Class CmsUndoRedoHandler

    • 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.HandlerRegistration
      addHandler​(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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 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