|
Gridarta Editor
|
Maintains the undo state for one map control. More...
Collaboration diagram for net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:Public Member Functions | |
| boolean | canRedo () |
| Return whether a "redo" operation is possible. More... | |
| boolean | canUndo () |
| Return whether an "undo" operation is possible. More... | |
| void | finish (@NotNull final UndoState< G, A, R > undoState) |
| Finishes an undo or redo operation. More... | |
| void | finish () |
| Finishes an undo or redo operation. More... | |
| MapTransactionListener< G, A, R > | getMapTransactionListener () |
| Returns the MapTransactionListener that was passed to the constructor. More... | |
| UndoState< G, A, R > | redo () |
| Perform a "redo" operation. More... | |
| String | redoName () |
| Return the "redo" operation name. More... | |
| void | trimToSize (final int maxUndoStates) |
| Discard old undo information. More... | |
| UndoState< G, A, R > | undo () |
| Perform an "undo" operation. More... | |
| UndoModel (@NotNull final GameObjectFactory< G, A, R > gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final MapTransactionListener< G, A, R > mapTransactionListener) | |
| Creates a new instance. More... | |
| String | undoName () |
| Return the "undo" operation name. More... | |
Private Member Functions | |
| void | addUndoState (@NotNull final UndoState< G, A, R > undoState) |
| Add a new undo state to the undo stack. More... | |
| void | discardAllRedo () |
| Discard all "redo" information. More... | |
| void | discardRedo () |
| Discard one "redo" information. More... | |
| void | discardUndo () |
| Discard one "undo" information. More... | |
Private Attributes | |
| final GameObjectFactory< G, A, R > | gameObjectFactory |
| The GameObjectFactory to use. More... | |
| final GameObjectMatchers | gameObjectMatchers |
| The GameObjectMatchers to use. More... | |
| final MapTransactionListener< G, A, R > | mapTransactionListener |
| The stored MapTransactionListener. More... | |
| UndoType | type = UndoType.NORMAL |
| The type for recording undo information. More... | |
| final List< UndoState< G, A, R > > | undoStack = new ArrayList<>() |
| The undo stack. More... | |
| int | undoStackIndex |
| Current index into undoStack. More... | |
Maintains the undo state for one map control.
The state consists of a linear list of UndoStates. Possible operations are "undo" and "redo". If a map is changed after performing one or more "undo" operations, the previously recorded "redo" operations are discarded.
Definition at line 40 of file UndoModel.java.
| net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.UndoModel | ( | @NotNull final GameObjectFactory< G, A, R > | gameObjectFactory, |
| @NotNull final GameObjectMatchers | gameObjectMatchers, | ||
| @NotNull final MapTransactionListener< G, A, R > | mapTransactionListener | ||
| ) |
Creates a new instance.
| gameObjectFactory | the game object factory to use |
| gameObjectMatchers | the game object matchers to use |
| mapTransactionListener | the map transaction listener to store |
Definition at line 85 of file UndoModel.java.
References net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.gameObjectFactory, net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.gameObjectMatchers, and net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapTransactionListener.
|
private |
Add a new undo state to the undo stack.
This discards the existing "redo" information (if present).
| undoState | the undo state to add |
Definition at line 106 of file UndoModel.java.
Here is the call graph for this function:
Here is the caller graph for this function:| boolean net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.canRedo | ( | ) |
Return whether a "redo" operation is possible.
Definition at line 142 of file UndoModel.java.
Referenced by net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doRedo(), and net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.trimToSize().
Here is the caller graph for this function:| boolean net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.canUndo | ( | ) |
Return whether an "undo" operation is possible.
Definition at line 133 of file UndoModel.java.
Here is the caller graph for this function:
|
private |
Discard all "redo" information.
Definition at line 257 of file UndoModel.java.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Discard one "redo" information.
Definition at line 266 of file UndoModel.java.
Referenced by net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.discardAllRedo(), and net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.trimToSize().
Here is the caller graph for this function:
|
private |
Discard one "undo" information.
Definition at line 275 of file UndoModel.java.
Here is the caller graph for this function:| void net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.finish | ( | @NotNull final UndoState< G, A, R > | undoState | ) |
Finishes an undo or redo operation.
Does nothing if none is in progress.
| undoState | the changes of the operation |
Definition at line 208 of file UndoModel.java.
References net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addUndoState(), and net.sf.gridarta.model.undo.UndoType.NORMAL.
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.finish | ( | ) |
Finishes an undo or redo operation.
Does nothing if none is in progress.
Definition at line 229 of file UndoModel.java.
References net.sf.gridarta.model.undo.UndoState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapArchObject(), net.sf.gridarta.model.undo.UndoState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getName(), net.sf.gridarta.model.undo.UndoType.NORMAL, net.sf.gridarta.model.undo.UndoState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setSavedSquares(), and net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.undoStackIndex.
Here is the call graph for this function:| MapTransactionListener<G, A, R> net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapTransactionListener | ( | ) |
Returns the MapTransactionListener that was passed to the constructor.
Definition at line 97 of file UndoModel.java.
Here is the caller graph for this function:| UndoState<G, A, R> net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.redo | ( | ) |
Perform a "redo" operation.
Definition at line 193 of file UndoModel.java.
References net.sf.gridarta.model.undo.UndoType.REDO.
| String net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.redoName | ( | ) |
Return the "redo" operation name.
Definition at line 162 of file UndoModel.java.
Here is the caller graph for this function:| void net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.trimToSize | ( | final int | maxUndoStates | ) |
Discard old undo information.
| maxUndoStates | the maximum number of undo states to save |
Definition at line 118 of file UndoModel.java.
References net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.canRedo(), net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.discardRedo(), and net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.discardUndo().
Here is the call graph for this function:
Here is the caller graph for this function:| UndoState<G, A, R> net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.undo | ( | ) |
Perform an "undo" operation.
Definition at line 176 of file UndoModel.java.
References net.sf.gridarta.model.undo.UndoType.UNDO.
| String net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.undoName | ( | ) |
Return the "undo" operation name.
Definition at line 150 of file UndoModel.java.
Here is the caller graph for this function:
|
private |
The GameObjectFactory to use.
Definition at line 46 of file UndoModel.java.
|
private |
The GameObjectMatchers to use.
Definition at line 52 of file UndoModel.java.
|
private |
The stored MapTransactionListener.
Definition at line 58 of file UndoModel.java.
Referenced by net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapTransactionListener(), and net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.UndoModel().
|
private |
The type for recording undo information.
Definition at line 77 of file UndoModel.java.
|
private |
The undo stack.
It consists of recorded UndoStates for the associated net.sf.gridarta.model.mapmodel.MapModel.
Definition at line 65 of file UndoModel.java.
|
private |
Current index into undoStack.
If
, "undo" is not possible; if
, "redo" is not possible.
Definition at line 72 of file UndoModel.java.