changeset 1340:290d5687f202

#253 Implemented ThemePanel's 'remove' action. flys-client/trunk@2990 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 17 Oct 2011 15:00:12 +0000
parents d935fd42ae0e
children e26088566e8a
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/server/CollectionHelper.java flys-client/src/main/java/de/intevation/flys/client/shared/model/AttributedTheme.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultTheme.java flys-client/src/main/java/de/intevation/flys/client/shared/model/Theme.java
diffstat 6 files changed, 62 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Oct 17 13:04:31 2011 +0000
+++ b/flys-client/ChangeLog	Mon Oct 17 15:00:12 2011 +0000
@@ -1,3 +1,19 @@
+2011-10-17  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue253 (Diagramm: Mehrfachauswahl zum Verschieben/Löschen auf Themen)
+
+	* src/main/java/de/intevation/flys/client/shared/model/Theme.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultTheme.java,
+	  src/main/java/de/intevation/flys/client/shared/model/AttributedTheme.java:
+	  Prepared Themes to support a "visible" attribute.
+
+	* src/main/java/de/intevation/flys/client/server/CollectionHelper.java:
+	  Write the "visible" attribute of a Theme into the attribute of a
+	  Collection.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java: Do
+	  not display Themes which are not visible (getVisible() == 0).
+
 2011-10-17  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	Mon Oct 17 13:04:31 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Mon Oct 17 15:00:12 2011 +0000
@@ -189,7 +189,7 @@
         for (int i = 1; i <= count; i++) {
             Theme theme = themeList.getThemeAt(i);
 
-            if (theme == null) {
+            if (theme == null || theme.getVisible() == 0) {
                 continue;
             }
 
@@ -374,11 +374,15 @@
 
         remove.addClickHandler(new ClickHandler() {
             public void onClick(MenuItemClickEvent evt) {
-                SC.warn("Currently not implemented");
-
                 for (ListGridRecord record: records) {
                     FacetRecord facet = (FacetRecord) record;
+
+                    Theme theme = facet.getTheme();
+                    theme.setVisible(0);
+                    theme.setActive(0);
                 }
+
+                updateCollection();
             }
         });
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/CollectionHelper.java	Mon Oct 17 13:04:31 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/CollectionHelper.java	Mon Oct 17 15:00:12 2011 +0000
@@ -202,6 +202,7 @@
             cr.addAttr(t, "pos", Integer.toString(theme.getPosition()), true);
             cr.addAttr(t, "index", Integer.toString(theme.getIndex()), true);
             cr.addAttr(t, "description", theme.getDescription(), true);
+            cr.addAttr(t, "visible", theme.getVisible(), true);
         }
 
         return t;
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/AttributedTheme.java	Mon Oct 17 13:04:31 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/AttributedTheme.java	Mon Oct 17 15:00:12 2011 +0000
@@ -128,6 +128,18 @@
 
 
     @Override
+    public int getVisible() {
+        return getAttrAsInt("visible");
+    }
+
+
+    @Override
+    public void setVisible(int visible) {
+        addAttr("visible", String.valueOf(visible));
+    }
+
+
+    @Override
     public boolean equals(Object o) {
         if (!(o instanceof AttributedTheme)) {
             return false;
@@ -159,6 +171,10 @@
             return false;
         }
 
+        if (other.getVisible() != getVisible()) {
+            return false;
+        }
+
         return true;
     }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultTheme.java	Mon Oct 17 13:04:31 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultTheme.java	Mon Oct 17 15:00:12 2011 +0000
@@ -12,6 +12,8 @@
 
     protected int active;
 
+    protected int visible;
+
     protected String artifact;
 
     protected String facet;
@@ -27,6 +29,7 @@
         int     pos,
         int     index,
         int     active,
+        int     visible,
         String  art,
         String  facet,
         String  description)
@@ -34,6 +37,7 @@
         this.position    = pos;
         this.index       = index;
         this.active      = active;
+        this.visible     = visible;
         this.artifact    = art;
         this.facet       = facet;
         this.description = description;
@@ -85,6 +89,16 @@
     }
 
 
+    public int getVisible() {
+        return visible;
+    }
+
+
+    public void setVisible(int visible) {
+        this.visible = visible;
+    }
+
+
     public boolean equals(Object o) {
         if (!(o instanceof DefaultTheme)) {
             return false;
@@ -116,6 +130,10 @@
             return false;
         }
 
+        if (other.visible != visible) {
+            return false;
+        }
+
         return true;
     }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Theme.java	Mon Oct 17 13:04:31 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Theme.java	Mon Oct 17 15:00:12 2011 +0000
@@ -18,6 +18,10 @@
 
     void setActive(int active);
 
+    int getVisible();
+
+    void setVisible(int visible);
+
     String getArtifact();
 
     String getFacet();

http://dive4elements.wald.intevation.org