Package de.hybris.platform.cockpit.util
Class UndoTools
java.lang.Object
de.hybris.platform.cockpit.util.UndoTools
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddOperationAndEventInternal(UndoManager undoManager, UndoableOperation operation, Object eventSource) static voidaddUndoOperationAndEvent(UndoManager undoManager, UndoableOperation operation, Object eventSource) Adds the given operation to the undo stack and sends global undo event.static voidDiscards undo grouping without adding any undo operations to undo manager.static List<UndoableOperation>Returns list of currently grouped operations (SeestartUndoGrouping()).static booleanisItemValid(TypedObject typedObject) static voidredo(UndoManager undoManager, UndoableOperation operation) Performs re-do of all operation from the top of the stack to the given one.static voidStarts grouping of undo-able operations.static voidstopUndoGrouping(UndoManager undoManager, Object eventSource) Stops the grouping of undo-able operations.static voidstopUndoGrouping(UndoManager undoManager, Object eventSource, BulkUndoableOperation bulk) static voidundo(UndoManager undoManager, UndoableOperation operation) Performs undo of all operation from the top of the stack to the given one.
-
Constructor Details
-
UndoTools
public UndoTools()
-
-
Method Details
-
undo
public static void undo(UndoManager undoManager, UndoableOperation operation) throws CannotUndoException Performs undo of all operation from the top of the stack to the given one.- Parameters:
undoManager- the undo manageroperation- the operation- Throws:
CannotUndoException- when one of the operations throws it
-
redo
public static void redo(UndoManager undoManager, UndoableOperation operation) throws CannotRedoException Performs re-do of all operation from the top of the stack to the given one.- Parameters:
undoManager- the undo manageroperation- the operation- Throws:
CannotRedoException- when one of the operations throws it
-
addUndoOperationAndEvent
public static void addUndoOperationAndEvent(UndoManager undoManager, UndoableOperation operation, Object eventSource) Adds the given operation to the undo stack and sends global undo event.- Parameters:
undoManager- the undo manageroperation- the operation to be addedeventSource- the object to be used as source of the undo event
-
startUndoGrouping
public static void startUndoGrouping()Starts grouping of undo-able operations. All operations will be added to a group instead of adding to the undo manager stack. To stop grouping, callstopUndoGrouping(UndoManager um, Object eventSource). Calling it the group sill be added to the undo manager stack as one bulk operation. Note: the grouping is per thread. -
stopUndoGrouping
Stops the grouping of undo-able operations. The group sill be added to the undo manager stack as one bulk operation. SeestartUndoGrouping()for more details about operation grouping and how to start it. Note: the grouping is per thread.- Parameters:
undoManager- the undo managereventSource- the object to be used as source of undo event- See Also:
-
stopUndoGrouping
public static void stopUndoGrouping(UndoManager undoManager, Object eventSource, BulkUndoableOperation bulk) -
getGroupedOperations
Returns list of currently grouped operations (SeestartUndoGrouping()).- Returns:
- list of currently grouped operations
-
discardUndoGrouping
public static void discardUndoGrouping()Discards undo grouping without adding any undo operations to undo manager. -
addOperationAndEventInternal
public static void addOperationAndEventInternal(UndoManager undoManager, UndoableOperation operation, Object eventSource) -
isItemValid
-