ca.odell.glazedlists.event

Class ListEvent<E>


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

Field Summary

static int
DELETE
different types of changes
static int
INSERT
static int
UPDATE
protected EventList
sourceList
the list that has changed

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
getBlockStartIndex()
Gets the first 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
getIndex()
Gets the current row index.
abstract int[]
getReorderMap()
Gets the reorder map of this list.
EventList
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.

Field Details

DELETE

public static final int DELETE
different types of changes
Field Value:
0

INSERT

public static final int INSERT
Field Value:
2

UPDATE

public static final int UPDATE
Field Value:
1

sourceList

protected EventList sourceList
the list that has changed

Method Details

copy

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

getBlockEndIndex

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

getBlockStartIndex

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

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.

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.

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.

getSourceList

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

getType

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

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.

isReordering

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

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.

nextBlock

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

reset

public abstract void reset()

toString

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

Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2007-12-21 23:49