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 java.lang.Object implements com.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsUndoRedoHandler.UndoRedoState>
Handler for the undo redo function.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
CmsUndoRedoHandler.ChangeTimer
A timer to delay the addition of a change.static class
CmsUndoRedoHandler.ChangeType
The change types.class
CmsUndoRedoHandler.UndoRedoState
Representing the undo/redo state.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChange(java.lang.String valuePath, java.lang.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
getInstance()
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
isIntitalized()
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 Detail
-
getInstance
public static CmsUndoRedoHandler getInstance()
Returns the undo redo handler instance.- Returns:
- the handler instance
-
addChange
public void addChange(java.lang.String valuePath, java.lang.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
-
addValueChangeHandler
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsUndoRedoHandler.UndoRedoState> handler)
- Specified by:
addValueChangeHandler
in interfacecom.google.gwt.event.logical.shared.HasValueChangeHandlers<CmsUndoRedoHandler.UndoRedoState>
- See Also:
HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
-
clear
public void clear()
Clears the undo/redo stacks and all references.
-
fireEvent
public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
- Specified by:
fireEvent
in interfacecom.google.gwt.event.shared.HasHandlers
- See Also:
HasHandlers.fireEvent(com.google.gwt.event.shared.GwtEvent)
-
hasRedo
public boolean hasRedo()
Indicates if there are changes to be undone.- Returns:
true
if there are changes to be undone
-
hasUndo
public boolean hasUndo()
Indicates if there are changes to be undone.- Returns:
true
if there are changes to be undone
-
initialize
public void initialize(org.opencms.acacia.shared.CmsEntity entity, CmsEditorBase editor, CmsRootHandler rootHandler)
Initializes the handler to be used for the given entity.- Parameters:
entity
- the edited entityeditor
- the editor instancerootHandler
- the root attribute handler
-
isIntitalized
public boolean isIntitalized()
Indicates if the handler has been initialized.- Returns:
true
if the handler has been initialized
-
redo
public void redo()
Re-applies the latest state in the redo stack.
-
undo
public void undo()
Reverts to the latest state in the undo stack.
-
addHandler
protected <H extends com.google.gwt.event.shared.EventHandler> com.google.gwt.event.shared.HandlerRegistration addHandler(H handler, com.google.gwt.event.shared.GwtEvent.Type<H> type)
Adds this handler to the widget.- Type Parameters:
H
- the type of handler to add- Parameters:
type
- the event typehandler
- the handler- Returns:
HandlerRegistration
used to remove the handler
-
-