[Schmitzm-commits] r71 - in trunk: dist src/schmitzm/geotools/feature src/schmitzm/geotools/gui src/schmitzm/swing/event

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Apr 20 20:34:45 CEST 2009


Author: mojays
Date: 2009-04-20 20:34:43 +0200 (Mon, 20 Apr 2009)
New Revision: 71

Added:
   trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java
Modified:
   trunk/dist/schmitzm-src.zip
   trunk/dist/schmitzm.jar
   trunk/src/schmitzm/geotools/feature/FeatureUtil.java
   trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
Log:
new PropertyChangeEmitter

Modified: trunk/dist/schmitzm-src.zip
===================================================================
(Binary files differ)

Modified: trunk/dist/schmitzm.jar
===================================================================
(Binary files differ)

Modified: trunk/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2009-04-20 12:26:00 UTC (rev 70)
+++ trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2009-04-20 18:34:43 UTC (rev 71)
@@ -41,12 +41,14 @@
 import org.geotools.feature.IllegalAttributeException;
 import org.geotools.feature.SchemaException;
 import org.geotools.feature.type.GeometricAttributeType;
+import org.geotools.filter.FilterFactoryImpl;
 import org.geotools.map.MapLayer;
+import org.geotools.styling.Graphic;
+import org.geotools.styling.Mark;
 import org.geotools.styling.Style;
 import org.geotools.styling.StyleBuilder;
 import org.geotools.styling.Symbolizer;
-import org.geotools.styling.Mark;
-import org.geotools.styling.Graphic;
+import org.geotools.filter.FilterFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 
 import schmitzm.lang.LangUtil;
@@ -90,6 +92,9 @@
   /** Instance of AttributeTypeFactory. */
   public static final AttributeTypeFactory ATTRTYPE_FACTORY = AttributeTypeFactory.defaultInstance();
 
+  /** Instance of {@link FilterFactory}. */
+  public static final FilterFactory FILTER_FACTORY = new FilterFactoryImpl();
+  
   /** Join-Types. */
   public static enum JoinType {
     /** The feature of the left collection is taken into the result, even

Modified: trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java	2009-04-20 12:26:00 UTC (rev 70)
+++ trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java	2009-04-20 18:34:43 UTC (rev 71)
@@ -1,3 +1,13 @@
+/** SCHMITZM - This file is part of the java library of Martin O.J. Schmitz (SCHMITZM)
+
+    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+    You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
+
+    Diese Bibliothek ist freie Software; Sie dürfen sie unter den Bedingungen der GNU Lesser General Public License, wie von der Free Software Foundation veröffentlicht, weiterverteilen und/oder modifizieren; entweder gemäß Version 2.1 der Lizenz oder (nach Ihrer Option) jeder späteren Version.
+    Diese Bibliothek wird in der Hoffnung weiterverbreitet, daß sie nützlich sein wird, jedoch OHNE IRGENDEINE GARANTIE, auch ohne die implizierte Garantie der MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Mehr Details finden Sie in der GNU Lesser General Public License.
+    Sie sollten eine Kopie der GNU Lesser General Public License zusammen mit dieser Bibliothek erhalten haben; falls nicht, schreiben Sie an die Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
+ **/
 package schmitzm.geotools.gui;
 
 import java.awt.Insets;

Added: trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java
===================================================================
--- trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java	2009-04-20 12:26:00 UTC (rev 70)
+++ trunk/src/schmitzm/swing/event/PropertyChangeEmitter.java	2009-04-20 18:34:43 UTC (rev 71)
@@ -0,0 +1,71 @@
+/** SCHMITZM - This file is part of the java library of Martin O.J. Schmitz (SCHMITZM)
+
+    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+    You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
+
+    Diese Bibliothek ist freie Software; Sie dürfen sie unter den Bedingungen der GNU Lesser General Public License, wie von der Free Software Foundation veröffentlicht, weiterverteilen und/oder modifizieren; entweder gemäß Version 2.1 der Lizenz oder (nach Ihrer Option) jeder späteren Version.
+    Diese Bibliothek wird in der Hoffnung weiterverbreitet, daß sie nützlich sein wird, jedoch OHNE IRGENDEINE GARANTIE, auch ohne die implizierte Garantie der MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Mehr Details finden Sie in der GNU Lesser General Public License.
+    Sie sollten eine Kopie der GNU Lesser General Public License zusammen mit dieser Bibliothek erhalten haben; falls nicht, schreiben Sie an die Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
+ **/
+package schmitzm.swing.event;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.EventListener;
+import java.util.Vector;
+
+import javax.swing.event.EventListenerList;
+
+/**
+ * This class provides a super class for all classes which initiates
+ * {@link PropertyChangeEvent PropertyChangeEvents} to
+ * {@link PropertyChangeListener PropertyChangeListeners}. 
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
+ */
+public abstract class PropertyChangeEmitter {
+  /** Holds the connected listeners. */
+  protected EventListenerList listenerList = new EventListenerList();
+  /** Flag to (temporary) disable firing events. Useful if several changes
+   *  should be performed and fired collectively. */
+  protected boolean eventFiringEnabled = true;
+
+  /**
+   * Adds a listener to the listener list.
+   * @param listener a listener
+   */
+  public void addSelectionListener(PropertyChangeListener listener) {
+    listenerList.add((Class<PropertyChangeListener>)listener.getClass(), listener);
+  }
+  
+  /**
+   * Removes a listener to the listener list.
+   * @param listener a listener
+   */
+  public void removeSelectionListener(PropertyChangeListener listener) {
+    listenerList.remove((Class<PropertyChangeListener>)listener.getClass(), listener);
+  }
+  
+  /**
+   * Fires the {@link PropertyChangeEvent} to all connected
+   * {@link PropertyChangeListener PropertyChangeListeners} except
+   * the specified ones. Does nothing if {@link #eventFiringEnabled} is
+   * set to {@code false}.
+   * @param e an event
+   * @param exceptListeners listeners which are not notified (useful to avoid
+   *                        event circles)
+   */
+  protected void firePropertyChangeEvent(PropertyChangeEvent e, PropertyChangeListener... exceptListeners) {
+    if ( !eventFiringEnabled )
+      return;
+
+    Vector<PropertyChangeListener> exceptList = new Vector<PropertyChangeListener>();
+    for (PropertyChangeListener l : exceptListeners)
+      exceptList.add(l);
+    
+    for (PropertyChangeListener listener : listenerList.getListeners(PropertyChangeListener.class))
+      if ( !exceptList.contains(listener))
+        listener.propertyChange(e);
+  }
+
+}



More information about the Schmitzm-commits mailing list