## com.bbn.openmap.event
Class ListenerSupport

    java.lang.Object
      com.bbn.openmap.event.ListenerSupport

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  CenterSupport, EOMGListenerSupport, LayerSupport, MapMouseSupport, PaintListenerSupport, PanSupport, ProgressSupport, ProjectionSupport, SymbolChooser.SymbolTreeHolder, WindowSupport, ZoomSupport

public class ListenerSupport
extends java.lang.Object
implements java.io.Serializable

This is an utility class that can be used by beans that need support for handling listeners and firing events. You can use an subclass of this class as a member field of your bean and delegate work to it. It handles the work for a listener support subclass managing the Vector of listeners. It knows nothing about firing events to the listeners.

See Also:
  Serialized Form

Field Summary
`protected java.util.Vector` `listeners`
`protected java.lang.Object` `source`

Constructor Summary
`ListenerSupport(java.lang.Object sourceBean)` Construct a ListenerSupport object.

Method Summary
`void` `addListener(java.lang.Object listener)` Add an Object to the listener list.
`java.util.List` `getListeners()` Return a cloned list of Listeners.
`protected java.lang.Object` `getSource()` Get the source of the events.
`java.util.Iterator` `iterator()` Return an iterator over a clone of the listeners.
`void` `readObject(java.io.ObjectInputStream s)` Read the listeners from a stream.
`void` `removeAll()` Clear the listener list.
`void` `removeListener(java.lang.Object obj)` Remove an Object from the listener list.
`protected void` `setSource(java.lang.Object src)` Set the source of the events.
`int` `size()` Return the number of listeners.
`void` `writeObject(java.io.ObjectOutputStream s)` Write the listeners to a stream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### listeners

    protected transient java.util.Vector listeners

### source

    protected java.lang.Object source

Constructor Detail

### ListenerSupport

    public ListenerSupport(java.lang.Object sourceBean)

  Construct a ListenerSupport object.

Parameters:
  `sourceBean` - The bean to be given as the source for any events.

Method Detail

### setSource

    protected void setSource(java.lang.Object src)

  Set the source of the events.

### getSource

    protected java.lang.Object getSource()

  Get the source of the events.

### addListener

    public void addListener(java.lang.Object listener)

  Add an Object to the listener list.

  Parameters:
    `listener` - The listener object to be added

### removeListener

    public void removeListener(java.lang.Object obj)

  Remove an Object from the listener list.

  Parameters:
    `obj` - The Object to be removed

### removeAll

    public void removeAll()

  Clear the listener list.

### iterator

    public java.util.Iterator iterator()

  Return an iterator over a clone of the listeners. If listeners is null, it will return an empty iterator.

### size

    public int size()

  Return the number of listeners.

### getListeners

    public java.util.List getListeners()

  Return a cloned list of Listeners.

  Returns:
    List of listeners, null if none have been added.

### writeObject

    public void writeObject(java.io.ObjectOutputStream s)
                     throws java.io.IOException

  Write the listeners to a stream.

  Throws:
    `java.io.IOException`

### readObject

    public void readObject(java.io.ObjectInputStream s)
                    throws java.lang.ClassNotFoundException,
                           java.io.IOException

  Read the listeners from a stream.

  Throws:
    `java.lang.ClassNotFoundException`
    `java.io.IOException`

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details