changeset 2908:cd068ff7966d

Show only style attributes in StyleEditorWindow that are not 'hidden'. flys-client/trunk@4685 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Jun 2012 11:17:29 +0000 (2012-06-18)
parents 3521f330f57c
children 6d4a80b668a4
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java flys-client/src/main/java/de/intevation/flys/client/server/CollectionItemAttributeServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/server/ThemeListingServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java
diffstat 5 files changed, 39 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Jun 18 08:44:52 2012 +0000
+++ b/flys-client/ChangeLog	Mon Jun 18 11:17:29 2012 +0000
@@ -1,3 +1,20 @@
+2012-06-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/StyleHelper.java: New
+	  helper class which currently implements a function getStyle() that returns
+	  a Style object from XML Element.
+
+	* src/main/java/de/intevation/flys/client/server/CollectionItemAttributeServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/ThemeListingServiceImpl.java:
+	  Sources getStyle() out to StyleHelper.
+
+	* src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java:
+	  Added new boolean property 'hidden' and improved constructor.
+
+	* src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
+	  Added attribute 'pointcolor' to whitelist and display only attributes that
+	  are not 'hidden'.
+
 2012-06-18  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Mon Jun 18 08:44:52 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Mon Jun 18 11:17:29 2012 +0000
@@ -277,6 +277,7 @@
                          "font",
                          "textstyle",
                          "textsize",
+                         "pointcolor",
                          "pointsize",
                          "textcolor",
                          "textorientation",
@@ -293,7 +294,7 @@
         for (String settingName: sets) {
             StyleSetting set = style.getSetting(settingName);
 
-            if (set == null) {
+            if (set == null || set.isHidden()) {
                 continue;
             }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/CollectionItemAttributeServiceImpl.java	Mon Jun 18 08:44:52 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/CollectionItemAttributeServiceImpl.java	Mon Jun 18 11:17:29 2012 +0000
@@ -137,7 +137,7 @@
         NodeList items = e.getElementsByTagName("theme");
 
         for (int i = 0; i < items.getLength(); i++) {
-            Style s = getStyle ((Element) items.item(i));
+            Style s = StyleHelper.getStyle ((Element) items.item(i));
             if(s == null) {
                 throw new ServerException(ERROR_NO_STYLES_FOUND);
             }
@@ -198,37 +198,5 @@
         styles.appendChild(action);
         return styles;
     }
-
-
-    protected Style getStyle (Element element) {
-
-        if (!element.getTagName().equals("theme")) {
-            return null;
-        }
-
-        NodeList list = element.getElementsByTagName("field");
-        Style style = new Style();
-
-        style.setName (element.getAttribute("name"));
-        style.setFacet (element.getAttribute("facet"));
-        try {
-            int ndx = Integer.parseInt(element.getAttribute("index"));
-            style.setIndex (ndx);
-        }
-        catch(NumberFormatException nfe) {
-            return null;
-        }
-        for(int i = 0; i < list.getLength(); i++) {
-            Element e = (Element) list.item(i);
-            StyleSetting set = new StyleSetting (
-                e.getAttribute("name"),
-                e.getAttribute("default"),
-                e.getAttribute("display"),
-                e.getAttribute("hints"),
-                e.getAttribute("type"));
-            style.appendStyleSetting(set);
-        }
-        return style;
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ThemeListingServiceImpl.java	Mon Jun 18 08:44:52 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ThemeListingServiceImpl.java	Mon Jun 18 11:17:29 2012 +0000
@@ -90,7 +90,7 @@
 
                 for (int j = 0; j < theTheme.getLength(); j++) {
                     Element elem = (Element) theTheme.item(j);
-                    theStyles.put(groupName, getStyle(elem));
+                    theStyles.put(groupName, StyleHelper.getStyle(elem));
                 }
             }
 
@@ -102,38 +102,5 @@
 
         throw new ServerException(ERROR_NO_GROUPS_FOUND);
     }
-
-
-    protected Style getStyle (Element element) {
-        if (!element.getTagName().equals("theme")) {
-            return null;
-        }
-
-        NodeList list = element.getElementsByTagName("field");
-        Style style = new Style();
-
-        style.setName (element.getAttribute("name"));
-        style.setFacet (element.getAttribute("facet"));
-
-        try {
-            int ndx = Integer.parseInt(element.getAttribute("index"));
-            style.setIndex (ndx);
-        }
-        catch(NumberFormatException nfe) {
-            return null;
-        }
-
-        for(int i = 0; i < list.getLength(); i++) {
-            Element e = (Element) list.item(i);
-            StyleSetting set = new StyleSetting (
-                e.getAttribute("name"),
-                e.getAttribute("default"),
-                e.getAttribute("display"),
-                e.getAttribute("hints"),
-                e.getAttribute("type"));
-            style.appendStyleSetting(set);
-        }
-        return style;
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java	Mon Jun 18 08:44:52 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/StyleSetting.java	Mon Jun 18 11:17:29 2012 +0000
@@ -23,6 +23,9 @@
     /**The type*/
     protected String type;
 
+    /** Determines, if the property should be visible in UI or not.*/
+    protected boolean hidden;
+
 
     /**
      * Create a new StyleSetting for theme attribution.
@@ -40,17 +43,19 @@
      * @param type The attribute type.
      */
     public StyleSetting(
-        String name,
-        String defaultValue,
-        String displayName,
-        String hints,
-        String type)
+        String  name,
+        String  defaultValue,
+        String  displayName,
+        String  hints,
+        String  type,
+        boolean hidden)
     {
-        this.name = name;
+        this.name         = name;
         this.defaultValue = defaultValue;
-        this.displayName = displayName;
-        this.hints = hints;
-        this.type = type;
+        this.displayName  = displayName;
+        this.hints        = hints;
+        this.type         = type;
+        this.hidden       = hidden;
     }
 
     public void setName(String name) {
@@ -92,6 +97,10 @@
     public String getType() {
         return this.type;
     }
+
+    public boolean isHidden() {
+        return hidden;
+    }
 }
 
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org