|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Controller
A Controller is the top-level object responsible for setting up and running the GUIState. More or less, the Controller calls the init, start, step, finish, and quit methods on the GUIState. The Controller also provides a window management facility. The controller allows the GUIState to register windows to appear in a list to the user and to be closed properly when the program is quit. The controller also manages a repository of current inspectors. Both of these facilities are optional. Subclasses are not required to implement all these methods; they can stub some out except for doChangeCode(...).
Method Summary | |
---|---|
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. |
Method Detail |
---|
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |