javawrapper.MainWindow Class Reference

Main application window. More...

Inherits javax::swing::JFrame, and java::awt::event::ActionListener.

List of all members.

Public Member Functions

 MainWindow ()
 Constructor.
void SendMessage (ModelMessage oMsg)
 SendMessage accepts a message from the interface.
GUIManager GetDataManager ()
 Gets the GUI manager.
void SetModelState (int iState)
 Sets the current window state.
int GetModelState ()
 Gets the current window state.
void actionPerformed (ActionEvent oEvent)
 Manages window events.
void UpdateChartChoices ()
 Updates the chart choices in the data visualization panel according to the file which is selected in the file list.

Public Attributes

HelpBroker m_oHelpBroker
 JavaHelp class for managing help displays.

Protected Member Functions

void DoFileCloseData ()
 Closes an open output file.
void CloseOneDataFile (String sFileName)
 Closes a single output file and manages the file list.
void DoFileSave ()
 File | Save Parameter File action performed.
void SetCursorToDefault ()
 Changes the cursor to the default.
void processWindowEvent (WindowEvent e)
 Ensures the application closes when this window closes.

Protected Attributes

GUIManager m_oDataManager
 Manager controlling all functions related to creating and editing parameter files and running the model.
DataVisualizerManager m_oDataVisualizerManager
 Manager controlling all functions related to output data visualization.
HelpSet m_oHelpSet
 The HelpSet object for the help file - class is from JavaHelp.
JMenuItem m_jMenuFileNew
 File - new menu item.
JMenuItem m_jMenuFileBatchNew
 File - new batch file menu item.
JMenuItem m_jMenuFileOpen
 File - open file menu item.
JMenuItem m_jMenuFileSave
 File - file save menu item.
JMenuItem m_jMenuFileOpenData
 File - open output file menu item.
JMenuItem m_jMenuFileCloseData
 File - close output file menu item.
JMenuItem m_jMenuFileSetDir
 File - set working directory menu item.
JMenuItem m_jMenuFileExit = new JMenuItem("Exit", KeyEvent.VK_X)
 File - exit menu item.
JMenu m_jMenuEditTree = new JMenu("Tree Population")
 Edit - tree setup submenu.
JMenuItem m_jMenuEditGrid
 Edit - grid setup menu item.
JMenuItem m_jMenuEditFlow
 Edit - model flow menu item.
JMenuItem m_jMenuEditParameters
 Edit - parameters menu item.
JMenuItem m_jMenuEditDisturbance
 Edit - episodic events menu item.
JMenuItem m_jMenuEditHarvInter
 Edit - harvest interface menu item.
JMenuItem m_jMenuEditSchedStorms
 Edit - scheduled storms menu item.
JMenuItem m_jMenuEditOutput
 Edit - output options menu item.
JMenuItem m_jMenuTreeAllometry
 Tree submenu item - set allometry functions.
JMenuItem m_jMenuTreeSpecies
 Tree submenu item - edit species list.
JMenuItem m_jMenuTreeSizeClasses
 Tree submenu item - edit initial density size classes.
JMenuItem m_jMenuTreeTreeMaps
 Tree submenu item - manage tree maps.
JMenuItem m_jMenuModelRun = new JMenuItem("Run", KeyEvent.VK_R)
 Model - run menu item.
JMenuItem m_jMenuModelRunBatch = new JMenuItem("Run Batch...")
 Model - run batch menu item.
JMenuItem m_jMenuModelPause = new JMenuItem("Pause", KeyEvent.VK_P)
 Model - pause menu item.
JMenuItem m_jMenuModelStop
 Model - stop menu item.
JMenuItem m_jMenuHelpContents
 Help - contents menu item.
JMenuItem m_jMenuHelpAbout = new JMenuItem("About", KeyEvent.VK_A)
 Help - about menu item.
SORTIEComboBox m_jChartChoicesComboBox = new SORTIEComboBox()
 Holds the chart choices for the currently open output files.
SORTIEComboBox m_jFileChoicesComboBox = new SORTIEComboBox()
 Holds the list of currently open output files.
