[Schmitzm-commits] r121 - in trunk: dist src/org/geotools/renderer/lite/gridcoverage2d src/schmitzm/geotools/feature src/schmitzm/geotools/gui src/schmitzm/geotools/gui/resource/locales src/schmitzm/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 18 16:15:45 CEST 2009


Author: mojays
Date: 2009-05-18 16:15:42 +0200 (Mon, 18 May 2009)
New Revision: 121

Modified:
   trunk/dist/schmitzm-src.zip
   trunk/dist/schmitzm.jar
   trunk/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java
   trunk/src/schmitzm/geotools/feature/FeatureOperationTreeFilter.java
   trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
   trunk/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java
   trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle.properties
   trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties
   trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_fr.properties
   trunk/src/schmitzm/swing/ExceptionDialog.java
Log:
FeatureFilterPanel
- "TEST" used as default button
- dialog with details for error
FeatureLayerFilterDialog
- OK/APPLY buttons disables on errors
ExceptionDialog
- details can be shown as default
FeatureOperationTreeFilter
- exception is not caught in evaluate(.) to show errors in parent components

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

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

Modified: trunk/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java
===================================================================
--- trunk/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java	2009-05-18 14:15:42 UTC (rev 121)
@@ -41,16 +41,18 @@
 import org.opengis.coverage.grid.GridCoverage;
 import org.opengis.filter.expression.Expression;
 
+//ms-01.sn (only if the whole SCHMITZ library is available
 import schmitzm.geotools.styling.StylingUtil;
 import schmitzm.lang.LangUtil;
+//ms-01.en
 
 /**
  * A helper class for {@link GridCoverage} objects rendering SLD stylers
  * support.
- * 
+ *
  * @author Alessio Fabiani
  * @author Simone Giannecchini
- * 
+ *
  * @task Optimize and complete
  * @source $URL:
  *         http://svn.geotools.org/geotools/branches/coverages_branch/trunk/gt/module/render/src/org/geotools/renderer/lite/RasterSymbolizerSupport.java $
@@ -65,21 +67,21 @@
        *  in the {@link GridCoverage2D}. */
       GT_CLASSIC,
       /** Alternative way of <a href="">Martin Schmitz</a>. The {@link GridCoverage2D}
-       *  is resampled accordingly to the given color map. */ 
+       *  is resampled accordingly to the given color map. */
       MS_EXTENTION
     }
     /** The way the recoloring is processed. */
-    public static RECOLOR_MODE_TYPE RECOLOR_MODE = RECOLOR_MODE_TYPE.MS_EXTENTION; 
+    public static RECOLOR_MODE_TYPE RECOLOR_MODE = RECOLOR_MODE_TYPE.MS_EXTENTION;
 //ms-01.en
-    
+
     /** The Styled Layer Descriptor * */
     private final RasterSymbolizer symbolizer;
 
     /**
      * Constructor
-     * 
+     *
      * @param symbolizer
-     * 
+     *
      */
     public RasterSymbolizerSupport(final RasterSymbolizer symbolizer) {
         this.symbolizer = symbolizer;
@@ -91,7 +93,7 @@
             throw new IllegalArgumentException(
                     "Cannot Recolor GridCoverage: GridCoverage2D is needed.");
         }
-        
+
         // final ColorMap map = symbolizer.getColorMap();
         // if (map == null)
         // throw new IllegalArgumentException(
@@ -227,9 +229,9 @@
             return null;
         }
         Color color = (Color) exp.evaluate(null, Color.class);
-        int alpha = new Double(Math.ceil(255.0 * opacity)).intValue();        
-        if( color != null ){                       
-            return new Color( color.getRed(), color.getGreen(), color.getBlue(), alpha );            
+        int alpha = new Double(Math.ceil(255.0 * opacity)).intValue();
+        if( color != null ){
+            return new Color( color.getRed(), color.getGreen(), color.getBlue(), alpha );
         }
         else {
             // the value morphing code failed us .. let's try by hand
@@ -238,7 +240,7 @@
                 return null;
             }
             Integer  intval = Integer.decode((String) obj);
-            int i = intval.intValue();            
+            int i = intval.intValue();
             return new Color((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF, alpha);
         }
     }
@@ -246,7 +248,7 @@
         if (opacity == null) {
             return 1.0;
         }
