/[schmitzm]/trunk/src/skrueger/geotools/XMapPane.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/XMapPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 551 by alfonx, Mon Nov 23 15:47:04 2009 UTC revision 553 by alfonx, Mon Nov 23 21:39:17 2009 UTC
# Line 554  public class XMapPane extends JPanel { Line 554  public class XMapPane extends JPanel {
554    
555          /** Is set if a renderer has an error **/          /** Is set if a renderer has an error **/
556          protected ArrayList<Exception> renderingErrors = new ArrayList<Exception>();          protected ArrayList<Exception> renderingErrors = new ArrayList<Exception>();
557            
558            /** If <code>true</code>, then rendering exceptions are rendererd into the map pane **/
559            private boolean showExceptions= false;
560    
561          // /** If {@link #getVisibleRect()} of this {@link JPanel} is not yet          // /** If {@link #getVisibleRect()} of this {@link JPanel} is not yet
562          // defined, but we are **/          // defined, but we are **/
# Line 1411  public class XMapPane extends JPanel { Line 1414  public class XMapPane extends JPanel {
1414           * @see MapPaneListener#onRenderingStopped(org.geotools.swing.event.MapPaneEvent)           * @see MapPaneListener#onRenderingStopped(org.geotools.swing.event.MapPaneEvent)
1415           */           */
1416          public void onRenderingFailed(final Exception renderingError) {          public void onRenderingFailed(final Exception renderingError) {
1417                  this.renderingErrors.add(renderingError);  
1418                    // Store the exceptions so we can show it to the user:
1419                    if (!(renderingError instanceof java.lang.IllegalArgumentException
1420                                    && renderingError.getMessage().equals(
1421                                                    "Argument \"sourceCRS\" should not be null.")))
1422                            this.renderingErrors.add(renderingError);
1423                  if (renderingErrors.size() > 3)                  if (renderingErrors.size() > 3)
1424                          renderingErrors.remove(0);                          renderingErrors.remove(0);
1425                    
1426                  repaintTimer.stop();                  repaintTimer.stop();
1427                  LOGGER.warn("Rendering failed", renderingError);                  LOGGER.warn("Rendering failed", renderingError);
1428                  updateFinalImage();                  updateFinalImage();
# Line 2191  public class XMapPane extends JPanel { Line 2200  public class XMapPane extends JPanel {
2200                          y += 24;                          y += 24;
2201                  }                  }
2202    
2203                  if (renderingErrors != null) {                  if (renderingErrors != null && isShowExceptions()) {
2204    
2205                          final Color c = graphics.getColor();                          final Color c = graphics.getColor();
2206                          graphics.setFont(errorFont);                          graphics.setFont(errorFont);
2207    
2208                          for (Exception ex : renderingErrors) {                          for (Exception ex : renderingErrors) {
2209    
                                 if (ex instanceof java.lang.IllegalArgumentException  
                                                 && ex.getMessage().equals(  
                                                                 "Argument \"sourceCRS\" should not be null."))  
                                         continue;  
   
2210                                  String errStr = ex.getLocalizedMessage();                                  String errStr = ex.getLocalizedMessage();
2211    
2212                                  if (errStr == null)                                  if (errStr == null)
# Line 2364  public class XMapPane extends JPanel { Line 2368  public class XMapPane extends JPanel {
2368                  setMapArea(newMapArea);                  setMapArea(newMapArea);
2369          }          }
2370    
2371            /**
2372             * Shall non-fatal rendering exceptions be reported in the mappane or be
2373             * dropped quitely.
2374             */
2375            public void setShowExceptions(boolean showExceptions) {
2376                    this.showExceptions = showExceptions;
2377            }
2378    
2379            /**
2380             * Shall exceptions be reported in the mappane?
2381             */
2382            public boolean isShowExceptions() {
2383                    return showExceptions;
2384            }
2385    
2386  }  }

Legend:
Removed from v.551  
changed lines
  Added in v.553

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26