Class StreetsideRecord
- java.lang.Object
-
- org.openstreetmap.josm.plugins.streetside.history.StreetsideRecord
-
public class StreetsideRecord extends java.lang.Object
History record system in order to let the user undo and redo commands.
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<StreetsideCommand>commandListThe set of commands that have taken place or that have been undone.private static StreetsideRecordinstanceThe unique instance of the class.private java.util.List<StreetsideRecordListener>listenersintpositionLast written command.
-
Constructor Summary
Constructors Constructor Description StreetsideRecord()Main constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCommand(StreetsideCommand command)Adds a new command to the list.voidaddListener(StreetsideRecordListener lis)Adds a listener.private voidfireRecordChanged()static StreetsideRecordgetInstance()Returns the unique instance of the class.voidredo()Redoes latest undone action.voidremoveListener(StreetsideRecordListener lis)Removes the given listener.voidreset()Resets the object to its start state.voidundo()Undo latest command.
-
-
-
Field Detail
-
instance
private static StreetsideRecord instance
The unique instance of the class.
-
listeners
private final java.util.List<StreetsideRecordListener> listeners
-
commandList
public java.util.List<StreetsideCommand> commandList
The set of commands that have taken place or that have been undone.
-
position
public int position
Last written command.
-
-
Constructor Detail
-
StreetsideRecord
public StreetsideRecord()
Main constructor.
-
-
Method Detail
-
getInstance
public static StreetsideRecord getInstance()
Returns the unique instance of the class.- Returns:
- The unique instance of the class.
-
addListener
public void addListener(StreetsideRecordListener lis)
Adds a listener.- Parameters:
lis- The listener to be added.
-
removeListener
public void removeListener(StreetsideRecordListener lis)
Removes the given listener.- Parameters:
lis- The listener to be removed.
-
addCommand
public void addCommand(StreetsideCommand command)
Adds a new command to the list.- Parameters:
command- The command to be added.
-
undo
public void undo()
Undo latest command.
-
redo
public void redo()
Redoes latest undone action.
-
fireRecordChanged
private void fireRecordChanged()
-
reset
public void reset()
Resets the object to its start state.
-
-