Package repast.simphony.ui
Class RSApplication
- java.lang.Object
-
- repast.simphony.ui.RSApplication
-
- All Implemented Interfaces:
TickListener
,RunListener
public class RSApplication extends Object implements TickListener, RunListener
Main application mediator type object for Repast Simphony runtime.- Author:
- Nick Collier
-
-
Constructor Summary
Constructors Constructor Description RSApplication(UIActionExtensions actionExts, ModelPluginLoader loader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCustomUserPanel(JPanel panel)
boolean
close()
Closes the runtime application.void
createLayout(saf.core.ui.dock.DockingManager manager)
Creates the gui layout.void
createNewScenario()
Creates a new scenario through the new scenario wizard.Controller
getController()
Returns the current controller.Scenario
getCurrentScenario()
ErrorLog
getErrorLog()
Gets the error log.RSGui
getGui()
Returns the application guiProbeManager
getProbeManager()
static RSApplication
getRSApplicationInstance()
simphony.settings.SettingsRegistry
getSettingsRegistry()
Gets the settings registry.boolean
hasCustomUserPanelDefined()
void
initSim()
Initializes a simulation run.static boolean
isGui()
boolean
isStartSim()
Checks to see the state of startSim.void
loadLayout()
Loads and resets the current layout from a user selected file.void
open()
Opens a scenario via a directory chooser dialog.void
pause()
Pauses the simulation run.void
paused()
Invoked when the current run has been paused.void
removeCustomUserPanel()
void
reset()
Resets the gui and runtime infrastructure for another simulation run.void
resetLayout()
Resets the layout to the initial layout.void
restarted()
Invoked when the current run has been restarted after a pause.void
save()
Saves the current scenario.void
saveAs()
Saves the current scenario into a user specified scenario directory.void
saveAsDefaultLayout()
Saves the current view layout as the default layout for the current scenario.File
saveCurrentParameters()
Saves the current parameters to a parameters.xml file in the current scenario directory.void
saveLayout()
Saves the current layout to a user selected file.void
start()
Starts a simulation run.void
started()
Invoked when the current run has been started.void
step()
Steps a simulation run forward a single step.void
stop()
Stops the simulation run.void
stopped()
Invoked when the current run has been stopped.protected void
storeSettings()
void
tickCountUpdated(double newTick)
Called when the schedule increments the tick count.GUIParametersManager
updateGuiParamsManager(Parameters params, ParametersUI pui)
-
-
-
Constructor Detail
-
RSApplication
public RSApplication(UIActionExtensions actionExts, ModelPluginLoader loader)
-
-
Method Detail
-
getProbeManager
public ProbeManager getProbeManager()
-
isGui
public static boolean isGui()
-
getRSApplicationInstance
public static RSApplication getRSApplicationInstance()
-
addCustomUserPanel
public void addCustomUserPanel(JPanel panel)
-
hasCustomUserPanelDefined
public boolean hasCustomUserPanelDefined()
-
removeCustomUserPanel
public void removeCustomUserPanel()
-
initSim
public void initSim()
Initializes a simulation run. This initializes both the run mechanism and the gui.
-
isStartSim
public boolean isStartSim()
Checks to see the state of startSim. Should be called from Event Dispatch Thread.
-
start
public void start()
Starts a simulation run. Initializes the run if necessary.
-
step
public void step()
Steps a simulation run forward a single step.
-
pause
public void pause()
Pauses the simulation run.
-
stop
public void stop()
Stops the simulation run.
-
resetLayout
public void resetLayout()
Resets the layout to the initial layout.
-
saveLayout
public void saveLayout()
Saves the current layout to a user selected file.
-
saveAsDefaultLayout
public void saveAsDefaultLayout()
Saves the current view layout as the default layout for the current scenario.
-
loadLayout
public void loadLayout()
Loads and resets the current layout from a user selected file.
-
createNewScenario
public void createNewScenario()
Creates a new scenario through the new scenario wizard.
-
open
public void open()
Opens a scenario via a directory chooser dialog.
-
updateGuiParamsManager
public GUIParametersManager updateGuiParamsManager(Parameters params, ParametersUI pui)
-
reset
public void reset()
Resets the gui and runtime infrastructure for another simulation run.
-
saveAs
public void saveAs()
Saves the current scenario into a user specified scenario directory. The directory itself is selected via directory chooser widget.
-
saveCurrentParameters
public File saveCurrentParameters()
Saves the current parameters to a parameters.xml file in the current scenario directory.
-
save
public void save()
Saves the current scenario. If the current scenario has not been saved, this is the equivalent of save as.
-
close
public boolean close()
Closes the runtime application.- Returns:
- true
-
storeSettings
protected void storeSettings()
-
createLayout
public void createLayout(saf.core.ui.dock.DockingManager manager)
Creates the gui layout.- Parameters:
manager
-
-
tickCountUpdated
public void tickCountUpdated(double newTick)
Called when the schedule increments the tick count.- Specified by:
tickCountUpdated
in interfaceTickListener
- Parameters:
newTick
- the new tick value.
-
getController
public Controller getController()
Returns the current controller.- Returns:
- the current controller.
-
getGui
public RSGui getGui()
Returns the application gui- Returns:
- the application gui
-
getSettingsRegistry
public simphony.settings.SettingsRegistry getSettingsRegistry()
Gets the settings registry.- Returns:
- the settings registry.
-
getCurrentScenario
public Scenario getCurrentScenario()
-
paused
public void paused()
Invoked when the current run has been paused.- Specified by:
paused
in interfaceRunListener
-
restarted
public void restarted()
Invoked when the current run has been restarted after a pause.- Specified by:
restarted
in interfaceRunListener
-
started
public void started()
Invoked when the current run has been started.- Specified by:
started
in interfaceRunListener
-
stopped
public void stopped()
Invoked when the current run has been stopped.- Specified by:
stopped
in interfaceRunListener
-
getErrorLog
public ErrorLog getErrorLog()
Gets the error log.- Returns:
-
-