- java.lang.Object
-
- javafx.beans.binding.ListExpression<E>
-
- javafx.beans.property.ReadOnlyListProperty<E>
-
- javafx.beans.property.ListProperty<E>
-
- javafx.beans.property.ListPropertyBase<E>
-
- 参数类型
-
E-List元素的类型
- All Implemented Interfaces:
-
Iterable<E>,Collection<E>,List<E>,Observable,Property<E>,ReadOnlyProperty<E>,ObservableListValue<E>,ObservableObjectValue<E>,ObservableValue<E>,WritableListValue<E>,WritableObjectValue<E>,WritableValue<E>,ObservableList<E>
- 已知直接子类:
-
SimpleListProperty
public abstract class ListPropertyBase<E> extends ListProperty<E>
ListPropertyBase类是包装ObservableList的属性的基类。 它提供除了ReadOnlyProperty.getBean()和ReadOnlyProperty.getName()方法之外的属性所需的所有功能,必须通过扩展类来实现。- 从以下版本开始:
- JavaFX 2.1
- 另请参见:
-
ObservableList,ListProperty
-
-
Property Summary
Properties Type Property 描述 ReadOnlyBooleanPropertyempty一个布尔属性是true,如果列表为空。ReadOnlyIntegerPropertysize表示列表大小的整数属性。
-
构造方法摘要
构造方法 Constructor 描述 ListPropertyBase()构造函数ListPropertyBaseListPropertyBase(ObservableList<E> initialValue)ListPropertyBase的构造ListPropertyBase。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidaddListener(InvalidationListener listener)添加一个InvalidationListener,当Observable变得无效时,它将被通知。voidaddListener(ChangeListener<? super ObservableList<E>> listener)添加一个ChangeListener,当ObservableValue的值更改时,它将被通知。voidaddListener(ListChangeListener<? super E> listener)将侦听器添加到此可观察列表中。voidbind(ObservableValue<? extends ObservableList<E>> newObservable)为此Property创建一个单向绑定。ReadOnlyBooleanPropertyemptyProperty()一个布尔属性,如果列表为空,则为true。protected voidfireValueChangedEvent()发送通知到所有连接InvalidationListeners,ChangeListeners,并ListChangeListener。protected voidfireValueChangedEvent(ListChangeListener.Change<? extends E> change)发送通知到所有连接InvalidationListeners,ChangeListeners,并ListChangeListener。ObservableList<E>get()获取包装的值。protected voidinvalidated()可以覆盖方法invalidated()以接收无效通知。booleanisBound()可以用来检查,如果一个Property是绑定的。voidremoveListener(InvalidationListener listener)从监听器列表中删除给定的监听器,当Observable的值变为无效时通知Observable。voidremoveListener(ChangeListener<? super ObservableList<E>> listener)从监听器列表中删除给定的监听器,当ObservableValue的值发生变化时通知ObservableValue。voidremoveListener(ListChangeListener<? super E> listener)尝试从此可观察列表中删除侦听器。voidset(ObservableList<E> newValue)设置包装的值。ReadOnlyIntegerPropertysizeProperty()表示列表大小的整数属性。StringtoString()返回此ListPropertyBase对象的字符串表示形式。voidunbind()删除此Property的单向绑定。-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, of, of, of, of, of, of, of, of, of, of, of, of, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Methods inherited from class javafx.beans.binding.ListExpression
add, add, addAll, addAll, addAll, asString, clear, contains, containsAll, get, getSize, getValue, indexOf, isEmpty, isEqualTo, isNotEqualTo, isNotNull, isNull, iterator, lastIndexOf, listExpression, listIterator, listIterator, remove, remove, remove, removeAll, removeAll, retainAll, retainAll, set, setAll, setAll, size, subList, toArray, toArray, valueAt, valueAt
-
Methods inherited from class javafx.beans.property.ListProperty
bindBidirectional, setValue, unbindBidirectional
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javafx.collections.ObservableList
addAll, filtered, remove, removeAll, retainAll, setAll, setAll, sorted, sorted
-
Methods inherited from interface javafx.beans.value.ObservableValue
getValue
-
Methods inherited from class javafx.beans.property.ReadOnlyListProperty
bindContent, bindContentBidirectional, equals, hashCode, unbindContent, unbindContentBidirectional
-
Methods inherited from interface javafx.beans.property.ReadOnlyProperty
getBean, getName
-
Methods inherited from interface javafx.beans.value.WritableValue
getValue
-
-
-
-
Property Detail
-
size
public ReadOnlyIntegerProperty sizeProperty
- Specified by:
-
sizeProperty在ListExpression<E> - 另请参见:
-
ListExpression.getSize()
-
empty
public ReadOnlyBooleanProperty emptyProperty
- Specified by:
-
emptyProperty在ListExpression<E> - 另请参见:
-
ListExpression.isEmpty()
-
-
构造方法详细信息
-
ListPropertyBase
public ListPropertyBase()
构造函数ListPropertyBase
-
ListPropertyBase
public ListPropertyBase(ObservableList<E> initialValue)
ListPropertyBase的构造ListPropertyBase。- 参数
-
initialValue- 包装值的初始值
-
-
方法详细信息
-
sizeProperty
public ReadOnlyIntegerProperty sizeProperty()
描述从类复制:ListExpression表示列表大小的整数属性。- Specified by:
-
sizeProperty在ListExpression<E> - 另请参见:
-
ListExpression.getSize()
-
emptyProperty
public ReadOnlyBooleanProperty emptyProperty()
描述从类复制:ListExpression一个布尔属性是true,如果列表为空。- Specified by:
-
emptyProperty在ListExpression<E> - 另请参见:
-
ListExpression.isEmpty()
-
addListener
public void addListener(InvalidationListener listener)
描述从接口Observable复制添加一个InvalidationListener,当Observable变得无效时,它将被通知。 如果同一个监听器被多次添加,那么它将被多次通知。 也就是说,没有检查确保唯一性。请注意,相同的实际
InvalidationListener实例可能会安全注册为不同的Observables。Observable存储对侦听器的强烈引用,这将阻止侦听器被垃圾回收,并可能导致内存泄漏。 建议您在使用后拨打removeListener或使用WeakInvalidationListener的实例取消注册监听器,以避免此情况。- 参数
-
listener-listener注册 - 另请参见:
-
Observable.removeListener(InvalidationListener)
-
removeListener
public void removeListener(InvalidationListener listener)
描述从接口Observable复制从监听器列表中删除给定的监听器,当Observable的值变为无效时通知Observable。如果给定的侦听器以前没有被注册过(即它从未被添加过),那么这个方法调用是一个无操作的。 如果以前已经添加,那么它将被删除。 如果多次添加,那么只有第一次出现将被删除。
- 参数
-
listener- 要删除的侦听器 - 另请参见:
-
Observable.addListener(InvalidationListener)
-
addListener
public void addListener(ChangeListener<? super ObservableList<E>> listener)
说明从接口ObservableValue复制添加一个ChangeListener,当ObservableValue的值更改时,它将被通知。 如果同一个监听器被多次添加,那么它将被多次通知。 也就是说,没有检查确保唯一性。请注意,相同的实际
ChangeListener实例可能会安全注册为不同的ObservableValues。ObservableValue存储对侦听器的强烈引用,这将阻止侦听器被垃圾回收,并可能导致内存泄漏。 建议您在使用后通过调用removeListener注销一个监听器,或者使用WeakChangeListener的一个实例来避免这种情况。- 参数
-
listener-listener注册 - 另请参见:
-
ObservableValue.removeListener(ChangeListener)
-
removeListener
public void removeListener(ChangeListener<? super ObservableList<E>> listener)
说明从接口ObservableValue复制从监听器列表中删除给定的监听器,当ObservableValue的值发生变化时通知ObservableValue。如果给定的侦听器以前没有被注册过(即它从未被添加过),那么这个方法调用是一个无操作的。 如果以前已经添加,那么它将被删除。 如果多次添加,那么只有第一次出现将被删除。
- 参数
-
listener- 要删除的侦听器 - 另请参见:
-
ObservableValue.addListener(ChangeListener)
-
addListener
public void addListener(ListChangeListener<? super E> listener)
说明从接口ObservableList复制将侦听器添加到此可观察列表中。- 参数
-
listener- 用于监听列表的监听器更改
-
removeListener
public void removeListener(ListChangeListener<? super E> listener)
说明从接口ObservableList复制尝试从此可观察列表中删除侦听器。 如果监听者没有附加到此列表中,则不会发生任何事情。- 参数
-
listener- 要删除的侦听器
-
fireValueChangedEvent
protected void fireValueChangedEvent()
发送通知到所有连接InvalidationListeners,ChangeListeners,并ListChangeListener。 如果绑定变为无效,则通过调用set(ObservableList)或绑定属性来手动调用该值时调用此方法。
-
fireValueChangedEvent
protected void fireValueChangedEvent(ListChangeListener.Change<? extends E> change)
发送通知到所有连接InvalidationListeners,ChangeListeners,并ListChangeListener。 当列表的内容更改时调用此方法。- 参数
-
change- 需要传播的更改
-
invalidated
protected void invalidated()
可以覆盖方法invalidated()以接收无效通知。 这是Objects定义属性的首选选项,因为它需要更少的内存。 默认实现为空。
-
get
public ObservableList<E> get()
说明从接口WritableObjectValue复制获取包装的值。 这必须与从WritableValue.getValue()返回的值相同。此方法仅存在于将WritableObjectValue API与
WritableBooleanValue和子类WritableNumberValue对齐- 结果
- 当前值
-
set
public void set(ObservableList<E> newValue)
说明从界面WritableObjectValue复制设置包装的值。 应相当于WritableValue.setValue(java.lang.Object)- 参数
-
newValue- 新的价值 - 另请参见:
-
WritableObjectValue.get()
-
isBound
public boolean isBound()
描述从接口Property复制可以用来检查,如果一个Property是绑定的。- 结果
-
true如果Property是绑定的,否则false - 另请参见:
-
Property.bind(javafx.beans.value.ObservableValue)
-
bind
public void bind(ObservableValue<? extends ObservableList<E>> newObservable)
说明从界面:Property复制为此Property创建一个单向绑定。请注意,JavaFX具有通过弱侦听器实现的所有绑定调用。 这意味着bound属性可以被垃圾回收并停止更新。
- 参数
-
newObservable- 可观察到这个Property应该绑定到。
-
unbind
public void unbind()
说明从接口Property复制删除此Property的单向绑定。 如果Property未绑定,则调用此方法没有任何作用。
-
toString
public String toString()
返回此ListPropertyBase对象的字符串表示形式。- 重写:
-
toString在ListProperty<E> - 结果
-
这个
ListPropertyBase对象的字符串表示形式。
-
-