Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
ca.odell.glazedlists.UndoRedoSupport<E>
public final class UndoRedoSupport<E>
extends java.lang.Object
EventList
. The
granularity of each undoable edit is determined by the ListEvent from which
it was generated.
Not every change described in a ListEvent results in an undoable edit.
Specifically, a mutation of a list element IN PLACE does
not produce an undoable edit. For example, an ObservableElementList
which observes a change of an element, or a call to List.set
with
the same object at that index produce a ListEvent that does not have a
corresponding UndoRedoSupport.Edit
object. These ListEvents are ignored because they
lack sufficient information to undo or redo the change.
In general UndoRedoSupport only makes sense for use with a
BasicEventList
or a trivial wrapper around a BasicEventList which
does not affect the order or type of the elements, such as an
ObservableElementList
. Advanced transformations, such as
SortedList
or FilterList
will not work as expected with this
UndoRedoSupport class since their contents are controlled by information
outside of themselves (Comparator
s and
Matcher
s).
This class is agnostic to any particular GUI toolkit. As such it may be
used in a headless environment or can also be bound to a specific toolkit.
Nested Class Summary | |
static interface |
|
static interface |
|
Method Summary | |
static |
|
void |
|
void |
|
void |
public staticUndoRedoSupport install(EventList source)
Installs support for undoing and redoing changes to the givensource
. To be notified of undoable changes, aUndoRedoSupport.Listener
must be registered on the object that is returned by this method. That Listener object will typically add theUndoRedoSupport.Edit
it is given over to whatever data structure is managing all undo/redo functions for the entire application.
- Parameters:
source
- the EventList on which to provide undo/redo capabilities
- Returns:
- an instance of UndoRedoSupport through which the undo/redo behaviour can be customized
public void addUndoSupportListener(UndoRedoSupport.Listener l)
Add aUndoRedoSupport.Listener
which will receive a callback when an undoable edit occurs on the given sourceEventList
.
public void removeUndoSupportListener(UndoRedoSupport.Listener l)
Remove aUndoRedoSupport.Listener
from receiving a callback when an undoable edit occurs on the given sourceEventList
.
public void uninstall()