|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.engine.BaseController
uchicago.src.sim.engine.AbstractGUIController
uchicago.src.sim.engine.Controller
public class Controller
Default GUI control of the simulation. Allows start stop, step, exit, as well
as setup to re-run the simulation after a stop. A user will interact with a
Controller through the GUI, but, under normal circumstances,
should not create one. See SimInit
for more on how to run a simulation.
A list of the buttons displayed by the controller and what they do follows:
| Field Summary | |
|---|---|
protected BatchController |
batchController
used to do the multi-runs |
protected javax.swing.JButton |
btnBegin
|
protected javax.swing.JButton |
btnExit
|
protected javax.swing.JButton |
btnLoad
|
protected javax.swing.JButton |
btnMultRunsStart
|
protected javax.swing.JButton |
btnPause
|
protected javax.swing.JButton |
btnSettings
|
protected javax.swing.JButton |
btnSetup
|
protected javax.swing.JButton |
btnStart
|
protected javax.swing.JButton |
btnStep
|
protected javax.swing.JButton |
btnStop
|
protected java.util.ArrayList |
keyListeners
|
protected java.util.ArrayList |
listeners
|
protected IntrospectPanel |
modelPanel
|
protected RepastParamPanel |
parameterFilePanel
|
protected RepastActionPanel |
repastPanel
|
protected javax.swing.JLabel |
runCountLabel
|
protected javax.swing.JFrame |
settingsFrame
|
protected IntrospectPanel |
simPanel
|
protected javax.swing.JTabbedPane |
tabPane
|
protected javax.swing.JFrame |
tbFrame
|
protected javax.swing.JLabel |
tickCount
|
protected javax.swing.JToolBar |
toolBar
|
protected java.util.ArrayList |
userButtons
|
| Fields inherited from class uchicago.src.sim.engine.AbstractGUIController |
|---|
ALPHA_ORDER, chartModels, console, CONSOLE_ERR, CONSOLE_OUT, customCharts, DEFAULTS_INCLUDE_RNGSEED, mediaSchedulers, myParams, PROBE_ALPHA_ORDER, SHOW_CHARTS, UPDATE_PROBES |
| Fields inherited from class uchicago.src.sim.engine.BaseController |
|---|
done, doStep, executeBegin, exitOnExit, go, isGui, listenerList, model, monitor, params, pauseActionsExecuted, pauseAt, pauseAtAction, pauseSim, persistentObj, runFinished, runThread, schedule, simRun, sleepValue, time |
| Constructor Summary | |
|---|---|
Controller()
Constructs a Controller with no associated model, or parameters. |
|
Controller(ParameterSetter parameters)
Constructs a controller whose model has the specified parameters. |
|
| Method Summary | |
|---|---|
javax.swing.JButton |
addButton(javax.swing.JButton b)
Adds a user defined button to the toolbar. |
javax.swing.JButton |
addButton(java.lang.String label,
java.awt.event.ActionListener listener)
Adds a user defined button to the toolbar. |
void |
addExitListener(java.awt.event.ActionListener listener)
Adds an ActionListener listening for exit button presses. |
javax.swing.JButton |
addIconButton(java.lang.String path,
java.awt.event.ActionListener l)
Adds a user defined button to the toolbar. |
void |
addKeyListener(java.awt.event.KeyListener listener)
Adds a KeyListener listening for any keyboard action when the control toolbar has focus. |
void |
addPauseListener(java.awt.event.ActionListener listener)
Adds an ActionListener listening for pause button presses. |
void |
addStartListener(java.awt.event.ActionListener listener)
Adds an ActionListener listening for start button presses. |
void |
addStepListener(java.awt.event.ActionListener listener)
Adds an ActionListener listening for step button presses. |
void |
addStopListener(java.awt.event.ActionListener listener)
Adds an ActionListener listening for stop button presses. |
void |
beginModel()
Executes begin() on the SimModel associated with this AbstractGUIController. |
void |
display()
Displays the controller |
javax.swing.JFrame |
getFrame()
Returns the JFrame for controller tool bar. |
javax.swing.JTabbedPane |
getTabPane()
Returns the JTabbedPane that contains the parameter panel etc. |
javax.swing.JToolBar |
getToolBar()
Returns the tool bar containing the stop, start etc. buttons. |
protected void |
initParamFileOptions()
loads up the parameter file chooser panel |
protected void |
onTickCountUpdate()
Updates the tick clock whenever the tick count is incremented |
void |
pauseSim()
Pauses the simulation |
void |
setModel(SimModel model)
Sets the model that is controlled by this Controller. |
void |
setup()
Sets up this controller and is associated SimModel prior to a model run. |
void |
showSettings()
|
void |
shutdown()
Exits the simulation but does not exit the jvm. |
void |
simEventPerformed(SimEvent evt)
Invoked by a source on which this is a listener when a SimEvent is fired. |
protected void |
startMultRunsSim()
method called when the triple play button is pushed |
void |
startSim()
Starts the simulation. |
void |
stepSim()
Steps the simulation through one iteration of execution. |
void |
stopSim()
Stops the simulation. |
| Methods inherited from class uchicago.src.sim.engine.AbstractGUIController |
|---|
enableManipulation, exitSim, exitSimulation, getConsoleErr, getConsoleOut, getModelParameterPanel, getRepastParameterPanel, getRunCount, isBatch, isGUI, loadAndStart, makeCurrentParamsDefault, pauseSimulation, setConsoleErr, setConsoleOut, setParameters, showChartDialog, showLoadModelDialog, showMakeMovieDialog, showSnapshotDialog, showVersion, showWriteParamsDialog, stopSimulation |
| Methods inherited from class uchicago.src.sim.engine.BaseController |
|---|
addSimEventListener, fireSimEvent, getCellDepth, getCellHeight, getCellWidth, getCurrentTime, getDefaultModelParameters, getExitOnExit, getModel, getModelParameters, getPauseAt, getPersistentObj, getRandomSeed, getSchedule, notifyMonitor, putPersistentObj, removeSimEventListener, setCellDepth, setCellHeight, setCellWidth, setExitOnExit, setPauseAt, setRandomSeed, setSchedule, setupSchedule |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.swing.JToolBar toolBar
protected javax.swing.JFrame tbFrame
protected javax.swing.JButton btnSetup
protected javax.swing.JButton btnStart
protected javax.swing.JButton btnStep
protected javax.swing.JButton btnStop
protected javax.swing.JButton btnPause
protected javax.swing.JButton btnExit
protected javax.swing.JButton btnLoad
protected javax.swing.JButton btnSettings
protected javax.swing.JButton btnBegin
protected javax.swing.JButton btnMultRunsStart
protected RepastParamPanel parameterFilePanel
protected BatchController batchController
protected javax.swing.JLabel tickCount
protected javax.swing.JLabel runCountLabel
protected javax.swing.JFrame settingsFrame
protected javax.swing.JTabbedPane tabPane
protected IntrospectPanel modelPanel
protected IntrospectPanel simPanel
protected RepastActionPanel repastPanel
protected java.util.ArrayList userButtons
protected java.util.ArrayList listeners
protected java.util.ArrayList keyListeners
| Constructor Detail |
|---|
public Controller()
public Controller(ParameterSetter parameters)
parameters - default values for the model's parameters| Method Detail |
|---|
public void setModel(SimModel model)
setModel in interface IControllersetModel in class AbstractGUIControllermodel - the model associated with this BaseController
public javax.swing.JButton addButton(java.lang.String label,
java.awt.event.ActionListener listener)
label - the label for the new JButtonlistener - the ActionListener fired when the button is clickedpublic javax.swing.JButton addButton(javax.swing.JButton b)
b - the JButton to add
public javax.swing.JButton addIconButton(java.lang.String path,
java.awt.event.ActionListener l)
path - the path to image to use as an ImageIcon for the created
JButtonl - ActionListener fired when the button is clickedprotected void initParamFileOptions()
protected void startMultRunsSim()
public void startSim()
BaseController
startSim in interface IControllerstartSim in class BaseControllerpublic void stopSim()
BaseController
stopSim in interface IControllerstopSim in class BaseControllerpublic void shutdown()
AbstractGUIController
shutdown in class AbstractGUIControllerpublic void showSettings()
public void stepSim()
AbstractGUIController
stepSim in class AbstractGUIControllerpublic void beginModel()
AbstractGUIController
beginModel in class AbstractGUIControllerpublic void pauseSim()
BaseController
pauseSim in interface IControllerpauseSim in class BaseControllerpublic void setup()
AbstractGUIController
setup in class AbstractGUIControllerprotected void onTickCountUpdate()
onTickCountUpdate in class AbstractGUIControllerpublic void display()
public javax.swing.JFrame getFrame()
public javax.swing.JToolBar getToolBar()
public javax.swing.JTabbedPane getTabPane()
public void addStartListener(java.awt.event.ActionListener listener)
listener - the listener to listen for button clicks.public void addStopListener(java.awt.event.ActionListener listener)
listener - the listener to listen for button clicks.public void addPauseListener(java.awt.event.ActionListener listener)
listener - the listener to listen for button clicks.public void addExitListener(java.awt.event.ActionListener listener)
listener - the listener to listen for button clicks.public void addStepListener(java.awt.event.ActionListener listener)
listener - the listener to listen for button clicks.public void addKeyListener(java.awt.event.KeyListener listener)
listener - the listener to listen for keyboard eventspublic void simEventPerformed(SimEvent evt)
SimEvent is fired. Controller listens for
stop, end, and rng_seed events. Stop will stop the simulation, end will
end the simluation and an rng_seed event will update the model panel with
the new rng seed value.
simEventPerformed in interface SimEventListenersimEventPerformed in class AbstractGUIController
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||