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
The abstract base of commands.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal LCommandUndoableexecute(LFileModel model, LDatabaseTransactionType transaction, T parameters) Execute the command.final booleanprotected abstract LCommandUndoableonExecute(LFileModel model, LDatabaseTransactionType transaction, T parameters) protected abstract voidonRedo(LFileModel model, LDatabaseTransactionType transaction) protected abstract voidonUndo(LFileModel model, LDatabaseTransactionType transaction) final voidredo(LFileModel model, LDatabaseTransactionType transaction) Redo the command.final voidsetExecuted(boolean e) Set the command as executed.final voidundo(LFileModel model, LDatabaseTransactionType transaction) Undo the command.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.io7m.laurel.filemodel.internal.LCommandType
describe, loading, requiresCompaction, serialize, toProperties
-
Constructor Details
-
LCommandAbstract
public LCommandAbstract()
-
-
Method Details
-
isExecuted
public final boolean isExecuted()- Returns:
trueif 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:
LExceptioncom.io7m.darco.api.DDatabaseException
-
onRedo
protected abstract void onRedo(LFileModel model, LDatabaseTransactionType transaction) throws LException, com.io7m.darco.api.DDatabaseException - Throws:
LExceptioncom.io7m.darco.api.DDatabaseException
-
onUndo
protected abstract void onUndo(LFileModel model, LDatabaseTransactionType transaction) throws LException, com.io7m.darco.api.DDatabaseException - Throws:
LExceptioncom.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:LCommandTypeExecute the command.- Specified by:
executein interfaceLCommandType<T>- Parameters:
model- The modeltransaction- The database transactionparameters- The parameters- Returns:
- A value indicating if the command can be undone
- Throws:
LException- On errorscom.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:LCommandTypeRedo the command.- Specified by:
redoin interfaceLCommandType<T>- Parameters:
model- The modeltransaction- The database transaction- Throws:
LException- On errorscom.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:LCommandTypeUndo the command.- Specified by:
undoin interfaceLCommandType<T>- Parameters:
model- The modeltransaction- The database transaction- Throws:
LException- On errorscom.io7m.darco.api.DDatabaseException- On errors
-