public class TransactionEventAssembler<E> extends java.lang.Object implements IListEventAssembler<E>
| Modifier and Type | Class and Description |
|---|---|
static class |
TransactionEventAssembler.UndoRedoSupport<E>
UndoRedoSupport, as the name suggests, will provide generic support for undoing and redoing groups of changes to an
EventList. |
| Constructor and Description |
|---|
TransactionEventAssembler() |
TransactionEventAssembler(boolean rollbackSupport) |
TransactionEventAssembler(EventList<E> source) |
TransactionEventAssembler(EventList<E> source,
boolean rollbackSupport) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBufferedListEventListener(ListEventListener<? super E> listChangeListener) |
void |
addChange(int type,
int startIndex,
java.util.List<ObjectChange<E>> changeEvents)
Adds a block of changes to the set of list changes.
|
void |
addChange(int type,
int index,
ObjectChange<E> event)
Convenience method for appending a single change of the specified type.
|
void |
addListEventListener(ListEventListener<? super E> listChangeListener)
Registers the specified listener to be notified whenever new changes
are appended to this list change sequence.
|
void |
addRollbackEventListener(ListEventListener<? super E> listChangeListener) |
void |
beginEvent()
Demarks the beginning of a transaction which accumulates all ListEvents received during the transaction and fires a single aggregate ListEvent on
commitEvent(). |
void |
beginEvent(boolean buffered)
Demarks the beginning of a transaction.
|
void |
commitEvent()
Demarks the successful completion of a transaction.
|
void |
discardEvent()
Discards the current atomic change to this list change queue.
|
void |
dispose() |
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 |
elementDeleted(int index,
java.util.List<E> oldValues)
Adds a block of removal events
|
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 |
elementInserted(int index,
java.util.List<E> newValues)
Adds a block of insert events.
|
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 |
elementUpdated(int index,
java.util.List<E> oldValues,
java.util.List<E> newValues) |
void |
elementUpdated(int index,
java.util.List<ObjectChange<E>> changes)
Adds a block of update events
|
void |
elementUpdated(int index,
ObjectChange<E> change) |
ListEvent<E> |
emptyEvent() |
void |
forwardEvent(ListEvent<?> listChanges)
Forwards the event.
|
ListEventAssembler<E> |
getBufferedUpdates() |
ListEvent<E> |
getCurrentChanges()
Returns the uncommited changes of the current event level
|
java.util.List<ListEventListener<E>> |
getListEventListeners()
Get all
ListEventListeners observing the EventList. |
protected ListEventAssembler<E> |
getUpdates() |
boolean |
isEventEmpty()
Returns true if the current atomic change to this list change
queue is empty; false otherwise.
|
boolean |
isEventInProgress()
Indicate whether or not an event is in progress.
|
ListEventAssembler<E> |
newAssembler() |
void |
removeBufferedListEventListener(ListEventListener<? super E> listChangeListener) |
void |
removeListEventListener(ListEventListener<? super E> listChangeListener)
Removes the specified listener from receiving notification when new
changes are appended to this list change sequence.
|
void |
removeRollbackEventListener(ListEventListener<? super E> listChangeListener) |
void |
reorder(int[] reorderMap,
java.util.List<ObjectChange<E>> changes)
Sets the current event as a reordering.
|
void |
rollbackEvent()
Demarks the unsuccessful completion of a transaction.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateListEventPublisherpublic TransactionEventAssembler()
public TransactionEventAssembler(boolean rollbackSupport)
public boolean isEventInProgress()
IListEventAssemblerisEventInProgress in interface IListEventAssembler<E>public boolean isEventEmpty()
IListEventAssemblerisEventEmpty in interface IListEventAssembler<E>public ListEvent<E> getCurrentChanges()
IListEventAssemblergetCurrentChanges in interface IListEventAssembler<E>public ListEvent<E> emptyEvent()
emptyEvent in interface IListEventAssembler<E>public ListEventAssembler<E> newAssembler()
newAssembler in interface IListEventAssembler<E>public ListEventAssembler<E> getBufferedUpdates()
protected ListEventAssembler<E> getUpdates()
public void elementInserted(int index,
E newValue)
elementInserted in interface IListEventAssembler<E>public void elementInserted(int index,
java.util.List<E> newValues)
elementInserted in interface IListEventAssembler<E>public void elementDeleted(int index,
E oldValue)
elementDeleted in interface IListEventAssembler<E>public void elementDeleted(int index,
java.util.List<E> oldValues)
elementDeleted in interface IListEventAssembler<E>public void elementUpdated(int index,
java.util.List<ObjectChange<E>> changes)
elementUpdated in interface IListEventAssembler<E>public void elementUpdated(int index,
E oldValue,
E newValue)
elementUpdated in interface IListEventAssembler<E>public void elementUpdated(int index,
java.util.List<E> oldValues,
java.util.List<E> newValues)
elementUpdated in interface IListEventAssembler<E>public void elementUpdated(int index,
ObjectChange<E> change)
elementUpdated in interface IListEventAssembler<E>public void addChange(int type,
int index,
ObjectChange<E> event)
addChange in interface IListEventAssembler<E>public void addChange(int type,
int startIndex,
java.util.List<ObjectChange<E>> changeEvents)
addChange in interface IListEventAssembler<E>public void reorder(int[] reorderMap,
java.util.List<ObjectChange<E>> changes)
reorder in interface IListEventAssembler<E>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.
forwardEvent in interface IListEventAssembler<E>public void beginEvent()
commitEvent().beginEvent in interface IListEventAssembler<E>public void beginEvent(boolean buffered)
buffered is true then all ListEvents received during the transaction are accumulated and
fired as a single aggregate ListEvent on commitEvent(). If buffered is false then all ListEvents received during the
transaction are forwarded immediately and commitEvent() produces no ListEvent of its own.beginEvent in interface IListEventAssembler<E>buffered - true indicates ListEvents should be buffered and sent on commitEvent(); false indicates they should be sent on
immediatelypublic void commitEvent()
beginEvent(true) then a single ListEvent will be fired from this TransactionList describing the changes accumulated during the transaction.commitEvent in interface IListEventAssembler<E>public void discardEvent()
IListEventAssemblerThe 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.
discardEvent in interface IListEventAssembler<E>public void rollbackEvent()
beginEvent(false) then a single ListEvent will be fired from this TransactionList describing the rollback of the changes accumulated during the
transaction.public void dispose()
public void addListEventListener(ListEventListener<? super E> listChangeListener)
IListEventAssemblerFor 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.
addListEventListener in interface IListEventAssembler<E>listChangeListener - event listener != nullpublic void removeListEventListener(ListEventListener<? super E> listChangeListener)
IListEventAssemblerThis 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.
removeListEventListener in interface IListEventAssembler<E>listChangeListener - event listener != nullpublic void addBufferedListEventListener(ListEventListener<? super E> listChangeListener)
public void removeBufferedListEventListener(ListEventListener<? super E> listChangeListener)
public void addRollbackEventListener(ListEventListener<? super E> listChangeListener)
public void removeRollbackEventListener(ListEventListener<? super E> listChangeListener)
public java.util.List<ListEventListener<E>> getListEventListeners()
IListEventAssemblerListEventListeners observing the EventList.getListEventListeners in interface IListEventAssembler<E>Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by swimmesberger at Mon Feb 25 11:02:37 CET 2019