Класс SetPropertyBase<E>
- Type Parameters:
-
E- тип элементовSet
- Все реализуемые интерфейсы:
-
Iterable<E>,Collection<E>,Set<E>,Observable,Property<ObservableSet<E>>,ReadOnlyProperty<ObservableSet<E>>,ObservableObjectValue<ObservableSet<E>>,ObservableSetValue<E>,ObservableValue<ObservableSet<E>>,WritableObjectValue<ObservableSet<E>>,WritableSetValue<E>,WritableValue<ObservableSet<E>>,ObservableSet<E>
- Непосредственные известные подклассы:
SimpleSetProperty
public abstract class SetPropertyBase<E> extends SetProperty<E>
SetPropertyBase является базовым классом для свойства, которое оборачивает ObservableSet. Он предоставляет всю необходимую функциональность для свойства, за исключением методов ReadOnlyProperty.getBean() и ReadOnlyProperty.getName(), которые должны быть реализованы производными классами.- С тех пор:
- JavaFX 2.1
- См. также:
Краткое описание свойств
| Тип | Свойство | Описание |
|---|---|---|
ReadOnlyBooleanProperty |
empty |
Логическое свойство, которое равно true, если множество пустое. |
ReadOnlyIntegerProperty |
size |
Целочисленное свойство, представляющее размер множества. |
Краткое описание конструкторов
| Конструктор | Описание |
|---|---|
SetPropertyBase() |
Конструктор SetPropertyBase
|
SetPropertyBase |
Конструктор SetPropertyBase. |
Краткое описание методов
| Модификатор и тип | Метод | Описание |
|---|---|---|
void |
addListener |
Добавляет InvalidationListener, который будет уведомляться всякий раз, когда Observable становится недействительным. |
void |
addListener |
Добавляет ChangeListener, который будет уведомляться всякий раз, когда значение ObservableValue изменяется. |
void |
addListener |
Добавляет слушатель к этому наблюдаемому множеству. |
void |
bind |
Создает однонаправленную привязку для этого Property. |
ReadOnlyBooleanProperty |
emptyProperty() |
Логическое свойство, которое равно true, если множество пустое. |
protected void |
fireValueChangedEvent() |
Отправляет уведомления всем подключенным InvalidationListeners, ChangeListeners и SetChangeListener. |
protected void |
fireValueChangedEvent |
Отправляет уведомления всем подключенным InvalidationListeners, ChangeListeners и SetChangeListener. |
ObservableSet<E> |
get() |
Получить обернутое значение. |
protected void |
invalidated() |
Метод invalidated() может быть переопределен для получения уведомлений о потере действительности. |
boolean |
isBound() |
Может использоваться для проверки, привязано ли Property. |
void |
removeListener |
Удаляет указанный слушатель из списка слушателей, которые уведомляются всякий раз, когда значение Observable становится недействительным. |
void |
removeListener |
Удаляет указанного слушателя из списка слушателей, которые уведомляются всякий раз, когда значение ObservableValue изменяется. |
void |
removeListener |
Пытается удалить слушателя из этого наблюдаемого множества. |
void |
set |
Установить обернутое значение. |
ReadOnlyIntegerProperty |
sizeProperty() |
Целочисленное свойство, представляющее размер множества. |
String |
toString() |
Возвращает строковое представление этого объекта SetPropertyBase. |
void |
unbind() |
Удаляет однонаправленную привязку для этого Property. |
Методы, объявленные в классе javafx.beans.property.SetProperty
bindBidirectional, setValue, unbindBidirectional
Методы, объявленные в классе javafx.beans.property.ReadOnlySetProperty
bindContent, bindContentBidirectional, equals, hashCode, unbindContent, unbindContentBidirectional
Методы, объявленные в классе javafx.beans.binding.SetExpression
add, addAll, asString, clear, contains, containsAll, getSize, getValue, isEmpty, isEqualTo, isNotEqualTo, isNotNull, isNull, iterator, remove, removeAll, retainAll, setExpression, size, toArray, toArray
Методы, объявленные в классе java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Методы, объявленные в интерфейсе java.util.Collection
parallelStream, removeIf, stream, toArray
Методы, объявленные в интерфейсе javafx.beans.Observable
subscribe
Методы, объявленные в интерфейсе javafx.beans.value.ObservableValue
flatMap, getValue, map, orElse, subscribe, subscribe, when
Методы, объявленные в интерфейсе javafx.beans.property.ReadOnlyProperty
getBean, getName
Методы, объявленные в интерфейсе java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray
Методы, объявленные в интерфейсе javafx.beans.value.WritableValue
getValue
Подробное описание полей
size
public ReadOnlyIntegerProperty sizeProperty
- Specified by:
-
sizePropertyin classSetExpression<E> - Returns:
- the property
- See Also:
empty
public ReadOnlyBooleanProperty emptyProperty
- Specified by:
-
emptyPropertyin classSetExpression<E> - Returns:
- the
ReadOnlyBooleanProperty - See Also:
Подробное описание конструкторов
SetPropertyBase
public SetPropertyBase()
SetPropertyBase
SetPropertyBase
public SetPropertyBase(ObservableSet<E> initialValue)
SetPropertyBase.- Parameters:
-
initialValue- the initial value of the wrapped value
Подробное описание методов
sizeProperty
public ReadOnlyIntegerProperty sizeProperty()
SetExpression- Specified by:
-
sizePropertyin classSetExpression<E> - Returns:
- the
sizeproperty - See Also:
emptyProperty
public ReadOnlyBooleanProperty emptyProperty()
SetExpressiontrue, if the set is empty.- Specified by:
-
emptyPropertyin classSetExpression<E> - Returns:
- the
emptyproperty - See Also:
addListener
public void addListener(InvalidationListener listener)
ObservableInvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness. Note that the same actual InvalidationListener instance may be safely registered for different Observables.
The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakInvalidationListener avoid this situation.
- Parameters:
-
listener- The listener to register - See Also:
removeListener
public void removeListener(InvalidationListener listener)
ObservableObservable becomes invalid. If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
- Parameters:
-
listener- The listener to remove - See Also:
addListener
public void addListener(ChangeListener<? super ObservableSet<E>> listener)
ObservableValueChangeListener which will be notified whenever the value of the ObservableValue changes. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness. Note that the same actual ChangeListener instance may be safely registered for different ObservableValues.
The ObservableValue stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakChangeListener avoid this situation.
- Parameters:
-
listener- The listener to register - See Also:
removeListener
public void removeListener(ChangeListener<? super ObservableSet<E>> listener)
ObservableValueObservableValue changes. If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
- Parameters:
-
listener- The listener to remove - See Also:
addListener
public void addListener(SetChangeListener<? super E> listener)
ObservableSet- Parameters:
-
listener- the listener for listening to the set changes
removeListener
public void removeListener(SetChangeListener<? super E> listener)
ObservableSet- Parameters:
-
listener- a listener to remove
fireValueChangedEvent
protected void fireValueChangedEvent()
InvalidationListeners, ChangeListeners, and SetChangeListener. This method is called when the value is changed, either manually by calling set(javafx.collections.ObservableSet) or in case of a bound property, if the binding becomes invalid.fireValueChangedEvent
protected void fireValueChangedEvent(SetChangeListener.Change<? extends E> change)
InvalidationListeners, ChangeListeners, and SetChangeListener. This method is called when the content of the list changes.- Parameters:
-
change- the change that needs to be propagated
invalidated
protected void invalidated()
invalidated() can be overridden to receive invalidation notifications. This is the preferred option in Objects defining the property, because it requires less memory. The default implementation is empty.get
public ObservableSet<E> get()
WritableObjectValueWritableValue.getValue(). This method exists only to align WritableObjectValue API with WritableBooleanValue and subclasses of WritableNumberValue
- Returns:
- The current value
установить
public void set(ObservableSet<E> newValue)
WritableObjectValueWritableValue.setValue(java.lang.Object)
- Параметры:
-
newValue- Новое значение - См. также:
isBound
public boolean isBound()
PropertyProperty.- Возвращает:
-
true, еслиPropertyпривязана,falseв противном случае - См. также:
привязать
public void bind(ObservableValue<? extends ObservableSet<E>> newObservable)
PropertyProperty. Обратите внимание, что в JavaFX все вызовы bind реализованы с помощью слабых слушателей. Это означает, что связанное свойство может быть удалено из памяти и остановлено от обновления.
- Параметры:
-
newObservable- Наблюдаемое свойство, к которому должна быть привязана этаProperty.
отвязать
public void unbind()
PropertyProperty. Если Property не привязана, вызов этого метода не оказывает влияния.toString
public String toString()
SetPropertyBase.- Переопределяет:
-
toStringв классеSetProperty<E> - Возвращает:
- строковое представление этого объекта
SetPropertyBase.
© 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.