APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.collections.transformation

public abstract Class TransformationList<E, F>

extends ObservableListBase<E>
Class Inheritance
Known Direct Subclasses
javafx.collections.transformation.FilteredList, javafx.collections.transformation.SortedList
Type Parameters
<E>
the type parameter of this list
<F>
the upper bound of the type of the source list
Imports
javafx.collections.ListChangeListener.Change, .ListChangeListener, .ObservableList, .ObservableListBase, .WeakListChangeListener, java.util.List

A base class for all lists that wrap another list in a way that changes (transforms) the wrapped list's elements, order, size, or structure. If the source list is observable, a listener is automatically added to it and the events are delegated to sourceChanged(javafx.collections.ListChangeListener.Change).
Since
JavaFX 8.0

Field Summary

Modifier and TypeField and Description
private ObservableList<? extends F>
source

Contains the source list of this transformation list.

private ListChangeListener<F>
sourceListener

This field contains the result of expression "source instanceof javafx.collections.ObservableList".

Constructor Summary

AccessConstructor and Description
protected
TransformationList(ObservableList<? extends F>
the wrapped list
source
)

Creates a new Transformation list wrapped around the source list.

Method Summary

Modifier and TypeMethod and Description
private ListChangeListener<F>
public final ObservableList<? extends F>

Returns:

The List that is directly wrapped by this TransformationList
getSource
()

The source list specified in the constructor of this transformation list.

public abstract int

Returns:

the index of the element's origin in the source list
getSourceIndex
(int
the index in this list
index
)

Maps the index of this list's element to an index in the direct source list.

public final int

Returns:

the index of the element's origin in the provided list
getSourceIndexFor
(ObservableList<?>
a list from the transformation chain
list
,
int
the index of an element in this list
index
)

Maps the index of this list's element to an index of the provided list.

public abstract int

Returns:

the index of the element in this list if it is contained in this list or negative value otherwise
getViewIndex
(int
the index in the source list
index
)

Maps the index of the direct source list's element to an index in this list.

public final boolean

Returns:

true if the list is in the transformation chain as specified above.
isInTransformationChain
(ObservableList<?>
the list to check
list
)

Checks whether the provided list is in the chain under this TransformationList.

protected abstract void
sourceChanged(ListChangeListener.Change<? extends F>
the change
c
)

Called when a change from the source is triggered.

Inherited from javafx.collections.ObservableListBase:
addAlladdListeneraddListenerbeginChangeendChangefireChangehasListenersnextAddnextPermutationnextRemovenextRemovenextReplacenextSetnextUpdateremoveremoveAllremoveListenerremoveListenerretainAllsetAllsetAll

Field Detail

sourceback to summary
private ObservableList<? extends F> source

Contains the source list of this transformation list. This is never null and should be used to directly access source list content

sourceListenerback to summary
private ListChangeListener<F> sourceListener

This field contains the result of expression "source instanceof javafx.collections.ObservableList". If this is true, it is possible to do transforms online.

Constructor Detail

TransformationListback to summary
protected TransformationList(ObservableList<? extends F> source)

Creates a new Transformation list wrapped around the source list.

Parameters
source:ObservableList<? extends F>

the wrapped list

Method Detail

getListenerback to summary
private ListChangeListener<F> getListener()
getSourceback to summary
public final ObservableList<? extends F> getSource()

The source list specified in the constructor of this transformation list.

Returns:ObservableList<? extends F>

The List that is directly wrapped by this TransformationList

getSourceIndexback to summary
public abstract int getSourceIndex(int index)

Maps the index of this list's element to an index in the direct source list.

Parameters
index:int

the index in this list

Returns:int

the index of the element's origin in the source list

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index >= size())
See Also
getSource()
getSourceIndexForback to summary
public final int getSourceIndexFor(ObservableList<?> list, int index)

Maps the index of this list's element to an index of the provided list. The list must be in the transformation chain.

Parameters
list:ObservableList<?>

a list from the transformation chain

index:int

the index of an element in this list

Returns:int

the index of the element's origin in the provided list

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index >= size())
See Also
isInTransformationChain(javafx.collections.ObservableList)
getViewIndexback to summary
public abstract int getViewIndex(int index)

Maps the index of the direct source list's element to an index in this list.

Parameters
index:int

the index in the source list

Returns:int

the index of the element in this list if it is contained in this list or negative value otherwise

Exceptions
IndexOutOfBoundsException:
if the index is out of range (index < 0 || index >= getSource().size())
Since
9
See Also
getSource(), getSourceIndex(int)
isInTransformationChainback to summary
public final boolean isInTransformationChain(ObservableList<?> list)

Checks whether the provided list is in the chain under this TransformationList. This means the list is either the direct source as returned by getSource() or the direct source is a TransformationList, and the list is in it's transformation chain.

Parameters
list:ObservableList<?>

the list to check

Returns:boolean

true if the list is in the transformation chain as specified above.

sourceChangedback to summary
protected abstract void sourceChanged(ListChangeListener.Change<? extends F> c)

Called when a change from the source is triggered.

Parameters
c:ListChangeListener.Change<? extends F>

the change