changeset 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 ce0bbac13bc8
children 670fd067bd80
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java
diffstat 2 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Oct 21 08:11:32 2011 +0000
+++ b/flys-client/ChangeLog	Fri Oct 21 10:19:07 2011 +0000
@@ -1,3 +1,10 @@
+2011-10-21  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue352 (W-INFO / WSP: Markierung bei Verschieben in Steuerung geht verloren)
+
+	* src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java:
+	  Keep grid selection alive after theme has been modified.
+
 2011-10-21  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
--- 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