 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.undo;
22 import java.util.ArrayList;
23 import java.util.List;
31 import org.jetbrains.annotations.NotNull;
65 private final List<UndoState<G, A, R>>
undoStack =
new ArrayList<>();
119 while (
undoStack.size() > maxUndoStates) {
152 throw new IllegalStateException(
"undo stack is empty");
164 throw new IllegalStateException(
"redo stack is empty");
178 throw new IllegalStateException(
"undo stack is empty");
195 throw new IllegalStateException(
"redo stack is empty");
REDO
A redo operation is executing.
UndoType type
The type for recording undo information.
Abstract factory for creating GameObject instances.
int undoStackIndex
Current index into undoStack.
A getMapArchObject()
Returns the map arch object before the operation started.
Base package of all Gridarta classes.
void discardUndo()
Discard one "undo" information.
void setSavedSquares(@NotNull final SavedSquares< G, A, R > savedSquares)
Records the affected map squares.
Interface for listeners listening on map transactions of MapModels.
final List< UndoState< G, A, R > > undoStack
The undo stack.
UndoState< G, A, R > redo()
Perform a "redo" operation.
Reflects a game object (object on a map).
void addUndoState(@NotNull final UndoState< G, A, R > undoState)
Add a new undo state to the undo stack.
void discardRedo()
Discard one "redo" information.
Records a set of changed map squares.
final MapTransactionListener< G, A, R > mapTransactionListener
The stored MapTransactionListener.
GameObjects are the objects based on Archetypes found on maps.
void finish()
Finishes an undo or redo operation.
String getName()
Return the name of the operation.
Classes related to matching {GameObjects}, so called { net.sf.gridarta.model.match....
Interface for MapArchObjects.
Maintains GameObjectMatcher instances.
boolean canUndo()
Return whether an "undo" operation is possible.
String undoName()
Return the "undo" operation name.
Holds information to undo/redo one edit operation.
final GameObjectMatchers gameObjectMatchers
The GameObjectMatchers to use.
UndoModel(@NotNull final GameObjectFactory< G, A, R > gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final MapTransactionListener< G, A, R > mapTransactionListener)
Creates a new instance.
Represents the type of undo recording.
String redoName()
Return the "redo" operation name.
NORMAL
Normal operation: appends changes to undo stack.
MapTransactionListener< G, A, R > getMapTransactionListener()
Returns the MapTransactionListener that was passed to the constructor.
void trimToSize(final int maxUndoStates)
Discard old undo information.
Maintains the undo state for one map control.
UndoState< G, A, R > undo()
Perform an "undo" operation.
void finish(@NotNull final UndoState< G, A, R > undoState)
Finishes an undo or redo operation.
UNDO
An undo operation is executing.
boolean canRedo()
Return whether a "redo" operation is possible.
final GameObjectFactory< G, A, R > gameObjectFactory
The GameObjectFactory to use.
void discardAllRedo()
Discard all "redo" information.