|
Gridarta Editor
|
Implements the controller for undo/redo actions. More...
Inheritance diagram for net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
Collaboration diagram for net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:Public Member Functions | |
| int | getMaxUndoStates () |
| Returns the maximum number of undo states saved for each map. More... | |
| void | redo () |
| "Redo" was selected. More... | |
| void | setAction (@NotNull final Action action, @NotNull final String name) |
| Sets the Action instance for this editor action. More... | |
| void | setMaxUndoStates (final int maxUndoStates) |
| Sets the maximum number of undo states saved for each map. More... | |
| void | undo () |
| "Undo" was selected. More... | |
| UndoControl (@NotNull final MapManager< G, A, R > mapManager, @NotNull final GameObjectFactory< G, A, R > gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers) | |
| Create a new instance. More... | |
Private Member Functions | |
| boolean | doRedo (final boolean performAction) |
| Performs the "redo" action. More... | |
| boolean | doUndo (final boolean performAction) |
| Performs the "undo" action. More... | |
| void | refreshMenus () |
| Enable/disable menu entries based on the current state. More... | |
Private Attributes | |
| Action | aRedo |
| Action for "redo" function. More... | |
| Action | aUndo |
| Action for "undo" function. More... | |
| MapModel< G, A, R > | mapModel |
| Map model for the current map. More... | |
| int | maxUndoStates = 100 |
| The maximum number of undo states saved for each map. More... | |
| final Map< MapModel< G, A, R >, UndoModel< G, A, R > > | undoModels = new IdentityHashMap<>() |
| Contains an UndoModel for each known MapModel. More... | |
Static Private Attributes | |
| static final ActionBuilder | ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta") |
| Action Builder to create Actions. More... | |
Implements the controller for undo/redo actions.
Definition at line 51 of file UndoControl.java.
| net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.UndoControl | ( | @NotNull final MapManager< G, A, R > | mapManager, |
| @NotNull final GameObjectFactory< G, A, R > | gameObjectFactory, | ||
| @NotNull final GameObjectMatchers | gameObjectMatchers | ||
| ) |
Create a new instance.
| mapManager | the map manager |
| gameObjectFactory | the game object factory to use |
| gameObjectMatchers | the game object matchers to use |
Records the map state at transaction begin time. It is used to detect (and drop) edit operations that do not change the map state.
Records the undo model at transaction begin time.
Definition at line 94 of file UndoControl.java.
References net.sf.gridarta.model.mapmodel.MapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addMapTransactionListener(), net.sf.gridarta.model.mapmodel.SavedSquares< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.cloneAndClear(), net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.finish(), net.sf.gridarta.model.mapmodel.MapModel< 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 >.getMapArchObject(), net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapTransactionListener(), net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.refreshMenus(), net.sf.gridarta.model.mapmodel.SavedSquares< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.removeEmptySquares(), 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 >.trimToSize().
Here is the call graph for this function:
|
private |
Performs the "redo" action.
| performAction | whether to perform or check the action |
Definition at line 299 of file UndoControl.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.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapModel, and net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.refreshMenus().
Referenced by net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.redo(), and net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.refreshMenus().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Performs the "undo" action.
| performAction | whether to perform or check the action |
Definition at line 267 of file UndoControl.java.
References net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.canUndo(), net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapModel, and net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.refreshMenus().
Referenced by net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.refreshMenus(), and net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.undo().
Here is the call graph for this function:
Here is the caller graph for this function:| int net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMaxUndoStates | ( | ) |
Returns the maximum number of undo states saved for each map.
Definition at line 243 of file UndoControl.java.
| void net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.redo | ( | ) |
"Redo" was selected.
Definition at line 234 of file UndoControl.java.
Here is the call graph for this function:
|
private |
Enable/disable menu entries based on the current state.
Definition at line 190 of file UndoControl.java.
References net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doRedo(), net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doUndo(), net.sf.gridarta.utils.ActionBuilderUtils.getString(), net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.redoName(), and net.sf.gridarta.model.undo.UndoModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.undoName().
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(), net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doUndo(), and net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.UndoControl().
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setAction | ( | @NotNull final Action | action, |
| @NotNull final String | name | ||
| ) |
Sets the Action instance for this editor action.
| action | the action instance |
| name | the name of the action |
Implements net.sf.gridarta.utils.EditorAction.
Definition at line 327 of file UndoControl.java.
| void net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setMaxUndoStates | ( | final int | maxUndoStates | ) |
Sets the maximum number of undo states saved for each map.
| maxUndoStates | the maximum number of undo states saved for each map; 0 |
Definition at line 252 of file UndoControl.java.
| void net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.undo | ( | ) |
"Undo" was selected.
Definition at line 226 of file UndoControl.java.
Referenced by net.sf.gridarta.actions.UndoActionsTest.testInsert1().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Action Builder to create Actions.
Definition at line 57 of file UndoControl.java.
|
private |
Action for "redo" function.
Definition at line 86 of file UndoControl.java.
|
private |
Action for "undo" function.
Definition at line 80 of file UndoControl.java.
|
private |
Map model for the current map.
Set to
if no map is active.
Definition at line 69 of file UndoControl.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.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doUndo().
|
private |
The maximum number of undo states saved for each map.
Definition at line 74 of file UndoControl.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 >.getMaxUndoStates(), and net.sf.gridarta.gui.undo.UndoControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setMaxUndoStates().
|
private |
Contains an UndoModel for each known MapModel.
Definition at line 63 of file UndoControl.java.