be.ugent.caagt.swirl.undoredo

Class UndoCommand

Implemented Interfaces:
EventListener, UndoListener

public class UndoCommand
extends be.ugent.caagt.swirl.undoredo.UndoRedoCommand

Action command which undoes the last change registered with the corresponding undo manager. The undo manager is assumed to be installed as an attribute to the command manager with key UndoManager.class.getName()

Whenever the state of the undo manager changes, caption and description of the 'undoredo' face of the command are changed. Use face inheritance to propagate either the caption or the description to the appropriate menu or toolbar faces, as in the following example:

   
  <command id="undo">
    <class>be.ugent.caagt.swirl.undoredo.UndoCommand</class>
    <face name="undoredo">
       <text>_Undo</text>
       <accelerator keyStroke="ctrl Z"/>
       <description>Undo</description>
    </face>
    <face name="menu" extends="[undoredo]">
       <description/>
    </face>
    <face name="toolbar" extends="[undoredo]">
       <text/>
       <icon type="classpath">...</icon>
    </face>
  </command>
 
The initial text and description of the 'undoredo' face are used whenever the command is disabled.

Important note: work on this part of the Swirl library will be discontinued because unfortunately newer versions of the GUI commands framework will no longer be available as open source. In due course this class will become deprecated and will eventually be removed from the library.

Field Summary

Fields inherited from class be.ugent.caagt.swirl.undoredo.UndoRedoCommand

undoManager

Constructor Summary

UndoCommand(CommandManager commandManager, String id)
Construct an action command of this type.

Method Summary

protected String
getCaption()
protected void
handleExecute()
void
undoStateChanged()

Methods inherited from class be.ugent.caagt.swirl.undoredo.UndoRedoCommand

getCaption, handleExecute, setEnabled, undoStateChanged

Constructor Details

UndoCommand

public UndoCommand(CommandManager commandManager,
                   String id)
Construct an action command of this type.

Method Details

getCaption

protected String getCaption()
Overrides:
getCaption in interface be.ugent.caagt.swirl.undoredo.UndoRedoCommand

handleExecute

protected void handleExecute()
Overrides:
handleExecute in interface be.ugent.caagt.swirl.undoredo.UndoRedoCommand

undoStateChanged

public void undoStateChanged()
Specified by:
undoStateChanged in interface UndoListener
Overrides:
undoStateChanged in interface be.ugent.caagt.swirl.undoredo.UndoRedoCommand