org.openbp.cockpit.modeler.undo
Class ModelerUndoable

java.lang.Object
  extended by org.openbp.cockpit.modeler.undo.ModelerUndoable
All Implemented Interfaces:
Undoable

public class ModelerUndoable
extends java.lang.Object
implements Undoable

'Brute force' implemenation of an undoable object for the process modeler. This undoable simply contains a before and after operation image (clone) of the process. This is the easy way because we don't need to thing about how to revert an operation, but it's definately memory-consuming.

Author:
Heiko Erhardt

Constructor Summary
ModelerUndoable(Modeler modeler)
          Default constructor.
 
Method Summary
protected  ProcessItem copyProcess(ProcessItem process)
          Copies a process.
 java.lang.String getDisplayName()
          Gets the display name.
 boolean isRedoable()
          Returns true if the action can be redone.
 boolean redo()
          Redo the action.
protected  void restoreSelection(java.util.List selectionQualifiers)
          Restores the current selection.
protected  java.util.List saveSelection()
          Saves the current selection of the associated modeler.
 void setDisplayName(java.lang.String displayName)
          Sets the display name.
 boolean undo()
          Undo the last Action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelerUndoable

public ModelerUndoable(Modeler modeler)
Default constructor.

Parameters:
modeler - Modeler
Method Detail

undo

public boolean undo()
Description copied from interface: Undoable
Undo the last Action.

Specified by:
undo in interface Undoable
Returns:
boolean - true action undo was successful false otherwise
See Also:
Undoable.undo()

isRedoable

public boolean isRedoable()
Description copied from interface: Undoable
Returns true if the action can be redone.

Specified by:
isRedoable in interface Undoable
Returns:
boolean - true action is reduable false otherwise
See Also:
Undoable.isRedoable()

redo

public boolean redo()
Description copied from interface: Undoable
Redo the action.

Specified by:
redo in interface Undoable
Returns:
boolean - true action redo was successful false otherwise
See Also:
Undoable.redo()

getDisplayName

public java.lang.String getDisplayName()
Gets the display name.

Specified by:
getDisplayName in interface Undoable
Returns:
String a name which can be displayed on screen

setDisplayName

public void setDisplayName(java.lang.String displayName)
Sets the display name.


copyProcess

protected ProcessItem copyProcess(ProcessItem process)
Copies a process. Clones the process and clears all figures references from the clone.

Parameters:
process - Process to clone
Returns:
The clone

saveSelection

protected java.util.List saveSelection()
Saves the current selection of the associated modeler.

Returns:
A list of ModelQualifier objects denoting the selected elements or null if no elements were selected

restoreSelection

protected void restoreSelection(java.util.List selectionQualifiers)
Restores the current selection.

Parameters:
selectionQualifiers - A list of ModelQualifier objects denoting the selected elements or null if no elements were selected


Copyright © 2011. All Rights Reserved.