Class UndoRedo

  • All Implemented Interfaces:
    java.io.Serializable

    public class UndoRedo
    extends java.lang.Object
    implements java.io.Serializable
    Undo/Redo management
    See Also:
    Serialized Form
    • Constructor Detail

      • UndoRedo

        public UndoRedo()
        Default constructor: not serialized and unlimited
      • UndoRedo

        public UndoRedo​(boolean serialize,
                        int maxSize)
        Constructor
        Parameters:
        serialize - True to save Undo/Redo into files
        maxSize - Redo max size (0=not limited)
    • Method Detail

      • getRedo

        public FlowXML getRedo()
        Redo flow
      • getUndo

        public FlowXML getUndo()
        Undo flow
      • setEnabled

        public void setEnabled​(boolean enabled)
        Push enabling
      • clear

        public void clear​(Grant g)
        Clear all undo/redo
      • canUndo

        public boolean canUndo()
        Is there something to undo ?
      • isUndoEnabled

        public boolean isUndoEnabled​(int index)
        Is undo enabled at index ?
      • canRedo

        public boolean canRedo()
        Is there something to redo ?
      • isRedoEnabled

        public boolean isRedoEnabled​(int index)
        Is redo enabled at index ?
      • getCurrentRedo

        public ObjectXML getCurrentRedo()
        Return the current redo if exists
      • redo

        public ObjectXML redo​(Grant g)
        Redo the changes of current position (if preRedo of object returns true)
      • redoAll

        public void redoAll​(Grant g)
        Redo all changes (if preRedo of object returns true)
      • getCurrentUndo

        public ObjectXML getCurrentUndo()
        Return the current undo if exists
      • undo

        public ObjectXML undo​(Grant g)
        Undo the changes of current position (if preUndo of object returns true)
      • undoAll

        public void undoAll​(Grant g)
        Undo all changes (if preUndo of object returns true)
      • push

        public void push​(ObjectDB obj,
                         java.lang.String action,
                         boolean timestamp,
                         boolean patchMode)
        Insert the object patch at current position and discard forward redo (if isUndoable of object returns true)
        Parameters:
        obj - Object with current fields
        action - Action ObjectXML.ACTION_*
        timestamp - Push the timestamp
        patchMode - Push changed field only
      • append

        public void append​(Grant g,
                           UndoRedo ur)
        Append Undo/Redo
      • writeFiles

        public void writeFiles​(Grant g)
      • getRedoFile

        public java.io.File getRedoFile​(Grant g)
      • getUndoFile

        public java.io.File getUndoFile​(Grant g)
      • redoLog

        public void redoLog​(ObjectDB obj)
        Store actions into RedoLog
      • pruneRedoLogs

        public static java.lang.String pruneRedoLogs()
        Prune RedoLogs
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object