-         
+
         Double value = (Double) opacity.evaluate(null, Double.class);
         if (value == null) {
             return 1.0;
@@ -269,23 +271,25 @@
       Double value = (Double) quantity.evaluate(null, Double.class);
       if (value == null)
           return 0.0;
-      return value.doubleValue();    
+      return value.doubleValue();
     }
 
     /**
      * Extends an array with new values.
-     * @param source source array 
+     * @param source source array
      * @param newElem new elements the array is extended with
      * @return a new array object
      */
     private static <T> T[] extendArray(T[] source, T... newElem) {
+//ms: if SCHMITZM library is available:
       return LangUtil.extendArray(source, newElem);
+//ms: if SCHMITZM library is NOT available:
 //      T[] newArray =  java.util.Arrays.copyOf(source, source.length+newElem.length);
 //      for (int i=0; i<newElem.length; i++)
 //        newArray[source.length+i] = newElem[i];
 //      return newArray;
     }
-    
+
     public GridSampleDimension transformColormap(GridSampleDimension dimension, RasterSymbolizer symbolizer) {
       if ( symbolizer == null || symbolizer.getColorMap() == null )
         return dimension;
@@ -314,7 +318,7 @@
           sampleQuanFactor *= 10;
       }
       //////////////////////////////////////////////////////////
-      
+
       for ( ColorMapEntry cme : colorMap.getColorMapEntries() ) {
         double opacity     = toOpacity(cme.getOpacity());
         Color  color       = toColor(cme.getColor(), opacity);
@@ -327,11 +331,11 @@
         geoQuantMax        = Math.max(geoQuantMax, geoQuant);
         // create a sample quantity which is different from the geophysics value,
         // so a GeophysicsCategory is created
-        //int    sampleQuan  = (int)Math.round(geoQuant)*10 + 1;  
+        //int    sampleQuan  = (int)Math.round(geoQuant)*10 + 1;
         int    sampleQuan  = (int)Math.round(geoQuant*sampleQuanFactor) + 1;
         sampleQuantMin     = Math.min(sampleQuantMin, sampleQuan);
         sampleQuantMax     = Math.max(sampleQuantMax, sampleQuan);
-        
+
         // if a category for the label already exists, treat this
         // as a range definition; otherwise create a single value
         // Category
@@ -355,11 +359,11 @@
               new NumberRange(sampleQuan, sampleQuan),
               new NumberRange(geoQuant,   geoQuant)
           ));
-        
+
       }
-      
+
       // if no categories are defined by color map do not resample; instead use
-      // the existing categories (and the grid/image internal color definition) 
+      // the existing categories (and the grid/image internal color definition)
       if ( categories.isEmpty() )
         return dimension;
 
@@ -373,7 +377,7 @@
         sampleQuantMax = Math.max(sampleQuantMax, (int)noDataValue);
         categories.put(String.valueOf("NoData_"+noDataValue), createNoDataCategory(value, noDataValue));
       }
-      
+
       // Declare "all" values smaller/greater the color map values
       // automatically as NoData
       final int lowerStart = Integer.MIN_VALUE;
@@ -393,7 +397,7 @@
             new NumberRange(lowerStart,       geoQuantMin-1)
         ));
       //categories.put("_autoNoData2_", Category.NODATA);
