public interface Controller
Modifier and Type | Method and Description |
---|---|
void |
doChangeCode(java.lang.Runnable r)
Deprecated.
|
java.util.ArrayList |
getAllFrames()
Returns all registered frames.
|
java.util.ArrayList |
getAllInspectors()
Returns a list of all current inspectors.
|
void |
refresh()
Lazily updates and redraws all the displays and inspectors.
|
boolean |
registerFrame(javax.swing.JFrame frame)
Simulations can call this to add a frame to be listed in the "Display list" of the Controller.
|
void |
registerInspector(Inspector inspector,
Stoppable stopper)
Registers an inspector to be refreshed as appropriate and stopped when the model is restarted.
|
void |
setInspectors(Bag inspectors,
Bag names)
Replaces current inspectors with the ones provided.
|
boolean |
unregisterAllFrames()
Simulations can call this to clear out the "Display list" of the Controller.
|
boolean |
unregisterFrame(javax.swing.JFrame frame)
Simulations can call this to remove a frame from the "Display list" of the Controller.
|
void doChangeCode(java.lang.Runnable r)
You have other options for updating the model from external threads. One option is to add a Steppable to GUIState's scheduleImmediate(...) queue. When the Steppable is stepped, it will be done so inside the model's thread. This is asynchronous (non-blocking), however.
Alternatively, you can synchronize on state.schedule and run your code. This is synchronous.
boolean registerFrame(javax.swing.JFrame frame)
boolean unregisterFrame(javax.swing.JFrame frame)
boolean unregisterAllFrames()
java.util.ArrayList getAllFrames()
void refresh()
void setInspectors(Bag inspectors, Bag names)
void registerInspector(Inspector inspector, Stoppable stopper)
java.util.ArrayList getAllInspectors()