Class ElementCommand

  • All Implemented Interfaces:
    IElementCommand

    public abstract class ElementCommand
    extends java.lang.Object
    implements IElementCommand
    Extension adapter class for the IElementCommand. The subclasses must override the execute/undo/redo methods to implement their own command. All the command is undoable and redoable by default.
    • Constructor Summary

      Constructors 
      Constructor Description
      ElementCommand()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canRedo()
      Tells if this record can be redone.
      boolean canUndo()
      Tells if this record can be undone.
      abstract void execute()
      Executes the record.
      java.lang.String getLabel()
      Gets the label of this record.
      abstract void redo()
      Redoes the record.
      abstract void undo()
      Undoes the record.
      • Methods inherited from class java.lang.Object

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

      • ElementCommand

        public ElementCommand()
    • Method Detail

      • execute

        public abstract void execute()
        Description copied from interface: IElementCommand
        Executes the record. Derived classes do the desired operation. All semantic and other checks must have already been done; the record operation must succeed.
        Specified by:
        execute in interface IElementCommand
      • undo

        public abstract void undo()
        Description copied from interface: IElementCommand
        Undoes the record. Leaves the state of the IR identical to what it was before execute was called. Note that the operation must be designed so that it succeeds if the IR is in the correct state: the same state it was in after execute( ) was called. (If the IR is in any other state, then a programming error has occurred.)
        Specified by:
        undo in interface IElementCommand
      • redo

        public abstract void redo()
        Description copied from interface: IElementCommand
        Redoes the record. Logically repeats the execute record. The state of the IR must be identical to that after undo( ) has executed. After the call, the state of the IR must be identical to that after execute( ) was called.
        Specified by:
        redo in interface IElementCommand
      • canUndo

        public boolean canUndo()
        Description copied from interface: IElementCommand
        Tells if this record can be undone. All records should be undoable in the production system. A record may temporarily not support undo during a development cycle.
        Specified by:
        canUndo in interface IElementCommand
        Returns:
        true if the record can be undone, false otherwise
      • canRedo

        public boolean canRedo()
        Description copied from interface: IElementCommand
        Tells if this record can be redone. All records should be redoable in the production system. A record may temporarily not support redo during a development cycle.
        Specified by:
        canRedo in interface IElementCommand
        Returns:
        true if redoable, false otherwise.
      • getLabel

        public java.lang.String getLabel()
        Description copied from interface: IElementCommand
        Gets the label of this record. This label should be localized. The label is optional.
        Specified by:
        getLabel in interface IElementCommand
        Returns:
        the label of this record