SORTIE Java Interface
1
|
The GUI manager provides all behind-the-scenes functionality for the Main Window. More...
Public Member Functions | |
GUIManager (MainWindow oWindow) throws ModelException | |
Constructor. More... | |
boolean | hasParameterFileBeenModified () |
Whether or not the current parameter file has been modified. More... | |
HelpBroker | getHelpBroker () |
Gets the HelpBroker object which manages help display for the entire application. More... | |
void | proposeNewParameterFile () throws ModelException |
This can be used to propose that a new parameter file is being created. More... | |
String | getParameterFileName () |
Gets the parameter file name. More... | |
void | displayOutputWindow () |
Display the window which allows the user to set up output options. More... | |
void | displayTreeSpeciesSetupWindow () |
Displays the window which allows the user to set up tree species. More... | |
void | displayTreeSizeClassEditor () |
Displays the window which allows the user to set up tree initial density size classes. More... | |
void | displayManageTreeMap () throws ModelException |
Displays the window which allows the user to manage tree maps. More... | |
void | displayGridSetupWindow () |
Displays the window which allows the user to set up grids. More... | |
void | inputTreeMap (String sFileName) throws ModelException |
This passes a tree map file on to the tree population. More... | |
boolean | inputXMLFile (String sFileName, JFrame oWindow) throws ModelException |
Accepts an XML file for input. More... | |
void | convertPre7ParameterFile (String sOldFileName, String sNewFileName) throws ModelException |
Converts a pre-version 7 parameter file to version 7. More... | |
void | inputXMLParameterFile (String sFileName) throws ModelException |
Inputs an XML parameter file. More... | |
void | inputXMLDataFile (String sFileName, JFrame oWindow) throws ModelException |
Inputs an XML file which is not a parameter type. More... | |
boolean | getSnagAwareness () throws ModelException |
Gets whether or not the run is snag-aware. More... | |
boolean | writeParameterFile (String sFileName) throws ModelException |
Writes out the XML parameter file with the current settings. More... | |
MainWindow | getMainWindow () |
Gets the MainWindow object. More... | |
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. More... | |
void | createNewParameterFile () throws ModelException |
Performs the actions necessary to start a new parameter file. More... | |
void | clearCurrentData () throws ModelException |
This clears old settings in order to accept a new parameter file. More... | |
OutputBehaviors | getOutputBehaviors () |
Gets the OutputBehaviors object, or null if none exists. More... | |
DisperseBehaviors | getDisperseBehaviors () |
Gets the DisperseBehaviors object, or null if none exists. More... | |
SeedPredationBehaviors | getSeedPredationBehaviors () |
Gets the SeedPredationBehaviors object, or null if none exists. More... | |
SnagDynamicsBehaviors | getSnagDynamicsBehaviors () |
Gets the SnagDynamicsBehaviors object, or null if none exists. More... | |
AnalysisBehaviors | getAnalysisBehaviors () |
Gets the AnalysisBehaviors object, or null if none exists. More... | |
EstablishmentBehaviors | getEstablishmentBehaviors () |
Gets the EstablishmentBehaviors object, or null if none exists. More... | |
EpiphyticEstablishmentBehaviors | getEpiphyticEstablishmentBehaviors () |
Gets the EpiphyticEstablishmentBehaviors object, or null if none exists. More... | |
ManagementBehaviors | getManagementBehaviors () |
Gets the ManagementBehaviors object, or null if none exists. More... | |
MortalityUtilitiesBehaviors | getMortalityUtilitiesBehaviors () |
Gets the MortalityUtilitiesBehaviors object, or null if none exists. More... | |
StateChangeBehaviors | getStateChangeBehaviors () |
Gets the StateChangeBehaviors object, or null if none exists. More... | |
SubstrateBehaviors | getSubstrateBehaviors () |
Gets the Substrate object. More... | |
MortalityBehaviors | getMortalityBehaviors () |
Gets the MortalityBehaviors object. More... | |
GrowthBehaviors | getGrowthBehaviors () |
Gets the GrowthBehaviors object. More... | |
Plot | getPlot () |
Gets the Plot object. More... | |
TreePopulation | getTreePopulation () |
Gets the tree population object. More... | |
DisturbanceBehaviors | getDisturbanceBehaviors () |
Gets the disturbance behaviors object, or null if none exists. More... | |
PlantingBehaviors | getPlantingBehaviors () |
Gets the planting behaviors object, or null if none exists. More... | |
LightBehaviors | getLightBehaviors () |
Gets the light behaviors object. More... | |
MortalityUtilitiesBehaviors | getRemoveDeadBehaviors () |
Gets the remove dead behaviors object. More... | |
Grid [] | getAllGrids () |
Gets all of the Grid objects. More... | |
BehaviorTypeBase [] | getAllObjects () |
Gets the array of managed objects. More... | |
void | displayRunParameters () |
Allows the user to edit parameters. More... | |
void | displayModelFlowWindow () |
Allows the user to edit simulation flow and behavior order. More... | |
void | doSetup () throws ModelException |
Triggers the DoSetup() methods of all BehaviorTypeBase objects under management. More... | |
Grid | addGrid (Grid oNewGrid, boolean bReplace) |
This adds a new grid object to the list. More... | |
Grid | getGridByName (String sName) |
Finds a grid when provided with the grid's name. More... | |
Grid | getGridByHash (Integer iHash) |
Finds a grid when provided with the grid's hashcode. More... | |
void | changeOfSpeciesName (String sOldSpecies, String sNewSpecies) throws ModelException |
Changes the list of species names. More... | |
void | copySpecies (int iSpeciesCopyFrom, int iSpeciesCopyTo) throws ModelException |
Performs any necessary tasks associated with copying one species to another. More... | |
void | changeOfSpecies (int iOldNumSpecies, int[] p_iIndexer, String[] p_sNewSpecies) throws ModelException |
Changes the list of species names. More... | |
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. More... | |
void | writeTextVersionOfParameterFile (String sFileName) throws ModelException |
Writes out a tab-delimited text file. More... | |
Protected Member Functions | |
void | validateDataSet () throws ModelException |
Checks to see if the currently loaded dataset is adequate for creating a run and internally valid. More... | |
Protected Attributes | |
BehaviorTypeBase [] | mp_oManagedObjects |
This is an array of behaviors and populations, in the order in which they would appear in the parameter file. More... | |
final String | PARAMETER_FILE = "01" |
This stands for the parameter file XML file type. More... | |
final String | DETAILED_OUTPUT_FILE = "06" |
This stands for the detailed output file XML file type. More... | |
final String | DETAILED_OUTPUT_TIMESTEP = "07" |
This stands for the detailed output timestep file XML file type. More... | |
final String | BATCH_FILE = "04" |
This stands for the batch file XML file type. More... | |
Private Member Functions | |
void | fixListPositions () throws ModelException |
This updates the list position numbers of all enabled behaviors. More... | |
Private Attributes | |
String | m_sParameterFile |
Path and name of parameter currently loaded, if any. More... | |
boolean | m_bWasParameterFileModified |
Flag for whether or not a loaded parameter file was modified. More... | |
ArrayList< Grid > | mp_oManagedGrids = new ArrayList<Grid>(0) |
Array of grid objects. More... | |
MainWindow | m_oMainWindow |
Pointer to main application window. More... | |
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: Cary Institute of Ecosystem Studies
Edit history:
---------------—
December 16, 2009: Created (LEM)
May 14, 2015: Changed new parameter file function (LEM)
sortie.gui.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.
oWindow | Main application window. |
ModelException | if something goes wrong with object setup. |
This adds a new grid object to the list.
oNewGrid | Grid Grid to add. |
bReplace | If true, this grid replaces any existing grids with this name. If false, if it has the same name as another grid object, the first grid is returned and this grid is dropped. |
void sortie.gui.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.
fOldX | float Old plot X length. |
fOldY | float Old plot Y length. |
fNewX | float New plot X length. |
fNewY | float New plot Y length. |
ModelException | if there is a problem. |
void sortie.gui.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.
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. |
ModelException | if there is a problem. |
void sortie.gui.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.
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) |
ModelException | if there is a problem. |
void sortie.gui.GUIManager.clearCurrentData | ( | ) | throws ModelException |
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.
ModelException | if there are any problems. |
void sortie.gui.GUIManager.convertPre7ParameterFile | ( | String | sOldFileName, |
String | sNewFileName | ||
) | throws ModelException |
Converts a pre-version 7 parameter file to version 7.
sOldFileName | Filename of file to convert. |
sNewFileName | Filename of version 7 file to write. |
ModelException | if the file cannot be parsed or is invalid. |
void sortie.gui.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.
iSpeciesCopyFrom | int Species to copy. |
iSpeciesCopyTo | int Species that is the copy. |
ModelException | if there is a problem. |
void sortie.gui.GUIManager.createNewParameterFile | ( | ) | throws ModelException |
Performs the actions necessary to start a new parameter file.
ModelException | if there is a problem with setup. |
void sortie.gui.GUIManager.displayGridSetupWindow | ( | ) |
Displays the window which allows the user to set up grids.
void sortie.gui.GUIManager.displayManageTreeMap | ( | ) | throws ModelException |
Displays the window which allows the user to manage tree maps.
void sortie.gui.GUIManager.displayModelFlowWindow | ( | ) |
Allows the user to edit simulation flow and behavior order.
void sortie.gui.GUIManager.displayOutputWindow | ( | ) |
Display the window which allows the user to set up output options.
void sortie.gui.GUIManager.displayRunParameters | ( | ) |
Allows the user to edit parameters.
void sortie.gui.GUIManager.displayTreeSizeClassEditor | ( | ) |
Displays the window which allows the user to set up tree initial density size classes.
void sortie.gui.GUIManager.displayTreeSpeciesSetupWindow | ( | ) |
Displays the window which allows the user to set up tree species.
void sortie.gui.GUIManager.doSetup | ( | ) | throws ModelException |
Triggers the DoSetup() methods of all BehaviorTypeBase objects under management.
ModelException | passed through from the BehaviorTypeBase objects. |
|
private |
This updates the list position numbers of all enabled behaviors.
Grid [] sortie.gui.GUIManager.getAllGrids | ( | ) |
Gets all of the Grid objects.
BehaviorTypeBase [] sortie.gui.GUIManager.getAllObjects | ( | ) |
Gets the array of managed objects.
AnalysisBehaviors sortie.gui.GUIManager.getAnalysisBehaviors | ( | ) |
Gets the AnalysisBehaviors object, or null if none exists.
DisperseBehaviors sortie.gui.GUIManager.getDisperseBehaviors | ( | ) |
Gets the DisperseBehaviors object, or null if none exists.
DisturbanceBehaviors sortie.gui.GUIManager.getDisturbanceBehaviors | ( | ) |
Gets the disturbance behaviors object, or null if none exists.
EpiphyticEstablishmentBehaviors sortie.gui.GUIManager.getEpiphyticEstablishmentBehaviors | ( | ) |
Gets the EpiphyticEstablishmentBehaviors object, or null if none exists.
EstablishmentBehaviors sortie.gui.GUIManager.getEstablishmentBehaviors | ( | ) |
Gets the EstablishmentBehaviors object, or null if none exists.
Grid sortie.gui.GUIManager.getGridByHash | ( | Integer | iHash | ) |
Finds a grid when provided with the grid's hashcode.
iHash | Grid hash code. |
Grid sortie.gui.GUIManager.getGridByName | ( | String | sName | ) |
Finds a grid when provided with the grid's name.
sName | String Grid name. |
GrowthBehaviors sortie.gui.GUIManager.getGrowthBehaviors | ( | ) |
Gets the GrowthBehaviors object.
HelpBroker sortie.gui.GUIManager.getHelpBroker | ( | ) |
Gets the HelpBroker object which manages help display for the entire application.
LightBehaviors sortie.gui.GUIManager.getLightBehaviors | ( | ) |
Gets the light behaviors object.
MainWindow sortie.gui.GUIManager.getMainWindow | ( | ) |
Gets the MainWindow object.
ManagementBehaviors sortie.gui.GUIManager.getManagementBehaviors | ( | ) |
Gets the ManagementBehaviors object, or null if none exists.
MortalityBehaviors sortie.gui.GUIManager.getMortalityBehaviors | ( | ) |
Gets the MortalityBehaviors object.
MortalityUtilitiesBehaviors sortie.gui.GUIManager.getMortalityUtilitiesBehaviors | ( | ) |
Gets the MortalityUtilitiesBehaviors object, or null if none exists.
OutputBehaviors sortie.gui.GUIManager.getOutputBehaviors | ( | ) |
Gets the OutputBehaviors object, or null if none exists.
String sortie.gui.GUIManager.getParameterFileName | ( | ) |
Gets the parameter file name.
PlantingBehaviors sortie.gui.GUIManager.getPlantingBehaviors | ( | ) |
Gets the planting behaviors object, or null if none exists.
Plot sortie.gui.GUIManager.getPlot | ( | ) |
Gets the Plot object.
MortalityUtilitiesBehaviors sortie.gui.GUIManager.getRemoveDeadBehaviors | ( | ) |
Gets the remove dead behaviors object.
SeedPredationBehaviors sortie.gui.GUIManager.getSeedPredationBehaviors | ( | ) |
Gets the SeedPredationBehaviors object, or null if none exists.
boolean sortie.gui.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.
ModelException | passed through from called methods. Should never be thrown. |
SnagDynamicsBehaviors sortie.gui.GUIManager.getSnagDynamicsBehaviors | ( | ) |
Gets the SnagDynamicsBehaviors object, or null if none exists.
StateChangeBehaviors sortie.gui.GUIManager.getStateChangeBehaviors | ( | ) |
Gets the StateChangeBehaviors object, or null if none exists.
SubstrateBehaviors sortie.gui.GUIManager.getSubstrateBehaviors | ( | ) |
Gets the Substrate object.
TreePopulation sortie.gui.GUIManager.getTreePopulation | ( | ) |
Gets the tree population object.
boolean sortie.gui.GUIManager.hasParameterFileBeenModified | ( | ) |
Whether or not the current parameter file has been modified.
void sortie.gui.GUIManager.inputTreeMap | ( | String | sFileName | ) | throws ModelException |
This passes a tree map file on to the tree population.
sFileName | Name of file. |
ModelException | if the tree population rejects the file. |
void sortie.gui.GUIManager.inputXMLDataFile | ( | String | sFileName, |
JFrame | oWindow | ||
) | throws ModelException |
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.
sFileName | XML parameter file name |
oWindow | Parent application window |
ModelException | if the file cannot be parsed or is invalid. |
boolean sortie.gui.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.
sFileName | File name of file to input. |
oWindow | Parent window. |
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. |
void sortie.gui.GUIManager.inputXMLParameterFile | ( | String | sFileName | ) | throws ModelException |
Inputs an XML parameter file.
sFileName | XML parameter file name |
ModelException | if the file cannot be parsed or is invalid. |
String sortie.gui.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.
ModelException | if there are any data validation problems. |
void sortie.gui.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.
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.
ModelException | if anything goes wrong with setup. |
|
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.
ModelException | if the dataset is not valid. |
boolean sortie.gui.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.
sFileName | Filename of new file. |
ModelException | If there is a problem validating the data or writing the file. |
void sortie.gui.GUIManager.writeTextVersionOfParameterFile | ( | String | sFileName | ) | throws ModelException |
Writes out a tab-delimited text file.
|
protected |
This stands for the batch file XML file type.
This matches the value in the C++ file "DataTypes.h".
|
protected |
This stands for the detailed output file XML file type.
This matches the value in the C++ file "DataTypes.h".
|
protected |
This stands for the detailed output timestep file XML file type.
This matches the value in the C++ file "DataTypes.h".
|
private |
Flag for whether or not a loaded parameter file was modified.
|
private |
Pointer to main application window.
|
private |
Path and name of parameter currently loaded, if any.
Array of grid objects.
BehaviorTypeBase objects create the members of this grid.
|
protected |
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
|
protected |
This stands for the parameter file XML file type.
This matches the value in the C++ file "DataTypes.h".