javawrapper.GUIManager Class Reference

The GUI manager provides all behind-the-scenes functionality for the Main Window. More...

List of all members.

Public Member Functions

 GUIManager (MainWindow oWindow) throws ModelException
 Constructor.
boolean HasParameterFileBeenModified ()
 Whether or not the current parameter file has been modified.
HelpBroker GetHelpBroker ()
 Gets the HelpBroker object which manages help display for the entire application.
void ProposeNewParameterFile () throws ModelException
 This can be used to propose that a new parameter file is being created.
String GetParameterFileName ()
 Gets the parameter file name.
void DisplayOutputWindow ()
 Display the window which allows the user to set up output options.
void DisplayTreeSpeciesSetupWindow ()
 Displays the window which allows the user to set up tree species.
void DisplayTreeSizeClassEditor ()
 Displays the window which allows the user to set up tree initial density size classes.
void DisplayTreeAllometryFunctionEditor ()
 Displays the window which allows the user to edit the allometry functions.
void DisplayManageTreeMap () throws ModelException
 Displays the window which allows the user to manage tree maps.
void DisplayGridSetupWindow ()
 Displays the window which allows the user to set up grids.
void DisplayHarvestInterfaceWindow () throws ModelException
 Displays the window which allows the user to set up the harvest interface.
void DisplayScheduleStormsWindow () throws ModelException
 Displays the window which allows the user to schedule storms.
void InputTreeMap (String sFileName) throws ModelException
 This passes a tree map file on to the tree population.
boolean InputXMLFile (String sFileName, JFrame oWindow) throws ModelException
 Accepts an XML file for input.
boolean GetSnagAwareness () throws ModelException
 Gets whether or not the run is snag-aware.
boolean WriteParameterFile (String sFileName) throws ModelException
 Writes out the XML parameter file with the current settings.
MainWindow GetMainWindow ()
 Gets the MainWindow object.
String[] GetBehaviorList (int iSpecies, int iType)
 Gets the descriptive names list of behaviors for a tree species/type combo.
void SetBehaviorList (SpeciesTypeCombo oToSet, String[] p_sBehaviors) throws ModelException
 Sets the list of behaviors for a tree species/type combo.
String PrepToRun () throws ModelException
 Takes all loaded data and prepares a parameter file to pass to the core to run, returning the filename of the parameter file.
void CreateNewParameterFile () throws ModelException
 Performs the actions necessary to start a new parameter file.
OutputBehaviors GetOutputBehaviors ()
 Gets the OutputBehaviors object, or null if none exists.
DisperseBehaviors GetDisperseBehaviors ()
 Gets the DisperseBehaviors object, or null if none exists.
SeedPredationBehaviors GetSeedPredationBehaviors ()
 Gets the SeedPredationBehaviors object, or null if none exists.
SnagDynamicsBehaviors GetSnagDynamicsBehaviors ()
 Gets the SnagDynamicsBehaviors object, or null if none exists.
AnalysisBehaviors GetAnalysisBehaviors ()
 Gets the AnalysisBehaviors object, or null if none exists.
EstablishmentBehaviors GetEstablishmentBehaviors ()
 Gets the EstablishmentBehaviors object, or null if none exists.
EpiphyticEstablishmentBehaviors GetEpiphyticEstablishmentBehaviors ()
 Gets the EpiphyticEstablishmentBehaviors object, or null if none exists.
SubstrateBehaviors GetSubstrateBehaviors ()
 Gets the Substrate object.
MortalityBehaviors GetMortalityBehaviors ()
 Gets the MortalityBehaviors object.
GrowthBehaviors GetGrowthBehaviors ()
 Gets the GrowthBehaviors object.
Plot GetPlot ()
 Gets the Plot object.
TreePopulation GetTreePopulation ()
 Gets the tree population object.
Allometry GetAllometry ()
 Gets the allometry object.
