Class ReadOnlyMapWrapperEx<K,V>

java.lang.Object
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>
org.eclipse.gef.common.beans.property.ReadOnlyMapWrapperEx<K,V>
Type Parameters:
K - The key type of the wrapped ObservableMap.
V - The value type of the wrapped ObservableMap.
All Implemented Interfaces:
Map<K,V>, javafx.beans.Observable, javafx.beans.property.Property<javafx.collections.ObservableMap<K,V>>, javafx.beans.property.ReadOnlyProperty<javafx.collections.ObservableMap<K,V>>, javafx.beans.value.ObservableMapValue<K,V>, javafx.beans.value.ObservableObjectValue<javafx.collections.ObservableMap<K,V>>, javafx.beans.value.ObservableValue<javafx.collections.ObservableMap<K,V>>, javafx.beans.value.WritableMapValue<K,V>, javafx.beans.value.WritableObjectValue<javafx.collections.ObservableMap<K,V>>, javafx.beans.value.WritableValue<javafx.collections.ObservableMap<K,V>>, javafx.collections.ObservableMap<K,V>

public class ReadOnlyMapWrapperEx<K,V> extends javafx.beans.property.ReadOnlyMapWrapper<K,V>
A replacement for ReadOnlyMapWrapper to fix the following JavaFX issues:
  • All listeners were removed when removing one (https://bugs.openjdk.java.net/browse/JDK-8136465): fixed by keeping track of all listeners and ensuring that remaining listeners are re-added when a listener is removed.
  • Change notifications are fired even when the observed value did not change.(https://bugs.openjdk.java.net/browse/JDK-8089169)
  • Bidirectional binding not working (https://bugs.openjdk.java.net/browse/JDK-8089557): fixed by not forwarding listeners to the nested read-only property but rather keeping the lists of listeners distinct.
  • Property Summary

    Properties inherited from class javafx.beans.property.MapPropertyBase

    empty, size
  • Nested Class Summary

    Nested classes/interfaces inherited from interface java.util.Map

    Map.Entry<K extends Object,V extends Object>
  • Constructor Summary

    Constructors
    Constructor
    Description
    The constructor of ReadOnlyMapWrapperEx
    The constructor of ReadOnlyMapWrapperEx
    ReadOnlyMapWrapperEx(Object bean, String name, javafx.collections.ObservableMap<K,V> initialValue)
    The constructor of ReadOnlyMapWrapperEx
    ReadOnlyMapWrapperEx(javafx.collections.ObservableMap<K,V> initialValue)
    The constructor of ReadOnlyMapWrapperEx
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addListener(javafx.beans.InvalidationListener listener)
    void
    addListener(javafx.beans.value.ChangeListener<? super javafx.collections.ObservableMap<K,V>> listener)
    void
    addListener(javafx.collections.MapChangeListener<? super K,? super V> listener)
    protected void
    protected void
    fireValueChangedEvent(javafx.collections.MapChangeListener.Change<? extends K,? extends V> change)
    javafx.beans.property.ReadOnlyMapProperty<K,V>
    Returns the readonly property, that is synchronized with this ReadOnlyMapWrapper.
    int
     
    void
    removeListener(javafx.beans.InvalidationListener listener)
    void
    removeListener(javafx.beans.value.ChangeListener<? super javafx.collections.ObservableMap<K,V>> listener)
    void
    removeListener(javafx.collections.MapChangeListener<? super K,? super V> listener)

    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, 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
  • Constructor Details

    • ReadOnlyMapWrapperEx

      public ReadOnlyMapWrapperEx()
      The constructor of ReadOnlyMapWrapperEx
    • ReadOnlyMapWrapperEx

      public ReadOnlyMapWrapperEx(Object bean, String name)
      The constructor of ReadOnlyMapWrapperEx
      Parameters:
      bean - the bean of this ReadOnlyMapWrapperEx
      name - the name of this ReadOnlyMapWrapperEx
    • ReadOnlyMapWrapperEx

      public ReadOnlyMapWrapperEx(Object bean, String name, javafx.collections.ObservableMap<K,V> initialValue)
      The constructor of ReadOnlyMapWrapperEx
      Parameters:
      bean - the bean of this ReadOnlyMapWrapperEx
      name - the name of this ReadOnlyMapWrapperEx
      initialValue - the initial value of the wrapped value
    • ReadOnlyMapWrapperEx

      public ReadOnlyMapWrapperEx(javafx.collections.ObservableMap<K,V> initialValue)
      The constructor of ReadOnlyMapWrapperEx
      Parameters:
      initialValue - the initial value of the wrapped value
  • Method Details

    • addListener

      public void addListener(javafx.beans.value.ChangeListener<? super javafx.collections.ObservableMap<K,V>> listener)
      Specified by:
      addListener in interface javafx.beans.value.ObservableValue<K>
      Overrides:
      addListener in class javafx.beans.property.MapPropertyBase<K,V>
    • addListener

      public void addListener(javafx.beans.InvalidationListener listener)
      Specified by:
      addListener in interface javafx.beans.Observable
      Overrides:
      addListener in class javafx.beans.property.MapPropertyBase<K,V>
    • addListener

      public void addListener(javafx.collections.MapChangeListener<? super K,? super V> listener)
      Specified by:
      addListener in interface javafx.collections.ObservableMap<K,V>
      Overrides:
      addListener in class javafx.beans.property.MapPropertyBase<K,V>
    • fireValueChangedEvent

      protected void fireValueChangedEvent()
      Overrides:
      fireValueChangedEvent in class javafx.beans.property.ReadOnlyMapWrapper<K,V>
    • fireValueChangedEvent

      protected void fireValueChangedEvent(javafx.collections.MapChangeListener.Change<? extends K,? extends V> change)
      Overrides:
      fireValueChangedEvent in class javafx.beans.property.ReadOnlyMapWrapper<K,V>
    • getReadOnlyProperty

      public javafx.beans.property.ReadOnlyMapProperty<K,V> getReadOnlyProperty()
      Returns the readonly property, that is synchronized with this ReadOnlyMapWrapper.
      Overrides:
      getReadOnlyProperty in class javafx.beans.property.ReadOnlyMapWrapper<K,V>
      Returns:
      the readonly property
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class javafx.beans.property.ReadOnlyMapProperty<K,V>
    • removeListener

      public void removeListener(javafx.beans.value.ChangeListener<? super javafx.collections.ObservableMap<K,V>> listener)
      Specified by:
      removeListener in interface javafx.beans.value.ObservableValue<K>
      Overrides:
      removeListener in class javafx.beans.property.MapPropertyBase<K,V>
    • removeListener

      public void removeListener(javafx.beans.InvalidationListener listener)
      Specified by:
      removeListener in interface javafx.beans.Observable
      Overrides:
      removeListener in class javafx.beans.property.MapPropertyBase<K,V>
    • removeListener

      public void removeListener(javafx.collections.MapChangeListener<? super K,? super V> listener)
      Specified by:
      removeListener in interface javafx.collections.ObservableMap<K,V>
      Overrides:
      removeListener in class javafx.beans.property.MapPropertyBase<K,V>