javawrapper::MainWindow Class Reference

Main application window. More...

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.
JMenuItem m_jMenuEditTree
 Edit - tree setup menu item.
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_jMenuEditOutput
 Edit - output options menu item.
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.
JComboBox m_jChartChoicesComboBox = new JComboBox()
 Holds the chart choices for the currently open output files.
JComboBox m_jFileChoicesComboBox = new JComboBox()
 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.

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
Exceptions:
ModelException passing through from called methods.

void DoEditHarvestInterface () throws ModelException
 Edit | Harvest Interface action performed
Exceptions:
ModelException passing through from called methods.

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 DoEditTree ()
 Displays the Tree editing 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 (  )  [inline]

Constructor.

Draws the window.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)


Member Function Documentation

void javawrapper::MainWindow::actionPerformed ( ActionEvent  oEvent  )  [inline]

Manages window events.

Parameters:
oEvent Event triggered.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::CloseOneDataFile ( String  sFileName  )  [inline, protected]

Closes a single output file and manages the file list.

Parameters:
sFileName String File to close.

void javawrapper::MainWindow::CreateGUI (  )  [inline, private]

Component initialization and GUI construction.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
November 17, 2004: Added run control buttons panel (LEM)

void javawrapper::MainWindow::DoDrawChart (  )  [inline, package]

Draws a chart upon selection in the data visualizer panel.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoEditEpisodicEvents (  )  throws ModelException [inline, private]

Edit | Episodic events action performed

Exceptions:
ModelException passing through from called methods.


Edit history:
------------------
May 4, 2004: Created (LEM)

void javawrapper::MainWindow::DoEditGrid (  )  [inline, private]

Displays the Grid editing window.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoEditModelFlow (  )  [inline, private]

Edit | Edit model flow action performed.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoEditOutput (  )  [inline, private]

Edit | Edit output options action performed.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoEditParameters (  )  [inline, private]

Edit | Run parameters data action performed.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoEditTree (  )  [inline, private]

Displays the Tree editing window.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoFileBatchNew (  )  [inline, private]

File | New Batch File action performed.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoFileCloseData (  )  [inline, protected]

Closes an open output file.

All open windows related to this file are closed as well.
Edit history:
------------------
July 30, 2004: Created (LEM)
May 8, 2006: Added "All" option if there is more than one file (LEM)

void javawrapper::MainWindow::DoFileExit (  )  [inline, 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.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoFileNew (  )  [inline, private]

File | New Parameter File action performed.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoFileOpen (  )  [inline, 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.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
November 2, 2004: Added a message to the message bar (LEM)
June 7, 2005: Removed old parameter file support (LEM)

void javawrapper::MainWindow::DoFileOpenData (  )  throws ModelException [inline, 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.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::DoFileSave (  )  [inline, 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.


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
November 22, 2005: Made it so that the save dialog would display the name of the last parameter file

void javawrapper::MainWindow::DoModelPause ( boolean  bAlert  )  throws ModelException [inline, 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::DoModelRun ( int  iNumStepsToRun  )  [inline, 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.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
November 8, 2004: Added run after pause feature (LEM)

void javawrapper::MainWindow::DoModelRunBatch (  )  [inline, private]

Model | Run Batch action performed.

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


Edit history:
------------------
March 31, 2005: Created (LEM)

void javawrapper::MainWindow::DoModelStop (  )  throws ModelException [inline, private]

Model | Stop Run action performed.

Stops the currently executing run.

Exceptions:
ModelException passed through from called functions.

void javawrapper::MainWindow::DoViewRunOutput (  )  throws ModelException [inline, 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.

Edit history:
------------------
November 18, 2004: Created (LEM)

GUIManager javawrapper::MainWindow::GetDataManager (  )  [inline]

Gets the GUI manager.

Returns:
The GUI manager.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

int javawrapper::MainWindow::GetModelState (  )  [inline]

Gets the current window state.

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

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::LoadHelp (  )  throws ModelException [inline, 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.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::processWindowEvent ( WindowEvent  e  )  [inline, protected]

Ensures the application closes when this window closes.

Parameters:
e WindowEvent Window event.

void javawrapper::MainWindow::SendMessage ( ModelMessage  oMsg  )  [inline]

SendMessage accepts a message from the interface.

Parameters:
oMsg Message to accept.

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::SetCursorToDefault (  )  [inline, 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::SetModelState ( int  iState  )  [inline]

Sets the current window state.

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

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)

void javawrapper::MainWindow::UpdateChartChoices (  )  [inline]

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


Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)


Member Data Documentation

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.

JMenuItem javawrapper::MainWindow::m_jMenuEditDisturbance [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuEditFlow [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuEditGrid [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuEditHarvInter [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuEditOutput [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuEditParameters [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuEditTree [protected]

Initial value:

 new JMenuItem("Tree setup",
      KeyEvent.VK_T)
Edit - tree setup menu item.

JMenuItem javawrapper::MainWindow::m_jMenuFileBatchNew [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuFileCloseData [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuFileNew [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuFileOpen [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuFileOpenData [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuFileSave [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuFileSetDir [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuHelpContents [protected]

Initial value:

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

JMenuItem javawrapper::MainWindow::m_jMenuModelStop [protected]

Initial value:

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

JButton javawrapper::MainWindow::m_jModelLoadOutputButton [protected]

Initial value:

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

JButton javawrapper::MainWindow::m_jModelPauseButton [protected]

Initial value:

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

JButton javawrapper::MainWindow::m_jModelRunButton [protected]

Initial value:

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

JButton javawrapper::MainWindow::m_jModelStepForwardButton [protected]

Initial value:

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

JButton javawrapper::MainWindow::m_jModelStopButton [protected]

Initial value:

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


The documentation for this class was generated from the following file:
Generated on Wed Nov 29 08:45:04 2006 for SORTIE Java Interface by  doxygen 1.4.7