JTextField m_jParameterFileField = new JTextField()
 Field in the status bar holding the parameter file.
JTextField m_jModelStatusField = new JTextField()
 Field holding the model status.
JTextField m_jMessagesField = new JTextField()
 Field holding model messages.
JButton m_jModelRunButton
 Button for running model.
JButton m_jModelStopButton
 Button for stopping model.
JButton m_jModelPauseButton
 Button for pausing model.
JButton m_jModelStepForwardButton
 Button for stepping model.
JButton m_jModelLoadOutputButton
 Button for loading run's output.

Package Functions

void DoDrawChart ()
 Draws a chart upon selection in the data visualizer panel.

Static Package Attributes

static final long serialVersionUID = 1

Private Member Functions

void LoadHelp () throws ModelException
 Loads the SORTIE help file so that it can be opened from buttons and menu commands.
void CreateGUI ()
 Component initialization and GUI construction.
void DoFileExit ()
 File | Exit action performed.
void DoFileNew ()
 File | New Parameter File action performed.
void DoFileSetWorkingDirectory ()
 File | Set Working Directory action performed.
void DoFileBatchNew ()
 File | New Batch File action performed.
void DoViewRunOutput () throws ModelException
 Responds to the click of the button for viewing the current run's output.
void DoFileOpen ()
 File | Open Parameter File action performed.
void DoModelRunBatch ()
 Model | Run Batch action performed.
void DoFileOpenData () throws ModelException
 Opens an output file.
void DoEditModelFlow ()
 Edit | Edit model flow action performed.
void DoEditParameters ()
 Edit | Run parameters data action performed.
void DoEditOutput ()
 Edit | Edit output options action performed.
void DoEditEpisodicEvents () throws ModelException
 Edit | Episodic events action performed.
void DoEditHarvestInterface () throws ModelException
 Edit | Harvest Interface action performed.
void DoEditScheduleStorms () throws ModelException
 Edit | Schedule Storms action performed.
void DoModelPause (boolean bAlert) throws ModelException
 Model | Pause action performed.
void DoModelStop () throws ModelException
 Model | Stop Run action performed.
void DoModelRun (int iNumStepsToRun)
 Model | Run action performed.
void DoEditTreeSpecies ()
 Displays the tree species editing window.
void DoEditTreeSetAllometryFunctions ()
 Displays the allometry functions editing window.
void DoEditTreeDensityClasses ()
 Displays the tree initial density classes window.
void DoEditTreeManageTreeMap () throws ModelException
 Displays the tree map management window.
void DoEditGrid ()
 Displays the Grid editing window.

Private Attributes

Interface m_oInterface = null
 Object managing the interface between this application and the C++ model core.
Timer m_oTimer
 Object that allows us to update the GUI while the core model is running.
int m_iState
 File loaded, no file loaded, running, etc.
JDesktopPane m_oDesktop
 Desktop pane - allows the use of JInternalFrames.
JScrollPane m_jScroller
 Scroll pane for the desktop.
boolean m_bViewingRunOutput = false
 Flag for whether or not the user is doing real-time data visualization of the current run.
boolean m_bKeepRunning = false
 Flag for whether, during real-time data visualization, a new run timestep should be triggered after data updates.

Classes

class  RunListener
 Runs the window's timer code while the C++ core is running. More...


Detailed Description

Main application window.

The main application window has two main functions; creating and editing parameter files for running the model, and viewing the output generated. To run these functions, it has a separate manager object for each. The rest of the components in this window are for GUI display.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Institute of Ecosystem Studies

