Class EventListUndoTracker<E>
java.lang.Object
com.levigo.jadice.web.client.undo.EventListUndoTracker<E>
- Type Parameters:
E
- the type of element in the EventList
An EventListUndoTracker tracks changes to the contents of an
EventList
.
UndoableEdit
s can be generated and fed into an DefaultUndoManager
. Multiple event
list edits can be collected into distinct logical edits.
Usually, an EventListUndoTracker will not remain be attached to an EventList
for a long
time, if the life-cycle of the target list isn't closely managed. Instead, it should be attached
before performing a set of operations and detached as soon as it is completed using
done()
, discard()
or finish(String)
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
discard()
Finish tracking changes on the EventList and discard all edits (not only the pending ones!)void
done()
Finish tracking changes on the EventList.void
Finish tracking changes on the EventList.void
Create a snapshot of all pending edits and commit them into the UndoManager under the given human-readable edit description.static <E> EventListUndoTracker
<E> startTracking
(org.jadice.util.glazedlists.EventList<E> list, UndoManager undoManager) Install anEventListUndoTracker
on the given event list.
-
Method Details
-
startTracking
public static <E> EventListUndoTracker<E> startTracking(org.jadice.util.glazedlists.EventList<E> list, UndoManager undoManager) Install anEventListUndoTracker
on the given event list. Collected edits will be fed into the given undo manager. Once an operation to be tracked is completed, the undo tracker can be detached usingdone()
,discard()
orfinish(String)
.- Parameters:
list
- the listundoManager
- the target undo manager- Returns:
- an EventListUndoTracker
-
snapshot
Create a snapshot of all pending edits and commit them into the UndoManager under the given human-readable edit description. If no edits are currently pending (no changes have been made since installation or the most recentsnapshot(String)
), nothing will happen.- Parameters:
description
- the description of the edit
-
finish
Finish tracking changes on the EventList. Takes all pending edits and commits them into the UndoManager under the given human-readable edit description. If no edits are currently pending (no changes have been made since installation or the most recentsnapshot(String)
) no Edit will be committed. This method is a shortcut for callingsnapshot(String)
anddone()
in sequence.- Parameters:
description
- the description of the edit
-
discard
public void discard()Finish tracking changes on the EventList and discard all edits (not only the pending ones!) captured by this tracker. -
done
public void done()Finish tracking changes on the EventList. If any pending edits remain, those are discarded and do not become part of an undoable edit.
-