|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.odell.glazedlists.calculation.AbstractCalculation<N>
ca.odell.glazedlists.calculation.AbstractEventListCalculation<N,E>
public abstract class AbstractEventListCalculation<N,E>
The transition between an EventList and a single calculated value based on information from each element of the EventList happens in subclasses of this class. To ease the job of maintaining the value of the Calculation when the backing EventList changes, this abstract class provides three abstract methods which must be implemented:
inserted(E)
updates the value of this Calculation to include the inserted elementdeleted(E)
updates the value of this Calculation to exclude the deleted elementupdated(E, E)
updates the value of this Calculation to include the replacement element and exclude the prior element
Constructor Summary | |
---|---|
protected |
AbstractEventListCalculation(N initialValue,
EventList<E> source)
|
Method Summary | |
---|---|
protected abstract void |
deleted(E oldElement)
Updates the value of this Calculation to exclude the information from the oldElement . |
void |
dispose()
Releases the resources consumed by this AbstractEventListCalculation
so that it may eventually be garbage collected. |
protected abstract void |
inserted(E newElement)
Updates the value of this Calculation to include the information from the newElement . |
void |
listChanged(ListEvent<E> listChanges)
Updates the value of this Calculation in response to the listChanges . |
protected abstract void |
updated(E oldElement,
E newElement)
Updates the value of this Calculation to exclude the information from the oldElement and include the information from the
newElement . |
Methods inherited from class ca.odell.glazedlists.calculation.AbstractCalculation |
---|
addPropertyChangeListener, fireValueChange, getName, getValue, removePropertyChangeListener, setName, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractEventListCalculation(N initialValue, EventList<E> source)
initialValue
- the value that should immediately be reported as the
value of this Calculationsource
- the List of elements from which this calculation is derivedMethod Detail |
---|
public void dispose()
AbstractEventListCalculation
so that it may eventually be garbage collected.
An AbstractEventListCalculation
will be garbage collected
without a call to dispose()
, but not before its source
EventList
is garbage collected. By calling dispose()
,
you allow the AbstractEventListCalculation
to be garbage
collected before its source EventList
. This is necessary for
situations where an AbstractEventListCalculation
is short-lived
but its source EventList
is long-lived.
dispose
in interface Calculation<N>
protected abstract void inserted(E newElement)
newElement
.
newElement
- the new element within the EventListprotected abstract void deleted(E oldElement)
oldElement
.
oldElement
- the old element within the EventListprotected abstract void updated(E oldElement, E newElement)
oldElement
and include the information from the
newElement
.
oldElement
- the old element within the EventListnewElement
- the new element which replaced the oldElementpublic void listChanged(ListEvent<E> listChanges)
listChanges
.
listChanged
in interface ListEventListener<E>
listChanges
- describes the changes to the backing EventList
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |