changeset 1450:bb91cdf8407b

Minor refactoring to ease addition of new style-fields (are now added automically). flys-client/trunk@3469 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 19 Dec 2011 16:18:53 +0000
parents 8da36efc839a
children bc830e564b6d
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/shared/model/Style.java
diffstat 3 files changed, 27 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Dec 19 15:38:10 2011 +0000
+++ b/flys-client/ChangeLog	Mon Dec 19 16:18:53 2011 +0000
@@ -1,3 +1,13 @@
+2011-12-19	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Minor refactoring to ease addition of new (theme-style) settings.
+
+	* main/java/de/intevation/flys/client/shared/model/Style.java:
+	  Added getter for list of settings.
+
+	* main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
+	  Minor renaming, consume list instead of whitequerying entries.
+
 2011-12-19  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/CollectionHelper.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Mon Dec 19 15:38:10 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Mon Dec 19 16:18:53 2011 +0000
@@ -155,8 +155,8 @@
     protected VLayout createPropertyGrid() {
         VLayout properties = new VLayout();
 
-        Theme t = facet.getTheme();
-        Style s = attributes.getStyle(t.getFacet(), t.getIndex());
+        Theme theme = facet.getTheme();
+        Style style = attributes.getStyle(theme.getFacet(), theme.getIndex());
 
         StaticTextItem name = new StaticTextItem("name", "Name");
         name.setValue(facet.getName());
@@ -164,25 +164,11 @@
         name.setTitleAlign(Alignment.LEFT);
         name.setDisabled(true);
         name.setShowDisabled(false);
-        DynamicForm f = new DynamicForm();
-        f.setFields(name);
-        properties.addMember(f);
+        DynamicForm form = new DynamicForm();
+        form.setFields(name);
+        properties.addMember(form);
 
-        String[] sets = {"showlines",
-                         "showpoints",
-                         "linetype",
-                         "linesize",
-                         "linecolor",
-                         "font",
-                         "textstyle",
-                         "textsize",
-                         "textcolor",
-                         "textorientation",
-                         "backgroundcolor",
-                         "showbackground"};
-
-        for (int i = 0; i < sets.length; i ++) {
-            StyleSetting set = s.getSetting(sets[i]);
+        for (StyleSetting set: style.getSettings()) {
 
             if (set == null) {
                 continue;
@@ -195,6 +181,7 @@
                 set.getDefaultValue());
             properties.addMember(property);
         }
+
         return properties;
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Style.java	Mon Dec 19 15:38:10 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Style.java	Mon Dec 19 16:18:53 2011 +0000
@@ -88,6 +88,16 @@
 
 
     /**
+     * Getter for style settings.
+     *
+     * @return The list of style settings.
+     */
+    public List<StyleSetting> getSettings() {
+        return this.settings;
+    }
+
+
+    /**
      * Getter for style setting.
      * @param i The index in the settings list.
      *

http://dive4elements.wald.intevation.org