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
Nested ClassesModifier and TypeClassDescriptionprotected classA timer to delay the addition of a change.static enumThe change types.classRepresenting the undo/redo state. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChange(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.HandlerRegistrationaddValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsUndoRedoHandler.UndoRedoState> handler) voidclear()Clears the undo/redo stacks and all references.voidfireEvent(com.google.gwt.event.shared.GwtEvent<?> event) static CmsUndoRedoHandlerReturns the undo redo handler instance.booleanhasRedo()Indicates if there are changes to be undone.booleanhasUndo()Indicates if there are changes to be undone.voidinitialize(org.opencms.acacia.shared.CmsEntity entity, CmsEditorBase editor, CmsRootHandler rootHandler) Initializes the handler to be used for the given entity.booleanIndicates if the handler has been initialized.voidredo()Re-applies the latest state in the redo stack.voidundo()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:
trueif there are changes to be undone
-
hasUndo
Indicates if there are changes to be undone.- Returns:
trueif there are changes to be undone
-
isIntitalized
Indicates if the handler has been initialized.- Returns:
trueif 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.
-