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.

  • 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 path
      attributeName - the attribute name
      valueIndex - the value index
      changeType - 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 interface com.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 interface com.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 entity
      editor - the editor instance
      rootHandler - 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 type
      handler - the handler
      Returns:
      HandlerRegistration used to remove the handler