Author:
Lora E. Murphy
Version:
1.1
Todo:
Window icon

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
May 4, 2004: Added the Harvest window (LEM)
July 30, 2004: Added the ability to close output files (LEM)
November 8, 2004: Added pause run and stop run functionality (LEM)
November 12, 2004: Added Help->About (LEM)
November 17, 2004: Added the run control buttons panel (LEM)
November 18, 2004: Added real-time data visualization (LEM)
March 31, 2005: Added batch file choice and upgraded version number to 1.1 (not that I've been very good about this) (LEM)
October 13, 2005: Added scroll bars (LEM)

Constructor & Destructor Documentation

javawrapper.MainWindow.MainWindow (  ) 

Constructor.

Draws the window.


Member Function Documentation

void javawrapper.MainWindow.LoadHelp (  )  throws ModelException [private]

Loads the SORTIE help file so that it can be opened from buttons and menu commands.

Exceptions:
ModelException if the help is not found.

void javawrapper.MainWindow.SendMessage ( ModelMessage  oMsg  ) 

SendMessage accepts a message from the interface.

Parameters:
oMsg Message to accept.

void javawrapper.MainWindow.CreateGUI (  )  [private]

Component initialization and GUI construction.

void javawrapper.MainWindow.DoDrawChart (  )  [package]

Draws a chart upon selection in the data visualizer panel.

GUIManager javawrapper.MainWindow.GetDataManager (  ) 

Gets the GUI manager.

Returns:
The GUI manager.

void javawrapper.MainWindow.DoFileExit (  )  [private]

File | Exit action performed.

This prompts a save if the user has changed the parameter file, and causes the data visualizer manager to perform cleanup operations.

void javawrapper.MainWindow.DoFileNew (  )  [private]

File | New Parameter File action performed.

void javawrapper.MainWindow.DoFileSetWorkingDirectory (  )  [private]

File | Set Working Directory action performed.

void javawrapper.MainWindow.DoFileBatchNew (  )  [private]

File | New Batch File action performed.

void javawrapper.MainWindow.DoViewRunOutput (  )  throws ModelException [private]

Responds to the click of the button for viewing the current run's output.

If there is no parameter file loaded, this tells the user that it can't do the requested operation. If there's no output to load, this tells the user that. Otherwise, this will load all currently created output files for the current run.

Exceptions:
ModelException if there is a problem opening the output.

void javawrapper.MainWindow.DoFileOpen (  )  [private]

File | Open Parameter File action performed.

Allows the user to input a parameter file of either the old or new type. Any selected file is passed to the GUI manager for processing.

void javawrapper.MainWindow.DoModelRunBatch (  )  [private]

Model | Run Batch action performed.

Allows the user to input a batch file and run it.

void javawrapper.MainWindow.DoFileOpenData (  )  throws ModelException [private]

Opens an output file.

Any file that was chosen by the user gets passed to the Data Visualization Manager for processing.

Exceptions:
ModelException if anything goes wrong with the data visualization.

void javawrapper.MainWindow.DoFileCloseData (  )  [protected]

Closes an open output file.

All open windows related to this file are closed as well.

void javawrapper.MainWindow.CloseOneDataFile ( String  sFileName  )  [protected]

Closes a single output file and manages the file list.

Parameters:
sFileName String File to close.

void javawrapper.MainWindow.DoFileSave (  )  [protected]

File | Save Parameter File action performed.

This is a request to save a parameter file. The request is passed to the GUI manager for processing.

void javawrapper.MainWindow.DoEditModelFlow (  )  [private]

Edit | Edit model flow action performed.

void javawrapper.MainWindow.DoEditParameters (  )  [private]

Edit | Run parameters data action performed.

void javawrapper.MainWindow.DoEditOutput (  )  [private]

Edit | Edit output options action performed.

void javawrapper.MainWindow.DoEditEpisodicEvents (  )  throws ModelException [private]

Edit | Episodic events action performed.

Exceptions:
ModelException passing through from called methods.

void javawrapper.MainWindow.DoEditHarvestInterface (  )  throws ModelException [private]

Edit | Harvest Interface action performed.

Exceptions:
ModelException passing through from called methods.

void javawrapper.MainWindow.DoEditScheduleStorms (  )  throws ModelException [private]

Edit | Schedule Storms action performed.

Exceptions:
ModelException passing through from called methods.

void javawrapper.MainWindow.SetModelState ( int  iState  ) 

Sets the current window state.

Parameters:
iState State to set to. Should be one of the choices in MainWindowStateSetter.

int javawrapper.MainWindow.GetModelState (  ) 

Gets the current window state.

Returns:
int Current state. This matches one of the choices in MainWindowStateSetter.

void javawrapper.MainWindow.DoModelPause ( boolean  bAlert  )  throws ModelException [private]

Model | Pause action performed.

Pauses the model.

Exceptions:
ModelException passing through from called methods.
Parameters:
bAlert Whether or not to alert the user to the pause.

void javawrapper.MainWindow.DoModelStop (  )  throws ModelException [private]

Model | Stop Run action performed.

Stops the currently executing run.

Exceptions:
ModelException passed through from called functions.

void javawrapper.MainWindow.DoModelRun ( int  iNumStepsToRun  )  [private]

Model | Run action performed.

This runs the model. The request is passed off to the Interface, which handles the communications with the C++ core.

If there is an existing Interface object whose run has been paused, then this will pass it the run command and let it continue. If the model is already running, this does nothing.

Parameters:
iNumStepsToRun Number of timesteps to run the model. Set to 0 if the model should run without interruption.

void javawrapper.MainWindow.SetCursorToDefault (  )  [protected]

Changes the cursor to the default.

This is a separate function so it can be called from the private inner class created in DoModelRun().

void javawrapper.MainWindow.actionPerformed ( ActionEvent  oEvent  ) 

Manages window events.

Parameters:
oEvent Event triggered.

void javawrapper.MainWindow.DoEditTreeSpecies (  )  [private]

Displays the tree species editing window.

void javawrapper.MainWindow.DoEditTreeSetAllometryFunctions (  )  [private]

Displays the allometry functions editing window.

void javawrapper.MainWindow.DoEditTreeDensityClasses (  )  [private]

Displays the tree initial density classes window.

void javawrapper.MainWindow.DoEditTreeManageTreeMap (  )  throws ModelException [private]

Displays the tree map management window.

void javawrapper.MainWindow.DoEditGrid (  )  [private]

Displays the Grid editing window.

void javawrapper.MainWindow.UpdateChartChoices (  ) 

Updates the chart choices in the data visualization panel according to the file which is selected in the file list.

void javawrapper.MainWindow.processWindowEvent ( WindowEvent  e  )  [protected]

Ensures the application closes when this window closes.

Parameters:
e WindowEvent Window event.


Member Data Documentation

final long javawrapper.MainWindow.serialVersionUID = 1 [static, package]

Object managing the interface between this application and the C++ model core.

Object that allows us to update the GUI while the core model is running.

Manager controlling all functions related to creating and editing parameter files and running the model.

Manager controlling all functions related to output data visualization.

HelpSet javawrapper.MainWindow.m_oHelpSet [protected]

The HelpSet object for the help file - class is from JavaHelp.

JavaHelp class for managing help displays.

File loaded, no file loaded, running, etc.

JDesktopPane javawrapper.MainWindow.m_oDesktop [private]

Desktop pane - allows the use of JInternalFrames.

JScrollPane javawrapper.MainWindow.m_jScroller [private]

Scroll pane for the desktop.

Initial value:

 new JMenuItem("New parameter file",
      KeyEvent.VK_N)
File - new menu item.

Initial value:

 new JMenuItem("New batch file",
      KeyEvent.VK_B)
File - new batch file menu item.

Initial value:

 new JMenuItem("Open file",
      KeyEvent.VK_O)
File - open file menu item.

Initial value:

 new JMenuItem("Save parameter file",
      KeyEvent.VK_S)
File - file save menu item.

Initial value:

 new JMenuItem("Open output file",
      KeyEvent.VK_R)
File - open output file menu item.

Initial value:

 new JMenuItem(
      "Close output file", KeyEvent.VK_C)
File - close output file menu item.

Initial value:

 new JMenuItem(
      "Set working directory", KeyEvent.VK_D)
File - set working directory menu item.

JMenuItem javawrapper.MainWindow.m_jMenuFileExit = new JMenuItem("Exit", KeyEvent.VK_X) [protected]

File - exit menu item.

JMenu javawrapper.MainWindow.m_jMenuEditTree = new JMenu("Tree Population") [protected]

Edit - tree setup submenu.

Initial value:

 new JMenuItem("Grid layer setup",
      KeyEvent.VK_G)
Edit - grid setup menu item.

Initial value:

 new JMenuItem("Model flow",
      KeyEvent.VK_M)
Edit - model flow menu item.

Initial value:

 new JMenuItem("Parameters",
      KeyEvent.VK_P)
Edit - parameters menu item.

Initial value:

 new JMenuItem("Episodic events",
      KeyEvent.VK_D)
Edit - episodic events menu item.

Initial value:

 new JMenuItem("Harvest interface",
      KeyEvent.VK_H)
Edit - harvest interface menu item.

Initial value:

 new JMenuItem("Schedule storms",
      KeyEvent.VK_S)
Edit - scheduled storms menu item.

Initial value:

 new JMenuItem("Output options",
      KeyEvent.VK_O)
Edit - output options menu item.

Initial value:

 
                      new JMenuItem("Set allometry functions", KeyEvent.VK_A)
Tree submenu item - set allometry functions.

Initial value:

 
                      new JMenuItem("Edit species list", KeyEvent.VK_S)
Tree submenu item - edit species list.

Initial value:

 
          new JMenuItem("Edit initial density size classes", KeyEvent.VK_I)
Tree submenu item - edit initial density size classes.

Initial value:

 new JMenuItem("Manage tree maps", 
      KeyEvent.VK_M)
Tree submenu item - manage tree maps.

JMenuItem javawrapper.MainWindow.m_jMenuModelRun = new JMenuItem("Run", KeyEvent.VK_R) [protected]

Model - run menu item.

JMenuItem javawrapper.MainWindow.m_jMenuModelRunBatch = new JMenuItem("Run Batch...") [protected]

Model - run batch menu item.

JMenuItem javawrapper.MainWindow.m_jMenuModelPause = new JMenuItem("Pause", KeyEvent.VK_P) [protected]

Model - pause menu item.

Initial value:

 new JMenuItem("Stop run",
      KeyEvent.VK_S)
Model - stop menu item.

Initial value:

 new JMenuItem("Contents",
      KeyEvent.VK_C)
Help - contents menu item.

JMenuItem javawrapper.MainWindow.m_jMenuHelpAbout = new JMenuItem("About", KeyEvent.VK_A) [protected]

Help - about menu item.

Holds the chart choices for the currently open output files.

Holds the list of currently open output files.

JTextField javawrapper.MainWindow.m_jParameterFileField = new JTextField() [protected]

Field in the status bar holding the parameter file.

JTextField javawrapper.MainWindow.m_jModelStatusField = new JTextField() [protected]

Field holding the model status.

JTextField javawrapper.MainWindow.m_jMessagesField = new JTextField() [protected]

Field holding model messages.

Initial value:

 new JButton(new ModelIcon(15, 15,
      ModelIcon.RIGHT_TRIANGLE))
Button for running model.

Initial value:

 new JButton(new ModelIcon(15, 15,
      ModelIcon.RECTANGLE))
Button for stopping model.

Initial value:

 new JButton(new ModelIcon(15, 15,
      ModelIcon.PAUSE))
Button for pausing model.

Initial value:

 new JButton(new ModelIcon(15,
      15,
      ModelIcon.STEP_FORWARD))
Button for stepping model.

Initial value:

 new JButton(
      "View this run's output")
Button for loading run's output.

boolean javawrapper.MainWindow.m_bViewingRunOutput = false [private]

Flag for whether or not the user is doing real-time data visualization of the current run.

boolean javawrapper.MainWindow.m_bKeepRunning = false [private]

Flag for whether, during real-time data visualization, a new run timestep should be triggered after data updates.

If the user has run the model instead of pausing it or stepping forward one timestep, this is set to true. Otherwise, it is false and no new timestep will be triggered after the charts have been refreshed.


The documentation for this class was generated from the following file:

Generated on Wed Oct 28 14:01:21 2009 for SORTIE Java Interface by  doxygen 1.5.6