MetaDone
metadone.metabusiness.impl.UndoRedoManager_impl Class Reference
Inheritance diagram for metadone.metabusiness.impl.UndoRedoManager_impl:
Collaboration diagram for metadone.metabusiness.impl.UndoRedoManager_impl:

List of all members.

Classes

class  UndoEventGroup
class  UndoRedoList

Public Member Functions

 UndoRedoManager_impl (Workspace workspace)
final Workspace getWorkspace ()
Object getContext ()
synchronized boolean addContext (Object context)
synchronized boolean removeContext (Object context)
boolean canRedo ()
synchronized void redo () throws UndoRedoException
synchronized void undo () throws UndoRedoException
synchronized void trigger (Metal1Event event)

Private Member Functions

synchronized UndoRedoList getList ()

Private Attributes

final Workspace workspace
final HashMap< Object,
UndoRedoList
map = new HashMap<Object, UndoRedoList>()
final LinkedList< Object > context = new LinkedList<Object>()
volatile boolean undoing
volatile boolean redoing

Static Private Attributes

static final Logger logger = Logger.getLogger(UndoRedoManager_impl.class)
static final long EVENT_GROUP_DURATION_MILLI = 500

Detailed Description

Implements partial undo/redo by observing the events and trying to reproduce the inverse transformation.

FIXME this is a bad way of implementing undo/redo it should be done for example by using a command pattern (also transactions at metal1/metal2 level would help)


Constructor & Destructor Documentation

metadone.metabusiness.impl.UndoRedoManager_impl.UndoRedoManager_impl ( Workspace  workspace)

Member Function Documentation

synchronized boolean metadone.metabusiness.impl.UndoRedoManager_impl.addContext ( Object  context)

Adds a context on the context stack.

Parameters:
contextThe new context
Returns:
true if the context was added

Implements metadone.metabusiness.UndoRedoManager.

boolean metadone.metabusiness.impl.UndoRedoManager_impl.canRedo ( )

Indicates whether redo can be called.

The result is false if it makes no sense to redo, most of the time it means that undo() was not yet called.

Returns:
true if it is possible to redo

Implements metadone.metabusiness.UndoRedoManager.

References metadone.metabusiness.impl.UndoRedoManager_impl.UndoRedoList.canRedo(), metadone.metabusiness.impl.UndoRedoManager_impl.getContext(), and metadone.metabusiness.impl.UndoRedoManager_impl.map.

synchronized UndoRedoList metadone.metabusiness.impl.UndoRedoManager_impl.getList ( ) [private]
final Workspace metadone.metabusiness.impl.UndoRedoManager_impl.getWorkspace ( )

Gets the workspace.

Returns:
The workspace

Implements metadone.metabusiness.UndoRedoManager.

References metadone.metabusiness.impl.UndoRedoManager_impl.workspace.

synchronized boolean metadone.metabusiness.impl.UndoRedoManager_impl.removeContext ( Object  context)

Removes the context from the stack.

Parameters:
contextThe context
Returns:
true if the context was removed

Implements metadone.metabusiness.UndoRedoManager.


Member Data Documentation

final LinkedList<Object> metadone.metabusiness.impl.UndoRedoManager_impl.context = new LinkedList<Object>() [private]
final Logger metadone.metabusiness.impl.UndoRedoManager_impl.logger = Logger.getLogger(UndoRedoManager_impl.class) [static, private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations