diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java @ 8910:d9c89651bd67

Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
author gernotbelger
date Thu, 22 Feb 2018 18:46:37 +0100
parents 5e38e2924c07
children 924cd9943337
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java	Thu Feb 22 18:44:28 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java	Thu Feb 22 18:46:37 2018 +0100
@@ -294,6 +294,7 @@
 
         // Done via array to keep the order.
         String[] sets = {"showlines",
+                         "showborder",
                          "showpoints",
                          "linetype",
                          "linesize",
@@ -372,6 +373,7 @@
      * @return The dynamic form for the attribute property.
      */
     protected DynamicForm createPropertyUI(
+        // FIXME: display name (which comes from the server side) is not used but i10n happens on client side,, 
         String dname,
         String name,
         String type,
@@ -535,6 +537,9 @@
             f.setValueMap(valueMap);
             f.setValue(value);
         }
+        else if (type.equals("areapattern")) {
+            f = createAreaPetternUi(name, value);
+        }
         else if (type.equals("font")) {
             f = new SelectItem(name, MSG.getString(name));
             LinkedHashMap<String, String> valueMap =
@@ -587,6 +592,33 @@
     }
 
 
+    private FormItem createAreaPetternUi(String name, String value) {
+        final FormItem f = new SelectItem(name, MSG.getString(name));
+        
+        f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/areapattern-");
+        f.setImageURLSuffix(".png");
+        f.setValueIconHeight(20);
+        f.setValueIconWidth(80);
+
+        final LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
+        final Map<String, String> valueIcons = new LinkedHashMap<String, String>();
+
+        // FIXME: ugly, using knowledge of available patterns at this point, creating redundancy with AreaFillPattern enum.
+        // But the whole code does it like that, so this is 'flys style'
+        final String[] patterns = new String[] {"pattern1", "x"};
+        for (int i = 0; i < patterns.length; i++) {
+            final String pattern = patterns[i];
+
+            valueMap.put(pattern, "");
+            valueIcons.put(pattern, pattern);
+        }
+
+        f.setValueIcons(valueIcons);
+        f.setValueMap(valueMap);
+        f.setValue(value);
+        return f;
+    }
+
     protected FormItem createLineSizeUI(FormItem f) {
         LinkedHashMap<String, String> valueIcons =
             new LinkedHashMap<String, String>();

http://dive4elements.wald.intevation.org