Package org.evoludo.simulator.views
Class Distribution
Object
UIObject
Widget
Composite
AbstractView
Distribution
- All Implemented Interfaces:
HasAttachHandlers,HasHandlers,EventListener,HasVisibility,IsRenderable,IsWidget,ProvidesResize,RequiresResize,AbstractGraph.Controller,GenericPopGraph.PopGraphController,TooltipProvider,TooltipProvider.Index,ChangeListener,MilestoneListener,BasicTooltipProvider
public class Distribution
extends AbstractView
implements GenericPopGraph.PopGraphController, TooltipProvider.Index
The view to display the distribution of continuous traits. For a single trait
the histrogram of trait densities is shown as a heatmap over time. For two
traits a 2D distribution is shown and for multiple traits the traits shown
along the horizontal and vertical axes can be selected.
- 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.PendingActionNested classes/interfaces inherited from interface TooltipProvider
TooltipProvider.Index, TooltipProvider.Parametric, TooltipProvider.Simplex -
Field Summary
FieldsModifier and TypeFieldDescription(package private) double[]The storage to accommodate the trait histograms.protected List<PopGraph2D> The list of graphs that display the trajectories in 2D phase planes.protected intThe maximum number of bins for the trait histograms.(package private) intThe index of the trait to be shown along the x-axis.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.(package private) intThe index of the trait to be shown along the y-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
ConstructorsConstructorDescriptionDistribution(EvoLudoGWT engine, Data type) Construct a new view to display the distribution of continuous traits of the current EvoLudo model. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAllocate all graphs managed by this view.private GeometrycreateGeometry(int nTraits) Create a geometry for the given number of traits.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.getTooltipAt(AbstractGraph<?> graph, int node) Get the tooltip for the location with indexindex.voidCalled after the EvoLudo model got re-initialized.voidpopulateContextMenuAt(ContextMenu menu, int node) Opportunity for the controller to add functionality to the context menu (optional implementation).voidreset(boolean hard) Called when a module has been reset.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, populateContextMenu, 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
getLogger, getModel, getType, isRunning, layoutComplete, populateContextMenu, setInitialStateMethods inherited from interface BasicTooltipProvider
getTooltipAt, getTooltipAtMethods inherited from interface GenericPopGraph.PopGraphController
mouseHitNode, mouseHitNodeMethods 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.
-
MAX_BINS
protected int MAX_BINSThe maximum number of bins for the trait histograms. -
bins
double[] binsThe storage to accommodate the trait histograms. -
traitXIdx
int traitXIdxThe index of the trait to be shown along the x-axis. -
traitYIdx
int traitYIdxThe index of the trait to be shown along the y-axis. -
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
-
Distribution
Construct a new view to display the distribution of continuous traits of the current EvoLudo model.- Parameters:
engine- the pacemaker for running the modeltype- the type of data to display
-
-
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:
-
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
-
createGeometry
Create a geometry for the given number of traits. Utility method to generate a linear geometry (with history) for a single trait and a 2D square lattice for multiple traits.- Parameters:
nTraits- the number of traits- Returns:
- the geometry
-
getTooltipAt
Description copied from interface:TooltipProvider.IndexGet the tooltip for the location with indexindex.- Specified by:
getTooltipAtin interfaceTooltipProvider.Index- Parameters:
graph- the graph requesting the tooltipnode- theindexof the location- Returns:
- the tooltip for the node
- See Also:
-
populateContextMenuAt
Description copied from interface:GenericPopGraph.PopGraphControllerOpportunity for the controller to add functionality to the context menu (optional implementation). Additional entries should be added tomenu. If the context menu was opened while the mouse was over a node its index isnode. At this point the menu already contains entries that are relevant for all graphs, e.g. fullscreen and export. Override this method to add further, more specialized entries. Finally, the current pane will be asked whether it wants to add further entries (e.g. autoscale axes).- Specified by:
populateContextMenuAtin interfaceGenericPopGraph.PopGraphController- Parameters:
menu- the context menunode- the index of node- See Also:
-
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
-