Class MapListenerHelperEx<K,​V>

  • Type Parameters:
    K - The key type of the ObservableMap.
    V - The value type of the ObservableMap.
    Direct Known Subclasses:
    MapExpressionHelperEx

    public class MapListenerHelperEx<K,​V>
    extends java.lang.Object
    A utility class to support change notifications for an ObservableMap , replacing the JavaFX-internal MapChangeListener helper class.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MapListenerHelperEx.AtomicChange<K,​V>
      A simple implementation of an MapChangeListener.Change.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapListenerHelperEx​(javafx.collections.ObservableMap<K,​V> source)
      Constructs a new MapListenerHelperEx for the given source ObservableMap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(javafx.beans.InvalidationListener listener)
      Adds a new InvalidationListener to this MapListenerHelperEx.
      void addListener​(javafx.collections.MapChangeListener<? super K,​? super V> listener)
      Adds a new MapChangeListener to this MapListenerHelperEx.
      void fireValueChangedEvent​(javafx.collections.MapChangeListener.Change<? extends K,​? extends V> change)
      Notifies all attached InvalidationListeners and MapChangeListeners about the change.
      protected javafx.collections.ObservableMap<K,​V> getSource()
      Returns the source ObservableMap this MapListenerHelperEx is bound to, which is used in change notifications.
      protected void notifyInvalidationListeners()
      Notifies all registered InvalidationListeners.
      protected void notifyMapChangeListeners​(javafx.collections.MapChangeListener.Change<? extends K,​? extends V> change)
      Notifies the attached MapChangeListeners about the related change.
      void removeListener​(javafx.beans.InvalidationListener listener)
      Removes the given InvalidationListener from this MapListenerHelperEx.
      void removeListener​(javafx.collections.MapChangeListener<? super K,​? super V> listener)
      Removes the given MapChangeListener from this MapListenerHelperEx.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapListenerHelperEx

        public MapListenerHelperEx​(javafx.collections.ObservableMap<K,​V> source)
        Constructs a new MapListenerHelperEx for the given source ObservableMap.
        Parameters:
        source - The ObservableMap to use as source in change notifications.
    • Method Detail

      • addListener

        public void addListener​(javafx.beans.InvalidationListener listener)
        Adds a new InvalidationListener to this MapListenerHelperEx. If the same listener is added more than once, it will be registered more than once and will receive multiple change events.
        Parameters:
        listener - The listener to add.
      • addListener

        public void addListener​(javafx.collections.MapChangeListener<? super K,​? super V> listener)
        Adds a new MapChangeListener to this MapListenerHelperEx. If the same listener is added more than once, it will be registered more than once and will receive multiple change events.
        Parameters:
        listener - The listener to add.
      • fireValueChangedEvent

        public void fireValueChangedEvent​(javafx.collections.MapChangeListener.Change<? extends K,​? extends V> change)
        Notifies all attached InvalidationListeners and MapChangeListeners about the change.
        Parameters:
        change - The change to notify listeners about.
      • getSource

        protected javafx.collections.ObservableMap<K,​V> getSource()
        Returns the source ObservableMap this MapListenerHelperEx is bound to, which is used in change notifications.
        Returns:
        The source ObservableMap.
      • notifyInvalidationListeners

        protected void notifyInvalidationListeners()
        Notifies all registered InvalidationListeners.
      • notifyMapChangeListeners

        protected void notifyMapChangeListeners​(javafx.collections.MapChangeListener.Change<? extends K,​? extends V> change)
        Notifies the attached MapChangeListeners about the related change.
        Parameters:
        change - The applied change.
      • removeListener

        public void removeListener​(javafx.beans.InvalidationListener listener)
        Removes the given InvalidationListener from this MapListenerHelperEx. If its was registered more than once, removes one occurrence.
        Parameters:
        listener - The listener to remove.
      • removeListener

        public void removeListener​(javafx.collections.MapChangeListener<? super K,​? super V> listener)
        Removes the given MapChangeListener from this MapListenerHelperEx. If its was registered more than once, removes one occurrence.
        Parameters:
        listener - The listener to remove.