DisturbanceBehaviors GetDisturbanceBehaviors ()
 Gets the disturbance behaviors object, or null if none exists.
PlantingBehaviors GetPlantingBehaviors ()
 Gets the planting behaviors object, or null if none exists.
LightBehaviors GetLightBehaviors ()
 Gets the light behaviors object.
MortalityUtilitiesBehaviors GetRemoveDeadBehaviors ()
 Gets the remove dead behaviors object.
BehaviorTypeBase[] GetAllBehaviorGroups ()
 Gets all of the objects descended from BehaviorTypeBase.
Grid[] GetAllGrids ()
 Gets all of the Grid objects.
WorkerBase[] GetAllObjects ()
 Gets the array of managed objects.
void DisplayRunParameters ()
 Allows the user to edit parameters.
void DisplayModelFlowWindow ()
 Allows the user to edit simulation flow and behavior order.
JDialog DisplayEpisodicEventsWindow () throws ModelException
 Allows the user to edit episodic event data.
void ExtractParameters (JDialog jDataWindow) throws ModelException
 Extracts the data from the parameter window and passes it to objects.
void DoSetup () throws ModelException
 Triggers the DoSetup() methods of all BehaviorTypeBase objects under management.
Grid AddGrid (Grid oNewGrid)
 This adds a new grid object to the list.
Grid GetGridByName (String sName)
 Finds a grid when provided with the grid's name.
void ChangeOfSpeciesName (String sOldSpecies, String sNewSpecies) throws ModelException
 Changes the list of species names.
void CopySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException
 Performs any necessary tasks associated with copying one species to another.
void ChangeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException
 Changes the list of species names.
void ChangeOfPlotResolution (float fOldX, float fOldY, float fNewX, float fNewY) throws ModelException
 This takes a change of plot resolution and deals with any grid maps found.

Protected Member Functions

void InputXMLParameterFile (String sFileName) throws ModelException
 Inputs an XML parameter file.
void InputXMLDataFile (String sFileName, JFrame oWindow) throws ModelException
 Inputs an XML file which is not a parameter type.
void ValidateDataSet () throws ModelException
 Checks to see if the currently loaded dataset is adequate for creating a run and internally valid.
void ClearCurrentData () throws ModelException
 This clears old settings in order to accept a new parameter file.

Protected Attributes

WorkerBase[] mp_oManagedObjects
 This is an array of behaviors and populations, in the order in which they would appear in the parameter file.
final String PARAMETER_FILE = "01"
 This stands for the parameter file XML file type.
final String DETAILED_OUTPUT_FILE = "06"
 This stands for the detailed output file XML file type.
final String DETAILED_OUTPUT_TIMESTEP = "07"
 This stands for the detailed output timestep file XML file type.
final String BATCH_FILE = "04"
 This stands for the batch file XML file type.

Private Attributes

String m_sParameterFile
 Path and name of parameter currently loaded, if any.
boolean m_bWasParameterFileModified
 Flag for whether or not a loaded parameter file was modified.
Vector< Gridmp_oManagedGrids = new Vector<Grid>(0)
 Array of grid objects.
MainWindow m_oMainWindow
 Pointer to main application window.


Detailed Description

The GUI manager provides all behind-the-scenes functionality for the Main Window.

It performs a function very similar to the Simulation Manager in the C++ code.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Institute of Ecosystem Studies

Author:
Lora E. Murphy
Version:
1.0

Edit history:
------------------
April 28, 2004: Submitted in beta version (LEM)
August 14, 2006: Grid management moved here (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)

Constructor & Destructor Documentation

javawrapper.GUIManager.GUIManager ( MainWindow  oWindow  )  throws ModelException

Constructor.

This creates the objects with no data in them so they can be filled during a new parameter file setup.

Parameters:
oWindow Main application window.
Exceptions:
ModelException if something goes wrong with object setup.


Member Function Documentation

boolean javawrapper.GUIManager.HasParameterFileBeenModified (  ) 

