com.levigo.util.base.glazedlists.event
Class ListEvent<E>

java.lang.Object
  extended by java.util.EventObject
      extended by com.levigo.util.base.glazedlists.event.ListEvent<E>
All Implemented Interfaces:
Serializable

public abstract class ListEvent<E>
extends EventObject

A ListEvent models a change to a list.

The lists may change over time, causing this sequence of changes to grow indefinitely. The event is accessed like an iterator, with the user calling next() repeatedly to view the changes in sequence.

It is also possible to view changes in blocks, which may provide some performance benefit. To use this, use the nextBlock() method instead of the next() method.

Author:
Jesse Wilson
See Also:
Serialized Form

Field Summary
static int DELETE
          different types of changes
static int INSERT
           
protected  EventList<E> sourceList
          the list that has changed
static Object UNKNOWN_VALUE
          indicates a removed element whose value is unknown
static int UPDATE
           
 
Fields inherited from class java.util.EventObject
source
 
Method Summary
abstract  ListEvent<E> copy()
          Create a bitwise copy of this ListEvent.
abstract  int getBlockEndIndex()
          Gets the last row of the current block of changes.
abstract  int getBlocksRemaining()
          Deprecated. this method depends on a particular implementation of how list events are stored internally, and this implementation has since changed.
abstract  int getBlockStartIndex()
          Gets the first row of the current block of changes.
abstract  int getIndex()
          Gets the current row index.
abstract  E getNewValue()
          Deprecated. this is a developer preview API that is not yet fit for human consumption. Hopefully the full implementation is complete for Glazed Lists 2.0.
abstract  E getOldValue()
          Deprecated. this is a developer preview API that is not yet fit for human consumption. Hopefully the full implementation is complete for Glazed Lists 2.0.
abstract  int[] getReorderMap()
          Gets the reorder map of this list.
 EventList<E> getSourceList()
          Gets the List where this event originally occured.
abstract  int getType()
          Gets the type of the current change, which should be one of ListEvent.INSERT, UPDATE, or DELETE.
abstract  boolean hasNext()
          Without incrementing the implicit iterator, this tests if there is another change to view.
abstract  boolean isReordering()
          Tests if this change is a complete reordering of the list.
abstract  boolean next()
          Increments the change sequence to view the next change.
abstract  boolean nextBlock()
          Increments the change sequence to view the next change block.
abstract  void reset()
          Resets this event's position to the previously-marked position.
abstract  String toString()
          Gets this event as a String.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DELETE

public static final int DELETE
different types of changes

See Also:
Constant Field Values

UPDATE

public static final int UPDATE
See Also:
Constant Field Values

INSERT

public static final int INSERT
See Also:
Constant Field Values

UNKNOWN_VALUE

public static final Object UNKNOWN_VALUE
indicates a removed element whose value is unknown


sourceList

protected EventList<E> sourceList
the list that has changed

Method Detail

copy

public abstract ListEvent<E> copy()
Create a bitwise copy of this ListEvent.


reset

public abstract void reset()
Resets this event's position to the previously-marked position. This should be used for TransformedLists that require multiple-passes of the ListEvent in order to process it.


next

public abstract boolean next()
Increments the change sequence to view the next change. This will return true if such a change exists and false when there is no change to view.


hasNext

public abstract boolean hasNext()
Without incrementing the implicit iterator, this tests if there is another change to view. The user will still need to call next() to view such a change.


nextBlock

public abstract boolean nextBlock()
Increments the change sequence to view the next change block.


isReordering

public abstract boolean isReordering()
Tests if this change is a complete reordering of the list.


getReorderMap

public abstract int[] getReorderMap()
Gets the reorder map of this list. This will also increment the change sequence to the next change.

Returns:
an array of integers where the the previous index of a value is stored at the current index of that value.

getIndex

public abstract int getIndex()
Gets the current row index. If the block type is delete, this will always return the startIndex of the current list change.


getBlockStartIndex

public abstract int getBlockStartIndex()
Gets the first row of the current block of changes. Inclusive.


getBlockEndIndex

public abstract int getBlockEndIndex()
Gets the last row of the current block of changes. Inclusive.


getType

public abstract int getType()
Gets the type of the current change, which should be one of ListEvent.INSERT, UPDATE, or DELETE.


getOldValue

public abstract E getOldValue()
Deprecated. this is a developer preview API that is not yet fit for human consumption. Hopefully the full implementation is complete for Glazed Lists 2.0.

Gets the previous value for a deleted or updated element. If that data is not available, this will return UNKNOWN_VALUE.


getNewValue

public abstract E getNewValue()
Deprecated. this is a developer preview API that is not yet fit for human consumption. Hopefully the full implementation is complete for Glazed Lists 2.0.

Gets the current value for an inserted or updated element. If that data is not available, this will return UNKNOWN_VALUE.


getBlocksRemaining

public abstract int getBlocksRemaining()
Deprecated. this method depends on a particular implementation of how list events are stored internally, and this implementation has since changed.

Gets the number of blocks currently remaining in this atomic change.


getSourceList

public EventList<E> getSourceList()
Gets the List where this event originally occured.


toString

public abstract String toString()
Gets this event as a String. This simply iterates through all blocks and concatenates them.

Overrides:
toString in class EventObject


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.