adams.flow.transformer.pixelselector
Class AbstractPixelSelectorAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by adams.gui.action.AbstractBaseAction
          extended by adams.flow.transformer.pixelselector.AbstractPixelSelectorAction
All Implemented Interfaces:
Destroyable, OptionHandler, ActionListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
AddClassification, BottomRightCorner, SimpleSelect, TopLeftCorner

public abstract class AbstractPixelSelectorAction
extends AbstractBaseAction
implements OptionHandler

Ancestor for actions for the PixelSelector interactive transformer.

Version:
$Revision: 4776 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
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 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
AbstractPixelSelectorAction()
          Initializes the object.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Invoked when an action occurs.
 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 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
getAccelerator, getIcon, getMnemonic, getName, getToolTipText, hasAccelerator, hasMnemonic, hasToolTipText, isSelected, setAccelerator, 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
 

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.

Constructor Detail

AbstractPixelSelectorAction

public AbstractPixelSelectorAction()
Initializes the object.

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 class AbstractBaseAction

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 interface OptionHandler

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 interface OptionHandler
Returns:
the manager

cleanUpOptions

public void cleanUpOptions()
Cleans up the options.

Specified by:
cleanUpOptions in interface OptionHandler

destroy

public void destroy()
Frees up memory in a "destructive" non-reversible way.

Cleans up the options.

Specified by:
destroy in interface Destroyable
See Also:
cleanUpOptions()

toString

public String toString()
Returns a string representation of the options.

Overrides:
toString in class Object
Returns:
a string representation

toCommandLine

public String toCommandLine()
Returns the commandline string.

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

actionPerformed

public void actionPerformed(ActionEvent e)
Invoked when an action occurs.

Specified by:
actionPerformed in interface ActionListener
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


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.