gov.nasa.gsfc.drl.rtstps.viewer.path
Class StatusWindowAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by gov.nasa.gsfc.drl.rtstps.library.XAction
          extended by gov.nasa.gsfc.drl.rtstps.viewer.path.StatusWindowAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
PacketAction, PathServiceAction

public abstract class StatusWindowAction
extends XAction

This class is an action that causes a new status window to be opened for one RT-STPS node block type.

I maintain a list of active windows by window identifier so as to avoid duplicate windows. I become a window listener on each window so that I can remove it from my list of open windows when it closes. It is the window's responsibility to disconnect itself from the Distributor.

See Also:
Serialized Form

Nested Class Summary
(package private)  class StatusWindowAction.MyWindowAdapter
           
 
Field Summary
private  java.util.TreeSet<java.lang.String> activeWindows
           
private  java.lang.String blockType
           
private  Distributor distributor
           
private  javax.swing.JFrame frame
           
private static long serialVersionUID
           
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
StatusWindowAction(java.lang.String title, java.lang.String blockType, javax.swing.JFrame frame, Distributor distributor)
          Create a status window action.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The action that is performed when the button is pressed or the menu item is selected.
protected abstract  StatusWindow createStatusWindow(javax.swing.JFrame frame, java.lang.String blockName, Distributor distributor)
          Create a custom status window (dialog or frame) to show what the user chooses.
private  java.util.List<java.lang.String> getBlockList(java.lang.String blockType)
          Get a list of packet blocks from the Distributor.
private  java.lang.String pickBlock(java.lang.String blockType, java.util.List<java.lang.String> list)
          Ask the user to choose a status block.
 
Methods inherited from class gov.nasa.gsfc.drl.rtstps.library.XAction
getKeyStroke, getMnemonic, getText, getToolTip
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

frame

private javax.swing.JFrame frame

distributor

private Distributor distributor

blockType

private java.lang.String blockType

activeWindows

private java.util.TreeSet<java.lang.String> activeWindows

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

StatusWindowAction

public StatusWindowAction(java.lang.String title,
                          java.lang.String blockType,
                          javax.swing.JFrame frame,
                          Distributor distributor)
Create a status window action.

Parameters:
title - The label associated with this action.
blockType - A RT-STPS node block type such as "vcdu." The action will ask the user to select one status block to view from a list of blocks that match the block type.
frame - The parent frame
distributor - The status distributor
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Description copied from class: XAction
The action that is performed when the button is pressed or the menu item is selected.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Specified by:
actionPerformed in class XAction

createStatusWindow

protected abstract StatusWindow createStatusWindow(javax.swing.JFrame frame,
                                                   java.lang.String blockName,
                                                   Distributor distributor)
Create a custom status window (dialog or frame) to show what the user chooses.


getBlockList

private java.util.List<java.lang.String> getBlockList(java.lang.String blockType)
Get a list of packet blocks from the Distributor.


pickBlock

private java.lang.String pickBlock(java.lang.String blockType,
                                   java.util.List<java.lang.String> list)
Ask the user to choose a status block.

Parameters:
blockType - the block type name
list - a list of status block names