changeset 2443:993871f8e2f2

Partial fix flys/issue624 (removing cross section). flys-client/trunk@4111 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 02 Mar 2012 10:53:40 +0000
parents 49ca36baf4ab
children 22989ed51064
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java
diffstat 3 files changed, 47 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Mar 02 10:26:08 2012 +0000
+++ b/flys-client/ChangeLog	Fri Mar 02 10:53:40 2012 +0000
@@ -1,3 +1,15 @@
+2012-03-02	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Partial Fix flys/issue624 (removing cross section does not remove it
+	from select box).
+
+	* src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java
+	  (removeThemes): Extracted to be able to override.
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java
+	  (removeThemes): Overridden to also remove theme from select box.
+			  This has side effects though (TODO).
+
 2012-03-02	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Fix flys/issue621 (areas against deleted themes.)
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Mar 02 10:26:08 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Mar 02 10:53:40 2012 +0000
@@ -433,6 +433,19 @@
     }
 
 
+    /** Remove given themes (not asking for confirmation). */
+    protected void removeThemes(final ListGridRecord[] records) {
+        for (ListGridRecord record: records) {
+            FacetRecord facet = (FacetRecord) record;
+            Theme theme = facet.getTheme();
+            theme.setVisible(0);
+            theme.setActive(0);
+            updateCollection();
+        }
+    }
+
+
+    /** Create menu item for removing theme(s). Will ask for confirmation. */
     protected MenuItem createRemoveItem(final ListGridRecord[] records) {
         MenuItem remove = new MenuItem(MSG.removeTheme());
 
@@ -442,14 +455,7 @@
                     @Override
                     public void execute(Boolean value) {
                         if (value) {
-                            for (ListGridRecord record: records) {
-                                FacetRecord facet = (FacetRecord) record;
-                                Theme theme = facet.getTheme();
-                                theme.setVisible(0);
-                                theme.setActive(0);
-
-                                updateCollection();
-                            }
+                            removeThemes(records);
                         }
                     }
                 });
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Fri Mar 02 10:26:08 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Fri Mar 02 10:53:40 2012 +0000
@@ -369,6 +369,21 @@
     }
 
 
+    /** Remove the themes, also from the master (reference) select box. */
+    @Override
+    protected void removeThemes(final ListGridRecord[] records) {
+        // TODO take care of what happens if that was the last
+        // cross section and/or the cross section currently selected as master.
+        for (ListGridRecord record: records) {
+            FacetRecord facet = (FacetRecord) record;
+            Theme theme = facet.getTheme();
+            masters.remove(theme.getArtifact());
+        }
+        masterCb.setValueMap(masters);
+        super.removeThemes(records);
+    }
+
+
     public void spinnerValueEntered(final SpinnerItem item,
         final double enteredKm, final FacetRecord facetRecord
     ) {
@@ -642,9 +657,11 @@
         // Synchron checking.
         MenuItem synchronNavigationMenuItem = new MenuItem();
         if (synchronNavigation == true) {
+            // TODO i18n
             synchronNavigationMenuItem.setTitle("Einzeln navigieren");
         }
         else {
+            // TODO i18n
             synchronNavigationMenuItem.setTitle("Synchron navigieren");
         }
         synchronNavigationMenuItem.addClickHandler(new ClickHandler() {
@@ -729,8 +746,10 @@
      * @param theme The cross section theme.
      */
     protected void addToReferences(Theme theme) {
-        masters.put(theme.getArtifact(), theme.getDescription());
-        masterCb.setValueMap(masters);
+        if (theme.getVisible() != 0) {
+            masters.put(theme.getArtifact(), theme.getDescription());
+            masterCb.setValueMap(masters);
+        }
         findCurrentCSMaster();
         if (masterCb.getSelectedRecord() == null) {
             masterCb.setValue(getCurrentCSMaster());

http://dive4elements.wald.intevation.org