Package org.opencms.acacia.client
Class CmsUndoRedoHandler
java.lang.Object
org.opencms.acacia.client.CmsUndoRedoHandler
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsUndoRedoHandler.UndoRedoState>
,com.google.gwt.event.shared.HasHandlers
public final class CmsUndoRedoHandler
extends Object
implements com.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsUndoRedoHandler.UndoRedoState>
Handler for the undo redo function.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
A timer to delay the addition of a change.static enum
The change types.class
Representing the undo/redo state. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChange
(String valuePath, String attributeName, int valueIndex, CmsUndoRedoHandler.ChangeType changeType) Adds a change to the undo stack.protected <H extends com.google.gwt.event.shared.EventHandler>
com.google.gwt.event.shared.HandlerRegistrationaddHandler
(H handler, com.google.gwt.event.shared.GwtEvent.Type<H> type) Adds this handler to the widget.com.google.gwt.event.shared.HandlerRegistration
addValueChangeHandler
(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsUndoRedoHandler.UndoRedoState> handler) void
clear()
Clears the undo/redo stacks and all references.void
fireEvent
(com.google.gwt.event.shared.GwtEvent<?> event) static CmsUndoRedoHandler
Returns the undo redo handler instance.boolean
hasRedo()
Indicates if there are changes to be undone.boolean
hasUndo()
Indicates if there are changes to be undone.void
initialize
(org.opencms.acacia.shared.CmsEntity entity, CmsEditorBase editor, CmsRootHandler rootHandler) Initializes the handler to be used for the given entity.boolean
Indicates if the handler has been initialized.void
redo()
Re-applies the latest state in the redo stack.void
undo()
Reverts to the latest state in the undo stack.
-
Method Details
-
getInstance
Returns the undo redo handler instance.- Returns:
- the handler instance
-
addChange
public void addChange(String valuePath, String attributeName, int valueIndex, CmsUndoRedoHandler.ChangeType changeType) Adds a change to the undo stack.- Parameters:
valuePath
- the entity value pathattributeName
- the attribute namevalueIndex
- the value indexchangeType
- the change type
-
clear
Clears the undo/redo stacks and all references. -
hasRedo
Indicates if there are changes to be undone.- Returns:
true
if there are changes to be undone
-
hasUndo
Indicates if there are changes to be undone.- Returns:
true
if there are changes to be undone
-
isIntitalized
Indicates if the handler has been initialized.- Returns:
true
if the handler has been initialized
-
redo
Re-applies the latest state in the redo stack. -
undo
Reverts to the latest state in the undo stack.
-