- java.lang.Object
-
- javafx.beans.binding.MapExpression<K,V>
-
- javafx.beans.property.ReadOnlyMapProperty<K,V>
-
- javafx.beans.property.MapProperty<K,V>
-
- Type Parameters:
K
- the type of the key elements of theMap
V
- the type of the value elements of theMap
- 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>
- Direct Known Subclasses:
MapPropertyBase
public abstract class MapProperty<K,V> extends ReadOnlyMapProperty<K,V> implements Property<ObservableMap<K,V>>, WritableMapValue<K,V>
This class provides a full implementation of aProperty
wrapping anObservableMap
. The value of aMapProperty
can be get and set withObservableObjectValue.get()
,MapExpression.getValue()
,WritableObjectValue.set(Object)
, andsetValue(javafx.collections.ObservableMap)
. A property can be bound and unbound unidirectional withProperty.bind(javafx.beans.value.ObservableValue)
andProperty.unbind()
. Bidirectional bindings can be created and removed withbindBidirectional(Property)
andunbindBidirectional(Property)
. The context of aMapProperty
can be read withReadOnlyProperty.getBean()
andReadOnlyProperty.getName()
.- Since:
- JavaFX 2.1
- See Also:
ObservableMap
,ObservableMapValue
,WritableMapValue
,ReadOnlyMapProperty
,Property
-
-
Property Summary
-
Properties inherited from class javafx.beans.binding.MapExpression
empty, size
-
-
Constructor Summary
Constructors Constructor Description MapProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindBidirectional(Property<ObservableMap<K,V>> other)
Create a bidirectional binding between thisProperty
and another one.void
setValue(ObservableMap<K,V> v)
Set the wrapped value.String
toString()
Returns a string representation of thisMapProperty
object.void
unbindBidirectional(Property<ObservableMap<K,V>> other)
Remove a bidirectional binding between thisProperty
and another one.-
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, emptyProperty, entrySet, get, getSize, getValue, isEmpty, isEqualTo, isNotEqualTo, isNotNull, isNull, keySet, mapExpression, put, putAll, remove, size, sizeProperty, valueAt, valueAt, values
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
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
-
Methods inherited from interface javafx.beans.Observable
addListener, removeListener
-
Methods inherited from interface javafx.collections.ObservableMap
addListener, removeListener
-
Methods inherited from interface javafx.beans.value.ObservableObjectValue
get
-
Methods inherited from interface javafx.beans.value.ObservableValue
addListener, getValue, removeListener
-
Methods inherited from interface javafx.beans.property.ReadOnlyProperty
getBean, getName
-
Methods inherited from interface javafx.beans.value.WritableObjectValue
get, set
-
Methods inherited from interface javafx.beans.value.WritableValue
getValue
-
-
-
-
Method Detail
-
setValue
public void setValue(ObservableMap<K,V> v)
Set the wrapped value.- Specified by:
setValue
in interfaceWritableValue<K>
- Parameters:
v
- The new value
-
bindBidirectional
public void bindBidirectional(Property<ObservableMap<K,V>> other)
Create a bidirectional binding between thisProperty
and another one. Bidirectional bindings exists independently of unidirectional bindings. So it is possible to add unidirectional binding to a property with bidirectional binding and vice-versa. However, this practice is discouraged.It is possible to have multiple bidirectional bindings of one Property.
JavaFX bidirectional binding implementation use weak listeners. This means bidirectional binding does not prevent properties from being garbage collected.
- Specified by:
bindBidirectional
in interfaceProperty<K>
- Parameters:
other
- the otherProperty
-
unbindBidirectional
public void unbindBidirectional(Property<ObservableMap<K,V>> other)
Remove a bidirectional binding between thisProperty
and another one. If no bidirectional binding between the properties exists, calling this method has no effect. It is possible to unbind by a call on the second property. This code will work:property1.bindBirectional(property2); property2.unbindBidirectional(property1);
- Specified by:
unbindBidirectional
in interfaceProperty<K>
- Parameters:
other
- the otherProperty
-
toString
public String toString()
Returns a string representation of thisMapProperty
object.- Overrides:
toString
in classReadOnlyMapProperty<K,V>
- Returns:
- a string representation of this
MapProperty
object.
-
-