Skip navigation links
LuciadFusion
2023.1.08
com.luciad.gui

LuciadFusionClass TLcdCompositeUndoable

    • Method Detail

      • setUseWrappedDisplayName

        public void setUseWrappedDisplayName(boolean aUseWrappedDisplayName)
        Specifies whether the display name of the contained undoable should be used when only one undoable is wrapped in this composite undoable.
        Parameters:
        aUseWrappedDisplayName - true if you want the display name of the wrapped ILcdUndoable to be used, false otherwise.
        See Also:
        isUseWrappedDisplayName()
      • isUseWrappedDisplayName

        public boolean isUseWrappedDisplayName()
        Returns whether the display name of the wrapped undoable is used.
        Returns:
        Whether the display name of the wrapped undoable is used.
        See Also:
        setUseWrappedDisplayName(boolean)
      • addUndoable

        public boolean addUndoable(ILcdUndoable aUndoable)
        Adds the given ILcdUndoable to this composite undoable. This undoable will be undone and redone, along with the other undoables that have been added. All undoables added to this composite undoable are undone in the order in which they were added, and redone in the reverse order they were added. Will only succeed if finish() has not yet been called.
        Specified by:
        addUndoable in interface ILcdUndoable
        Overrides:
        addUndoable in class ALcdUndoable
        Parameters:
        aUndoable - The undoable to add.
        Returns:
        Whether or not aUndoable was accepted by this ILcdUndoable.
      • finish

        public void finish()

        Finishes this composite undoable so that no other undoables can be added to it.

        Do not forget to call this method when you have added all necessary undoables, as TLcdUndoManager calls addUndoable(ILcdUndoable) to provide multiple ILcdUndoable instances with the option of collapsing into a single one if this is desired. For instance several keystrokes can be combined in one undoable when a user is typing text.

      • dieImpl

        public void dieImpl()
        Description copied from class: ALcdUndoable
        Override this method with the actual die behavior. This method is called by die() when it is allowed to do so. The default implementation is an empty implementation.
        Overrides:
        dieImpl in class ALcdUndoable
      • isSignificant

        public boolean isSignificant()
        Description copied from class: ALcdUndoable
        Returns false if this ILcdUndoable is insignificant--for example one that maintains the user's selection, but does not change any model state. This status can be used by an ILcdUndoableListener (like TLcdUndoManager) when deciding which ILcdUndoables to present to the user as Undo/Redo options, and which to perform as side effects of undoing or redoing other events.

        This default implementation always returns true.

        Specified by:
        isSignificant in interface ILcdUndoable
        Overrides:
        isSignificant in class ALcdUndoable
        Returns:
        Whether or not this ILcdUndoable is significant.
      • canRedoImpl

        public boolean canRedoImpl()
        Returns whether or not this composite undoable can be redone.
        Overrides:
        canRedoImpl in class ALcdUndoable
        Returns:
        True if this composite undoables was finished and if there are any ILcdUndoable objects to be redone.
      • canUndoImpl

        public boolean canUndoImpl()
        Returns whether or not this composite undoable can be undone.
        Overrides:
        canUndoImpl in class ALcdUndoable
        Returns:
        True if this composite undoables was finished and if there are any ILcdUndoable objects to be undone.
      • asListener

        public final ILcdUndoableListener asListener()
        Returns an ILcdUndoableListener instance that will add each received ILcdUndoable to this composite implementation.

        Each call of this method will return the same listener instance.

        A typical use-case of this method is if you want to combine multiple undoables (from a single or multiple sources) into one composite undoable, allowing the user to undo/redo multiple operations in one go:

        
           ILcdUndoableSource firstSource = ...;
           ILcdUndoableSource secondSource = ...;
        
           TLcdCompositeUndoable undoable = new TLcdCompositeUndoable("Undo changes");
           firstSource.addUndoableListener(undoable.asListener());
           secondSource.addUndoableListener(undoable.asListener());
        
           makeChanges(firstSource, secondSource);
        
           firstSource.removeUndoableListener(undoable.asListener());
           secondSource.removeUndoableListener(undoable.asListener());
        
           undoable.finish();
        
           fireUndoableHappened(undoable);
         
        Returns:
        an ILcdUndoableListener that adds the undoables to this composite implementation
        Since:
        2017.0
LuciadFusion
2023.1.08