Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
ca.odell.glazedlists.event.ListEventAssembler<E>
public final class ListEventAssembler<E>
extends java.lang.Object
Field Summary | |
protected boolean |
|
protected int |
|
protected int[] |
|
protected EventList |
|
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
static ListEventPublisher |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
List |
|
boolean |
|
void |
|
void |
|
protected boolean allowNestedEvents
whether to allow nested events
protected int eventLevel
the event level is the number of nested events
protected int[] reorderMap
the current reordering array if this change is a reorder
protected EventListsourceList
the list that this tracks changes for
public ListEventAssembler(EventListsourceList, ListEventPublisher publisher)
Creates a new ListEventAssembler that tracks changes for the specified list.
public void addChange(int type, int index)
Deprecated. replaced with
elementInserted(int,E)
,elementUpdated
andelementDeleted(int,E)
.Convenience method for appending a single change of the specified type.
public void addChange(int type, int startIndex, int endIndex)
Deprecated. replaced with
elementInserted(int,E)
,elementUpdated
andelementDeleted(int,E)
.Adds a block of changes to the set of list changes. The change block allows a range of changes to be grouped together for efficiency. One or more calls to this method must be prefixed by a call to beginEvent() and followed by a call to commitEvent().
public void addDelete(int index)
Deprecated. replaced with
elementDeleted(int,E)
.Convenience method for appending a single delete.
public void addDelete(int startIndex, int endIndex)
Deprecated. replaced with
elementDeleted(int,E)
.Convenience method for appending a range of deletes.
public void addInsert(int index)
Deprecated. replaced with
elementInserted(int,E)
.Convenience method for appending a single insert.
public void addInsert(int startIndex, int endIndex)
Deprecated. replaced with
elementInserted(int,E)
.Convenience method for appending a range of inserts.
public void addListEventListener(E> listChangeListener)
Registers the specified listener to be notified whenever new changes are appended to this list change sequence. For each listener, a ListEvent is created, which provides a read-only view to the list changes in the list. The same ListChangeView object is used for all notifications to the specified listener, so if a listener does not process a set of changes, those changes will persist in the next notification.
public void addUpdate(int index)
Deprecated. replaced with
elementUpdated
.Convenience method for appending a single update.
public void addUpdate(int startIndex, int endIndex)
Deprecated. replaced with
elementUpdated
.Convenience method for appending a range of updates.
public void beginEvent()
Starts a new atomic change to this list change queue. This simple change event does not support change events nested within. To allow other methods to nest change events within a change event, use beginEvent(true).
public void beginEvent(boolean allowNestedEvents)
Starts a new atomic change to this list change queue. This signature allows you to specify allowing nested changes. This simply means that you can call other methods that contain a beginEvent(), commitEvent() block and their changes will be recorded but not fired. This allows the creation of list modification methods to call simpler list modification methods while still firing a single ListEvent to listeners.
- Parameters:
allowNestedEvents
- false to throw an exception if another call to beginEvent() is made before the next call to commitEvent(). Nested events allow multiple method's events to be composed into a single event.
- See Also:
Bug 52
public void commitEvent()
Commits the current atomic change to this list change queue. This will notify all listeners about the change. If the current event is nested within a greater event, this will simply change the nesting level so that further changes are applied directly to the parent change.
public void discardEvent()
Discards the current atomic change to this list change queue. This does not notify any listeners about any changes. The caller of this method is responsible for returning the EventList to its state before the event began. If they fail to do so, the EventList pipeline may be in an inconsistent state. If the current event is nested within a greater event, this will discard changes at the current nesting level and that further changes are still applied directly to the parent change.
public void elementDeleted(int index, E oldValue)
Add to the current ListEvent the removal of the element at the specified index, with the specified previous value.
public void elementInserted(int index, E newValue)
Add to the current ListEvent the insert of the element at the specified index, with the specified previous value.
public void elementUpdated(int index, E oldValue)
Deprecated. replaced with
elementUpdated(int, Object, Object)
.
public void elementUpdated(int index, E oldValue, E newValue)
Add to the current ListEvent the update of the element at the specified index, with the specified previous value.
public void forwardEvent(ListEvent> listChanges)
Forwards the event. This is a convenience method that does the following:
1. beginEvent()
2. For all changes in sourceEvent, apply those changes to this
3. commitEvent() Note that this method should be preferred to manually forwarding events because it is heavily optimized. Note that currently this implementation does a best effort to preserve reorderings. This means that a reordering is lost if it is combined with any other ListEvent.
public List> getListEventListeners()
Get allListEventListener
s observing theEventList
.
public boolean isEventEmpty()
Returns true if the current atomic change to this list change queue is empty; false otherwise.
- Returns:
- true if the current atomic change to this list change queue is empty; false otherwise
public void removeListEventListener(E> listChangeListener)
Removes the specified listener from receiving notification when new changes are appended to this list change sequence. This uses the==
identity comparison to find the listener instead ofequals()
. This is because multiple Lists may be listening and thereforeequals()
may be ambiguous.
public void reorder(int[] reorderMap)
Sets the current event as a reordering. Reordering events cannot be combined with other events.