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.ExportTypeNested classes/interfaces inherited from class UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface ChangeListener
ChangeListener.PendingAction -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContextMenuThe context menu to set the buffer size for graphs with historical data.private ContextMenuItemThe context menu item to clear the console.protected ContextMenuThe context menu for the console.protected Console.LogThe 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, wrapperFields inherited from class UIObject
DEBUG_ID_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAllocate all graphs managed by this view.voidclearLog()Clear the console log.voidCreate the widget that will contain the graphical representations of the data.getName()Get the name of this view.booleankeyUpHandler(String key) Opportunity for view to implement keyboard shortcut for actions (non repeating).voidLog message in console.voidpopulateContextMenuAt(ContextMenu menu, int x, int y) Populate context menumenuin listening widget at (relative) position(x,y).voidsetLogCapacity(int capacity) Set the capacity of the log buffer.voidupdate(boolean force) Called when the view needs updating.Methods inherited from class AbstractView
activate, 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, zoomMethods inherited from class Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetMethods inherited from class Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsMethods 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, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface AbstractGraph.Controller
setInitialStateMethods 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:AbstractViewGet the name of this view. This is used to dynamically build the view selector.- Specified by:
getNamein 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:AbstractViewCreate the widget that will contain the graphical representations of the data.- Overrides:
createWidgetin classAbstractView
-
allocateGraphs
protected void allocateGraphs()Description copied from class:AbstractViewAllocate 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:
allocateGraphsin 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:AbstractViewCalled 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 unlessforceistrue.- Specified by:
updatein classAbstractView- Parameters:
force-trueto 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:
keyUpHandlerin classAbstractView- Parameters:
key- the code of the released key- Returns:
trueif the key was handled
-
setLogCapacity
public void setLogCapacity(int capacity) Set the capacity of the log buffer. If the buffer capacity is set to0the number of messsages is unlimited.- Parameters:
capacity- the capacity of the log buffer
-
populateContextMenuAt
Description copied from interface:ContextMenu.ProviderPopulate context menumenuin listening widget at (relative) position(x,y).- Specified by:
populateContextMenuAtin interfaceContextMenu.Provider- Parameters:
menu- context menu entries are added herex- horizontal coordinate (relative to listening widget)y- horizontal coordinate (relative to listening widget)
-