|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsim.display.SimpleController
public class SimpleController
| Field Summary | |
|---|---|
static int |
PS_PAUSED
The play thread is presently paused. |
static int |
PS_PLAYING
The play thread is presently playing. |
static int |
PS_STOPPED
The play thread is presently stopped. |
| Constructor Summary | |
|---|---|
SimpleController(GUIState simulation)
|
|
SimpleController(GUIState simulation,
boolean displayInspectors)
|
|
| Method Summary | |
|---|---|
void |
doChangeCode(java.lang.Runnable r)
Deprecated. |
void |
doClose()
Closes the Controller and shuts down the simulation. |
boolean |
doNew()
Calls forth the "New Simulation" window. |
java.util.ArrayList |
getAllFrames()
Returns a list of all displays. |
java.util.ArrayList |
getAllInspectors()
Returns a list of all current inspectors. |
boolean |
getIncrementSeedOnPlay()
Deprecated. renamed to getIncrementSeedOnStop |
boolean |
getIncrementSeedOnStop()
|
int |
getPlayState()
Gets whether or not the current thread is PS_PLAYING, PS_STOPPED, or PS_PAUSED. |
void |
pressPause()
Called when the user presses the pause button. |
void |
pressPlay()
Called when the user presses the play button. |
void |
pressStop()
Called when the user presses the stop button. |
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 console |
void |
registerInspector(Inspector inspector,
Stoppable stopper)
Registers an inspector to be Stopped if necessary in the future. |
void |
removeAllInspectors(boolean killDraggedOutWindowsToo)
Stops and removes all inspectors. |
void |
setIncrementSeedOnPlay(boolean val)
Deprecated. renamed to setIncrementSeedOnStop |
void |
setIncrementSeedOnStop(boolean val)
|
void |
setInspectors(Bag inspectors,
Bag names)
Adds new inspectors to the Console's list, given the provided inspectors, their portrayals, and appropriate names for them. |
void |
stopAllInspectors(boolean killDraggedOutWindowsToo)
Stops all inspectors. |
boolean |
unregisterAllFrames()
Simulations can call this to clear out the "Display list" of the console |
boolean |
unregisterFrame(javax.swing.JFrame frame)
Simulations can call this to remove a frame from the "Display list" of the console |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PS_STOPPED
public static final int PS_PLAYING
public static final int PS_PAUSED
| Constructor Detail |
|---|
public SimpleController(GUIState simulation)
public SimpleController(GUIState simulation,
boolean displayInspectors)
| Method Detail |
|---|
public int getPlayState()
public void doClose()
public void setIncrementSeedOnPlay(boolean val)
public boolean getIncrementSeedOnPlay()
public void setIncrementSeedOnStop(boolean val)
public boolean getIncrementSeedOnStop()
public void pressStop()
public void pressPause()
public void pressPlay()
public boolean registerFrame(javax.swing.JFrame frame)
registerFrame in interface Controllerpublic boolean unregisterFrame(javax.swing.JFrame frame)
unregisterFrame in interface Controllerpublic boolean unregisterAllFrames()
unregisterAllFrames in interface Controllerpublic void doChangeCode(java.lang.Runnable r)
ControllerYou 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.
doChangeCode in interface Controllerpublic void refresh()
Controller
refresh in interface Controller
public void setInspectors(Bag inspectors,
Bag names)
setInspectors in interface Controller
public void registerInspector(Inspector inspector,
Stoppable stopper)
registerInspector in interface Controllerpublic void stopAllInspectors(boolean killDraggedOutWindowsToo)
public void removeAllInspectors(boolean killDraggedOutWindowsToo)
public boolean doNew()
public java.util.ArrayList getAllInspectors()
getAllInspectors in interface Controllerpublic java.util.ArrayList getAllFrames()
getAllFrames in interface Controller
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||