Class Phase2D

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsRenderable, IsWidget, ProvidesResize, RequiresResize, AbstractGraph.Controller, ChangeListener, MilestoneListener

public class Phase2D extends AbstractView
The view to display time series of data as a trajectory in a 2D phase plane.
Author:
Christoph Hauert
  • Field Details

    • graphs

      protected List<ParaGraph> graphs
      The list of graphs that display the trajectories in 2D phase planes.
      Implementation Notes:
      List<ParaGraph> graphs is deliberately hiding List<AbstractGraph> graphs from the superclass because it saves a lot of ugly casting. Note that the two fields point to one and the same object.
    • graph

      protected ParaGraph graph
      The graph that displays the trajectory in a 2D phase plane.
      Implementation Notes:
      ParaGraph graph is a short-cut to graphs.get(0) as long as only a single graph is acceptable.
    • state

      protected double[] state
      The current state of the model.
    • map

      protected HasPhase2D.Data2Phase map
      The map that transforms the current state of the model to a point on the 2D phase plane.
    • traitXItems

      private ContextMenuCheckBoxItem[] traitXItems
      The context menu for selecting traits to display on the horizontal axis.
    • traitYItems

      private ContextMenuCheckBoxItem[] traitYItems
      The context menu for selecting traits to display on the vertical axis.
    • traitXMenu

      private ContextMenu traitXMenu
      The context menu trigger for selecting traits to display on the horizontal axis.
    • traitYMenu

      private ContextMenu traitYMenu
      The context menu trigger for selecting traits to display on the vertical axis.
  • Constructor Details

    • Phase2D

      public Phase2D(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.
      Parameters:
      engine - the pacemaker for running the model
  • Method Details

    • getName

      public String 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 class AbstractView
      Returns:
      the name of this view
    • 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's calcBounds(int, int) is triggered through setBounds(int, int) to properly calculate the layout.
      Specified by:
      allocateGraphs in class AbstractView
      See Also:
    • unload

      public void unload()
      Description copied from class: AbstractView
      Unload 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:
      unload in class AbstractView
    • reset

      public void reset(boolean hard)
      Description copied from class: AbstractView
      Called when a module has been reset. All graphs are reset and updated if needed, unless hard is true.
      Overrides:
      reset in class AbstractView
      Parameters:
      hard - the flag to indicate whether to do a hard reset
    • modelDidInit

      public void modelDidInit()
      Description copied from interface: MilestoneListener
      Called after the EvoLudo model got re-initialized.
      Specified by:
      modelDidInit in interface MilestoneListener
      Overrides:
      modelDidInit in class AbstractView
    • 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 unless force is true.
      Specified by:
      update in class AbstractView
      Parameters:
      force - true to force the update
    • getXAxisLabel

      private String getXAxisLabel()
      Get the label of the horizontal axis.
      Returns:
      the label of the x-axis
    • getYAxisLabel

      private String getYAxisLabel()
      Get the label of the vertical axis.
      Returns:
      the label of the y-axis
    • getTraitName

      private String getTraitName(int idx)
      Get the name of the trait with index idx. 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.Controller
      Notifies the controller that the user requested setting a new initial configuration init (optional implementation).
      Parameters:
      init - the new initial configuration
      Returns:
      true if the request was honoured
    • populateContextMenu

      public void populateContextMenu(ContextMenu menu)
      Description copied from interface: AbstractGraph.Controller
      Opportunity for the controller to add functionality to the context menu (optional implementation).
      Specified by:
      populateContextMenu in interface AbstractGraph.Controller
      Overrides:
      populateContextMenu in class AbstractView
      Parameters:
      menu - the context menu
    • exportTypes

      protected AbstractView.ExportType[] exportTypes()
      Description copied from class: AbstractView
      Return the list of export types that are acceptable for _all_ graphs in this view.
      Overrides:
      exportTypes in class AbstractView
      Returns:
      the list of viable export types