Class WindowAction

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public abstract class WindowAction extends BasicAction
An Action which controls display of a window. ActionEvents passed to this action may have the action command set to one of the strings HIDE or SHOW to define what the command means (in fact anything other than HIDE counts as SHOW). It has a bound property with key VISIBLE which indicates whether the associated window is currently showing or not. Setting the VISIBLE property true/false has the same effect as invoking the action with the SHOW/HIDE command string.

This class is currently a bit messy and overspecified for what it does.

Since:
2 Mar 2004
Author:
Mark Taylor (Starlink)
See Also:
  • Field Details

    • HIDE

      public static final String HIDE
      Action command text for the action which hides the window associated with this action.
      See Also:
    • SHOW

      public static final String SHOW
      Action command text for the action which reveals the window associated with this action.
      See Also:
    • VISIBLE

      public static final String VISIBLE
      Name of the bound property which indicates whether the window associated with this action is currently visible in the GUI.
      See Also:
  • Constructor Details

    • WindowAction

      protected WindowAction(String name, Icon icon, String shortdesc)
      Constructs a new WindowAction.
      Parameters:
      name - action name
      icon - action icon
      shortdesc - action short description property
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent evt)
    • getValue

      public Object getValue(String key)
      Specified by:
      getValue in interface Action
      Overrides:
      getValue in class AbstractAction
    • putValue

      public void putValue(String key, Object newValue)
      Specified by:
      putValue in interface Action
      Overrides:
      putValue in class AbstractAction
    • getWindow

      public abstract Window getWindow(Component parent)
      Returns the window associated with this action, creating it if necessary.
      Parameters:
      parent - component which may be used for placing the new window
    • hasWindow

      public abstract boolean hasWindow()
      Indicates whether the window associated with this window is currently in existence.
      Returns:
      true iff the window exists
    • getButton

      public JToggleButton getButton()
      Returns a toggle button which toggles visibility of the window associated with this action.

      ** Mostly working but not used at the moment **

      Returns:
      new button