Whether or not the current parameter file has been modified.

Returns:
true if modified, false if not.

HelpBroker javawrapper.GUIManager.GetHelpBroker (  ) 

Gets the HelpBroker object which manages help display for the entire application.

Returns:
System HelpBroker object.

void javawrapper.GUIManager.ProposeNewParameterFile (  )  throws ModelException

This can be used to propose that a new parameter file is being created.

If there is currently no parameter file name, this will accept the proposal and place the key "<New>" in the parameter file name. Then, everything is set as through there is a parameter file entered. All objects are allowed to DoSetup().

If it is not time to create a new parameter file, nothing happens.

This is called by the TreeSetup dialog when changes have been made because it's the first step in creating a new file. It does not know whether it's modifying an existing file or creating a new one, so it calls this so the GUIManager object can decide.

Exceptions:
ModelException if anything goes wrong with setup.

String javawrapper.GUIManager.GetParameterFileName (  ) 

Gets the parameter file name.

Returns:
The parameter file name.

void javawrapper.GUIManager.DisplayOutputWindow (  ) 

Display the window which allows the user to set up output options.

void javawrapper.GUIManager.DisplayTreeSpeciesSetupWindow (  ) 

Displays the window which allows the user to set up tree species.

void javawrapper.GUIManager.DisplayTreeSizeClassEditor (  ) 

Displays the window which allows the user to set up tree initial density size classes.

void javawrapper.GUIManager.DisplayTreeAllometryFunctionEditor (  ) 

Displays the window which allows the user to edit the allometry functions.

void javawrapper.GUIManager.DisplayManageTreeMap (  )  throws ModelException

Displays the window which allows the user to manage tree maps.

void javawrapper.GUIManager.DisplayGridSetupWindow (  ) 

Displays the window which allows the user to set up grids.

void javawrapper.GUIManager.DisplayHarvestInterfaceWindow (  )  throws ModelException

Displays the window which allows the user to set up the harvest interface.

Exceptions:
ModelException passing through from called functions

void javawrapper.GUIManager.DisplayScheduleStormsWindow (  )  throws ModelException

Displays the window which allows the user to schedule storms.

Exceptions:
ModelException passing through from called functions

void javawrapper.GUIManager.InputTreeMap ( String  sFileName  )  throws ModelException

This passes a tree map file on to the tree population.

Parameters:
sFileName Name of file.
Exceptions:
ModelException if the tree population rejects the file.

boolean javawrapper.GUIManager.InputXMLFile ( String  sFileName,
JFrame  oWindow 
) throws ModelException

Accepts an XML file for input.

The file type is determined, and then action is taken depending on type. If the file type is a parameter file or a detailed output setup file, existing data is cleared and then the file is parsed. If the file type is detailed output timestep, the user is asked whether they want to replace or add to existing data. The appropriate step is then taken.

Parameters:
sFileName File name of file to input.
oWindow Parent window.
Exceptions:
ModelException if the file cannot be recognized, cannot be parsed, or is invalid; or if this is a data file and there is no parameter file loaded.
Returns:
boolean Whether the file that was read was a data file. A batch file causes this to be false; all else is true (assuming no errors).

void javawrapper.GUIManager.InputXMLParameterFile ( String  sFileName  )  throws ModelException [protected]

Inputs an XML parameter file.

Parameters:
sFileName XML parameter file name
Exceptions:
ModelException if the file cannot be parsed or is invalid.

void javawrapper.GUIManager.InputXMLDataFile ( String  sFileName,
JFrame  oWindow 
) throws ModelException [protected]

Inputs an XML file which is not a parameter type.

This would probably be a detailed output timestep file, a tree map, or a grid map. This method does not clear out existing data before parsing the file.

Parameters:
sFileName XML parameter file name
oWindow Parent application window
Exceptions:
ModelException if the file cannot be parsed or is invalid.

