Package org.evoludo.simulator.views
Class Phase2D
Object
UIObject
Widget
Composite
AbstractView
Phase2D
- All Implemented Interfaces:
HasAttachHandlers,HasHandlers,EventListener,HasVisibility,IsRenderable,IsWidget,ProvidesResize,RequiresResize,AbstractGraph.Controller,ChangeListener,MilestoneListener
The view to display time series of data as a trajectory in a 2D phase plane.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassCommand to toggle the inclusion of a trait on the phase plane axes.Nested 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 TypeFieldDescriptionprotected ParaGraphThe graph that displays the trajectory in a 2D phase plane.The list of graphs that display the trajectories in 2D phase planes.protected HasPhase2D.Data2PhaseThe map that transforms the current state of the model to a point on the 2D phase plane.protected double[]The current state of the model.private ContextMenuCheckBoxItem[]The context menu for selecting traits to display on the horizontal axis.private ContextMenuThe context menu trigger for selecting traits to display on the horizontal axis.private ContextMenuCheckBoxItem[]The context menu for selecting traits to display on the vertical axis.private ContextMenuThe context menu trigger for selecting traits to display on the vertical axis.Fields inherited from class AbstractView
engine, exportSubmenu, exportSubmenuTrigger, gCols, gRows, isActive, isLoaded, logger, MIN_MSEC_BETWEEN_UPDATES, model, restoreMenu, timestamp, type, updatetime, wrapperFields inherited from class UIObject
DEBUG_ID_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionPhase2D(EvoLudoGWT engine) Construct a new view to display the time series data of the current EvoLudo model as a trajectory in a 2D phase plane. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAllocate all graphs managed by this view.protected AbstractView.ExportType[]Return the list of export types that are acceptable for _all_ graphs in this view.getName()Get the name of this view.private StringgetTraitName(int idx) Get the name of the trait with indexidx.private StringGet the label of the horizontal axis.private StringGet the label of the vertical axis.voidCalled after the EvoLudo model got re-initialized.voidOpportunity for the controller to add functionality to the context menu (optional implementation).voidreset(boolean hard) Called when a module has been reset.booleansetInitialState(double[] init) Notifies the controller that the user requested setting a new initial configurationinit(optional implementation).voidunload()Unload the view.voidupdate(boolean force) Called when the view needs updating.Methods inherited from class AbstractView
activate, createWidget, deactivate, destroyGraphs, dispose, export, export, exportDataHeader, exportMeanData, exportPNG, exportStatData, exportSVG, exportTrajData, getGraphAt, getLogger, getMode, getModel, getStatus, getStatus, getType, hasLayout, isRunning, keyDownHandler, keyUpHandler, layoutComplete, load, modelChanged, modelDidReset, modelStopped, modelUnloaded, moduleRestored, moduleUnloaded, onResize, scheduleUpdate, setBounds, setMode, shift, 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 MilestoneListener
modelLoaded, modelRelaxed, modelRunning, modelSettings, moduleLoaded
-
Field Details
-
graphs
The list of graphs that display the trajectories in 2D phase planes.- Implementation Notes:
List<ParaGraph> graphsis deliberately hidingList<AbstractGraph> graphsfrom the superclass because it saves a lot of ugly casting. Note that the two fields point to one and the same object.
-
graph
The graph that displays the trajectory in a 2D phase plane.- Implementation Notes:
ParaGraph graphis a short-cut tographs.get(0)as long as only a single graph is acceptable.
-
state
protected double[] stateThe current state of the model. -
map
The map that transforms the current state of the model to a point on the 2D phase plane. -
traitXItems
The context menu for selecting traits to display on the horizontal axis. -
traitYItems
The context menu for selecting traits to display on the vertical axis. -
traitXMenu
The context menu trigger for selecting traits to display on the horizontal axis. -
traitYMenu
The context menu trigger for selecting traits to display on the vertical axis.
-
-
Constructor Details
-
Phase2D
Construct a new view to display the time series data of the current EvoLudo model as a trajectory in a 2D phase plane.- 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
-
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:
-
unload
public void unload()Description copied from class:AbstractViewUnload the view. This is called when changing the module or model that implement this view. This is independent of the activation of the view.- Overrides:
unloadin classAbstractView
-
reset
public void reset(boolean hard) Description copied from class:AbstractViewCalled when a module has been reset. All graphs are reset and updated if needed, unlesshardistrue.- Overrides:
resetin classAbstractView- Parameters:
hard- the flag to indicate whether to do a hard reset
-
modelDidInit
public void modelDidInit()Description copied from interface:MilestoneListenerCalled after the EvoLudo model got re-initialized.- Specified by:
modelDidInitin interfaceMilestoneListener- Overrides:
modelDidInitin classAbstractView
-
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
-
getXAxisLabel
Get the label of the horizontal axis.- Returns:
- the label of the
x-axis
-
getYAxisLabel
Get the label of the vertical axis.- Returns:
- the label of the
y-axis
-
getTraitName
Get the name of the trait with indexidx. In multi-species modules the species name is prepended and the index refers to traits of all species.- Parameters:
idx- the index of the trait- Returns:
- the name of the trait
-
setInitialState
public boolean setInitialState(double[] init) Description copied from interface:AbstractGraph.ControllerNotifies the controller that the user requested setting a new initial configurationinit(optional implementation).- Parameters:
init- the new initial configuration- Returns:
trueif the request was honoured
-
populateContextMenu
Description copied from interface:AbstractGraph.ControllerOpportunity for the controller to add functionality to the context menu (optional implementation).- Specified by:
populateContextMenuin interfaceAbstractGraph.Controller- Overrides:
populateContextMenuin classAbstractView- Parameters:
menu- the context menu
-
exportTypes
Description copied from class:AbstractViewReturn the list of export types that are acceptable for _all_ graphs in this view.- Overrides:
exportTypesin classAbstractView- Returns:
- the list of viable export types
-