gov.nasa.gsfc.drl.rtstps.viewer.commands
Class CommandButtons

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.viewer.commands.CommandButtons
All Implemented Interfaces:
StatusListener

public class CommandButtons
extends java.lang.Object
implements StatusListener

This class controls the primary RT-STPS button commands. It creates the appropriate Action classes and links them so they enable or disable themselves depending on the current command state. Not all XActions may be defined here.

ButtonCommands is a StatusListener so that it can see external changes to the command state and thereby change the enable/disable status of the buttons. It should be attached to the Distributor to listen for state- related StatusItems.

A client may register with ButtonCommands as a CommandStateListener. The client will be notified of command state changes due to button presses. It will NOT be notified of command state changes due to external events, which is available from the Distributor as periodic StatusItems.

If a client needs command state change notification, it should register instead as a CommandStateListener with CommandState, which will notify it of both internal and external command state changes.


Field Summary
private  int currentState
          This is the last state I saw from the Distributor.
private  ExitAction exit
           
private  GoAction go
           
private  boolean isLoaded
           
private  LocalLoadAction lload
           
private  RemoteLoadAction rload
           
private  StopAction stop
           
private  UnloadAction unload
           
private  ZeroAction zero
           
 
Constructor Summary
CommandButtons(javax.swing.JFrame frame, RtStpsServices server, int initialCommandState)
          Create the command buttons.
 
Method Summary
 void addCommandStateListener(CommandStateListener csl)
           
 XAction getExitAction()
           
 XAction getGoAction()
           
 XAction getLocalLoadAction()
           
 XAction getRemoteLoadAction()
           
 XAction getStopAction()
           
 XAction getUnloadAction()
           
 XAction getZeroAction()
           
 void processStatusItem(StatusItem item, java.lang.String fullName)
          Process command state status items so that the button's enable/disable state reflect the current command state.
 void removeCommandStateListener(CommandStateListener csl)
           
private  void setButtonState(int state)
          Change the enable/disable status of the buttons depending on the command state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lload

private LocalLoadAction lload

rload

private RemoteLoadAction rload

go

private GoAction go

stop

private StopAction stop

unload

private UnloadAction unload

exit

private ExitAction exit

zero

private ZeroAction zero

currentState

private int currentState
This is the last state I saw from the Distributor. It is not necessarily the current button state.


isLoaded

private boolean isLoaded
Constructor Detail

CommandButtons

public CommandButtons(javax.swing.JFrame frame,
                      RtStpsServices server,
                      int initialCommandState)
Create the command buttons.

Method Detail

getLocalLoadAction

public final XAction getLocalLoadAction()

getRemoteLoadAction

public final XAction getRemoteLoadAction()

getGoAction

public final XAction getGoAction()

getStopAction

public final XAction getStopAction()

getUnloadAction

public final XAction getUnloadAction()

getExitAction

public final XAction getExitAction()

getZeroAction

public final XAction getZeroAction()

addCommandStateListener

public void addCommandStateListener(CommandStateListener csl)

removeCommandStateListener

public void removeCommandStateListener(CommandStateListener csl)

processStatusItem

public void processStatusItem(StatusItem item,
                              java.lang.String fullName)
Process command state status items so that the button's enable/disable state reflect the current command state.

Specified by:
processStatusItem in interface StatusListener

setButtonState

private void setButtonState(int state)
Change the enable/disable status of the buttons depending on the command state.