boolean javawrapper.GUIManager.GetSnagAwareness (  )  throws ModelException

Gets whether or not the run is snag-aware.

This searches through all behaviors looking for any that are applied to snags. If none, then the run is not snag-aware.

Returns:
True if the run has any snags anywhere; false if it doesn't.
Exceptions:
ModelException passed through from called methods. Should never be thrown.

void javawrapper.GUIManager.ValidateDataSet (  )  throws ModelException [protected]

Checks to see if the currently loaded dataset is adequate for creating a run and internally valid.

The dataset is valid if there is at least one behavior enabled, and each managed object successfully validates its internal data.

Exceptions:
ModelException if the dataset is not valid.

boolean javawrapper.GUIManager.WriteParameterFile ( String  sFileName  )  throws ModelException

Writes out the XML parameter file with the current settings.

Note that it is not required that the data set be adequate or valid; this way work can be saved in progress. However, if the dataset is invalid, the user will be warned of that fact.

Parameters:
sFileName Filename of new file.
Returns:
Whether or not a file was saved.
Exceptions:
ModelException If there is a problem validating the data or writing the file.

MainWindow javawrapper.GUIManager.GetMainWindow (  ) 

Gets the MainWindow object.

Returns:
MainWindow MainWindow object.

String [] javawrapper.GUIManager.GetBehaviorList ( int  iSpecies,
int  iType 
)

Gets the descriptive names list of behaviors for a tree species/type combo.

Parameters:
iSpecies Species
iType Type
Returns:
String array of behavior names.

void javawrapper.GUIManager.SetBehaviorList ( SpeciesTypeCombo  oToSet,
String[]  p_sBehaviors 
) throws ModelException

Sets the list of behaviors for a tree species/type combo.

This replaces any existing assignments.

Parameters:
oToSet Species/type combo to set behaviors for
p_sBehaviors String array of behavior DISPLAY names.
Exceptions:
ModelException if there is an unrecognized behavior present.

String javawrapper.GUIManager.PrepToRun (  )  throws ModelException

Takes all loaded data and prepares a parameter file to pass to the core to run, returning the filename of the parameter file.

Returns:
The filename of the parameter file which can be passed to the core code.
Exceptions:
ModelException if there are any data validation problems.

void javawrapper.GUIManager.CreateNewParameterFile (  )  throws ModelException

Performs the actions necessary to start a new parameter file.

Exceptions:
ModelException if there is a problem with setup.

void javawrapper.GUIManager.ClearCurrentData (  )  throws ModelException [protected]

This clears old settings in order to accept a new parameter file.

If there's no current data, this will make sure everything is set up to accept new data.

The parameter file string is set to empty, and the parameter file modified flag is set to false.

Exceptions:
ModelException if there are any problems.

OutputBehaviors javawrapper.GUIManager.GetOutputBehaviors (  ) 

Gets the OutputBehaviors object, or null if none exists.

Returns:
OutputBehaviors object.

DisperseBehaviors javawrapper.GUIManager.GetDisperseBehaviors (  ) 

Gets the DisperseBehaviors object, or null if none exists.

Returns:
DisperseBehaviors object.

SeedPredationBehaviors javawrapper.GUIManager.GetSeedPredationBehaviors (  ) 

Gets the SeedPredationBehaviors object, or null if none exists.

Returns:
SeedPredationBehaviors object.

SnagDynamicsBehaviors javawrapper.GUIManager.GetSnagDynamicsBehaviors (  ) 

Gets the SnagDynamicsBehaviors object, or null if none exists.

Returns:
SnagDynamicsBehaviors object.

AnalysisBehaviors javawrapper.GUIManager.GetAnalysisBehaviors (  ) 

Gets the AnalysisBehaviors object, or null if none exists.

Returns:
AnalysisBehaviors object.

EstablishmentBehaviors javawrapper.GUIManager.GetEstablishmentBehaviors (  ) 

