Package com.j3d.engine.react.actions
package com.j3d.engine.react.actions
Stores all Undo/Redo related classes, labelled as "Actions"
Generally, an Action is any piece of code which can undo itself
and redo itself if undone. If an action cannot undo itself to a 1:1 state as it was before then
it is usually marked via Action.isReversible().
If a method foo() defines a new Action, it is foo()'s
responsibility to add this Action to the History and then after
foo() has to explicitly call Action.run().
The History panel does not handle the first invocation
of the action. Only it's undo and redo after it has been invoked.
Action Classes invalid input: '&' Interfaces
There are many different interfaces one can implement to encapsulate undoable code, all with different semantics.
-
A generic
Actionis one that when done, returns a value. This is the base of all Actions. -
A
VoidActionis an Action who only produces side effects. Has the same effect as defining anActionwho's<T>value isVoid -
A
DirtyActionis an Action, who implementsCleanableActionmeaning when it is no longer required to live anywhere, it's resources get cleaned up viaCleanableAction.cleanup() -
A
DirtyVoidActionis aVoidActionwho implementsCleanableActionmeaning when it is no longer required to live anywhere, it's resources get cleaned up viaCleanableAction.cleanup(). -
An
AbstractActionis an abstract class implementingVoidAction. This class exists such that concrete implementations ofVoidActioncan extend it and only override the methods they need, providing default behaviour forundo(),isReversible(),getDescription(), andgetTime(). -
A
ConstructorActionis an action, which has already been run (via a class' defining constructor). This allows actions to still define a way to undo (and redo) this action even though it has already been executed. This also implementsCleanableActionrequiring explicit resource cleanup.
- Author:
- Lehlogonolo Poole
-
ClassDescriptionAbstractAction is an abstract class that implements the Action interface with default behaviors.Action<T>Represents an action that can be executed and undone by either the app or the user affecting the scene.An implementation for Actions which provide a clean-up method to be called when the action is deleted from the history.A specialisation of a
AbstractActionandCleanableActionspecifically for a class's constructor.DirtyAction<T>An Action where the action returns meaningful output, but also requires clean-up when the action eventually gets deleted from the history.An Action where the action is purely side effects but requires clean-up when the action gets deleted.An action who does not need to return any meaningful value.