## com.bbn.openmap.event
Class LayerSupport

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

All Implemented Interfaces:
  java.io.Serializable

public class LayerSupport
extends ListenerSupport

This is a utility class that can be used by beans that need support for handling LayerListeners and firing LayerEvents. You can use an instance of this class as a member field of your bean and delegate work to it.

See Also:
  Serialized Form

Nested Class Summary
`protected class` `LayerSupport.SetLayerRunnable` A reusable Runnable used by a thread to notify listeners when layers are turned on/off or shuffled.

Field Summary
`protected java.util.Vector` `events` Event information stack.
`protected boolean` `synchronous`
`protected java.lang.Thread` `t` Used to see if another Thread object needs to be created.

Fields inherited from class com.bbn.openmap.event.ListenerSupport
`listeners, source`

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

Method Summary
`void` `addLayerListener(LayerListener listener)` Add a LayerListener to the listener list.
`void` `fireLayer(int type, Layer[] layers)` Send a layer event to all registered listeners.
`boolean` `isSynchronous()`
`LayerSupport.SetLayerRunnable` `popLayerEvent()` Return the first event on the stack, may be null if there is nothing to do.
`void` `pushLayerEvent(int layerEventType, Layer[] layers)` Pushed the information onto a Vector stack to get executed by a separate thread.
`void` `removeLayerListener(LayerListener listener)` Remove a LayerListener from the listener list.
`void` `setSynchronous(boolean synchronous)`

Methods inherited from class com.bbn.openmap.event.ListenerSupport
`addListener, getListeners, getSource, iterator, readObject, removeAll, removeListener, setSource, size, writeObject`

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

Field Detail

### synchronous

    protected boolean synchronous

### t

    protected java.lang.Thread t

  Used to see if another Thread object needs to be created.

### events

    protected java.util.Vector events

  Event information stack.

Constructor Detail

### LayerSupport

    public LayerSupport(java.lang.Object sourceBean)

  Construct a LayerSupport.

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

Method Detail

### addLayerListener

    public void addLayerListener(LayerListener listener)

  Add a LayerListener to the listener list.

  Parameters:
    `listener` - The LayerListener to be added

### removeLayerListener

    public void removeLayerListener(LayerListener listener)

  Remove a LayerListener from the listener list.

  Parameters:
    `listener` - The LayerListener to be removed

### fireLayer

    public void fireLayer(int type,
                          Layer[] layers)

  Send a layer event to all registered listeners.

  Parameters:
    `type` - the event type: one of ADD, REMOVE, REPLACE
    `layers` - the list of layers
  See Also:
    `LayerEvent`

### pushLayerEvent

    public void pushLayerEvent(int layerEventType,
                               Layer[] layers)

  Pushed the information onto a Vector stack to get executed by a separate thread. Any thread launched is held on to, and if that thread is is null or not active, a new thread is kicked off. The dying thread checks the Vector stack and fires another event if it can.

  Parameters:
    `layerEventType` -
    `layers` -

### popLayerEvent

    public LayerSupport.SetLayerRunnable popLayerEvent()

  Return the first event on the stack, may be null if there is nothing to do.

### isSynchronous

    public boolean isSynchronous()

### setSynchronous

    public void setSynchronous(boolean synchronous)

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