-      
+
       // Create the GridSampleDimension
       GridSampleDimension gsd = new GridSampleDimension(
           dimension.getDescription().toString(),
@@ -414,7 +418,9 @@
      * @param geoValue geophysics value representing the NoData
      */
     public static Category createNoDataCategory(int value, double geoValue) {
+//ms: if SCHMITZM library is available:
       return StylingUtil.createNoDataCategory(value, geoValue);
+//ms: if SCHMITZM library is NOT available:
 //      return new Category(
 //          Vocabulary.formatInternational(VocabularyKeys.NODATA),
 //          new Color[] { new Color(0,0,0,0) },
@@ -423,7 +429,7 @@
 //      );
     }
 //ms-01.en
-    
+
     /**
      * Transform the supplied RGB colors.
      */

Modified: trunk/src/schmitzm/geotools/feature/FeatureOperationTreeFilter.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/FeatureOperationTreeFilter.java	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/schmitzm/geotools/feature/FeatureOperationTreeFilter.java	2009-05-18 14:15:42 UTC (rev 121)
@@ -56,18 +56,19 @@
 	 * 
 	 * @param feature
 	 *            zu ueberpruefendes Feature
-	 * @return {@code true}, wenn die Auswertung
+	 * @return {@code true}, wenn das Feature dem Filter entspricht
 	 */
 	public boolean evaluate(Feature feature) {
-		 try{
-		Object result = opTree.evaluate(feature);
-		return result instanceof Boolean && (Boolean) result
-				|| result instanceof Number
-				&& ((Number) result).doubleValue() != 0;
-		 } catch (Exception e){
-		 e.printStackTrace();
-		 return false;
-		 }
+// Exception sollte hier nicht ausgegeben werden, da bei allgemeinen Fehlern
+// die Exception fuer JEDES Feature ausgegeben wuerde!	  
+//	  try{
+	    Object result = opTree.evaluate(feature);
+	    return result instanceof Boolean && (Boolean) result
+	        || result instanceof Number  && ((Number) result).doubleValue() != 0;
+//  	  } catch (Exception e){
+//  	    e.printStackTrace(); 
+//  	    return false;
+//  	  }
 	}
 
   /**

Modified: trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java	2009-05-18 14:15:42 UTC (rev 121)
@@ -10,18 +10,28 @@
  **/
 package schmitzm.geotools.gui;
 
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
 import java.awt.Insets;
 import java.awt.GridBagConstraints;
 import java.awt.event.ActionListener;
 import java.awt.event.ActionEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+
+import javax.swing.AbstractAction;
 import javax.swing.JButton;
 import javax.swing.JLabel;
 import javax.swing.ListSelectionModel;
 import javax.swing.JTextField;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
+
 import java.util.Map;
 
+import schmitzm.swing.ExceptionDialog;
 import schmitzm.swing.SwingUtil;
 import schmitzm.geotools.feature.AttributeTypeFilter;
 
@@ -33,9 +43,10 @@
 import schmitzm.geotools.feature.FeatureOperationTree;
 import schmitzm.geotools.feature.FeatureOperationTreeParser;
 import schmitzm.geotools.feature.FeatureOperationTreeFilter;
+import skrueger.swing.OkButton;
 
 /**
- * Diese Klasse stellt ein Panel zur Vefuegung, mit der ein
+ * Diese Klasse stellt ein Panel zur Verfuegung, mit der ein
  * {@link FeatureOperationTreeFilter} in Form einer arithmetischen
  * (und boolschen) Formel erstellt werden kann. Neben den Komponenten zur
  * Definition/Eingabe des Filters enthaelt das Panel einen Vorschau-Bereich,
@@ -61,6 +72,13 @@
    *  @see #layoutConstraints
    *  @see #testButton */
   public static final String TESTRESULT_LABEL = FeatureCollectionFilterPanel.class.getName()+".TestResultLabel";
+  /** Konstante fuer die Layout-Constraints des Details-Button.
+   *  @see #layoutConstraints
+   *  @see #testResultDetails */
+  public static final String TESTRESULTDETAILS_BUTTON = FeatureCollectionFilterPanel.class.getName()+".TestResultDetailsButton";
+  /** Konstante fuer den Tooltip des Details-Button.
+   *  @see #testResultDetails */
+  public static final String TESTRESULTDETAILS_TOOLTIP = FeatureCollectionFilterPanel.class.getName()+".TestResultDetailsToolTip";
 
   /** Panel fuer Filter-Vorschau. */
   private FeatureTablePane previewPanel = null;
@@ -68,11 +86,16 @@
   protected JButton testButton = null;
   /** Label mit Ergebnis des Formel-Tests */
   protected JLabel  testResult = null;
+  /** Button fuer Details des Formel-Tests-Ergebnis */
+  protected JButton  testResultDetails = null;
 
   /** Speichert, ob im Vorschau-Panel eine grafische Anzeige erscheinen soll */
   private boolean geomPrev = false;
   /** Speichert, die FeatureCollection */
   private FeatureCollection fc = null;
+  
+  /** Speichert den letzten Fehler in der Filter-Regel. */
+  protected Throwable testError = null;
 
   /**
    * Erzeugt ein neues Panel.
@@ -101,9 +124,10 @@
     layoutConstraints.get( ATTRIBUTE_TABLE ).weighty       = 0.3;
     layoutConstraints.get( RULE_TEXTFIELD ).gridwidth      = 2;
     layoutConstraints.get( OPERATOR_COMBOBOX ).gridx       = 2;
-    layoutConstraints.put( TEST_BUTTON,      new GridBagConstraints(0,4,1,1,  0,  0.0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,10,10,10),0,0) );
-    layoutConstraints.put( TESTRESULT_LABEL, new GridBagConstraints(1,4,2,1,1.0,  0.0,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5,10,10,10),0,0) );
-    layoutConstraints.put( PREVIEW_PANEL,    new GridBagConstraints(0,5,3,1,  0,  0.7,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,10,10,10),0,0) );
+    layoutConstraints.put( TEST_BUTTON,              new GridBagConstraints(0,4,1,1,  0,  0.0,GridBagConstraints.WEST,   GridBagConstraints.NONE, new Insets(5,10,10,10),0,0) );
+    layoutConstraints.put( TESTRESULT_LABEL,         new GridBagConstraints(1,4,2,1,1.0,  0.0,GridBagConstraints.WEST,   GridBagConstraints.HORIZONTAL, new Insets(5,10,10,10),0,0) );
+    layoutConstraints.put( TESTRESULTDETAILS_BUTTON, new GridBagConstraints(2,4,1,1,  0,  0.0,GridBagConstraints.EAST,   GridBagConstraints.NONE, new Insets(5,10,10,10),0,0) );
+    layoutConstraints.put( PREVIEW_PANEL,            new GridBagConstraints(0,5,3,1,  0,  0.7,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,10,10,10),0,0) );
 
     if ( initGUI )
       initGUI();
@@ -119,15 +143,28 @@
 		super.initGUI();
 
 		// Button zum Testen des Filters
-		testButton = new JButton(GeotoolsGUIUtil.RESOURCE
-				.getString(TEST_BUTTON));
+		testButton = new JButton(GeotoolsGUIUtil.RESOURCE.getString(TEST_BUTTON));
 		testButton.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent e) {
 				performRuleTest();
 			}
 		});
+		
+		// Button fuer Details des Test-Ergebnis
+		testResultDetails = new JButton( GeotoolsGUIUtil.RESOURCE.getString(TESTRESULTDETAILS_BUTTON) );
+		testResultDetails.setVisible(false);
+		testResultDetails.setToolTipText( GeotoolsGUIUtil.RESOURCE.getString(TESTRESULTDETAILS_TOOLTIP) );
+		testResultDetails.addActionListener( new ActionListener() {
+		  public void actionPerformed(ActionEvent e) {
+		    ExceptionDialog.show(FeatureCollectionFilterPanel.this, testError, true);
+		  }
+		});
+		
 		// Label fuer Fehler-Meldungen
 		testResult = new JLabel("");
+		// Schrift: rot und fett
+		testResult.setForeground( Color.RED );
+		testResult.setFont( testResult.getFont().deriveFont(Font.BOLD) );
 
 		if (getPreviewPanel() == null)
 			setPreviewPanel(new FeatureTablePane(null, geomPrev) {
@@ -139,8 +176,7 @@
 					super.initGUI(geomPreview);
 					// nur einzelne Zellen duerfen selektiert werden
 					featuresTable.setColumnSelectionAllowed(true);
-					featuresTable
-							.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+					featuresTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
 					// beim Klick auf eine Tabellenzelle, soll der Wert in die
 					// Formel
 					// uebernommen werden
@@ -172,9 +208,25 @@
 		SwingUtil.setPreferredHeight(getPreviewPanel(), 50);
 
 		// zusaetzliche Komponenten einfuegen
-		add(testButton, layoutConstraints.get(TEST_BUTTON));
-		add(testResult, layoutConstraints.get(TESTRESULT_LABEL));
+		add(testButton,        layoutConstraints.get(TEST_BUTTON));
+        add(testResultDetails, layoutConstraints.get(TESTRESULTDETAILS_BUTTON));
+        add(testResult,        layoutConstraints.get(TESTRESULT_LABEL));
 		add(getPreviewPanel(), layoutConstraints.get(PREVIEW_PANEL));
+		
+		// listen to the moment, the panel is inserted into a frame
+		// and then set the TEST-Button the default button
+		addAncestorListener( new AncestorListener() {
+          @Override
+          public void ancestorAdded(AncestorEvent event) {
+            if ( getRootPane() != null && getRootPane().getDefaultButton() == null )
+              getRootPane().setDefaultButton(testButton);
+            
+          }
+          @Override
+          public void ancestorMoved(AncestorEvent event) {}
+          @Override
+          public void ancestorRemoved(AncestorEvent event) {}
+		});
 	}
 
   /**
@@ -242,13 +294,24 @@
     try {
       FeatureCollection subCollection = filterFeatureCollection();
       getPreviewPanel().setFeatureCollection( subCollection );
-      testResult.setText("");
+      resetComponentsAfterTest(null);
     } catch (Exception err) {
       getPreviewPanel().setFeatureCollection( null );
-      testResult.setText( err.getMessage() );
+      resetComponentsAfterTest(err);
     }
     rule.grabFocus();
   }
+  
+  /**
+   * (De)aktiviert Label und Button fuer die Fehlermeldung entsprechend einer etwaigen
+   * Fehlermeldung. Wird ausgefuehrt nachdem der "Test"-Button geklickt wurde.
+   * @param err Fehler (kann {@code null} sein)
+   */
+  protected void resetComponentsAfterTest(Throwable err) {
+    testError = err;
+    testResult.setText( err != null ? err.getMessage() : "" );
+    testResultDetails.setVisible( err != null );
+  }
 
   /**
    * Setzt die {@link FeatureCollection}, die (gefiltert) in der Vorschau angezeigt

Modified: trunk/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java	2009-05-18 14:15:42 UTC (rev 121)
@@ -112,7 +112,15 @@
    * Initalisiert die GUI.
    */
   protected void initGUI() throws IOException {
-    filterPanel = new FeatureCollectionFilterPanel( layer.getFeatureSource().getFeatures(), true );
+    filterPanel = new FeatureCollectionFilterPanel( layer.getFeatureSource().getFeatures(), true ) {
+      @Override
+      protected void resetComponentsAfterTest(Throwable err) {
+        super.resetComponentsAfterTest(err);
+        // OK- und Uebernehmen-Button (de)aktivieren
+        okButton.setEnabled( err == null );
+        applyButton.setEnabled( err == null );
+      }
+    };
     okButton = new JButton( SwingUtil.RESOURCE.getString("Ok") );
     cancelButton = new JButton( SwingUtil.RESOURCE.getString("Cancel") );
     applyButton = new JButton( SwingUtil.RESOURCE.getString("Apply") );

Modified: trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle.properties
===================================================================
--- trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle.properties	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle.properties	2009-05-18 14:15:42 UTC (rev 121)
@@ -17,7 +17,8 @@
 schmitzm.geotools.feature.FeatureTableModel.AttrType=Type
 schmitzm.geotools.feature.FeatureTableModel.AttrValue=Value
 schmitzm.geotools.gui.FeatureCollectionFilterPanel.TestButton=Test filter
-schmitzm.geotools.gui.FeatureLayerFilterDialog.TITLE=Feature-Filter
+schmitzm.geotools.gui.FeatureCollectionFilterPanel.TestResultDetailsButton=?
+schmitzm.geotools.gui.FeatureCollectionFilterPanel.TestResultDetailsToolTip=Show error details...
 schmitzm.geotools.gui.MapActionControlPane.INFO=Info
 schmitzm.geotools.gui.MapActionControlPane.ZOOM_IN=Zoom in
 schmitzm.geotools.gui.MapActionControlPane.ZOOM_OUT=Zoom out

Modified: trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties
===================================================================
--- trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_de.properties	2009-05-18 14:15:42 UTC (rev 121)
@@ -14,6 +14,7 @@
 org.geotools.styling.StyleBuilder.MARK_X=X
 
 schmitzm.geotools.gui.FeatureCollectionFilterPanel.TestButton=Filter testen
+schmitzm.geotools.gui.FeatureCollectionFilterPanel.TestResultDetailsToolTip=Fehler-Details anzeigen...
 schmitzm.geotools.gui.FeatureLayerFilterDialog.TITLE=Feature-Filter
 schmitzm.geotools.gui.MapActionControlPane.ZOOM_IN=Heran zoomen
 schmitzm.geotools.gui.MapActionControlPane.ZOOM_OUT=Heraus zoomen

Modified: trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_fr.properties
===================================================================
--- trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_fr.properties	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/schmitzm/geotools/gui/resource/locales/GTResourceBundle_fr.properties	2009-05-18 14:15:42 UTC (rev 121)
@@ -17,6 +17,7 @@
 schmitzm.geotools.feature.FeatureTableModel.AttrType=type de données
 schmitzm.geotools.feature.FeatureTableModel.AttrValue=valeur
 schmitzm.geotools.gui.FeatureCollectionFilterPanel.TestButton=Tester le filtre
+schmitzm.geotools.gui.FeatureCollectionFilterPanel.TestResultDetailsToolTip=Afficher erreur au détail...
 schmitzm.geotools.gui.FeatureLayerFilterDialog.TITLE=Filtre de Feature
 schmitzm.geotools.gui.MapActionControlPane.ZOOM_IN=Zoom avant
 schmitzm.geotools.gui.MapActionControlPane.ZOOM_OUT=Zoom arrière

Modified: trunk/src/schmitzm/swing/ExceptionDialog.java
===================================================================
--- trunk/src/schmitzm/swing/ExceptionDialog.java	2009-05-16 21:25:44 UTC (rev 120)
+++ trunk/src/schmitzm/swing/ExceptionDialog.java	2009-05-18 14:15:42 UTC (rev 121)
@@ -80,6 +80,20 @@
    *                   (kann <code>null</code> sein!)
    */
   public ExceptionDialog(Component parent, Throwable err, String title, String errMessage) {
+    this(parent,err,title,errMessage,false);
+  }
+  
+  /**
+   * Erzeugt einen neuen Fehler-Dialog. Der Dialog wird relativ zum Parent-Fenster
+   * zentriert.
+   * @param parent     uebergeordnetes Fenster (kann <code>null</code> sein!)
+   * @param err        darzustellender Fehler
+   * @param title      Titel fuer das Fenster (kann <code>null</code> sein!)
+   * @param errMessage Meldung, die zu dem Fehler angezeigt angezeigt wird
+   *                   (kann <code>null</code> sein!)
+   * @param showDetails wenn {@code true} werden die Details initial angezeigt
+   */
+  public ExceptionDialog(Component parent, Throwable err, String title, String errMessage, boolean showDetails) {
     super((Frame)null,true);
     if ( err != null && (title==null || title.trim().equals("")) )
       title = err.getClass().getSimpleName();
@@ -90,12 +104,12 @@
     this.err               = err;
     this.messageLabel      = new JLabel(errMessage);
     this.okButton          = new JButton( SwingUtil.RESOURCE.getString("Ok") );
-    this.detailsButton     = new JToggleButton( SwingUtil.RESOURCE.getString("Details"), false );
+    this.detailsButton     = new JToggleButton( SwingUtil.RESOURCE.getString("Details"), showDetails );
     this.detailsTextArea   = new JTextArea(10,60);
     this.detailsTextArea.setEditable(false);
     this.detailsPrintStream = new TextAreaPrintStream(detailsTextArea);
     this.detailsScrollPane  = new JScrollPane(detailsTextArea);
-    this.detailsScrollPane.setVisible(false);
+    this.detailsScrollPane.setVisible(showDetails);
     this.setError(err);
     JOptionPane  pane = new JOptionPane(
       messageLabel,
@@ -194,4 +208,35 @@
     new ExceptionDialog(null,err).setVisible(true);
   }
 
+  /**
+   * Zeigt einen Fehler-Dialog an.
+   * @param parent      uebergeordnetes Fenster (kann <code>null</code> sein!)
+   * @param err         darzustellender Fehler
+   * @param title       Titel fuer das Fenster (kann <code>null</code> sein!)
+   * @param errMessage  Meldung, die zu dem Fehler angezeigt angezeigt wird
+   *                    (kann <code>null</code> sein!)
+   * @param showDetails wenn {@code true} werden die Details initial angezeigt
+   */
+  public static void show(Component parent, Throwable err, String title, String errMessage, boolean showDetails) {
+    new ExceptionDialog(parent,err,title,errMessage,showDetails).setVisible(true);
+  }
+
+  /**
+   * Zeigt einen Fehler-Dialog an.
+   * @param parent   uebergeordnetes Fenster (kann <code>null</code> sein!)
+   * @param err      darzustellender Fehler
+   * @param showDetails wenn {@code true} werden die Details initial angezeigt
+   */
+  public static void show(Component parent, Throwable err, boolean showDetails) {
+    show(parent,err,null,null,showDetails);
+  }
+
+  /**
+   * Zeigt einen Fehler-Dialog an.
+   * @param err darzustellender Fehler
+   * @param showDetails wenn {@code true} werden die Details initial angezeigt
+   */
+  public static void show(Throwable err, boolean showDetails) {
+    show(null,err,showDetails);
+  }
 }



More information about the Schmitzm-commits mailing list