Class LCommandAbstract<T>

java.lang.Object
com.io7m.laurel.filemodel.internal.LCommandAbstract<T>
Type Parameters:
T - The type of parameters
All Implemented Interfaces:
LCommandType<T>
Direct Known Subclasses:
LCommandCaptionDelete, LCommandCaptionsAdd, LCommandCaptionsModify, LCommandCategoriesAdd, LCommandCategoriesSetRequired, LCommandCategoriesUnsetRequired, LCommandCategoryCaptionsAssign, LCommandCategoryCaptionsUnassign, LCommandCategorySelect, LCommandCompact, LCommandExport, LCommandGlobalCaptionModify, LCommandGlobalCaptionOrderLower, LCommandGlobalCaptionOrderUpper, LCommandGlobalCaptionsAdd, LCommandGlobalCaptionsRemove, LCommandImageCaptionsAssign, LCommandImageCaptionsUnassign, LCommandImagesAdd, LCommandImagesDelete, LCommandImageSelect, LCommandImageSourceSet, LCommandLoad, LCommandMetadataPut, LCommandMetadataRemove, LCommandValidate

public abstract class LCommandAbstract<T> extends Object implements LCommandType<T>
The abstract base of commands.
  • Constructor Details

    • LCommandAbstract

      public LCommandAbstract()
  • Method Details

    • isExecuted

      public final boolean isExecuted()
      Returns:
      true if this command has ever successfully executed
    • setExecuted

      public final void setExecuted(boolean e)
      Set the command as executed.
      Parameters:
      e - The state
    • onExecute

      protected abstract LCommandUndoable onExecute(LFileModel model, LDatabaseTransactionType transaction, T parameters) throws LException, com.io7m.darco.api.DDatabaseException
      Throws:
      LException
      com.io7m.darco.api.DDatabaseException
    • onRedo

      protected abstract void onRedo(LFileModel model, LDatabaseTransactionType transaction) throws LException, com.io7m.darco.api.DDatabaseException
      Throws:
      LException
      com.io7m.darco.api.DDatabaseException
    • onUndo

      protected abstract void onUndo(LFileModel model, LDatabaseTransactionType transaction) throws LException, com.io7m.darco.api.DDatabaseException
      Throws:
      LException
      com.io7m.darco.api.DDatabaseException
    • execute

      public final LCommandUndoable execute(LFileModel model, LDatabaseTransactionType transaction, T parameters) throws LException, com.io7m.darco.api.DDatabaseException
      Description copied from interface: LCommandType
      Execute the command.
      Specified by:
      execute in interface LCommandType<T>
      Parameters:
      model - The model
      transaction - The database transaction
      parameters - The parameters
      Returns:
      A value indicating if the command can be undone
      Throws:
      LException - On errors
      com.io7m.darco.api.DDatabaseException - On errors
    • redo

      public final void redo(LFileModel model, LDatabaseTransactionType transaction) throws LException, com.io7m.darco.api.DDatabaseException
      Description copied from interface: LCommandType
      Redo the command.
      Specified by:
      redo in interface LCommandType<T>
      Parameters:
      model - The model
      transaction - The database transaction
      Throws:
      LException - On errors
      com.io7m.darco.api.DDatabaseException - On errors
    • undo

      public final void undo(LFileModel model, LDatabaseTransactionType transaction) throws LException, com.io7m.darco.api.DDatabaseException
      Description copied from interface: LCommandType
      Undo the command.
      Specified by:
      undo in interface LCommandType<T>
      Parameters:
      model - The model
      transaction - The database transaction
      Throws:
      LException - On errors
      com.io7m.darco.api.DDatabaseException - On errors