Gets the EstablishmentBehaviors object, or null if none exists.

Returns:
EstablishmentBehaviors object.

EpiphyticEstablishmentBehaviors javawrapper.GUIManager.GetEpiphyticEstablishmentBehaviors (  ) 

Gets the EpiphyticEstablishmentBehaviors object, or null if none exists.

Returns:
EpiphyticEstablishmentBehaviors object.

SubstrateBehaviors javawrapper.GUIManager.GetSubstrateBehaviors (  ) 

Gets the Substrate object.

Returns:
Substrate object, or null if none exists.

MortalityBehaviors javawrapper.GUIManager.GetMortalityBehaviors (  ) 

Gets the MortalityBehaviors object.

Returns:
MortalityBehaviors object, or null if none exists.

GrowthBehaviors javawrapper.GUIManager.GetGrowthBehaviors (  ) 

Gets the GrowthBehaviors object.

Returns:
GrowthBehaviors object, or null if none exists.

Plot javawrapper.GUIManager.GetPlot (  ) 

Gets the Plot object.

Returns:
Plot object, or null if none exists.

TreePopulation javawrapper.GUIManager.GetTreePopulation (  ) 

Gets the tree population object.

Returns:
TreePopulation object, or null if none exists.

Allometry javawrapper.GUIManager.GetAllometry (  ) 

Gets the allometry object.

Returns:
Allometry object, or null if none exists.

DisturbanceBehaviors javawrapper.GUIManager.GetDisturbanceBehaviors (  ) 

Gets the disturbance behaviors object, or null if none exists.

Returns:
DisturbanceBehaviors object, or null if none exists.

PlantingBehaviors javawrapper.GUIManager.GetPlantingBehaviors (  ) 

Gets the planting behaviors object, or null if none exists.

Returns:
PlantingBehaviors object, or null if none exists.

LightBehaviors javawrapper.GUIManager.GetLightBehaviors (  ) 

Gets the light behaviors object.

Returns:
LightBehaviors object, or null if none exists.

MortalityUtilitiesBehaviors javawrapper.GUIManager.GetRemoveDeadBehaviors (  ) 

Gets the remove dead behaviors object.

Returns:
RemoveDeadBehaviors object, or null if none exists.

BehaviorTypeBase [] javawrapper.GUIManager.GetAllBehaviorGroups (  ) 

Gets all of the objects descended from BehaviorTypeBase.

Returns:
An array of behaviors.

Grid [] javawrapper.GUIManager.GetAllGrids (  ) 

Gets all of the Grid objects.

Returns:
An array of behaviors.

WorkerBase [] javawrapper.GUIManager.GetAllObjects (  ) 

Gets the array of managed objects.

Returns:
The array of managed objects.

void javawrapper.GUIManager.DisplayRunParameters (  ) 

Allows the user to edit parameters.

void javawrapper.GUIManager.DisplayModelFlowWindow (  ) 

Allows the user to edit simulation flow and behavior order.

JDialog javawrapper.GUIManager.DisplayEpisodicEventsWindow (  )  throws ModelException

Allows the user to edit episodic event data.

This specifically doesn't actually display the window. The MainWindow object that called this gets the option to resize it because it's so big. If I had lots of time, I'd do this for all windows.

Exceptions:
ModelException passing through from called methods.
Returns:
The new window.

void javawrapper.GUIManager.ExtractParameters ( JDialog  jDataWindow  )  throws ModelException

Extracts the data from the parameter window and passes it to objects.

Parameters:
jDataWindow Window holding parameters.
Exceptions:
ModelException if the data extracted is invalid.

void javawrapper.GUIManager.DoSetup (  )  throws ModelException

Triggers the DoSetup() methods of all BehaviorTypeBase objects under management.

Exceptions:
ModelException passed through from the BehaviorTypeBase objects.

Grid javawrapper.GUIManager.AddGrid ( Grid  oNewGrid  ) 

