Class Observable

java.lang.Object
org.apache.sis.portrayal.Observable
Direct Known Subclasses:
Canvas

abstract class Observable extends Object
Parent class of all objects for which it is possible to register listeners. This base class does not need to be public; its methods will appear as if they were defined directly in sub-classes.
Since:
1.1
Version:
1.3
  • Field Details

  • Constructor Details

    • Observable

      Observable()
      Only used by classes in this package.
  • Method Details

    • addPropertyChangeListener

      public final void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Registers a listener for the property of the given name. The listener will be notified every time that the property of the given name got a new value. If the same listener is registered twice for the same property, then it will be notified twice (this method does not perform duplication checks).
      Parameters:
      propertyName - name of the property to listen (should be one of the *_PROPERTY constants).
      listener - property listener to register.
    • removePropertyChangeListener

      public final void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Unregisters a property listener. The given propertyName should be the name used during listener registration. If the specified listener is not registered for the named property, then nothing happen. If the listener has been registered twice, then only one registration is removed (one registration will remain).
      Parameters:
      propertyName - name of the listened property.
      listener - property listener to unregister.
    • hasPropertyChangeListener

      protected final boolean hasPropertyChangeListener(String propertyName)
      Returns true if the given property has at least one listener.
      Parameters:
      propertyName - name of the property to test.
      Returns:
      true if the given property has at least one listener.
      Since:
      1.3
    • firePropertyChange

      protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
      Notifies all registered listeners that a property of the given name changed its value. The change event source will be this. It is caller responsibility to verify that the old and new values are different (this method does not check for equality).
      Parameters:
      propertyName - name of the property that changed its value.
      oldValue - the old property value (may be null).
      newValue - the new property value (may be null).
      See Also:
    • firePropertyChange

      protected void firePropertyChange(PropertyChangeEvent event)
      Notifies all registered listeners that a property changed its value. It is caller responsibility to verify that the event source and property name are valid.
      Parameters:
      event - the event to forward. Cannot be null.
      See Also: