org.graffiti.plugin.actions
Class GraffitiAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.graffiti.plugin.actions.GraffitiAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
AboutAction, CloneViewAction, CloseViewAction, EditRedoAction, EditUndoAction, ExitAction, FileCloseAction, FileNewAction, FileOpenAction, FileSaveAction, FileSaveAllAction, FileSaveAsAction, PluginManagerEditAction, RedrawViewAction, RunAlgorithm, SelectionAction, ViewNewAction

public abstract class GraffitiAction
extends AbstractAction

Represents the basic action in the graffiti system.

Version:
$Revision: 5768 $
See Also:
Serialized Form

Field Summary
protected static Bundle coreBundle
          The Bundle instance.
protected  MainFrame mainFrame
          The main frame.
protected  String name
          The abstract name of the action.
 
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
GraffitiAction(String name, MainFrame mainFrame)
          Constructs a new GraffitiAction from the given name.
 
Method Summary
abstract  HelpContext getHelpContext()
          Returns the help context for this action.
 String getName()
          Returns the abstract name of the action.
abstract  boolean isEnabled()
          Returns true, if this action is enabled.
 void setEnabled(boolean newValue)
          Basically very strange.
protected  void showError(String msg)
          Shows an error in a modal dialog box.
protected  void showWarning(String msg)
          Shows a warning in a modal dialog box.
 void update()
          Updates the state of the action.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

coreBundle

protected static final Bundle coreBundle
The Bundle instance.


mainFrame

protected MainFrame mainFrame
The main frame.


name

protected String name
The abstract name of the action.

Constructor Detail

GraffitiAction

public GraffitiAction(String name,
                      MainFrame mainFrame)
Constructs a new GraffitiAction from the given name.

Parameters:
name - the name for the action
mainFrame - DOCUMENT ME!
Method Detail

isEnabled

public abstract boolean isEnabled()
Returns true, if this action is enabled.

Specified by:
isEnabled in interface Action
Overrides:
isEnabled in class AbstractAction
Returns:
true, if this action is enabled.

getHelpContext

public abstract HelpContext getHelpContext()
Returns the help context for this action.

Returns:
the help context for this action.

setEnabled

public void setEnabled(boolean newValue)
Basically very strange. But it helps getting around the problem that buttons are not activated after the corresponding action has been installed and activated.

Specified by:
setEnabled in interface Action
Overrides:
setEnabled in class AbstractAction
See Also:
AbstractAction.setEnabled(boolean)

getName

public String getName()
Returns the abstract name of the action.

Returns:
the abstract name of the action.

update

public void update()
Updates the state of the action. Calls: setEnabled(isEnabled());.


showError

protected void showError(String msg)
Shows an error in a modal dialog box.

Parameters:
msg - the message to be shown.

showWarning

protected void showWarning(String msg)
Shows a warning in a modal dialog box.

Parameters:
msg - the message to be shown.


Generated at 2012-05-30 11:00:36 PM CEST