Package org.evoludo.simulator.views
Class Console
Object
UIObject
Widget
Composite
AbstractView
Console
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,IsRenderable
,IsWidget
,ProvidesResize
,RequiresResize
,AbstractGraph.Controller
,ChangeListener
,MilestoneListener
,ContextMenu.Provider
The view to display the console log.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class AbstractView
AbstractView.ExportCommand, AbstractView.ExportType
Nested classes/interfaces inherited from class UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Nested classes/interfaces inherited from interface ChangeListener
ChangeListener.PendingAction
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContextMenu
The context menu to set the buffer size for graphs with historical data.private ContextMenuItem
The context menu item to clear the console.protected ContextMenu
The context menu for the console.protected Console.Log
The console log.Fields inherited from class AbstractView
engine, exportSubmenu, exportSubmenuTrigger, gCols, graphs, gRows, isActive, isLoaded, logger, MIN_MSEC_BETWEEN_UPDATES, model, restoreMenu, timestamp, type, updatetime, wrapper
Fields inherited from class UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Allocate all graphs managed by this view.void
clearLog()
Clear the console log.void
Create the widget that will contain the graphical representations of the data.getName()
Get the name of this view.boolean
keyUpHandler
(String key) Opportunity for view to implement keyboard shortcut for actions (non repeating).void
Log message in console.void
populateContextMenuAt
(ContextMenu menu, int x, int y) Populate context menumenu
in listening widget at (relative) position(x,y)
.void
setLogCapacity
(int capacity) Set the capacity of the log buffer.void
update
(boolean force) Called when the view needs updating.Methods inherited from class AbstractView
activate, clear, deactivate, destroyGraphs, dispose, export, export, exportDataHeader, exportMeanData, exportPNG, exportStatData, exportSVG, exportTrajData, exportTypes, getGraphAt, getLogger, getMode, getModel, getStatus, getStatus, getType, hasLayout, isRunning, keyDownHandler, layoutComplete, load, modelChanged, modelDidInit, modelDidReset, modelStopped, modelUnloaded, moduleRestored, moduleUnloaded, onResize, populateContextMenu, reset, scheduleUpdate, setBounds, setMode, shift, unload, update, zoom
Methods inherited from class Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
Methods inherited from class Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
Methods inherited from class UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface AbstractGraph.Controller
setInitialState
Methods inherited from interface MilestoneListener
modelLoaded, modelRelaxed, modelRunning, modelSettings, moduleLoaded
-
Field Details
-
log
The console log. -
contextMenu
The context menu for the console. -
bufferSizeMenu
The context menu to set the buffer size for graphs with historical data. -
clearMenu
The context menu item to clear the console.
-
-
Constructor Details
-
Console
Create a new console log. This keeps a record of all messages logged by the model. By default the number of log entries is set to 1000.- Parameters:
engine
- the pacemaker for running the model
-
-
Method Details
-
getName
Description copied from class:AbstractView
Get the name of this view. This is used to dynamically build the view selector.- Specified by:
getName
in classAbstractView
- Returns:
- the name of this view
-
clearLog
public void clearLog()Clear the console log.Note: Cannot override
clear()
method because this would clear the log on activiation. -
createWidget
public void createWidget()Description copied from class:AbstractView
Create the widget that will contain the graphical representations of the data.- Overrides:
createWidget
in classAbstractView
-
allocateGraphs
protected void allocateGraphs()Description copied from class:AbstractView
Allocate all graphs managed by this view. This is called when loading the view. Once all views are attached to the browser DOM a call to the graph'scalcBounds(int, int)
is triggered throughsetBounds(int, int)
to properly calculate the layout.- Specified by:
allocateGraphs
in classAbstractView
- See Also:
-
log
Log message in console. The output is prettified by coloring messages according to their severity:Level.SEVERE
- error level, typeset in red color and labeled with ERROR:. Severe issues require immediate attention. May not be possible to recover and proceed.
Level.WARNING
- warning level, typeset in orange color and labeled with Warning:. Milder issues encountered that were typically resolved automatically. For example, settings may have changed with possibly unintended consequences.
Level.INFO
- default level. Use for reporting of general information and milestones.
Level.FINE
,Level.FINER
,Level.FINEST
- debug level typeset in blue color and labeled with DEBUG:. Used for verbose messaging to assist in debugging.
- Parameters:
level
- the severity level of the messagemsg
- the message to log
-
update
public void update(boolean force) Description copied from class:AbstractView
Called when the view needs updating. This gets called when the selected view changed or new data is available from the model. Views may ignore updating requests unlessforce
istrue
.- Specified by:
update
in classAbstractView
- Parameters:
force
-true
to force the update
-
keyUpHandler
Opportunity for view to implement keyboard shortcut for actions (non repeating). For example to clear the display or export graphics.List of shortcuts provided by all views for the following keys:
S
- Export snapshot of view in the Scalable Vecorized Graphics format,
svg
(if available). P
- Export snapshot of view as a bitmap in the Portable Network Graphic
format,
png
(if available). C
- Export data of model as in the Comma Separated Values format,
csv
(if available). For example, this can be used to export the raw statistical data obtained from fixation probability calculations. F
- Toggle full screen mode of data view without controls (if available).
The console ignores most keyboard shortcuts but redefines the following:
Backspace, Delete
- Clear the log.
- Overrides:
keyUpHandler
in classAbstractView
- Parameters:
key
- the code of the released key- Returns:
true
if the key was handled
-
setLogCapacity
public void setLogCapacity(int capacity) Set the capacity of the log buffer. If the buffer capacity is set to0
the number of messsages is unlimited.- Parameters:
capacity
- the capacity of the log buffer
-
populateContextMenuAt
Description copied from interface:ContextMenu.Provider
Populate context menumenu
in listening widget at (relative) position(x,y)
.- Specified by:
populateContextMenuAt
in interfaceContextMenu.Provider
- Parameters:
menu
- context menu entries are added herex
- horizontal coordinate (relative to listening widget)y
- horizontal coordinate (relative to listening widget)
-