- java.lang.Object
-
- javafx.beans.binding.ListExpression<E>
-
- Type Parameters:
E
- the type of theList
elements.
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,List<E>
,Observable
,ObservableListValue<E>
,ObservableObjectValue<ObservableList<E>>
,ObservableValue<ObservableList<E>>
,ObservableList<E>
- Direct Known Subclasses:
ListBinding
,ReadOnlyListProperty
public abstract class ListExpression<E> extends Object implements ObservableListValue<E>
ListExpression
is anObservableListValue
plus additional convenience methods to generate bindings in a fluent style.A concrete sub-class of
ListExpression
has to implement the methodObservableObjectValue.get()
, which provides the actual value of this expression.If the wrapped list of a
ListExpression
isnull
, all methods implementing theList
interface will behave as if they were applied to an immutable empty list.- Since:
- JavaFX 2.1
-
-
Property Summary
Properties Type Property Description abstract ReadOnlyBooleanProperty
empty
A boolean property that istrue
, if the list is empty.abstract ReadOnlyIntegerProperty
size
An integer property that represents the size of the list.
-
Constructor Summary
Constructors Constructor Description ListExpression()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringBinding
asString()
abstract ReadOnlyBooleanProperty
emptyProperty()
A boolean property that istrue
, if the list is empty.int
getSize()
The size of the listBooleanBinding
isEqualTo(ObservableList<?> other)
BooleanBinding
isNotEqualTo(ObservableList<?> other)
BooleanBinding
isNotNull()
BooleanBinding
isNull()
static <E> ListExpression<E>
listExpression(ObservableListValue<E> value)
Returns aListExpression
that wraps aObservableListValue
.abstract ReadOnlyIntegerProperty
sizeProperty()
An integer property that represents the size of the list.ObjectBinding<E>
valueAt(int index)
Creates a newObjectBinding
that contains the element at the specified position.ObjectBinding<E>
valueAt(ObservableIntegerValue index)
Creates a newObjectBinding
that contains the element at the specified position.-
Methods declared in interface java.util.Collection
parallelStream, removeIf, stream
-
Methods declared in interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods declared in interface javafx.beans.Observable
addListener, removeListener
-
Methods declared in interface javafx.collections.ObservableList
addAll, addListener, filtered, remove, removeAll, removeListener, retainAll, setAll, setAll, sorted, sorted
-
Methods declared in interface javafx.beans.value.ObservableObjectValue
get
-
Methods declared in interface javafx.beans.value.ObservableValue
addListener, getValue, removeListener
-
-
-
-
Property Detail
-
size
public abstract ReadOnlyIntegerProperty sizeProperty
An integer property that represents the size of the list.- See Also:
getSize()
-
empty
public abstract ReadOnlyBooleanProperty emptyProperty
A boolean property that istrue
, if the list is empty.- See Also:
List.isEmpty()
-
-
Method Detail
-
listExpression
public static <E> ListExpression<E> listExpression(ObservableListValue<E> value)
Returns aListExpression
that wraps aObservableListValue
. If theObservableListValue
is already aListExpression
, it will be returned. Otherwise a newListBinding
is created that is bound to theObservableListValue
.- Type Parameters:
E
- the type of the wrappedList
- Parameters:
value
- The sourceObservableListValue
- Returns:
- A
ListExpression
that wraps theObservableListValue
if necessary - Throws:
NullPointerException
- ifvalue
isnull
-
getSize
public int getSize()
The size of the list- Returns:
- the size
-
sizeProperty
public abstract ReadOnlyIntegerProperty sizeProperty()
An integer property that represents the size of the list.- See Also:
getSize()
-
emptyProperty
public abstract ReadOnlyBooleanProperty emptyProperty()
A boolean property that istrue
, if the list is empty.- See Also:
List.isEmpty()
-
valueAt
public ObjectBinding<E> valueAt(int index)
Creates a newObjectBinding
that contains the element at the specified position. Ifindex
points behind the list, theObjectBinding
containsnull
.- Parameters:
index
- the index of the element- Returns:
- the
ObjectBinding
- Throws:
IllegalArgumentException
- ifindex < 0
-
valueAt
public ObjectBinding<E> valueAt(ObservableIntegerValue index)
Creates a newObjectBinding
that contains the element at the specified position. Ifindex
points outside of the list, theObjectBinding
containsnull
.- Parameters:
index
- the index of the element- Returns:
- the
ObjectBinding
- Throws:
NullPointerException
- ifindex
isnull
-
isEqualTo
public BooleanBinding isEqualTo(ObservableList<?> other)
- Parameters:
other
- the otherObservableList
- Returns:
- the new
BooleanBinding
- Throws:
NullPointerException
- ifother
isnull
-
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableList<?> other)
- Parameters:
other
- the otherObservableList
- Returns:
- the new
BooleanBinding
- Throws:
NullPointerException
- ifother
isnull
-
isNull
public BooleanBinding isNull()
- Returns:
- the new
BooleanBinding
-
isNotNull
public BooleanBinding isNotNull()
- Returns:
- the new
BooleanBinding
-
asString
public StringBinding asString()
Creates aStringBinding
that holds the value of theListExpression
turned into aString
. If the value of thisListExpression
changes, the value of theStringBinding
will be updated automatically.- Returns:
- the new
StringBinding
-
-