|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gvsig.tools.undo.command.impl.DefaultUndoRedoCommandStack
public class DefaultUndoRedoCommandStack
Clase en memoria para registrar y gestionar los comandos que vamos realizando. La forma en que ha sido implementada esta clase, en vez de una única lista para albergar los comandos de deshacer(undos) y los de rehacer(redos), se ha optado por dos pilas una para deshacer(undos) y otra para rehacer(redos), de esta forma : Cuando se añade un nuevo comando, se inserta este a la pila de deshacer(undos) y se borra de la de rehacer(redos). Si se realiza un deshacer se desapila este comando de la pila deshacer(undos) y se apila en la de rehacer(redos). Y de la misma forma cuando se realiza un rehacer se desapila este comando de la pila de rehacer(redos) y pasa a la de deshacer(undos).
Constructor Summary | |
---|---|
DefaultUndoRedoCommandStack()
|
Method Summary | |
---|---|
void |
add(Command command)
|
void |
addObserver(Observer o)
|
boolean |
canRedo()
If a redo can be performed on the stack. |
boolean |
canUndo()
If an undo can be performed on the stack. |
void |
clear()
|
void |
deleteObserver(Observer o)
|
void |
deleteObservers()
|
void |
endComplex()
|
Command |
getNextRedoCommand()
|
Command |
getNextUndoCommand()
|
List |
getRedoInfos()
Returns the list of UndoRedoInfo in the REDO stack |
List |
getUndoInfos()
Returns the list of UndoRedoInfo in the UNDO stack |
boolean |
inComplex()
|
void |
redo()
Re-does the following redoable elements. |
void |
redo(int commands)
Re-does a number of the following redoable element. |
int |
size()
|
void |
startComplex(String description)
|
void |
undo()
Undoes the following undoable elements. |
void |
undo(int commands)
Undoes a number of the following undoable elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultUndoRedoCommandStack()
Method Detail |
---|
public void add(Command command)
add
in interface UndoRedoCommandStack
public void undo() throws UndoException
UndoRedoStack
undo
in interface UndoRedoStack
UndoException
- if there is an error performing de undo elementpublic void redo() throws RedoException
UndoRedoStack
redo
in interface UndoRedoStack
RedoException
- if there is an error performing de redo elementpublic void redo(int commands) throws RedoException
UndoRedoStack
redo
in interface UndoRedoStack
commands
- the number of elements to redo
RedoException
- if there is an error performing de redo elementpublic void undo(int commands) throws UndoException
UndoRedoStack
undo
in interface UndoRedoStack
commands
- the number of elements to undo
UndoException
- if there is an error performing de undo elementpublic boolean canUndo()
UndoRedoStack
canUndo
in interface UndoRedoStack
public boolean canRedo()
UndoRedoStack
canRedo
in interface UndoRedoStack
public List getUndoInfos()
UndoRedoStack
getUndoInfos
in interface UndoRedoStack
public List getRedoInfos()
UndoRedoStack
getRedoInfos
in interface UndoRedoStack
public int size()
size
in interface UndoRedoCommandStack
public void clear()
clear
in interface UndoRedoCommandStack
public Command getNextUndoCommand()
getNextUndoCommand
in interface UndoRedoCommandStack
public Command getNextRedoCommand()
getNextRedoCommand
in interface UndoRedoCommandStack
public void addObserver(Observer o)
addObserver
in interface Observable
public void deleteObserver(Observer o)
deleteObserver
in interface Observable
public void deleteObservers()
deleteObservers
in interface Observable
public void endComplex()
endComplex
in interface UndoRedoCommandStack
public void startComplex(String description)
startComplex
in interface UndoRedoCommandStack
public boolean inComplex()
inComplex
in interface UndoRedoCommandStack
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |