MetaDone
|
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 |
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)
metadone.metabusiness.impl.UndoRedoManager_impl.UndoRedoManager_impl | ( | Workspace | workspace | ) |
synchronized boolean metadone.metabusiness.impl.UndoRedoManager_impl.addContext | ( | Object | context | ) |
Adds a context on the context stack.
context | The new context |
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.
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.
Object metadone.metabusiness.impl.UndoRedoManager_impl.getContext | ( | ) |
Gets the current context.
null
) Implements metadone.metabusiness.UndoRedoManager.
References metadone.metabusiness.impl.UndoRedoManager_impl.context.
Referenced by metadone.metabusiness.impl.UndoRedoManager_impl.canRedo(), metadone.metabusiness.impl.UndoRedoManager_impl.getList(), metadone.metabusiness.impl.UndoRedoManager_impl.redo(), and metadone.metabusiness.impl.UndoRedoManager_impl.undo().
synchronized UndoRedoList metadone.metabusiness.impl.UndoRedoManager_impl.getList | ( | ) | [private] |
final Workspace metadone.metabusiness.impl.UndoRedoManager_impl.getWorkspace | ( | ) |
Gets the workspace.
Implements metadone.metabusiness.UndoRedoManager.
References metadone.metabusiness.impl.UndoRedoManager_impl.workspace.
synchronized void metadone.metabusiness.impl.UndoRedoManager_impl.redo | ( | ) | throws UndoRedoException |
Re-does the last undone operations.
UndoRedoException |
Implements metadone.metabusiness.UndoRedoManager.
References metadone.metabusiness.impl.UndoRedoManager_impl.getContext(), metadone.metabusiness.impl.UndoRedoManager_impl.map, metadone.metabusiness.impl.UndoRedoManager_impl.UndoRedoList.redo(), metadone.metabusiness.impl.UndoRedoManager_impl.redoing, and metadone.metabusiness.impl.UndoRedoManager_impl.undoing.
synchronized boolean metadone.metabusiness.impl.UndoRedoManager_impl.removeContext | ( | Object | context | ) |
Removes the context from the stack.
context | The context |
true
if the context was removed Implements metadone.metabusiness.UndoRedoManager.
synchronized void metadone.metabusiness.impl.UndoRedoManager_impl.trigger | ( | Metal1Event | event | ) |
synchronized void metadone.metabusiness.impl.UndoRedoManager_impl.undo | ( | ) | throws UndoRedoException |
Undoes the last operations.
UndoRedoException |
Implements metadone.metabusiness.UndoRedoManager.
References metadone.metabusiness.impl.UndoRedoManager_impl.getContext(), metadone.metabusiness.impl.UndoRedoManager_impl.map, metadone.metabusiness.impl.UndoRedoManager_impl.redoing, metadone.metabusiness.impl.UndoRedoManager_impl.UndoRedoList.undo(), and metadone.metabusiness.impl.UndoRedoManager_impl.undoing.
final LinkedList<Object> metadone.metabusiness.impl.UndoRedoManager_impl.context = new LinkedList<Object>() [private] |
Referenced by metadone.metabusiness.impl.UndoRedoManager_impl.getContext().
final long metadone.metabusiness.impl.UndoRedoManager_impl.EVENT_GROUP_DURATION_MILLI = 500 [static, private] |
final Logger metadone.metabusiness.impl.UndoRedoManager_impl.logger = Logger.getLogger(UndoRedoManager_impl.class) [static, private] |
final HashMap<Object, UndoRedoList> metadone.metabusiness.impl.UndoRedoManager_impl.map = new HashMap<Object, UndoRedoList>() [private] |
volatile boolean metadone.metabusiness.impl.UndoRedoManager_impl.redoing [private] |
volatile boolean metadone.metabusiness.impl.UndoRedoManager_impl.undoing [private] |
final Workspace metadone.metabusiness.impl.UndoRedoManager_impl.workspace [private] |