eu.beesoft.gantt.action
Class AbstractGanttAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by eu.beesoft.gantt.action.AbstractGanttAction
All Implemented Interfaces:
LanguageListener, java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
AbstractChartAction, AbstractTreeTableAction, AbstractZoomAction, RedoAction, UndoAction

public abstract class AbstractGanttAction
extends javax.swing.AbstractAction
implements LanguageListener

Abstract action to support all JGantt actions. It has two features:

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
enabled, changeSupport
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
AbstractGanttAction(JGantt component)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Implements ActionListener.
protected abstract  boolean executeAction(java.awt.event.ActionEvent event, UndoStep undo)
          Executive method for each subclassed action.
protected  JGantt getGantt()
          Returns the instance of JGantt to which this action belongs.
protected  java.lang.String getTextFromResourceBundle(java.lang.String key, boolean keyIsComplete, java.lang.String defaultValue)
          Returns text from resource bundle for given key.
 void languageChanged(Language source)
          Implements LanguageListener.
 
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, toString, wait, wait, wait
 

Constructor Detail

AbstractGanttAction

public AbstractGanttAction(JGantt component)
Constructor.

Parameters:
component - JGantt instance to which this action belongs
Method Detail

getGantt

protected final JGantt getGantt()
Returns the instance of JGantt to which this action belongs.

Returns:
the instance of the JGantt

languageChanged

public void languageChanged(Language source)
Implements LanguageListener. Invoked when environment changes. Reinitializes action properties from resource bundle.

Specified by:
languageChanged in interface LanguageListener
Parameters:
source - - source of this method invocation

getTextFromResourceBundle

protected java.lang.String getTextFromResourceBundle(java.lang.String key,
                                                     boolean keyIsComplete,
                                                     java.lang.String defaultValue)
Returns text from resource bundle for given key. Resource bundle is obtained from JGantt with method JGantt.getResourceBundleName(). If it returns null, Language.getText(Object, String, String) is called, Language.getText(String, String, String) otherwise.

Parameters:
key - - name of property in resource bundle
keyIsComplete - - if true, key is used "as is". If false, key is prefixed with this class qualified name. If resource not found, key is prefixed with this class simple name, and lookup is repeated
defaultValue - - this value is used as return value if required key is not found in resource bundle

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Implements ActionListener. Prepares instance of UndoStep and calls executeAction(ActionEvent, UndoStep). If it returns true, registers this UndoStep in JGantt UndoManager.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - - event

executeAction

protected abstract boolean executeAction(java.awt.event.ActionEvent event,
                                         UndoStep undo)
Executive method for each subclassed action.

Parameters:
event - - event fot this action
undo - - register for undo / redo operations
Returns:
true if action finished successfully