org.openide.util
Class ChangeSupport

java.lang.Object
  extended by org.openide.util.ChangeSupport

public final class ChangeSupport
extends java.lang.Object

A simple equivalent of PropertyChangeSupport for ChangeListeners. This class is not serializable.

Since:
7.8
Author:
Andrei Badea

Field Summary
(package private)  java.util.List<javax.swing.event.ChangeListener> listeners
           
 
Constructor Summary
ChangeSupport(java.lang.Object source)
          Creates a new ChangeSupport
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Adds a ChangeListener to the listener list.
 void fireChange()
          Fires a change event to all registered listeners.
 boolean hasListeners()
          Checks if there are any listeners registered to thisChangeSupport.
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Removes a ChangeListener from the listener list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

final java.util.List<javax.swing.event.ChangeListener> listeners
Constructor Detail

ChangeSupport

public ChangeSupport(java.lang.Object source)
Creates a new ChangeSupport

Parameters:
source - the instance to be given as the source for events.
Method Detail

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Adds a ChangeListener to the listener list. The same listener object may be added more than once, and will be called as many times as it is added. If listener is null, no exception is thrown and no action is taken.

Parameters:
listener - the ChangeListener to be added.

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Removes a ChangeListener from the listener list. If listener was added more than once, it will be notified one less time after being removed. If listener is null, or was never added, no exception is thrown and no action is taken.

Parameters:
listener - the ChangeListener to be removed.

fireChange

public void fireChange()
Fires a change event to all registered listeners.


hasListeners

public boolean hasListeners()
Checks if there are any listeners registered to thisChangeSupport.

Returns:
true if there are one or more listeners for the given property, false otherwise.