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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 8 17:02:28 CEST 2009


Author: alfonx
Date: 2009-05-08 17:02:28 +0200 (Fri, 08 May 2009)
New Revision: 105

Modified:
   trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java
   trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
   trunk/src/skrueger/geotools/selection/StyledLayerSelectionModel.java
   trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java
Log:
(Hacking Session in action - atomic commits can't be ensured)


Modified: trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java
===================================================================
--- trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java	2009-05-08 13:49:34 UTC (rev 104)
+++ trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java	2009-05-08 15:02:28 UTC (rev 105)
@@ -25,7 +25,7 @@
  */
 public abstract class PropertyChangeEmitter<E extends PropertyChangeListener> {
   /** Holds the connected listeners. */
-  protected EventListenerList listenerList = new EventListenerList();
+  protected Vector<E> listenerList = new Vector<E>();
   /** Flag to (temporary) disable firing events. Useful if several changes
    *  should be performed and fired collectively. */
   protected boolean eventFiringEnabled = true;
@@ -35,7 +35,7 @@
    * @param listener a listener
    */
   public void addListener(E listener) {
-    listenerList.add((Class<E>)listener.getClass(), listener);
+    listenerList.add(listener);
   }
   
   /**
@@ -43,7 +43,7 @@
    * @param listener a listener
    */
   public void removeListener(E listener) {
-    listenerList.remove((Class<E>)listener.getClass(), listener);
+    listenerList.remove(listener);
   }
   
   /**
@@ -63,9 +63,10 @@
     for (PropertyChangeListener l : exceptListeners)
       exceptList.add(l);
     
-    for (PropertyChangeListener listener : listenerList.getListeners(PropertyChangeListener.class))
+    for (PropertyChangeListener listener : listenerList){
       if ( !exceptList.contains(listener))
         listener.propertyChange(e);
+    }
   }
 
 }

Modified: trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-05-08 13:49:34 UTC (rev 104)
+++ trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-05-08 15:02:28 UTC (rev 105)
@@ -149,7 +149,6 @@
 				// TODO This clone is a deep clone and it is slow.. 
 				selectionMapStyle =  StylingUtil.clone(originalStyle);
 				
-				Rule[] rules = selectionMapStyle.getFeatureTypeStyles()[0].getRules();
 				
 				Rule selectedRule = StylingUtil.STYLE_FACTORY.createRule();
 				selectedRule.setFilter(new Filter() {
@@ -164,7 +163,11 @@
 						if (obj instanceof Feature) {
 							Feature f = (Feature)obj;
 							LOGGER.info("treffer");
-							return newSelection.contains(f);
+							// TODO BAD CODE
+							for (Feature ff : newSelection){
+								if (ff.getID().equals(f.getID())) return true;
+							}
+							return false;
 							
 						}
 						LOGGER.info("kein treffer");
@@ -173,20 +176,21 @@
 					
 				});
 				
-				Symbolizer[] symbolizers = selectedRule.getSymbolizers();
-				Style selectedStyle = StylingUtil.createDefaultStyle(styledMapLayer.getGeoObject());
-				LangUtil.extendArray(symbolizers, selectedStyle);
-				selectedRule.setSymbolizers(symbolizers);
+				Style defaultStyle = StylingUtil.createDefaultStyle(styledMapLayer.getGeoObject());
+				selectedRule.setSymbolizers(new Symbolizer[] {defaultStyle.getFeatureTypeStyles()[0].getRules()[0].getSymbolizers()[0]} );
 				
-				LangUtil.extendArray(rules, selectedRule);
+				Rule[] rules = selectionMapStyle.getFeatureTypeStyles()[0].getRules();
+				rules = LangUtil.extendArray(rules, selectedRule);
 				
+				selectionMapStyle.getFeatureTypeStyles()[0].setRules(rules);
+				
 //				selectionMapStyle.setFeatureTypeStyles(originalStyle.getF)
 				
 				// Flat copy the style
 				
+//				selectionMapStyle = StylingUtil.createDefaultStyle(styledMapLayer.getGeoObject());
 				
 				
-				
 			}
 
 			mapLayer.setStyle(selectionMapStyle);
@@ -212,10 +216,15 @@
 
 	@Override
 	public void performMapPaneEvent(JMapPaneEvent e) {
-		if (!(e instanceof FeatureSelectedEvent))
+		
+		if (!(e instanceof FeatureSelectedEvent)) {
+			LOGGER.debug("Ignoring event "+e);
 			return;
+		}
 
 		FeatureSelectedEvent fse = (FeatureSelectedEvent) e;
+		LOGGER.debug("Do event "+fse);
+		LOGGER.debug("Do event "+fse.getSelectionResult());
 
 		// ignore event if it is caused by the DpLayerVectorSelectionModel
 		if (selectionChangeCausedByMe)

Modified: trunk/src/skrueger/geotools/selection/StyledLayerSelectionModel.java
===================================================================
--- trunk/src/skrueger/geotools/selection/StyledLayerSelectionModel.java	2009-05-08 13:49:34 UTC (rev 104)
+++ trunk/src/skrueger/geotools/selection/StyledLayerSelectionModel.java	2009-05-08 15:02:28 UTC (rev 105)
@@ -48,7 +48,7 @@
   protected EventListenerList listenerList = new EventListenerList();
 
   /** Holds the current selection (e.g. {@link Feature Features}). */
-  protected final Set<E> selectionObjects;
+  protected final HashSet<E> selectionObjects;
 
   /** Holds the styled map whose selection is managed by this class. */
   protected final StyledMapInterface<?> styledMap;

Modified: trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java	2009-05-08 13:49:34 UTC (rev 104)
+++ trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java	2009-05-08 15:02:28 UTC (rev 105)
@@ -105,6 +105,9 @@
 		Vector<Feature> newSelection = layerSelModel.getSelection();
 		if (newSelection == null)
 			return;
+		
+		LOGGER.debug("Table pop changed "+selEvt);
+		LOGGER.debug("Table pop changed to "+newSelection);
 
 		// Avoid event circles in valueChanged(..)
 		selectionChangeCausedByMe = true;



More information about the Schmitzm-commits mailing list