public class UndoRedoHandler extends java.lang.Object implements MapView.LayerChangeListener
| Modifier and Type | Field and Description |
|---|---|
java.util.LinkedList<Command> |
commands
All commands that were made on the dataset.
|
private java.util.LinkedList<OsmDataLayer.CommandQueueListener> |
listenerCommands |
java.util.LinkedList<Command> |
redoCommands
The stack for redoing commands
|
| Constructor and Description |
|---|
UndoRedoHandler()
Constructs a new
UndoRedoHandler. |
| Modifier and Type | Method and Description |
|---|---|
void |
activeLayerChange(Layer oldLayer,
Layer newLayer)
Notifies this listener that the active layer has changed.
|
void |
add(Command c)
Executes the command and add it to the intern command queue.
|
boolean |
addCommandQueueListener(OsmDataLayer.CommandQueueListener l)
Adds a command queue listener.
|
void |
addNoRedraw(Command c)
Executes the command and add it to the intern command queue.
|
void |
afterAdd() |
void |
clean() |
void |
clean(Layer layer) |
void |
fireCommandsChanged() |
void |
layerAdded(Layer newLayer)
Notifies this listener that a layer has been added.
|
void |
layerRemoved(Layer oldLayer)
Notifies this listener that a layer has been removed.
|
void |
redo()
Redoes the last undoed command.
|
void |
redo(int num)
Redoes multiple commands.
|
void |
removeCommandQueueListener(OsmDataLayer.CommandQueueListener l)
Removes a command queue listener.
|
void |
undo()
Undoes the last added command.
|
void |
undo(int num)
Undoes multiple commands.
|
public final java.util.LinkedList<Command> commands
public final java.util.LinkedList<Command> redoCommands
private final java.util.LinkedList<OsmDataLayer.CommandQueueListener> listenerCommands
public UndoRedoHandler()
UndoRedoHandler.public void addNoRedraw(Command c)
c - The command to execute. Must not be null.public void afterAdd()
public void add(Command c)
c - The command to execute. Must not be null.public void undo()
public void undo(int num)
num - The number of commands to undopublic void redo()
public void redo(int num)
num - The number of commands to redopublic void fireCommandsChanged()
public void clean()
public void layerRemoved(Layer oldLayer)
MapView.LayerChangeListenerlayerRemoved in interface MapView.LayerChangeListeneroldLayer - The old removed layerpublic void layerAdded(Layer newLayer)
MapView.LayerChangeListenerlayerAdded in interface MapView.LayerChangeListenernewLayer - The new added layerpublic void activeLayerChange(Layer oldLayer, Layer newLayer)
MapView.LayerChangeListeneractiveLayerChange in interface MapView.LayerChangeListeneroldLayer - The previous active layernewLayer - The new activer layerpublic void removeCommandQueueListener(OsmDataLayer.CommandQueueListener l)
l - The command queue listener to removepublic boolean addCommandQueueListener(OsmDataLayer.CommandQueueListener l)
l - The commands queue listener to addtrue if the listener has been added, false otherwise