[Schmitzm-commits] r103 - in trunk/src: schmitzm/swing/event skrueger/geotools/selection

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 8 15:48:00 CEST 2009


Author: mojays
Date: 2009-05-08 15:48:00 +0200 (Fri, 08 May 2009)
New Revision: 103

Modified:
   trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java
   trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
   trunk/src/skrueger/geotools/selection/StyledFeatureLayerSelectionModel.java
   trunk/src/skrueger/geotools/selection/StyledLayerSelectionEvent.java
   trunk/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java
   trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java
Log:


Modified: trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java
===================================================================
--- trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java	2009-05-08 13:47:33 UTC (rev 102)
+++ trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java	2009-05-08 13:48:00 UTC (rev 103)
@@ -23,7 +23,7 @@
  * {@link PropertyChangeListener PropertyChangeListeners}. 
  * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
  */
-public abstract class PropertyChangeEmitter {
+public abstract class PropertyChangeEmitter<E extends PropertyChangeListener> {
   /** Holds the connected listeners. */
   protected EventListenerList listenerList = new EventListenerList();
   /** Flag to (temporary) disable firing events. Useful if several changes
@@ -34,16 +34,16 @@
    * Adds a listener to the listener list.
    * @param listener a listener
    */
-  public void addSelectionListener(PropertyChangeListener listener) {
-    listenerList.add((Class<PropertyChangeListener>)listener.getClass(), listener);
+  public void addListener(E listener) {
+    listenerList.add((Class<E>)listener.getClass(), listener);
   }
   
   /**
-   * Removes a listener to the listener list.
+   * Removes a listener from the listener list.
    * @param listener a listener
    */
-  public void removeSelectionListener(PropertyChangeListener listener) {
-    listenerList.remove((Class<PropertyChangeListener>)listener.getClass(), listener);
+  public void removeListener(E listener) {
+    listenerList.remove((Class<E>)listener.getClass(), listener);
   }
   
   /**

Modified: trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-05-08 13:47:33 UTC (rev 102)
+++ trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-05-08 13:48:00 UTC (rev 103)
@@ -65,7 +65,7 @@
  *         (University of Bonn/Germany)
  */
 public class FeatureMapLayerSelectionSynchronizer extends
-		StyledLayerSelectionModelSynchronizer<Feature> implements
+		StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel> implements
 		JMapPaneListener {
 	/**
 	 * Holds the {@link MapLayer} to keep synchronized with the layer selection

Modified: trunk/src/skrueger/geotools/selection/StyledFeatureLayerSelectionModel.java
===================================================================
--- trunk/src/skrueger/geotools/selection/StyledFeatureLayerSelectionModel.java	2009-05-08 13:47:33 UTC (rev 102)
+++ trunk/src/skrueger/geotools/selection/StyledFeatureLayerSelectionModel.java	2009-05-08 13:48:00 UTC (rev 103)
@@ -26,30 +26,47 @@
 import org.opengis.filter.Filter;
 
 import schmitzm.geotools.feature.FeatureUtil;
+import skrueger.geotools.StyledFeatureCollectionInterface;
+import skrueger.geotools.StyledFeatureSourceInterface;
 
 import com.vividsolutions.jts.geom.Envelope;
 
 /**
- * This manager takes care of every object selection for a {@link DpLayerVector}
- * in the several atlas components and informs the appropriate components  
- * to keep the selection synchronized.
- * <ul>
- *   <li>Geographical map of the layer</li>
- *   <li>Feature attribute table of the layer</li>
- *   <li>Chart visualizations of the layer</li>
- * </ul>
+ * This manager holds a set of {@link Feature Features} which are <i>selected</i>
+ * in a {@link StyledMapInterface} ({@link StyledFeatureCollectionInterface} or
+ * {@link StyledFeatureSourceInterface}).
  * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
  */
 public class StyledFeatureLayerSelectionModel extends StyledLayerSelectionModel<Feature> {
-	/** A static logger for this class  */
-  private static final Logger LOGGER = Logger.getLogger(StyledFeatureLayerSelectionModel.class);
-  /** Holds the current selection as {@link Style}. */
-  protected Style selectionMapStyle = null;
-  /** Holds the current selection as {@link Filter}. */
-  protected Filter selectionFilter = null;
-  /** Holds the current selection as {@code ChartStyle}.
-   *  TODO: determine an appropriate type for the chart styling. */
-  protected Object selectionChartStyle = null;
+  /**
+   * Creates a new selection model.
+   * @param styledMap styled map the selection is controlled of
+   */
+  public StyledFeatureLayerSelectionModel(StyledFeatureCollectionInterface styledMap) {
+    super(styledMap);
+  }
+  
+  /**
+   * Creates a new selection model.
+   * @param styledMap styled map the selection is controlled of
+   */
+  public StyledFeatureLayerSelectionModel(StyledFeatureSourceInterface styledMap) {
+    super(styledMap);
+  }
+  
+  
+  
+//***********  UNUSED STUFF  **************  
+  
+//	/** A static logger for this class  */
+//  private static final Logger LOGGER = Logger.getLogger(StyledFeatureLayerSelectionModel.class);
+//  /** Holds the current selection as {@link Style}. */
+//  protected Style selectionMapStyle = null;
+//  /** Holds the current selection as {@link Filter}. */
+//  protected Filter selectionFilter = null;
+//  /** Holds the current selection as {@code ChartStyle}.
+//   *  TODO: determine an appropriate type for the chart styling. */
+//  protected Object selectionChartStyle = null;
 //    
 //  /**
 //   * Creates a new selection model.

Modified: trunk/src/skrueger/geotools/selection/StyledLayerSelectionEvent.java
===================================================================
--- trunk/src/skrueger/geotools/selection/StyledLayerSelectionEvent.java	2009-05-08 13:47:33 UTC (rev 102)
+++ trunk/src/skrueger/geotools/selection/StyledLayerSelectionEvent.java	2009-05-08 13:48:00 UTC (rev 103)
@@ -18,24 +18,24 @@
 /**
  * Extends the {@link PropertyChangeEvent} by maintaining the event emitter.
  * The emitter is the {@link StyledLayerSelectionModel} while the event {@link #getSource() source}
- * holds the component which is component which causes the {@link StyledLayerSelectionModel}
+ * holds the component which causes the {@link StyledLayerSelectionModel}
  * to invoke the event (e.g. a chart, a map or a feature table). 
  * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
  */
 public class StyledLayerSelectionEvent extends PropertyChangeEvent {
   /** Holds the {@link StyledLayerSelectionModel} which invokes the event. */
-  protected  StyledLayerSelectionModel emitter = null;
+  protected  StyledLayerSelectionModel<?> emitter = null;
   
   /**
    * Creates a new event.
    * @param emitter      the {@link StyledLayerSelectionModel} which invokes the event
-   * @param source       the object which is responsable for the change (e.g. map or table);
+   * @param source       the object which is responsible for the change (e.g. map or table);
    *                     can be {@code null} if its a refresh event with no responsible
    * @param propertyName the name of the changed property
    * @param oldValue     the old property value (can be <code>null</code>)
    * @param newValue     the new property value (can be <code>null</code>)
    */
-  public StyledLayerSelectionEvent(StyledLayerSelectionModel emitter, Object source, String propertyName, Object oldValue, Object newValue) {
+  public StyledLayerSelectionEvent(StyledLayerSelectionModel<?> emitter, Object source, String propertyName, Object oldValue, Object newValue) {
     super(source, propertyName, oldValue, newValue);
     this.emitter = emitter;
   }
@@ -43,7 +43,7 @@
   /** 
    * Returns the {@link StyledLayerSelectionModel} which invokes the event.
    */
-  public StyledLayerSelectionModel getEmitter() {
+  public StyledLayerSelectionModel<?> getEmitter() {
     return emitter;
   }
 

Modified: trunk/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java	2009-05-08 13:47:33 UTC (rev 102)
+++ trunk/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java	2009-05-08 13:48:00 UTC (rev 103)
@@ -8,7 +8,14 @@
 
 import skrueger.geotools.selection.StyledLayerSelectionModel;
 
-public abstract class StyledLayerSelectionModelSynchronizer<E> implements PropertyChangeListener{
+/**
+ * The {@link StyledLayerSelectionModelSynchronizer} is the super class for all
+ * 
+ * @author mojays
+ *
+ * @param <E>
+ */
+public abstract class StyledLayerSelectionModelSynchronizer<E extends StyledLayerSelectionModel<?>> implements PropertyChangeListener{
 	protected final Logger LOGGER = Logger.getLogger(this.getClass());
 	
 	  /** Flag to avoid event circles between {@link DpLayerVectorSelectionModel}
@@ -16,7 +23,7 @@
 	  protected boolean selectionChangeCausedByMe = false;
 	  /** Holds the selection model of the layer to keep synchronized
 	   *  with the feature table. */
-	  protected final StyledLayerSelectionModel<E> layerSelModel;
+	  protected final E layerSelModel;
 
 	  /**
 		 * Creates a new synchronizer
@@ -24,8 +31,7 @@
 		 * @param layerSelModel
 		 *            layer selection model to keep synchronized with 
 		 */
-		protected StyledLayerSelectionModelSynchronizer(
-				StyledLayerSelectionModel<E> layerSelModel) {
+		protected StyledLayerSelectionModelSynchronizer(E layerSelModel) {
 
 			this.layerSelModel = layerSelModel;
 		}

Modified: trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java	2009-05-08 13:47:33 UTC (rev 102)
+++ trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java	2009-05-08 13:48:00 UTC (rev 103)
@@ -50,9 +50,7 @@
  * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
  *         (University of Bonn/Germany)
  */
-public class TableSelectionSynchronizer extends
-		StyledLayerSelectionModelSynchronizer<Feature> implements
-		ListSelectionListener {
+public class TableSelectionSynchronizer extends StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel> implements ListSelectionListener {
 	/**
 	 * Holds the table to keep synchronized with the layer selection model.
 	 */
@@ -69,9 +67,7 @@
 	 * @param table
 	 *            table to keep synchronized with the layer selection model
 	 */
-	public TableSelectionSynchronizer(
-			StyledFeatureLayerSelectionModel layerSelModel, JTable table) {
-
+	public TableSelectionSynchronizer(StyledFeatureLayerSelectionModel layerSelModel, JTable table) {
 		super(layerSelModel);
 
 		TableModel model = table.getModel();



More information about the Schmitzm-commits mailing list