be.ugent.caagt.swirl.undoredo

Class UndoAction

Implemented Interfaces:
EventListener, UndoListener

public class UndoAction
extends SimpleAction
implements UndoListener

Action which undoes the last change registered with the corresponding undo manager. When the action is enabled, the caption is taken from the current UndoableChange in the undo list of the associated UndoManager.

Field Summary

Fields inherited from class be.ugent.caagt.swirl.actions.SimpleAction

MEDIUM_DISABLED_ICON, MEDIUM_ICON

Constructor Summary

UndoAction(UndoManager manager, ResourceBundle bundle, String key, Icon icon, Icon mediumIcon, Icon mediumDisabledIcon)
Create an action of this type.

Method Summary

void
actionPerformed(ActionEvent e)
Undoes the current undoable change.
void
setEnabled(boolean newValue)
Enables/disables the action and changes the caption accordingly.
void
undoStateChanged()
Enables or disables the button according to whether any changes remain to be undone or not.

Methods inherited from class be.ugent.caagt.swirl.actions.SimpleAction

actionPerformed

Constructor Details

UndoAction

public UndoAction(UndoManager manager,
                  ResourceBundle bundle,
                  String key,
                  Icon icon,
                  Icon mediumIcon,
                  Icon mediumDisabledIcon)
Create an action of this type. When the action is enabled, the the caption is taken from the current UndoableChange of the associated UndoManager. . Mnemonic and accelerator key are taken from the description object as defined by the parameters bundle and key.
Parameters:
manager - Undo manager to which this action applies
bundle - Resource bundle which contains the description for this action.
key - Key used for the description of this action in the bundle.
icon - Small icon to be used for menu and standard button decoration (or null)
mediumIcon - Medium size icon to be used for tool bar buttons (or null)
mediumDisabledIcon - Medium size icon to be used for a disabled tool bar buttons (or null)

Method Details

actionPerformed

public void actionPerformed(ActionEvent e)
Undoes the current undoable change.
Overrides:
actionPerformed in interface SimpleAction

setEnabled

public void setEnabled(boolean newValue)
Enables/disables the action and changes the caption accordingly.

undoStateChanged

public void undoStateChanged()
Enables or disables the button according to whether any changes remain to be undone or not.
Specified by:
undoStateChanged in interface UndoListener