Spec-Zone.ru › OpenJavaFX 17

Class ListExpression<E>

java.lang.Object
javafx.beans.binding.ListExpression<E>
Type Parameters:
E - the type of the List 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 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

Properties
Type Property Description
abstract ReadOnlyBooleanProperty empty
A boolean property that is true, if the list is empty.
abstract ReadOnlyIntegerProperty size
An integer property that represents the size of the list.

Constructor Summary

Constructors
Constructor Description
ListExpression()
Creates a default ListExpression.

Method Summary

Modifier and Type Method Description
StringBinding asString()
Creates a StringBinding that holds the value of the ListExpression turned into a String.
abstract ReadOnlyBooleanProperty emptyProperty()
A boolean property that is true, if the list is empty.
int getSize()
The size of the list
BooleanBinding isEqualTo​(ObservableList<?> other)
Creates a new BooleanBinding that holds true if this list is equal to another ObservableList.
BooleanBinding isNotEqualTo​(ObservableList<?> other)
Creates a new BooleanBinding that holds true if this list is not equal to another ObservableList.
BooleanBinding isNotNull()
Creates a new BooleanBinding that holds true if the wrapped list is not null.
BooleanBinding isNull()
Creates a new BooleanBinding that holds true if the wrapped list is null.
static <E> ListExpression<E> listExpression​(ObservableListValue<E> value)
Returns a ListExpression that wraps a ObservableListValue.
abstract ReadOnlyIntegerProperty sizeProperty()
An integer property that represents the size of the list.
ObjectBinding<E> valueAt​(int index)
Creates a new ObjectBinding that contains the element at the specified position.
ObjectBinding<E> valueAt​(ObservableIntegerValue index)
Creates a new ObjectBinding 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.lang.Iterable

forEach

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 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 Details

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 is true, if the list is empty.
See Also:
List.isEmpty()

Constructor Details

ListExpression

public ListExpression()
Creates a default ListExpression.

Method Details

listExpression

public static <E> ListExpression<E> listExpression(ObservableListValue<E> value)
Returns a ListExpression that wraps a ObservableListValue. If the ObservableListValue is already a ListExpression, it will be returned. Otherwise a new ListBinding is created that is bound to the ObservableListValue.
Type Parameters:
E - the type of the wrapped List
Parameters:
value - The source ObservableListValue
Returns:
A ListExpression that wraps the ObservableListValue if necessary
Throws:
NullPointerException - if value is null

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 is true, if the list is empty.
See Also:
List.isEmpty()

valueAt

public ObjectBinding<E> valueAt(int index)
Creates a new ObjectBinding that contains the element at the specified position. If index points behind the list, the ObjectBinding contains null.
Parameters:
index - the index of the element
Returns:
the ObjectBinding
Throws:
IllegalArgumentException - if index < 0

valueAt

public ObjectBinding<E> valueAt(ObservableIntegerValue index)
Creates a new ObjectBinding that contains the element at the specified position. If index points outside of the list, the ObjectBinding contains null.
Parameters:
index - the index of the element
Returns:
the ObjectBinding
Throws:
NullPointerException - if index is null

isEqualTo

public BooleanBinding isEqualTo(ObservableList<?> other)
Creates a new BooleanBinding that holds true if this list is equal to another ObservableList.
Parameters:
other - the other ObservableList
Returns:
the new BooleanBinding
Throws:
NullPointerException - if other is null

isNotEqualTo

public BooleanBinding isNotEqualTo(ObservableList<?> other)
Creates a new BooleanBinding that holds true if this list is not equal to another ObservableList.
Parameters:
other - the other ObservableList
Returns:
the new BooleanBinding
Throws:
NullPointerException - if other is null

isNull

public BooleanBinding isNull()
Creates a new BooleanBinding that holds true if the wrapped list is null.
Returns:
the new BooleanBinding

isNotNull

public BooleanBinding isNotNull()
Creates a new BooleanBinding that holds true if the wrapped list is not null.
Returns:
the new BooleanBinding

asString

public StringBinding asString()
Creates a StringBinding that holds the value of the ListExpression turned into a String. If the value of this ListExpression changes, the value of the StringBinding will be updated automatically.
Returns:
the new StringBinding

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API