Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.gui
Class AvroraGui

    java.lang.Object
      avrora.gui.AvroraGui

All Implemented Interfaces:
  java.awt.event.ActionListener, javax.swing.event.ChangeListener, java.util.EventListener

public class AvroraGui
extends java.lang.Object
implements java.awt.event.ActionListener, javax.swing.event.ChangeListener

The `AvroraGUI` is the top level GUI component. It should be inited by VisualAction. It stores the physical, visible components of the GUI and also starts the various threads

Nested Class Summary
`class` | `AvroraGui.PaintThread` This thread will call the various monitor update and repaint methods for whatever monitor is currently being display in real time.

Field Summary
`java.lang.String[]` | `args` This is a list of arguments passed by the command line that `avrora.Main` did not process.
`static AvroraGui` | `instance` This is the actual instance of AvroraGui that is used.
`javax.swing.JFrame` | `masterFrame` This is GUI - everything fits inside the master frame
`javax.swing.JTabbedPane` | `monitorResults` This holds all our monitor "chalkboards" for displaying the data they collect
`ManageSimTime` | `simTimeBox` This handles the speed up/slow down, pause, stop, and start of a sim
`SimMenuBar` | `topMenu` This menu bar now contols most of the options specified by the GUI (this is the file, edit, options menus)
`ManageTopology` | `topologyBox` All information on node topology is displayed and set via this class

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent e)` This allows the GUI to respond to mouse clicks or other events.
`protected static javax.swing.ImageIcon` | `createImageIcon(java.lang.String path)` Returns an ImageIcon, or null if the path was invalid.
`MonitorPanel` | `createMonitorPanel(java.lang.String name)` This function creates an options panel and a display panel for a non-global visual monitor.
`void` | `debugAppend(java.lang.String b)` Used by DebugStream to allow writing to the debug window.
`java.util.List` | `getMonitorList()` Gets all monitors attached to the simulator.
`java.util.List` | `getOptionList()` Gets all options for the GUI and simulator.
`Simulation` | `getSimulation()` A `Simulation` object holds data about the current sim running
`static void` | `init(Options opt, java.lang.String[] args)` This function should be called by VisualAction to actually init the static reference to a physical AvroraGUI object
`void` | `removeMonitorPanel(MonitorPanel p)` This will remove a visual monitor panel from the tabbed pane.
`void` | `showGui()` Once the GUI has been "created" we call this function to physically display it to the screen
`void` | `startPaintThread()` This function will dispatch a new thread that will repaint our dynamic monitor window if new data has been collected
`void` | `stateChanged(javax.swing.event.ChangeEvent e)` Some modules (like a spinner) detect a state change and not an action.
`void` | `stopPaintThread()` This function will dispatch a new thread that will repaint our dynamic monitor window if new data has been collected

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### instance

    public static AvroraGui instance

  This is the actual instance of AvroraGui that is used. Since it's static, it can be called by anything that adds the current package

### args

    public java.lang.String[] args

  This is a list of arguments passed by the command line that `avrora.Main` did not process. Most likely it's a list of filenames.

### masterFrame

    public javax.swing.JFrame masterFrame

  This is GUI - everything fits inside the master frame

### topMenu

    public SimMenuBar topMenu

  This menu bar now contols most of the options specified by the GUI (this is the file, edit, options menus)

### simTimeBox

    public ManageSimTime simTimeBox

  This handles the speed up/slow down, pause, stop, and start of a sim

### topologyBox

    public ManageTopology topologyBox

  All information on node topology is displayed and set via this class

### monitorResults

    public javax.swing.JTabbedPane monitorResults

  This holds all our monitor "chalkboards" for displaying the data they collect

Method Detail

### init

    public static void init(Options opt,
                            java.lang.String[] args)

  This function should be called by VisualAction to actually init the static reference to a physical AvroraGUI object

  Parameters:
    `opt` - Options specified from the command line
    `args` - file names specified from the command line

### getSimulation

    public Simulation getSimulation()

  A `Simulation` object holds data about the current sim running

  Returns:
    Information about the current simulation running

### getMonitorList

    public java.util.List getMonitorList()

  Gets all monitors attached to the simulator. Uses `GUIDefaults`

  Returns:
    List of all monitors

### getOptionList

    public java.util.List getOptionList()

  Gets all options for the GUI and simulator. Uses `GUIDefaults`

  Returns:
    List of all monitors

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)

  This allows the GUI to respond to mouse clicks or other events. It calls the various methods in subclasses that are responsible for modules on the screen

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`
  Parameters:
    `e` - Holds information about what event happened

### stateChanged

    public void stateChanged(javax.swing.event.ChangeEvent e)

  Some modules (like a spinner) detect a state change and not an action. Thus, visual action can handle both. A specific hack here is that this function changes the visual monitor options panel if the stat change that occured as a change to visual monitor display panel.

  Specified by:
    `stateChanged` in interface `javax.swing.event.ChangeListener`
  Parameters:
    `e` - Holds information about what event happened

### debugAppend

    public void debugAppend(java.lang.String b)

  Used by DebugStream to allow writing to the debug window. This might be changed soon - Ben didn't like the way this was done (not efficient).

  Parameters:
    `b` - generally just one letter that needs to be output

### showGui

    public void showGui()

  Once the GUI has been "created" we call this function to physically display it to the screen

### createImageIcon

    protected static javax.swing.ImageIcon createImageIcon(java.lang.String path)

  Returns an ImageIcon, or null if the path was invalid.

### startPaintThread

    public void startPaintThread()

  This function will dispatch a new thread that will repaint our dynamic monitor window if new data has been collected

### stopPaintThread

    public void stopPaintThread()

  This function will dispatch a new thread that will repaint our dynamic monitor window if new data has been collected

### createMonitorPanel

    public MonitorPanel createMonitorPanel(java.lang.String name)

  This function creates an options panel and a display panel for a non-global visual monitor. It the displays the default simple look for the panels until the simulator is actually run. It also registers the monitor panel pair in the `monitorTabMap`

  Parameters:
    `name` - Name of the monitor
  Returns:
    The pair of panels wrapped together in one class

### removeMonitorPanel

    public void removeMonitorPanel(MonitorPanel p)

  This will remove a visual monitor panel from the tabbed pane. It will also remove the `MonitorPanel` instance from our global list of monitor panels. It will NOT destory the monitor options panel, but so long as the panel is never displayed again this isn't an issue.

  Parameters:
    `p` - The MonitorPanel that needs to be removed

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD