|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.base.glazedlists.event.ListEventAssembler<E>
public final class ListEventAssembler<E>
Models a continuous stream of changes on a list. Changes of the same type that occur on a continuous set of rows are grouped into blocks automatically for performance benefits.
Atomic sets of changes may involve many lines of changes and many blocks of changes. They are committed to the queue in one action. No other threads should be creating a change on the same list change queue when an atomic change is being created.
Field Summary | |
---|---|
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 EventList<E> |
sourceList
the list that this tracks changes for |
Constructor Summary | |
---|---|
ListEventAssembler(EventList<E> sourceList,
ListEventPublisher publisher)
Creates a new ListEventAssembler that tracks changes for the specified list. |
Method Summary | |
---|---|
void |
addChange(int type,
int index)
Deprecated. replaced with elementInserted(int, E) , elementUpdated(int, E, E)
and elementDeleted(int, E) . |
void |
addChange(int type,
int startIndex,
int endIndex)
Deprecated. replaced with elementInserted(int, E) , elementUpdated(int, E, E)
and elementDeleted(int, E) . |
void |
addDelete(int index)
Deprecated. replaced with elementDeleted(int, E) . |
void |
addDelete(int startIndex,
int endIndex)
Deprecated. replaced with elementDeleted(int, E) . |
void |
addInsert(int index)
Deprecated. replaced with elementInserted(int, E) . |
void |
addInsert(int startIndex,
int endIndex)
Deprecated. replaced with elementInserted(int, E) . |
void |
addListEventListener(ListEventListener<? super E> listChangeListener)
Registers the specified listener to be notified whenever new changes are appended to this list change sequence. |
void |
addUpdate(int index)
Deprecated. replaced with elementUpdated(int, E, E) . |
void |
addUpdate(int startIndex,
int endIndex)
Deprecated. replaced with elementUpdated(int, E, E) . |
void |
beginEvent()
Starts a new atomic change to this list change queue. |
void |
beginEvent(boolean allowNestedEvents)
Starts a new atomic change to this list change queue. |
void |
commitEvent()
Commits the current atomic change to this list change queue. |
static ListEventPublisher |
createListEventPublisher()
Create a new ListEventPublisher for an EventList not attached
to any other EventList s. |
void |
discardEvent()
Discards the current atomic change to this list change queue. |
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. |
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. |
void |
elementsInserted(int index,
int length)
|
void |
elementUpdated(int index,
E oldValue)
Deprecated. replaced with elementUpdated(int, Object, Object) . |
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. |
void |
forwardEvent(ListEvent<?> listChanges)
Forwards the event. |
List<ListEventListener<E>> |
getListEventListeners()
Get all ListEventListener s observing the EventList . |
boolean |
isEventEmpty()
Returns true if the current atomic change to this list change queue is empty; false otherwise. |
void |
removeListEventListener(ListEventListener<? super E> listChangeListener)
Removes the specified listener from receiving notification when new changes are appended to this list change sequence. |
void |
reorder(int[] reorderMap)
Sets the current event as a reordering. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected EventList<E> sourceList
protected int eventLevel
protected boolean allowNestedEvents
protected int[] reorderMap
Constructor Detail |
---|
public ListEventAssembler(EventList<E> sourceList, ListEventPublisher publisher)
Method Detail |
---|
public static ListEventPublisher createListEventPublisher()
ListEventPublisher
for an EventList
not attached
to any other EventList
s.
public void beginEvent()
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)
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.public void elementInserted(int index, E newValue)
public void elementUpdated(int index, E oldValue, E newValue)
public void elementDeleted(int index, E oldValue)
@Deprecated public void elementUpdated(int index, E oldValue)
elementUpdated(int, Object, Object)
.
@Deprecated public void addChange(int type, int startIndex, int endIndex)
elementInserted(int, E)
, elementUpdated(int, E, E)
and elementDeleted(int, E)
.
One or more calls to this method must be prefixed by a call to beginEvent() and followed by a call to commitEvent().
@Deprecated public void addChange(int type, int index)
elementInserted(int, E)
, elementUpdated(int, E, E)
and elementDeleted(int, E)
.
@Deprecated public void addInsert(int index)
elementInserted(int, E)
.
@Deprecated public void addDelete(int index)
elementDeleted(int, E)
.
@Deprecated public void addUpdate(int index)
elementUpdated(int, E, E)
.
@Deprecated public void addInsert(int startIndex, int endIndex)
elementInserted(int, E)
.
@Deprecated public void addDelete(int startIndex, int endIndex)
elementDeleted(int, E)
.
@Deprecated public void addUpdate(int startIndex, int endIndex)
elementUpdated(int, E, E)
.
public void reorder(int[] reorderMap)
public void forwardEvent(ListEvent<?> listChanges)
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 void commitEvent()
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()
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 boolean isEventEmpty()
public void addListEventListener(ListEventListener<? super E> listChangeListener)
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 removeListEventListener(ListEventListener<? super E> listChangeListener)
This uses the ==
identity comparison to find the listener
instead of equals()
. This is because multiple Lists may be
listening and therefore equals()
may be ambiguous.
public List<ListEventListener<E>> getListEventListeners()
ListEventListener
s observing the EventList
.
public void elementsInserted(int index, int length)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |