Revision: 5020
          http://sourceforge.net/p/jump-pilot/code/5020
Author:   michaudm
Date:     2016-09-17 16:51:08 +0000 (Sat, 17 Sep 2016)
Log Message:
-----------
Fix bug happening when modifying schema two times with InfoPanel opened

Modified Paths:
--------------
    core/trunk/ChangeLog
    core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributePanel.java
    core/trunk/src/com/vividsolutions/jump/workbench/ui/InfoModel.java

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2016-09-17 14:02:43 UTC (rev 5019)
+++ core/trunk/ChangeLog        2016-09-17 16:51:08 UTC (rev 5020)
@@ -5,6 +5,7 @@
 
 2016-09-17 mmichaud <m.michael.mich...@orange.fr>
   * FR #235 : Improved ExtractLayersByGeometryPlugIn
+  * Fix bug happening when modifying schema two times with InfoPanel opened
 
 2016-09-10 mmichaud <m.michael.mich...@orange.fr>
   * bugfix : old postgis driver could not save layer with pk != dbid

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributePanel.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributePanel.java     
2016-09-17 14:02:43 UTC (rev 5019)
+++ core/trunk/src/com/vividsolutions/jump/workbench/ui/AttributePanel.java     
2016-09-17 16:51:08 UTC (rev 5020)
@@ -30,6 +30,7 @@
  * www.vividsolutions.com
  */
 package com.vividsolutions.jump.workbench.ui;
+
 import java.awt.*;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
@@ -45,6 +46,7 @@
 import com.vividsolutions.jump.workbench.WorkbenchContext;
 import com.vividsolutions.jump.workbench.model.Layer;
 import com.vividsolutions.jump.workbench.model.LayerManagerProxy;
+import com.vividsolutions.jump.workbench.model.Layerable;
 import com.vividsolutions.jump.workbench.ui.zoom.PanToSelectedItemsPlugIn;
 import com.vividsolutions.jump.workbench.ui.zoom.ZoomToSelectedItemsPlugIn;
 
@@ -56,7 +58,7 @@
 
     //private SelectionManager selectionManager;
     private GridBagLayout gridBagLayout1 = new GridBagLayout();
-    private HashMap layerToTablePanelMap = new HashMap();
+    private HashMap<Layerable,AttributeTablePanel> layerToTablePanelMap = new 
HashMap();
     private InfoModel model;
     private WorkbenchContext workbenchContext;
     private ZoomToSelectedItemsPlugIn zoomToSelectedItemsPlugIn =
@@ -116,7 +118,7 @@
         }
     }
     public AttributeTablePanel getTablePanel(Layer layer) {
-        return (AttributeTablePanel) layerToTablePanelMap.get(layer);
+        return layerToTablePanelMap.get(layer);
     }
     public InfoModel getModel() {
         return model;
@@ -391,11 +393,11 @@
             return getTablePanel(nextLayer());
         }
         private Layer previousLayer() {
-            return (Layer) getModel().getLayers().get(
+            return getModel().getLayers().get(
                 getModel().getLayers().indexOf(panel.getModel().getLayer()) - 
1);
         }
         private Layer nextLayer() {
-            return (Layer) getModel().getLayers().get(
+            return getModel().getLayers().get(
                 getModel().getLayers().indexOf(panel.getModel().getLayer()) + 
1);
         }
         public Feature getFeature() {

Modified: core/trunk/src/com/vividsolutions/jump/workbench/ui/InfoModel.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/workbench/ui/InfoModel.java  
2016-09-17 14:02:43 UTC (rev 5019)
+++ core/trunk/src/com/vividsolutions/jump/workbench/ui/InfoModel.java  
2016-09-17 16:51:08 UTC (rev 5020)
@@ -40,6 +40,7 @@
 
 
 public class InfoModel {
+
     /**
      * Releases references to the data, to facilitate garbage collection.
      * Important for MDI apps like the JCS Workbench.
@@ -87,6 +88,7 @@
     }
 
     public void remove(Layer layer) {
+        if (!layerToTableModelMap.containsKey(layer)) return;
         LayerTableModel layerTableModel = getTableModel(layer);
 
         for (Iterator i = listeners.iterator(); i.hasNext();) {
@@ -94,7 +96,7 @@
             listener.layerRemoved(layerTableModel);
         }
 
-        ((LayerTableModel) layerToTableModelMap.get(layer)).dispose();
+        layerToTableModelMap.get(layer).dispose();
         layerToTableModelMap.remove(layer);
     }
 
@@ -112,7 +114,7 @@
             layerToTableModelMap.put(layer, new LayerTableModel(layer));
         }
 
-        return (LayerTableModel) layerToTableModelMap.get(layer);
+        return layerToTableModelMap.get(layer);
     }
 
     public List<Layer> getLayers() {


------------------------------------------------------------------------------
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to