com.jstatcom.ts
Class TSActionTypes

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.jstatcom.ts.TSActionTypes
All Implemented Interfaces:
TSListAccessor, java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public abstract class TSActionTypes
extends javax.swing.AbstractAction
implements TSListAccessor

This class holds default actions used by the TSList. The defined actions override execute(TSList tsList) to provide the a specific function on the underlying TSList, for example deleting all selected entries, changing the types of selected entires, etc.. The actions can be invoked via keys and/or items in the DefaultTSListPopup that is opened via a RIGHT click over the TSList.

New actions may be provided by subclassing this abstract class and setting the new action instance to the default DefaultTSListPopup. Also, existing actions may be removed from there.

If new actions should also be accessible via keys, they can be added to the DefaultTSKeyListener.

This class implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21) . If you compare TSActionTypes, always use the == operator.

Author:
Markus Kraetzig
See Also:
Serialized Form

Field Summary
static TSActionTypes CREATE_DUMMY
          Creates dummy variables by invoking a dialog.
static TSActionTypes DELETE
          Deletes selected time series after asking to confirm.
static TSActionTypes DETERMINISTIC
          Sets type of selected TS to deterministic.
static TSActionTypes EDIT_TS
          Invokes the TSEditorDialog.
static TSActionTypes ENDOGENOUS
          Sets type of selected TS to endogenous.
static TSActionTypes EXOGENOUS
          Sets type of selected TS to exogenous.
static TSActionTypes RENAME
          Renames time series by showing an input dialog.
static TSActionTypes SAVE_DAT
          Saves selected time series in a Dat file.
static TSActionTypes SHOW_DESCRIPTION
          Shows the description for prohject of the 1st selected time series.
static TSActionTypes TRANSFORM
          Transforms time series by invoking a dialog.
 
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
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Tries to retrieve TSList and triggers doAction.
abstract  void doAction(TSList tsList)
          This defines the operation that is actually carried out by the action.
 void enableForTSList(TSList tsList)
          Enables/disables the action according to the state of the underlying list.
 boolean equals(java.lang.Object o)
          Override prevention method to enforce a.equals(b) if and only if a==b.
 int hashCode()
          Override prevention method invokes super method.
 java.lang.String toString()
          Returns the name of the actiontype, do not use for comparisons.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DELETE

public static final TSActionTypes DELETE
Deletes selected time series after asking to confirm.


RENAME

public static final TSActionTypes RENAME
Renames time series by showing an input dialog.


TRANSFORM

public static final TSActionTypes TRANSFORM
Transforms time series by invoking a dialog.


CREATE_DUMMY

public static final TSActionTypes CREATE_DUMMY
Creates dummy variables by invoking a dialog.


SHOW_DESCRIPTION

public static final TSActionTypes SHOW_DESCRIPTION
Shows the description for prohject of the 1st selected time series.


SAVE_DAT

public static final TSActionTypes SAVE_DAT
Saves selected time series in a Dat file.


EDIT_TS

public static final TSActionTypes EDIT_TS
Invokes the TSEditorDialog.


ENDOGENOUS

public static final TSActionTypes ENDOGENOUS
Sets type of selected TS to endogenous.


EXOGENOUS

public static final TSActionTypes EXOGENOUS
Sets type of selected TS to exogenous.


DETERMINISTIC

public static final TSActionTypes DETERMINISTIC
Sets type of selected TS to deterministic.

Method Detail

actionPerformed

public final void actionPerformed(java.awt.event.ActionEvent e)
Tries to retrieve TSList and triggers doAction.

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

doAction

public abstract void doAction(TSList tsList)
This defines the operation that is actually carried out by the action. The method must be overridden if you define a new action.

Parameters:
tsList - the TSList to operate on

enableForTSList

public void enableForTSList(TSList tsList)
Enables/disables the action according to the state of the underlying list. The default is that the action is disabled if nothing is selected. This can be changed by overriding the method. Apart from that, the currently available TSList is set.

Specified by:
enableForTSList in interface TSListAccessor
Parameters:
tsList - the TSList to be referenced by the action

equals

public final boolean equals(java.lang.Object o)
Override prevention method to enforce a.equals(b) if and only if a==b.

Overrides:
equals in class java.lang.Object
Parameters:
o - object to compare with
Returns:
true if equal, false otherwise

hashCode

public final int hashCode()
Override prevention method invokes super method.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code

toString

public final java.lang.String toString()
Returns the name of the actiontype, do not use for comparisons.

Overrides:
toString in class java.lang.Object
Returns:
a string representation