|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--uchicago.src.sim.engine.BaseController
|
+--uchicago.src.sim.engine.AbstractGUIController
|
+--uchicago.src.sim.engine.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 JButton |
btnBegin
|
protected JButton |
btnExit
|
protected JButton |
btnLoad
|
protected JButton |
btnPause
|
protected JButton |
btnSettings
|
protected JButton |
btnSetup
|
protected JButton |
btnStart
|
protected JButton |
btnStep
|
protected JButton |
btnStop
|
protected ArrayList |
keyListeners
|
protected ArrayList |
listeners
|
protected IntrospectPanel |
modelPanel
|
protected RepastActionPanel |
repastPanel
|
protected JFrame |
settingsFrame
|
protected IntrospectPanel |
simPanel
|
protected JTabbedPane |
tabPane
|
protected JFrame |
tbFrame
|
protected JLabel |
tickCount
|
protected JToolBar |
toolBar
|
protected ArrayList |
userButtons
|
| Fields inherited from class uchicago.src.sim.engine.AbstractGUIController |
ALPHA_ORDER, chartModels, customCharts, DEFAULTS_INCLUDE_RNGSEED, exitOnExit, mediaSchedulers, myParams, SHOW_CHARTS, UPDATE_PROBES |
| Fields inherited from class uchicago.src.sim.engine.BaseController |
done, doStep, executeBegin, 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(Vector parameters)
Constructs a controller whose model has the specified parameters. |
|
| Method Summary | |
JButton |
addButton(JButton b)
Adds a user defined button to the toolbar. |
JButton |
addButton(String label,
ActionListener listener)
Adds a user defined button to the toolbar. |
void |
addExitListener(ActionListener listener)
Adds an ActionListener listening for exit button presses. |
JButton |
addIconButton(String path,
ActionListener l)
Adds a user defined button to the toolbar. |
void |
addKeyListener(KeyListener listener)
Adds a KeyListener listening for any keyboard action when the control toolbar has focus. |
void |
addPauseListener(ActionListener listener)
Adds an ActionListener listening for pause button presses. |
void |
addStartListener(ActionListener listener)
Adds an ActionListener listening for start button presses. |
void |
addStepListener(ActionListener listener)
Adds an ActionListener listening for step button presses. |
void |
addStopListener(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 |
JFrame |
getFrame()
Returns the JFrame for controller tool bar. |
JTabbedPane |
getTabPane()
Returns the JTabbedPane that contains the parameter panel etc. |
JToolBar |
getToolBar()
Returns the tool bar containing the stop, start etc. |
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. |
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, getModelParameterPanel, getRepastParameterPanel, isBatch, isGUI, loadAndStart, makeCurrentParamsDefault, pauseSimulation, setExitOnExit, setParameters, showChartDialog, showLoadModelDialog, showMakeMovieDialog, showSnapshotDialog, showVersion, showWriteParamsDialog, stopSimulation |
| Methods inherited from class uchicago.src.sim.engine.BaseController |
addSimEventListener, fireSimEvent, getCellDepth, getCellHeight, getCellWidth, getCurrentTime, getCurrentTimeDouble, getDefaultModelParameters, getModel, getModelParameters, getPauseAt, getPersistentObj, getRandomSeed, getSchedule, notifyMonitor, putPersistentObj, removeSimEventListener, setCellDepth, setCellHeight, setCellWidth, 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 JToolBar toolBar
protected JFrame tbFrame
protected JButton btnSetup
protected JButton btnStart
protected JButton btnStep
protected JButton btnStop
protected JButton btnPause
protected JButton btnExit
protected JButton btnLoad
protected JButton btnSettings
protected JButton btnBegin
protected JLabel tickCount
protected JFrame settingsFrame
protected JTabbedPane tabPane
protected IntrospectPanel modelPanel
protected IntrospectPanel simPanel
protected RepastActionPanel repastPanel
protected ArrayList userButtons
protected ArrayList listeners
protected ArrayList keyListeners
| Constructor Detail |
public Controller()
public Controller(Vector 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 JButton addButton(String label,
ActionListener listener)
label - the label for the new JButtonlistener - the ActionListener fired when the button is clickedpublic JButton addButton(JButton b)
b - the JButton to add
public JButton addIconButton(String path,
ActionListener l)
path - the path to image to use as an ImageIcon for the created
JButtonl - ActionListener fired when the button is clickedpublic 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 JFrame getFrame()
public JToolBar getToolBar()
public JTabbedPane getTabPane()
public void addStartListener(ActionListener listener)
listener - the listener to listen for button clicks.public void addStopListener(ActionListener listener)
listener - the listener to listen for button clicks.public void addPauseListener(ActionListener listener)
listener - the listener to listen for button clicks.public void addExitListener(ActionListener listener)
listener - the listener to listen for button clicks.public void addStepListener(ActionListener listener)
listener - the listener to listen for button clicks.public void addKeyListener(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
|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||