Class Console

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

public class Console extends AbstractView implements ContextMenu.Provider
The view to display the console log.
Author:
Christoph Hauert
  • Field Details

    • log

      protected Console.Log log
      The console log.
    • contextMenu

      protected ContextMenu contextMenu
      The context menu for the console.
    • bufferSizeMenu

      private ContextMenu bufferSizeMenu
      The context menu to set the buffer size for graphs with historical data.
    • clearMenu

      private ContextMenuItem clearMenu
      The context menu item to clear the console.
  • Constructor Details

    • Console

      public Console(EvoLudoGWT engine)
      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

      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
    • 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 class AbstractView
    • 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:
    • log

      public void log(Level level, String msg)
      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 message
      msg - 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 unless force is true.
      Specified by:
      update in class AbstractView
      Parameters:
      force - true to force the update
    • keyUpHandler

      public boolean keyUpHandler(String key)
      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 class AbstractView
      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 to 0 the number of messsages is unlimited.
      Parameters:
      capacity - the capacity of the log buffer
    • populateContextMenuAt

      public void populateContextMenuAt(ContextMenu menu, int x, int y)
      Description copied from interface: ContextMenu.Provider
      Populate context menu menu in listening widget at (relative) position (x,y).
      Specified by:
      populateContextMenuAt in interface ContextMenu.Provider
      Parameters:
      menu - context menu entries are added here
      x - horizontal coordinate (relative to listening widget)
      y - horizontal coordinate (relative to listening widget)