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:
ReadOnlyListProperty

public abstract class ListExpression<E> extends Object implements ObservableListValue<E>
A ListExpression is a 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 Details

  • Constructor Details

    • ListExpression

      public ListExpression()
  • Method Details

    • getValue

      public ObservableList<E> getValue()
      Description copied from interface: ObservableValue
      Returns the current value of this ObservableValue
      Specified by:
      getValue in interface ObservableValue<E>
      Returns:
      The current value
    • getSize

      public int getSize()
      The size of the list
    • sizeProperty

      public abstract ReadOnlyIntegerProperty sizeProperty()
      An integer property that represents the size of the list.
      Returns:
      the property
      See Also:
    • emptyProperty

      public abstract ReadOnlyBooleanProperty emptyProperty()
      A boolean property that is true, if the list is empty.
      Returns:
      the empty property
      See Also:
    • size

      public int size()
      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.
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
      Returns:
      the new StringBinding
    • isEmpty

      public boolean isEmpty()
      Gets the value of the empty property.
      Specified by:
      isEmpty in interface Collection<E>
      Specified by:
      isEmpty in interface List<E>
      Property description:
      A boolean property that is true, if the list is empty.
      Returns:
      the value of the empty property
      See Also:
    • contains

      public boolean contains(Object obj)
      Specified by:
      contains in interface Collection<E>
      Specified by:
      contains in interface List<E>
    • iterator

      public Iterator<E> iterator()
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface List<E>
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
    • toArray

      public <T> T[] toArray(T[] array)
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
    • add

      public boolean add(E element)
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface List<E>
    • remove

      public boolean remove(Object obj)
      Specified by:
      remove in interface Collection<E>
      Specified by:
      remove in interface List<E>
    • containsAll

      public boolean containsAll(Collection<?> objects)
      Specified by:
      containsAll in interface Collection<E>
      Specified by:
      containsAll in interface List<E>
    • addAll

      public boolean addAll(Collection<? extends E> elements)
      Specified by:
      addAll in interface Collection<E>
      Specified by:
      addAll in interface List<E>
    • addAll

      public boolean addAll(int i, Collection<? extends E> elements)
      Specified by:
      addAll in interface List<E>
    • removeAll

      public boolean removeAll(Collection<?> objects)
      Specified by:
      removeAll in interface Collection<E>
      Specified by:
      removeAll in interface List<E>
    • retainAll

      public boolean retainAll(Collection<?> objects)
      Specified by:
      retainAll in interface Collection<E>
      Specified by:
      retainAll in interface List<E>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<E>
      Specified by:
      clear in interface List<E>
    • get

      public E get(int i)
      Specified by:
      get in interface List<E>
    • set

      public E set(int i, E element)
      Specified by:
      set in interface List<E>
    • add

      public void add(int i, E element)
      Specified by:
      add in interface List<E>
    • remove

      public E remove(int i)
      Specified by:
      remove in interface List<E>
    • indexOf

      public int indexOf(Object obj)
      Specified by:
      indexOf in interface List<E>
    • lastIndexOf

      public int lastIndexOf(Object obj)
      Specified by:
      lastIndexOf in interface List<E>
    • listIterator

      public ListIterator<E> listIterator()
      Specified by:
      listIterator in interface List<E>
    • listIterator

      public ListIterator<E> listIterator(int i)
      Specified by:
      listIterator in interface List<E>
    • subList

      public List<E> subList(int from, int to)
      Specified by:
      subList in interface List<E>
    • addAll

      public boolean addAll(E... elements)
      Description copied from interface: ObservableList
      A convenient method for var-arg adding of elements.
      Specified by:
      addAll in interface ObservableList<E>
      Parameters:
      elements - the elements to add
      Returns:
      true (as specified by Collection.add(E))
    • setAll

      public boolean setAll(E... elements)
      Description copied from interface: ObservableList
      Clears the ObservableList and add all the elements passed as var-args.
      Specified by:
      setAll in interface ObservableList<E>
      Parameters:
      elements - the elements to set
      Returns:
      true (as specified by Collection.add(E))
    • setAll

      public boolean setAll(Collection<? extends E> elements)
      Description copied from interface: ObservableList
      Clears the ObservableList and add all elements from the collection.
      Specified by:
      setAll in interface ObservableList<E>
      Parameters:
      elements - the collection with elements that will be added to this observableArrayList
      Returns:
      true (as specified by Collection.add(E))
    • removeAll

      public boolean removeAll(E... elements)
      Description copied from interface: ObservableList
      A convenient method for var-arg usage of removaAll method.
      Specified by:
      removeAll in interface ObservableList<E>
      Parameters:
      elements - the elements to be removed
      Returns:
      true if list changed as a result of this call
    • retainAll

      public boolean retainAll(E... elements)
      Description copied from interface: ObservableList
      A convenient method for var-arg usage of retain method.
      Specified by:
      retainAll in interface ObservableList<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
      Basically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.
      Specified by:
      remove in interface ObservableList<E>
      Parameters:
      from - the start of the range to remove (inclusive)
      to - the end of the range to remove (exclusive)