Class ReadOnlyMapWrapper<K,V>
- javafx.beans.binding.MapExpression<K,V>
-
- javafx.beans.property.ReadOnlyMapProperty<K,V>
-
- javafx.beans.property.MapProperty<K,V>
-
- javafx.beans.property.MapPropertyBase<K,V>
-
- javafx.beans.property.SimpleMapProperty<K,V>
-
- javafx.beans.property.ReadOnlyMapWrapper<K,V>
All Implemented Interfaces:
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>
public class ReadOnlyMapWrapper<K,V> extends SimpleMapProperty<K,V>
Since:
JavaFX 2.1
-
Property Summary
-
Properties inherited from class javafx.beans.property.MapPropertyBase
empty, size
-
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor and Description ReadOnlyMapWrapper()The constructor ofReadOnlyMapWrapperReadOnlyMapWrapper(Object bean, String name)The constructor ofReadOnlyMapWrapperReadOnlyMapWrapper(Object bean, String name, ObservableMap<K,V> initialValue)The constructor ofReadOnlyMapWrapperReadOnlyMapWrapper(ObservableMap<K,V> initialValue)The constructor ofReadOnlyMapWrapper
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description voidaddListener(ChangeListener<? super ObservableMap<K,V>> listener)Adds aChangeListenerwhich will be notified whenever the value of theObservableValuechanges.voidaddListener(InvalidationListener listener)Adds anInvalidationListenerwhich will be notified whenever theObservablebecomes invalid.voidaddListener(MapChangeListener<? super K,? super V> listener)Add a listener to this observable map.protected voidfireValueChangedEvent()protected voidfireValueChangedEvent(MapChangeListener.Change<? extends K,? extends V> change)ReadOnlyMapProperty<K,V>getReadOnlyProperty()Returns the readonly property, that is synchronized with thisReadOnlyMapWrapper.voidremoveListener(ChangeListener<? super ObservableMap<K,V>> listener)Removes the given listener from the list of listeners, that are notified whenever the value of theObservableValuechanges.voidremoveListener(InvalidationListener listener)Removes the given listener from the list of listeners, that are notified whenever the value of theObservablebecomes invalid.voidremoveListener(MapChangeListener<? super K,? super V> listener)Tries to removed a listener from this observable list.-
Methods inherited from class javafx.beans.property.SimpleMapProperty
getBean, getName
-
Methods inherited from class javafx.beans.property.MapPropertyBase
bind, emptyProperty, get, invalidated, isBound, set, sizeProperty, toString, unbind
-
Methods inherited from class javafx.beans.property.MapProperty
bindBidirectional, setValue, unbindBidirectional
-
Methods inherited from class javafx.beans.property.ReadOnlyMapProperty
bindContent, bindContentBidirectional, equals, hashCode, unbindContent, unbindContentBidirectional
-
Methods inherited from class 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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javafx.beans.value.ObservableValue
getValue
-
Methods inherited from interface javafx.beans.value.WritableValue
getValue
-
Methods inherited from interface 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
-
-
Constructor Detail
-
ReadOnlyMapWrapper
public ReadOnlyMapWrapper()
The constructor ofReadOnlyMapWrapper
-
ReadOnlyMapWrapper
public ReadOnlyMapWrapper(ObservableMap<K,V> initialValue)
The constructor ofReadOnlyMapWrapperParameters:
initialValue- the initial value of the wrapped value
-
ReadOnlyMapWrapper
public ReadOnlyMapWrapper(Object bean, String name)The constructor ofReadOnlyMapWrapperParameters:
bean- the bean of thisReadOnlyMapWrapper
-
ReadOnlyMapWrapper
public ReadOnlyMapWrapper(Object bean, String name, ObservableMap<K,V> initialValue)The constructor ofReadOnlyMapWrapperParameters:
bean- the bean of thisReadOnlyMapWrapper
-
-
Method Detail
-
getReadOnlyProperty
public ReadOnlyMapProperty<K,V> getReadOnlyProperty()
Returns the readonly property, that is synchronized with thisReadOnlyMapWrapper.Returns:
the readonly property
-
addListener
public void addListener(InvalidationListener listener)
Adds anInvalidationListenerwhich will be notified whenever theObservablebecomes 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
InvalidationListenerinstance may be safely registered for differentObservables.The
Observablestores 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 callingremoveListenerafter use or to use an instance ofWeakInvalidationListeneravoid this situation.Specified by:
addListenerin interfaceObservableOverrides:
addListenerin classMapPropertyBase<K,V>Parameters:
listener- The listener to register
-
removeListener
public void removeListener(InvalidationListener listener)
Removes the given listener from the list of listeners, that are notified whenever the value of theObservablebecomes 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.
Specified by:
removeListenerin interfaceObservableOverrides:
removeListenerin classMapPropertyBase<K,V>Parameters:
listener- The listener to remove
-
addListener
public void addListener(ChangeListener<? super ObservableMap<K,V>> listener)
Adds aChangeListenerwhich will be notified whenever the value of theObservableValuechanges. 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
ChangeListenerinstance may be safely registered for differentObservableValues.The
ObservableValuestores 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 callingremoveListenerafter use or to use an instance ofWeakChangeListeneravoid this situation.Specified by:
addListenerin interfaceObservableValue<ObservableMap<K,V>>Overrides:
addListenerin classMapPropertyBase<K,V>Parameters:
listener- The listener to register
-
removeListener
public void removeListener(ChangeListener<? super ObservableMap<K,V>> listener)
Removes the given listener from the list of listeners, that are notified whenever the value of theObservableValuechanges.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.
Specified by:
removeListenerin interfaceObservableValue<ObservableMap<K,V>>Overrides:
removeListenerin classMapPropertyBase<K,V>Parameters:
listener- The listener to remove
-
addListener
public void addListener(MapChangeListener<? super K,? super V> listener)
Add a listener to this observable map.Specified by:
addListenerin interfaceObservableMap<K,V>Overrides:
addListenerin classMapPropertyBase<K,V>Parameters:
listener- the listener for listening to the list changes
-
removeListener
public void removeListener(MapChangeListener<? super K,? super V> listener)
Tries to removed a listener from this observable list. If the listener is not attached to this list, nothing happens.Specified by:
removeListenerin interfaceObservableMap<K,V>Overrides:
removeListenerin classMapPropertyBase<K,V>Parameters:
listener- a listener to remove
-
fireValueChangedEvent
protected void fireValueChangedEvent()
Sends notifications to all attachedInvalidationListeners,ChangeListeners, andMapChangeListener. This method is called when the value is changed, either manually by callingMapPropertyBase.set(javafx.collections.ObservableMap)or in case of a bound property, if the binding becomes invalid.Overrides:
fireValueChangedEventin classMapPropertyBase<K,V>
-
fireValueChangedEvent
protected void fireValueChangedEvent(MapChangeListener.Change<? extends K,? extends V> change)
Sends notifications to all attachedInvalidationListeners,ChangeListeners, andMapChangeListener. This method is called when the content of the list changes.Overrides:
fireValueChangedEventin classMapPropertyBase<K,V>Parameters:
change- the change that needs to be propagated
-
© 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.