diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java @ 1361:9d67cd17ab78

Bugfix: #352 Keep grid selection in theme panels alive after themes has been modified. flys-client/trunk@3054 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 21 Oct 2011 10:19:07 +0000
parents c437e4f0f7be
children 546f7f890ffa
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Oct 21 08:11:32 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Oct 21 10:19:07 2011 +0000
@@ -199,6 +199,8 @@
     protected void updateGrid() {
         GWT.log("ThemePanel.updateGrid");
 
+        ListGridRecord[] selected = list.getSelectedRecords();
+
         clearGrid();
 
         ThemeList themeList = getThemeList();
@@ -217,14 +219,30 @@
                 continue;
             }
 
-            list.addData(createRecord(theme));
+            FacetRecord newRecord = createRecord(theme);
+            list.addData(newRecord);
+
+            String newArtifact = theme.getArtifact();
+            String newFacet    = theme.getFacet();
+            int    newIndex    = theme.getIndex();
+
+            for (ListGridRecord r: selected) {
+                FacetRecord sel = (FacetRecord) r;
+                Theme oldTheme  = sel.getTheme();
+
+                if (oldTheme.getArtifact().equals(newArtifact)
+                    && oldTheme.getFacet().equals(newFacet)
+                    && oldTheme.getIndex() == newIndex) {
+                    list.selectRecord(newRecord);
+                }
+            }
         }
 
         fireOutputParameterChanged();
     }
 
 
-    protected ListGridRecord createRecord(Theme theme) {
+    protected FacetRecord createRecord(Theme theme) {
         return new FacetRecord(theme);
     }
 

http://dive4elements.wald.intevation.org