public final class UndoSupport<E> extends Object
UndoRedoSupport
provided by Glazed
Lists for specific use with Swing's native UndoManager
. Each
UndoRedoSupport.Edit
produced by Glazed List's
UndoRedoSupport
is adapted to Swing's UndoableEdit
interface
and then added
into the given UndoManager.
Fine grain control of the UndoableEdit
that is ultimately added
to the UndoableEdit
can be achieved by using
this
install
method and specifying a custom Function.
Modifier and Type | Method and Description |
---|---|
static <E> UndoSupport |
install(UndoManager undoManager,
EventList<E> source)
Installs support for undoing/redoing edits on the given
source . |
static <E> UndoSupport |
install(UndoManager undoManager,
EventList<E> source,
FunctionList.Function<UndoRedoSupport.Edit,UndoableEdit> editAdapter)
Installs support for undoing/redoing edits on the given
source . |
void |
uninstall()
This method removes undo/redo support from the
EventList it was
installed on. |
public static <E> UndoSupport install(UndoManager undoManager, EventList<E> source)
source
. Specifically, UndoableEdit
s are added to the
undoManager
each time the source
changes.
Undoing
and redoing
these edits will unapply/reapply the corresponding changes to the
source
.
This method uses a default strategy for mapping the GL-style edits
to UndoableEdit
s.
undoManager
- the manager of all undoable edits for the entire Swing applicationsource
- the EventList to watch for undoable editsIllegalStateException
- if this method is called from any Thread
other than the Swing Event Dispatch Threadpublic static <E> UndoSupport install(UndoManager undoManager, EventList<E> source, FunctionList.Function<UndoRedoSupport.Edit,UndoableEdit> editAdapter)
source
. Specifically, UndoableEdit
s are added to the
undoManager
each time the source
changes.
Undoing
and redoing
these edits will unapply/reapply the corresponding changes to the
source
.
This method uses the given editAdapter
for mapping the
GL-style edits to UndoableEdit
s.
undoManager
- the manager of all undoable edits for the entire Swing applicationsource
- the EventList to watch for undoable editseditAdapter
- the function that converts GL-style edits into Swing-style editsIllegalStateException
- if this method is called from any Thread
other than the Swing Event Dispatch Threadpublic void uninstall()
EventList
it was
installed on. This method is useful when the EventList
must
outlive the undo/redo support itself. Calling this method will make
this support object available for garbage collection independently of
the EventList
of items.IllegalStateException
- if this method is called from any Thread
other than the Swing Event Dispatch ThreadCopyright © 2024 levigo holding gmbh. All rights reserved.