Package uk.ac.starlink.topcat
Class WindowAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- uk.ac.starlink.topcat.BasicAction
-
- uk.ac.starlink.topcat.WindowAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,javax.swing.Action
public abstract class WindowAction extends BasicAction
AnActionwhich controls display of a window.ActionEvents passed to this action may have the action command set to one of the stringsHIDEorSHOWto define what the command means (in fact anything other than HIDE counts as SHOW). It has a bound property with keyVISIBLEwhich 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHIDEAction command text for the action which hides the window associated with this action.static java.lang.StringSHOWAction command text for the action which reveals the window associated with this action.static java.lang.StringVISIBLEName of the bound property which indicates whether the window associated with this action is currently visible in the GUI.
-
Constructor Summary
Constructors Modifier Constructor Description protectedWindowAction(java.lang.String name, javax.swing.Icon icon, java.lang.String shortdesc)Constructs a new WindowAction.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent evt)javax.swing.JToggleButtongetButton()Returns a toggle button which toggles visibility of the window associated with this action.java.lang.ObjectgetValue(java.lang.String key)abstract java.awt.WindowgetWindow(java.awt.Component parent)Returns the window associated with this action, creating it if necessary.abstract booleanhasWindow()Indicates whether the window associated with this window is currently in existence.voidputValue(java.lang.String key, java.lang.Object newValue)-
Methods inherited from class uk.ac.starlink.topcat.BasicAction
getEventWindow
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, isEnabled, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
HIDE
public static final java.lang.String HIDE
Action command text for the action which hides the window associated with this action.- See Also:
- Constant Field Values
-
SHOW
public static final java.lang.String SHOW
Action command text for the action which reveals the window associated with this action.- See Also:
- Constant Field Values
-
VISIBLE
public static final java.lang.String VISIBLE
Name of the bound property which indicates whether the window associated with this action is currently visible in the GUI.- See Also:
- Constant Field Values
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
-
getValue
public java.lang.Object getValue(java.lang.String key)
- Specified by:
getValuein interfacejavax.swing.Action- Overrides:
getValuein classjavax.swing.AbstractAction
-
putValue
public void putValue(java.lang.String key, java.lang.Object newValue)- Specified by:
putValuein interfacejavax.swing.Action- Overrides:
putValuein classjavax.swing.AbstractAction
-
getWindow
public abstract java.awt.Window getWindow(java.awt.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 javax.swing.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
-
-