|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.malai.undo.UndoCollector
public final class UndoCollector
Defines a collector of undone/redone objects.
This file is part of libMalai.
Copyright (c) 2009-2012 Arnaud BLOUIN
libMalan is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
libMalan is distributed without any warranty; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
Field Summary | |
---|---|
static java.lang.String |
EMPTY_REDO
The label display when there is no redo possible |
static java.lang.String |
EMPTY_UNDO
The label display when there is no undo possible |
private java.util.List<UndoHandler> |
handlers
The handlers that handles the collector. |
static UndoCollector |
INSTANCE
The default undo/redo collector. |
private java.util.Deque<Undoable> |
redo
Contains the redoable objects. |
private java.util.Deque<UndoHandler> |
redoHandlers
Contains the handlers of each undoable of the redo stack |
private int |
sizeMax
The maximal number of undo. |
private java.util.Deque<Undoable> |
undo
Contains the undoable objects. |
private java.util.Deque<UndoHandler> |
undoHandlers
Contains the handlers of each undoable of the undo stack |
Constructor Summary | |
---|---|
private |
UndoCollector()
The constructor by default. |
Method Summary | |
---|---|
void |
add(Undoable undoable,
UndoHandler undoHandler)
Adds an undoable object to the collector. |
void |
addHandler(UndoHandler handler)
Adds a handler to the collector. |
void |
clear()
Removes all the undoable objects of the collector. |
Undoable |
getLastRedo()
|
java.lang.String |
getLastRedoMessage()
|
Undoable |
getLastUndo()
|
java.lang.String |
getLastUndoMessage()
|
java.util.Deque<Undoable> |
getRedo()
|
int |
getSizeMax()
|
java.util.Deque<Undoable> |
getUndo()
|
void |
redo()
Redoes the last undoable object. |
void |
removeHandler(UndoHandler handler)
Removes the given handler from the collector. |
void |
setSizeMax(int max)
|
void |
undo()
Undoes the last undoable object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final UndoCollector INSTANCE
public static final java.lang.String EMPTY_REDO
public static final java.lang.String EMPTY_UNDO
private java.util.Deque<UndoHandler> undoHandlers
private java.util.Deque<UndoHandler> redoHandlers
private java.util.Deque<Undoable> undo
private java.util.Deque<Undoable> redo
private int sizeMax
private java.util.List<UndoHandler> handlers
Constructor Detail |
---|
private UndoCollector()
Method Detail |
---|
public void addHandler(UndoHandler handler)
handler
- The handler to add. Must not be null.public void removeHandler(UndoHandler handler)
handler
- The handler to remove. Must not be null.public void clear()
public void add(Undoable undoable, UndoHandler undoHandler)
undoable
- The undoable object to add.undoHandler
- The handler that produced or is associated to the undoable object.public void undo()
public void redo()
public java.lang.String getLastUndoMessage()
public java.lang.String getLastRedoMessage()
public Undoable getLastUndo()
public Undoable getLastRedo()
public int getSizeMax()
public void setSizeMax(int max)
max
- The max number of saved undoable objects. Must be great than 0.public java.util.Deque<Undoable> getUndo()
public java.util.Deque<Undoable> getRedo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |