Класс MapPropertyBase<K, V>
- Параметры типа:
-
K- тип элементов ключаMap -
V- тип элементов значенияMap
- Все реализованные интерфейсы:
-
Map<K,,V> Observable,Property<ObservableMap<K,,V>> ReadOnlyProperty<ObservableMap<K,,V>> ObservableMapValue<K,,V> ObservableObjectValue<ObservableMap<K,,V>> ObservableValue<ObservableMap<K,,V>> WritableMapValue<K,,V> WritableObjectValue<ObservableMap<K,,V>> WritableValue<ObservableMap<K,,V>> ObservableMap<K,V>
- Непосредственные известные подклассы:
SimpleMapProperty
public abstract class MapPropertyBase<K,V> extends MapProperty<K,V>
MapPropertyBase — базовый класс для свойства, оборачивающего ObservableMap. Он предоставляет всю функциональность, необходимую для свойства, за исключением методов ReadOnlyProperty.getBean() и ReadOnlyProperty.getName(), которые должны быть реализованы расширяющими классами.- С тех пор как:
- JavaFX 2.1
- См. также:
Краткое описание свойств
| Тип | Свойство | Описание |
|---|---|---|
ReadOnlyBooleanProperty |
empty |
Логическое свойство, которое равно true, если карта пуста. |
ReadOnlyIntegerProperty |
size |
Целочисленное свойство, представляющее размер карты. |
Краткое описание вложенных классов
Краткое описание конструкторов
| Конструктор | Описание |
|---|---|
MapPropertyBase() |
Конструктор MapPropertyBase
|
MapPropertyBase |
Конструктор MapPropertyBase. |
Краткое описание методов
| Модификатор и тип | Метод | Описание |
|---|---|---|
void |
addListener |
Добавляет InvalidationListener, который будет уведомляться всякий раз, когда Observable становится недоступным. |
void |
addListener |
Добавляет ChangeListener, который будет уведомляться всякий раз, когда значение ObservableValue изменяется. |
void |
addListener |
Добавляет слушатель к этой наблюдаемой карте. |
void |
bind |
Создаёт однонаправленную привязку для этой Property. |
ReadOnlyBooleanProperty |
emptyProperty() |
Логическое свойство, которое равно true, если карта пуста. |
protected void |
fireValueChangedEvent() |
Отправляет уведомления всем подключенным InvalidationListeners, ChangeListeners и MapChangeListener. |
protected void |
fireValueChangedEvent |
Отправляет уведомления всем подключенным InvalidationListeners, ChangeListeners и MapChangeListener. |
ObservableMap<K, |
get() |
Возвращает обернутое значение. |
protected void |
invalidated() |
Метод invalidated() может быть переопределён для получения уведомлений об утрате валидности. |
boolean |
isBound() |
Можно использовать для проверки, привязана ли Property. |
void |
removeListener |
Удаляет указанного слушателя из списка слушателей, которые уведомляются всякий раз, когда значение Observable теряет валидность. |
void |
removeListener |
Удаляет указанного слушателя из списка слушателей, которые уведомляются всякий раз, когда значение ObservableValue изменяется. |
void |
removeListener |
Пытается удалить слушателя из этой наблюдаемой карты. |
void |
set |
Устанавливает обернутое значение. |
ReadOnlyIntegerProperty |
sizeProperty() |
Целочисленное свойство, представляющее размер карты. |
String |
toString() |
Возвращает строковое представление этого объекта MapPropertyBase. |
void |
unbind() |
Удаляет однонаправленную привязку для этой Property. |
Методы, объявленные в классе javafx.beans.property.MapProperty
bindBidirectional, setValue, unbindBidirectional
Методы, объявленные в классе javafx.beans.property.ReadOnlyMapProperty
bindContent, bindContentBidirectional, equals, hashCode, unbindContent, unbindContentBidirectional
Методы, объявленные в классе javafx.beans.binding.MapExpression
asString, clear, containsKey, containsValue, entrySet, get, getSize, getValue, isEmpty, isEqualTo, isNotEqualTo, isNotNull, isNull, keySet, mapExpression, put, putAll, remove, size, valueAt, valueAt, values
Методы, объявленные в классе java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Методы, объявленные в интерфейсе java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Методы, объявленные в интерфейсе javafx.beans.Observable
subscribe
Методы, объявленные в интерфейсе javafx.beans.value.ObservableValue
flatMap, getValue, map, orElse, subscribe, subscribe, when
Методы, объявленные в интерфейсе javafx.beans.property.ReadOnlyProperty
getBean, getName
Методы, объявленные в интерфейсе javafx.beans.value.WritableValue
getValue
Подробное описание полей
size
public ReadOnlyIntegerProperty sizeProperty
- Определено в:
-
sizePropertyin classMapExpression<K,V> - Возвращает:
- the property
- См. также:
empty
public ReadOnlyBooleanProperty emptyProperty
- Определено в:
-
emptyPropertyin classMapExpression<K,V> - Возвращает:
- the
ReadOnlyBooleanProperty - См. также:
Подробное описание конструкторов
MapPropertyBase
public MapPropertyBase()
MapPropertyBase
MapPropertyBase
public MapPropertyBase(ObservableMap<K,V> initialValue)
MapPropertyBase.- Параметры:
-
initialValue- the initial value of the wrapped value
Подробное описание методов
sizeProperty
public ReadOnlyIntegerProperty sizeProperty()
MapExpression- Определено в:
-
sizePropertyin classMapExpression<K,V> - Возвращает:
- the
sizeproperty - См. также:
emptyProperty
public ReadOnlyBooleanProperty emptyProperty()
MapExpressiontrue, if the map is empty.- Определено в:
-
emptyPropertyin classMapExpression<K,V> - Возвращает:
- the
emptyproperty - См. также:
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.
- Параметры:
-
listener- The listener to register - См. также:
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.
- Параметры:
-
listener- The listener to remove - См. также:
addListener
public void addListener(ChangeListener<? super ObservableMap<K,V>> 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.
- Параметры:
-
listener- The listener to register - См. также:
removeListener
public void removeListener(ChangeListener<? super ObservableMap<K,V>> 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.
- Параметры:
-
listener- The listener to remove - См. также:
addListener
public void addListener(MapChangeListener<? super K,? super V> listener)
ObservableMap- Параметры:
-
listener- the listener for listening to the list changes
removeListener
public void removeListener(MapChangeListener<? super K,? super V> listener)
ObservableMap- Параметры:
-
listener- a listener to remove
fireValueChangedEvent
protected void fireValueChangedEvent()
InvalidationListeners, ChangeListeners, and MapChangeListener. This method is called when the value is changed, either manually by calling set(javafx.collections.ObservableMap) or in case of a bound property, if the binding becomes invalid.fireValueChangedEvent
protected void fireValueChangedEvent(MapChangeListener.Change<? extends K,? extends V> change)
InvalidationListeners, ChangeListeners, and MapChangeListener. This method is called when the content of the list changes.- Параметры:
-
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 ObservableMap<K,V> get()
WritableObjectValueWritableValue.getValue(). This method exists only to align WritableObjectValue API with WritableBooleanValue and subclasses of WritableNumberValue
- Возвращает:
- The current value
установить
public void set(ObservableMap<K,V> newValue)
WritableObjectValueWritableValue.setValue(java.lang.Object)
- Параметры:
-
newValue- Новое значение - См. также:
isBound
public boolean isBound()
PropertyProperty.- Возвращает:
-
true, еслиPropertyпривязана,falseв противном случае - См. также:
привязать
public void bind(ObservableValue<? extends ObservableMap<K,V>> newObservable)
PropertyProperty. Обратите внимание, что все вызовы bind в JavaFX реализованы с помощью слабых слушателей. Это означает, что привязанное свойство может быть удалено из памяти и прекратить обновление.
- Параметры:
-
newObservable- Наблюдаемое свойство, к которому должна быть привязана этаProperty.
отвязать
public void unbind()
PropertyProperty. Если Property не привязана, вызов этого метода не повлияет.toString
public String toString()
MapPropertyBase.- Переопределяет:
-
toStringв классеMapProperty<K,V> - Возвращает:
- строковое представление объекта
MapPropertyBase.
© 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.