Package uk.ac.starlink.topcat
Class TopcatWindowAction<W extends javax.swing.JFrame>
- java.lang.Object
-
- javax.swing.AbstractAction
-
- uk.ac.starlink.topcat.BasicAction
-
- uk.ac.starlink.topcat.TopcatWindowAction<W>
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,javax.swing.Action,TopcatToolAction
public class TopcatWindowAction<W extends javax.swing.JFrame> extends BasicAction implements TopcatToolAction
TopcatToolAction implementation that instantiates a window of a given class when invoked. The window will be instantiated via a constructor taking a singleComponentargument; such a constructor must therefore exist. This parent component is just used to position the window, it's permissible, though not encouraged, to just ignore that argument.- Since:
- 24 Jul 2013
- Author:
- Mark Taylor
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TopcatWindowAction(java.lang.String name, javax.swing.Icon icon, java.lang.String shortdesc, java.lang.Class<? extends W> winClazz)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent evt)Performs the action.protected WcreateWindow()Creates an instance of the window class used by this action.voidsetParent(java.awt.Component parent)Sets the parent component to use for initialising windows created by this action.-
Methods inherited from class uk.ac.starlink.topcat.BasicAction
getEventWindow
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
TopcatWindowAction
public TopcatWindowAction(java.lang.String name, javax.swing.Icon icon, java.lang.String shortdesc, java.lang.Class<? extends W> winClazz)Constructor.- Parameters:
name- action nameicon- action iconshortdesc- action short descriptionwinClazz- class of window to instantiate; must have a constructor that takes a java.awt.Component giving the window parent
-
-
Method Detail
-
createWindow
protected W createWindow()
Creates an instance of the window class used by this action.- Returns:
- window initialised with parent component
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
Performs the action. The default immplementation just callscreateWindow()and sets it visible. This may be overridden.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
setParent
public void setParent(java.awt.Component parent)
Sets the parent component to use for initialising windows created by this action.- Specified by:
setParentin interfaceTopcatToolAction- Parameters:
parent- parent component
-
-