Package de.hybris.platform.cockpit.util
Class UndoTools
- java.lang.Object
-
- de.hybris.platform.cockpit.util.UndoTools
-
public class UndoTools extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description UndoTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addOperationAndEventInternal(UndoManager undoManager, UndoableOperation operation, java.lang.Object eventSource)
static void
addUndoOperationAndEvent(UndoManager undoManager, UndoableOperation operation, java.lang.Object eventSource)
Adds the given operation to the undo stack and sends global undo event.static void
discardUndoGrouping()
Discards undo grouping without adding any undo operations to undo manager.static java.util.List<UndoableOperation>
getGroupedOperations()
Returns list of currently grouped operations (SeestartUndoGrouping()
).static boolean
isItemValid(TypedObject typedObject)
static void
redo(UndoManager undoManager, UndoableOperation operation)
Performs re-do of all operation from the top of the stack to the given one.static void
startUndoGrouping()
Starts grouping of undo-able operations.static void
stopUndoGrouping(UndoManager undoManager, java.lang.Object eventSource)
Stops the grouping of undo-able operations.static void
stopUndoGrouping(UndoManager undoManager, java.lang.Object eventSource, BulkUndoableOperation bulk)
static void
undo(UndoManager undoManager, UndoableOperation operation)
Performs undo of all operation from the top of the stack to the given one.
-
-
-
Method Detail
-
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, java.lang.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
public static void stopUndoGrouping(UndoManager undoManager, java.lang.Object eventSource)
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:
startUndoGrouping()
-
stopUndoGrouping
public static void stopUndoGrouping(UndoManager undoManager, java.lang.Object eventSource, BulkUndoableOperation bulk)
-
getGroupedOperations
public static java.util.List<UndoableOperation> 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, java.lang.Object eventSource)
-
isItemValid
public static boolean isItemValid(TypedObject typedObject)
-
-