This adds a new grid object to the list.

If it has the same name as another grid object, it will replace the old grid.

Parameters:
oNewGrid Grid Grid to add.
Returns:
Grid added, or the existing grid if it already existed.

Grid javawrapper.GUIManager.GetGridByName ( String  sName  ) 

Finds a grid when provided with the grid's name.

Parameters:
sName String Grid name.
Returns:
Grid Grid, or null if there is no grid by that name.

void javawrapper.GUIManager.ChangeOfSpeciesName ( String  sOldSpecies,
String  sNewSpecies 
) throws ModelException

Changes the list of species names.

This will change any names on the grids and then call the same function for all WorkerBase-descended objects. This is called when everything about the species remains the same except for the name. This is an easier process than actually changing the species list.

Parameters:
sOldSpecies String Old name of the species, with underscores instead of spaces (like the species names would come from the tree population)
sNewSpecies String New name of the species, with underscores instead of spaces (like the species names would come from the tree population)
Exceptions:
ModelException if there is a problem.

void javawrapper.GUIManager.CopySpecies ( int  iSpeciesCopyFrom,
int  iSpeciesCopyTo 
) throws ModelException

Performs any necessary tasks associated with copying one species to another.

This causes the change to propagate throughout the WorkerBase objects.

Parameters:
iSpeciesCopyFrom int Species to copy.
iSpeciesCopyTo int Species that is the copy.
Exceptions:
ModelException if there is a problem.

void javawrapper.GUIManager.ChangeOfSpecies ( int  iOldNumSpecies,
int[]  p_iIndexer,
String[]  p_sNewSpecies 
) throws ModelException

Changes the list of species names.

This will call the same function for all WorkerBase-descended objects.

Parameters:
iOldNumSpecies says how many species there used to be.
p_iIndexer is an array, sized to the new number of species. For each bucket (representing the index number of a species on the new list), the value is either the index of that same species in the old species list, or -1 if the species is new.
p_sNewSpecies the new species list, as the tree population would use it, with underscores instead of spaces.
Exceptions:
ModelException if there is a problem.

void javawrapper.GUIManager.ChangeOfPlotResolution ( float  fOldX,
float  fOldY,
float  fNewX,
float  fNewY 
) throws ModelException

This takes a change of plot resolution and deals with any grid maps found.

If the plot shrinks, the maps are trimmed to fit.

Parameters:
fOldX float Old plot X length.
fOldY float Old plot Y length.
fNewX float New plot X length.
fNewY float New plot Y length.
Exceptions:
ModelException if there is a problem.


Member Data Documentation

Path and name of parameter currently loaded, if any.

Flag for whether or not a loaded parameter file was modified.

This is an array of behaviors and populations, in the order in which they would appear in the parameter file.

I have this as protected instead of private so I can do outrageous testing manipulations

Vector<Grid> javawrapper.GUIManager.mp_oManagedGrids = new Vector<Grid>(0) [private]

Array of grid objects.

BehaviorTypeBase objects create the members of this grid.

Pointer to main application window.

final String javawrapper.GUIManager.PARAMETER_FILE = "01" [protected]

This stands for the parameter file XML file type.

This matches the value in the C++ file "DataTypes.h".

final String javawrapper.GUIManager.DETAILED_OUTPUT_FILE = "06" [protected]

This stands for the detailed output file XML file type.

This matches the value in the C++ file "DataTypes.h".

final String javawrapper.GUIManager.DETAILED_OUTPUT_TIMESTEP = "07" [protected]

This stands for the detailed output timestep file XML file type.

This matches the value in the C++ file "DataTypes.h".

final String javawrapper.GUIManager.BATCH_FILE = "04" [protected]

This stands for the batch file XML file type.

This matches the value in the C++ file "DataTypes.h".


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

Generated on Tue Apr 19 13:59:41 2011 for SORTIE Java Interface by  doxygen 1.5.6