|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.gsfc.drl.rtstps.viewer.commands.CommandState
public class CommandState
This class represents the command state of the RT-STPS server: unloaded, loaded and stopped, or loaded and go (running). Clients may register as CommandStateListeners to receive the current command state. CommandState will immediately send the current state to a registering listener.
This is the best place to get the current command state. You could also get command state from the Distributor as a StatusItem or from CommandButtons, but each has deficiencies. CommandButtons will only notify you of button presses but won't tell you about external changes to the command state. Distributor will tell you about external state changes but only on a periodic interval, so there can be a noticeable delay until you get a state change event. This class, CommandState, listens to both sources and provides a single source for command state.
Field Summary | |
---|---|
private int |
currentState
|
private boolean |
isLoaded
|
private java.util.LinkedList<CommandStateListener> |
listeners
|
Fields inherited from interface gov.nasa.gsfc.drl.rtstps.viewer.commands.CommandStateListener |
---|
LOADED_GO, LOADED_STOPPED, UNLOADED |
Constructor Summary | |
---|---|
CommandState(RtStpsServices server)
Create a CommandState object. |
Method Summary | |
---|---|
void |
addCommandStateListener(CommandStateListener csl)
Add a command state change listener. |
void |
commandStateChange(int state)
As a CommandStateListener, this class processes command state changes by sending state changes to its listeners. |
int |
getValue()
Get the current state. |
void |
processStatusItem(StatusItem item,
java.lang.String fullName)
As a status listener, this class listens for externally-caused state changes. |
void |
removeCommandStateListener(CommandStateListener csl)
Remove a command state change listener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int currentState
private boolean isLoaded
private java.util.LinkedList<CommandStateListener> listeners
Constructor Detail |
---|
public CommandState(RtStpsServices server) throws java.rmi.RemoteException
java.rmi.RemoteException
Method Detail |
---|
public final int getValue()
public void commandStateChange(int state)
commandStateChange
in interface CommandStateListener
public void addCommandStateListener(CommandStateListener csl)
public void removeCommandStateListener(CommandStateListener csl)
public void processStatusItem(StatusItem item, java.lang.String fullName)
processStatusItem
in interface StatusListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |