org.geotools.data
Class FeatureListenerManager

Object
  extended by FeatureListenerManager

public class FeatureListenerManager
extends Object

This class is used by DataStore implementations to provide FeatureListener support for the FeatureSources they create.

FeatureWriters created by the DataStore will need to make use of this class to provide the required FeatureEvents.

This class has been updated to store listeners using weak references in order to cut down on memory leaks.

Author:
Jody Garnett, Refractions Research
Module:
modules/library/main (gt-main.jar)

Constructor Summary
FeatureListenerManager()
           
 
Method Summary
 void addFeatureListener(FeatureSource<? extends FeatureType,? extends Feature> featureSource, FeatureListener featureListener)
          Used by FeaureSource implementations to provide listener support.
 void cleanListenerList(FeatureSource<? extends FeatureType,? extends Feature> featureSource)
           
 void fireChanged(String typeName, Transaction transaction, boolean commit)
          Notify all listeners that have registered interest for notification on this event type.
 void fireEvent(String typeName, Transaction transaction, FeatureEvent event)
          Provided event will be used as a template for notifying all FeatureSources for the provided typeName.
 void fireFeaturesAdded(String typeName, Transaction transaction, ReferencedEnvelope bounds, boolean commit)
          Notify all listeners that have registered interest for notification on this event type.
 void fireFeaturesChanged(String typeName, Transaction transaction, ReferencedEnvelope bounds, boolean commit)
          Notify all listeners that have registered interest for notification on this event type.
 void fireFeaturesRemoved(String typeName, Transaction transaction, ReferencedEnvelope bounds, boolean commit)
          Notify all listeners that have registered interest for notification on this event type.
 void removeFeatureListener(FeatureSource<? extends FeatureType,? extends Feature> featureSource, FeatureListener featureListener)
          Used by FeatureSource implementations to provide listener support.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureListenerManager

public FeatureListenerManager()
Method Detail

addFeatureListener

public void addFeatureListener(FeatureSource<? extends FeatureType,? extends Feature> featureSource,
                               FeatureListener featureListener)
Used by FeaureSource implementations to provide listener support.

Parameters:
featureSource -
featureListener -

removeFeatureListener

public void removeFeatureListener(FeatureSource<? extends FeatureType,? extends Feature> featureSource,
                                  FeatureListener featureListener)
Used by FeatureSource implementations to provide listener support.

Parameters:
featureSource -
featureListener -

cleanListenerList

public void cleanListenerList(FeatureSource<? extends FeatureType,? extends Feature> featureSource)

fireFeaturesAdded

public void fireFeaturesAdded(String typeName,
                              Transaction transaction,
                              ReferencedEnvelope bounds,
                              boolean commit)
Notify all listeners that have registered interest for notification on this event type.

This method is called by:

NOTE requiring to fire this event at FeatureWriter.next() is quite a gap inherited from an old API when FeatureWriter.write() didn't exist yet. It's a good idea though to fire the event at FeatureWriter.write() instead of FeatureWriter.next() so there are actually changes to notify for.

Parameters:
typeName - typeName being modified
transaction - Transaction used for change
bounds - BoundingBox of changes (may be null if unknown)
commit - true if

fireEvent

public void fireEvent(String typeName,
                      Transaction transaction,
                      FeatureEvent event)
Provided event will be used as a template for notifying all FeatureSources for the provided typeName.

Parameters:
typeName -
transaction -
event -

fireFeaturesChanged

public void fireFeaturesChanged(String typeName,
                                Transaction transaction,
                                ReferencedEnvelope bounds,
                                boolean commit)
Notify all listeners that have registered interest for notification on this event type.

This method is called by:

NOTE requiring to fire this event at FeatureWriter.next() is quite a gap inherited from an old API when FeatureWriter.write() didn't exist yet. It's a good idea though to fire the event at FeatureWriter.write() instead of FeatureWriter.next() so there are actually changes to notify for.

Parameters:
typeName - typeName being modified
transaction - Transaction used for change
bounds - BoundingBox of changes (may be null if unknown)

fireChanged

public void fireChanged(String typeName,
                        Transaction transaction,
                        boolean commit)
Notify all listeners that have registered interest for notification on this event type.

This method is called by:

Parameters:
typeName - typeName being modified
transaction - Transaction used for change
commit - true for commit, false for rollback

fireFeaturesRemoved

public void fireFeaturesRemoved(String typeName,
                                Transaction transaction,
                                ReferencedEnvelope bounds,
                                boolean commit)
Notify all listeners that have registered interest for notification on this event type.

This method is called by:

Parameters:
typeName - typeName being modified
transaction - Transaction used for change
bounds - BoundingBox of changes (may be null if unknown)


Copyright © 1996-2010 Geotools. All Rights Reserved.