Class AbstractPixelSelectorAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- adams.gui.action.AbstractBaseAction
-
- adams.flow.transformer.pixelselector.AbstractPixelSelectorAction
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,OptionHandler
,BaseAction
,ActionListener
,Serializable
,Cloneable
,EventListener
,Action
- Direct Known Subclasses:
AddClassification
,BottomRightCorner
,SimpleSelect
,TopLeftCorner
public abstract class AbstractPixelSelectorAction extends AbstractBaseAction implements OptionHandler
Ancestor for actions for thePixelSelector
interactive transformer.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected OptionManager
m_OptionManager
for managing the available options.static String
MOUSE_POSITION
the mouse position key.static String
PANEL
the panel this action is for.static String
PIXEL_POSITION
the pixel position key.-
Fields inherited from class adams.gui.action.AbstractBaseAction
ASYNCHRONOUS
-
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
Constructors Constructor Description AbstractPixelSelectorAction()
Initializes the object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
check()
Performs a check on the setup.void
cleanUpOptions()
Cleans up the options.void
defineOptions()
Adds options to the internal list of options.void
destroy()
Frees up memory in a "destructive" non-reversible way.protected void
doActionPerformed(ActionEvent e)
Invoked when an action occurs.protected abstract boolean
doProcessAction(ActionEvent e)
Reacts to the action event.protected void
finishInit()
Finishes the initialization in the constructor.Point
getMousePosition()
Returns the mouse position, if available.OptionManager
getOptionManager()
Returns the option manager.PixelSelectorPanel
getPanel()
Returns the panel, if available.Point
getPixelPosition()
Returns the pixel position, if available.protected abstract String
getTitle()
Returns the title of the action (used as menu item text).abstract String
globalInfo()
Returns a string describing the object.boolean
hasMousePosition()
Checks whether a mouse position is available.boolean
hasPanel()
Checks whether a panel is available.boolean
hasPixelPosition()
Checks whether a pixel position is available.protected void
initialize()
Initializes the members.protected OptionManager
newOptionManager()
Returns a new instance of the option manager.protected void
reset()
Resets the scheme.void
setMousePosition(Point value)
Stores the mouse position in the action.void
setPanel(PixelSelectorPanel value)
Stores the panel in the action.void
setPixelPosition(Point value)
Stores the pixel position in the action.String
toCommandLine()
Returns the commandline string.String
toString()
Returns a string representation of the options.-
Methods inherited from class adams.gui.action.AbstractBaseAction
actionPerformed, cleanUp, getAccelerator, getIcon, getMnemonic, getName, getToolTipText, hasAccelerator, hasIcon, hasMnemonic, hasToolTipText, isAsynchronous, isSelected, postActionPerformed, preActionPerformed, setAccelerator, setAsynchronous, setIcon, setIcon, setMnemonic, setName, setSelected, setToolTipText
-
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, wait, wait, wait
-
Methods inherited from interface javax.swing.Action
accept, addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
MOUSE_POSITION
public static final String MOUSE_POSITION
the mouse position key.- See Also:
- Constant Field Values
-
PIXEL_POSITION
public static final String PIXEL_POSITION
the pixel position key.- See Also:
- Constant Field Values
-
PANEL
public static final String PANEL
the panel this action is for.- See Also:
- Constant Field Values
-
m_OptionManager
protected OptionManager m_OptionManager
for managing the available options.
-
-
Method Detail
-
globalInfo
public abstract String globalInfo()
Returns a string describing the object.- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractBaseAction
-
getTitle
protected abstract String getTitle()
Returns the title of the action (used as menu item text).- Returns:
- the title
-
reset
protected void reset()
Resets the scheme.
-
newOptionManager
protected OptionManager newOptionManager()
Returns a new instance of the option manager.- Returns:
- the manager to use
-
defineOptions
public void defineOptions()
Adds options to the internal list of options. Derived classes must override this method to add additional options.- Specified by:
defineOptions
in interfaceOptionHandler
-
finishInit
protected void finishInit()
Finishes the initialization in the constructor.
Default implementation does nothing.
-
getOptionManager
public OptionManager getOptionManager()
Returns the option manager.- Specified by:
getOptionManager
in interfaceOptionHandler
- Returns:
- the manager
-
cleanUpOptions
public void cleanUpOptions()
Cleans up the options.- Specified by:
cleanUpOptions
in interfaceOptionHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Cleans up the options.- Specified by:
destroy
in interfaceDestroyable
- See Also:
cleanUpOptions()
-
toString
public String toString()
Returns a string representation of the options.
-
toCommandLine
public String toCommandLine()
Returns the commandline string.- Specified by:
toCommandLine
in interfaceOptionHandler
- Returns:
- the commandline
-
setMousePosition
public void setMousePosition(Point value)
Stores the mouse position in the action.- Parameters:
value
- the current mouse position, null to remove it
-
hasMousePosition
public boolean hasMousePosition()
Checks whether a mouse position is available.- Returns:
- true if position is available
-
getMousePosition
public Point getMousePosition()
Returns the mouse position, if available.- Returns:
- the position, null if not availabel
-
setPixelPosition
public void setPixelPosition(Point value)
Stores the pixel position in the action.- Parameters:
value
- the current pixel position, null to remove it
-
hasPixelPosition
public boolean hasPixelPosition()
Checks whether a pixel position is available.- Returns:
- true if position is available
-
getPixelPosition
public Point getPixelPosition()
Returns the pixel position, if available.- Returns:
- the position, null if not availabel
-
setPanel
public void setPanel(PixelSelectorPanel value)
Stores the panel in the action.- Parameters:
value
- the panel, null to remove it
-
hasPanel
public boolean hasPanel()
Checks whether a panel is available.- Returns:
- true if panel is available
-
getPanel
public PixelSelectorPanel getPanel()
Returns the panel, if available.- Returns:
- the panel, null if not availabel
-
doProcessAction
protected abstract boolean doProcessAction(ActionEvent e)
Reacts to the action event.- Parameters:
e
- the event- Returns:
- true if to update the report table
-
doActionPerformed
protected void doActionPerformed(ActionEvent e)
Invoked when an action occurs.- Specified by:
doActionPerformed
in classAbstractBaseAction
- Parameters:
e
- the action- See Also:
doProcessAction(ActionEvent)
-
check
public String check()
Performs a check on the setup.
Default implementation always returns null.- Returns:
- null if check passed, otherwise the error message
-
-