Class ChangeEventDispatcher


  • public class ChangeEventDispatcher
    extends Object
    This is a utility class that can be used by objects that support constrained properties. You can use an instance of this class as a member field and delegate various work to it.
    Author:
    Emil Ivov
    • Constructor Detail

      • ChangeEventDispatcher

        public ChangeEventDispatcher​(Object sourceObject)
        Constructs a VetoableChangeSupport object.
        Parameters:
        sourceObject - The object to be given as the source for any events.
    • Method Detail

      • addPropertyChangeListener

        public void addPropertyChangeListener​(PropertyChangeListener listener)
        Add a PropertyChangeListener to the listener list. The listener is registered for all properties.
        Parameters:
        listener - The PropertyChangeChangeListener to be added
      • addPropertyChangeListener

        public void addPropertyChangeListener​(String propertyName,
                                              PropertyChangeListener listener)
        Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property.
        Parameters:
        propertyName - The name of the property to listen on.
        listener - The ConfigurationChangeListener to be added
      • removePropertyChangeListener

        public void removePropertyChangeListener​(PropertyChangeListener listener)
        Remove a PropertyChangeListener from the listener list. This removes a ConfigurationChangeListener that was registered for all properties.
        Parameters:
        listener - The PropertyChangeListener to be removed
      • removePropertyChangeListener

        public void removePropertyChangeListener​(String propertyName,
                                                 PropertyChangeListener listener)
        Remove a PropertyChangeListener for a specific property.
        Parameters:
        propertyName - The name of the property that was listened on.
        listener - The VetoableChangeListener to be removed
      • addVetoableChangeListener

        public void addVetoableChangeListener​(org.jitsi.service.configuration.ConfigVetoableChangeListener listener)
        Add a VetoableChangeListener to the listener list. The listener is registered for all properties.
        Parameters:
        listener - The VetoableChangeListener to be added
      • removeVetoableChangeListener

        public void removeVetoableChangeListener​(org.jitsi.service.configuration.ConfigVetoableChangeListener listener)
        Remove a VetoableChangeListener from the listener list. This removes a VetoableChangeListener that was registered for all properties.
        Parameters:
        listener - The VetoableChangeListener to be removed
      • addVetoableChangeListener

        public void addVetoableChangeListener​(String propertyName,
                                              org.jitsi.service.configuration.ConfigVetoableChangeListener listener)
        Add a VetoableChangeListener for a specific property. The listener will be invoked only when a call on fireVetoableChange names that specific property.
        Parameters:
        propertyName - The name of the property to listen on.
        listener - The ConfigurationChangeListener to be added
      • removeVetoableChangeListener

        public void removeVetoableChangeListener​(String propertyName,
                                                 org.jitsi.service.configuration.ConfigVetoableChangeListener listener)
        Remove a VetoableChangeListener for a specific property.
        Parameters:
        propertyName - The name of the property that was listened on.
        listener - The VetoableChangeListener to be removed
      • fireVetoableChange

        public void fireVetoableChange​(String propertyName,
                                       Object oldValue,
                                       Object newValue)
        Report a vetoable property update to any registered listeners. If no one vetos the change, then fire a new ConfigurationChangeEvent indicating that the change has been accepted. In the case of a PropertyVetoException, end eventdispatch and rethrow the exception

        No event is fired if old and new are equal and non-null.

        Parameters:
        propertyName - The programmatic name of the property that is about to change..
        oldValue - The old value of the property.
        newValue - The new value of the property.
      • fireVetoableChange

        public void fireVetoableChange​(PropertyChangeEvent evt)
        Fire a vetoable property update to any registered listeners. If anyone vetos the change, then the exception will be rethrown by this method.

        No event is fired if old and new are equal and non-null.

        Parameters:
        evt - The PropertyChangeEvent to be fired.
      • firePropertyChange

        public void firePropertyChange​(String propertyName,
                                       Object oldValue,
                                       Object newValue)
        Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.
        Parameters:
        propertyName - The programmatic name of the property that was changed.
        oldValue - The old value of the property.
        newValue - The new value of the property.
      • firePropertyChange

        public void firePropertyChange​(PropertyChangeEvent evt)
        Fire an existing PropertyChangeEvent to any registered listeners. No event is fired if the given event's old and new values are equal and non-null.
        Parameters:
        evt - The PropertyChangeEvent object.
      • hasPropertyChangeListeners

        public boolean hasPropertyChangeListeners​(String propertyName)
        Check if there are any listeners for a specific property. (Generic listeners count as well)
        Parameters:
        propertyName - the property name.
        Returns:
        true if there are one or more listeners for the given property
      • hasVetoableChangeListeners

        public boolean hasVetoableChangeListeners​(String propertyName)
        Check if there are any vetoable change listeners for a specific property. (Generic vetoable change listeners count as well)
        Parameters:
        propertyName - the property name.
        Returns:
        true if there are one or more listeners for the given property