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
ListExpression
is an
ObservableListValue
plus additional convenience
methods to generate bindings in a fluent style.
A concrete sub-class of ListExpression
has to implement the method
ObservableObjectValue.get()
, which provides the
actual value of this expression.
If the wrapped list of a ListExpression
is null
, all methods implementing the List
interface will behave as if they were applied to an immutable empty list.
- Since:
- JavaFX 2.1
-
Property Summary
TypePropertyDescriptionabstract ReadOnlyBooleanProperty
A boolean property that istrue
, if the list is empty.abstract ReadOnlyIntegerProperty
An integer property that represents the size of the list. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int i, Collection<? extends E> elements) boolean
A convenience method for var-arg addition of elements.boolean
addAll
(Collection<? extends E> elements) asString()
void
clear()
boolean
boolean
containsAll
(Collection<?> objects) abstract ReadOnlyBooleanProperty
A boolean property that istrue
, if the list is empty.get
(int i) int
getSize()
The size of the listgetValue()
Returns the current value of thisObservableValue
int
boolean
isEmpty()
Gets the value of the property empty.isEqualTo
(ObservableList<?> other) isNotEqualTo
(ObservableList<?> other) isNull()
iterator()
int
lastIndexOf
(Object obj) static <E> ListExpression<E>
listExpression
(ObservableListValue<E> value) Returns aListExpression
that wraps aObservableListValue
.listIterator
(int i) remove
(int i) void
remove
(int from, int to) A simplified way of callingsublist(from, to).clear()
.boolean
boolean
A convenience method for var-arg usage of theremoveAll
method.boolean
removeAll
(Collection<?> objects) boolean
A convenience method for var-arg usage of theretainAll
method.boolean
retainAll
(Collection<?> objects) boolean
Clears the ObservableList and adds all the elements passed as var-args.boolean
setAll
(Collection<? extends E> elements) Clears the ObservableList and adds all elements from the collection.int
size()
abstract ReadOnlyIntegerProperty
An integer property that represents the size of the list.subList
(int from, int to) Object[]
toArray()
<T> T[]
toArray
(T[] array) valueAt
(int index) Creates a newObjectBinding
that contains the element at the specified position.valueAt
(ObservableIntegerValue index) Creates a newObjectBinding
that contains the element at the specified position.Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods declared in interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
Methods declared in interface javafx.beans.Observable
addListener, removeListener
Methods declared in interface javafx.collections.ObservableList
addListener, filtered, removeListener, sorted, sorted
Methods declared in interface javafx.beans.value.ObservableObjectValue
get
Methods declared in interface javafx.beans.value.ObservableValue
addListener, removeListener
-
Property Details
-
Constructor Details
-
ListExpression
public ListExpression()Creates a defaultListExpression
.
-
-
Method Details
-
getValue
Description copied from interface:ObservableValue
Returns the current value of thisObservableValue
- Specified by:
getValue
in interfaceObservableValue<E>
- Returns:
- The current value
-
listExpression
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
An integer property that represents the size of the list.- See Also:
-
emptyProperty
A boolean property that istrue
, if the list is empty.- See Also:
-
valueAt
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
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
- Parameters:
other
- the otherObservableList
- Returns:
- the new
BooleanBinding
- Throws:
NullPointerException
- ifother
isnull
-
isNotEqualTo
- Parameters:
other
- the otherObservableList
- Returns:
- the new
BooleanBinding
- Throws:
NullPointerException
- ifother
isnull
-
isNull
- Returns:
- the new
BooleanBinding
-
isNotNull
- Returns:
- the new
BooleanBinding
-
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
-
size
public int size() -
isEmpty
public boolean isEmpty()Gets the value of the property empty. -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] array) -
add
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
subList
-
addAll
Description copied from interface:ObservableList
A convenience method for var-arg addition of elements.- Specified by:
addAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to add- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableList
Clears the ObservableList and adds all the elements passed as var-args.- Specified by:
setAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to set- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableList
Clears the ObservableList and adds all elements from the collection.- Specified by:
setAll
in interfaceObservableList<E>
- Parameters:
elements
- the collection with elements that will be added to this observableArrayList- Returns:
- true (as specified by Collection.add(E))
-
removeAll
Description copied from interface:ObservableList
A convenience method for var-arg usage of theremoveAll
method.- Specified by:
removeAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to be removed- Returns:
- true if list changed as a result of this call
-
retainAll
Description copied from interface:ObservableList
A convenience method for var-arg usage of theretainAll
method.- Specified by:
retainAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to be retained- Returns:
- true if list changed as a result of this call
-
remove
public void remove(int from, int to) Description copied from interface:ObservableList
A simplified way of callingsublist(from, to).clear()
. As this is a common operation, ObservableList has this method for convenient usage.- Specified by:
remove
in interfaceObservableList<E>
- Parameters:
from
- the start of the range to remove (inclusive)to
- the end of the range to remove (exclusive)
-