changeset 1348:fb224f54c643

Prepared editor UI for annotation styling. flys-client/trunk@3015 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 18 Oct 2011 15:20:24 +0000
parents d81533df4138
children 46a4b74d87bf
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java
diffstat 2 files changed, 65 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Oct 18 14:11:52 2011 +0000
+++ b/flys-client/ChangeLog	Tue Oct 18 15:20:24 2011 +0000
@@ -1,3 +1,8 @@
+2011-10-18  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
+	  Prepared editor UI for annotation styling.
+
 2011-10-18	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Minor cosmetics.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Tue Oct 18 14:11:52 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Tue Oct 18 15:20:24 2011 +0000
@@ -93,8 +93,6 @@
      */
     protected void init() {
         setTitle(MSG.properties());
-        setWidth(270);
-        setHeight(200);
         setCanDragReposition(true);
         setCanDragResize(true);
 
@@ -121,9 +119,13 @@
         buttons.addMember(cancel);
         buttons.setAlign(Alignment.RIGHT);
 
-        layout.addMember(createPropertyGrid());;
+        VLayout propGrid = createPropertyGrid();
+
+        layout.addMember(propGrid);
         layout.addMember(buttons);
         addItem(layout);
+        setWidth(270);
+        setHeight(propGrid.getChildren().length * 25 + 50);
     }
 
 
@@ -198,30 +200,21 @@
         FormItem f;
         if(type.equals("int")) {
             f = new SelectItem(name, dname);
-            LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();
-            f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-");
-            f.setImageURLSuffix("px.png");
-            f.setValueIconHeight(20);
-            f.setValueIconWidth(80);
-            LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();  
-            valueMap.put("1", "");
-            valueMap.put("2", "");
-            valueMap.put("3", "");
-            valueMap.put("4", "");
-            valueMap.put("5", "");
-            valueMap.put("6", "");
-            valueMap.put("7", "");
-            valueMap.put("8", "");
-            valueIcons.put("1", "1");
-            valueIcons.put("2", "2");
-            valueIcons.put("3", "3");
-            valueIcons.put("4", "4");
-            valueIcons.put("5", "5");
-            valueIcons.put("6", "6");
-            valueIcons.put("7", "7");
-            valueIcons.put("8", "8");
-            f.setValueIcons(valueIcons);
-            f.setValueMap(valueMap);
+            if (name.equals("linesize")) {
+                f = createLineSizeUI(f);
+            }
+            else if (name.equals("textsize")) {
+                LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
+                valueMap.put("3", "3");
+                valueMap.put("5", "5");
+                valueMap.put("8", "8");
+                valueMap.put("10", "10");
+                valueMap.put("12", "12");
+                valueMap.put("14", "14");
+                valueMap.put("18", "18");
+                valueMap.put("24", "24");
+                f.setValueMap(valueMap);
+            }
             f.setValue(value);
         }
         else if (type.equals("boolean")) {
@@ -247,7 +240,7 @@
             f.setImageURLSuffix(".png");
             f.setValueIconHeight(20);
             f.setValueIconWidth(80);
-            LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();  
+            LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
             valueMap.put("10", "");
             valueMap.put("10,5", "");
             valueMap.put("20,10", "");
@@ -262,6 +255,16 @@
             f.setValueMap(valueMap);
             f.setValue(value);
         }
+        else if (type.equals("Font")) {
+            f = new SelectItem(name, dname);
+            LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
+            valueMap.put("arial", "<span style='font-family:arial'>Arial</span>");
+            valueMap.put("courier", "<span style='font-family:courier'>Courier</span>");
+            valueMap.put("verdana", "<span style='font-family:verdana'>Verdana</span>");
+            valueMap.put("times", "<span style='font-family:times'>Times</span>");
+            f.setValueMap(valueMap);
+            f.setValue(value);
+        }
         else {
             f = new FormItem();
         }
@@ -280,6 +283,35 @@
     }
 
 
+    protected FormItem createLineSizeUI(FormItem f) {
+        LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();
+        f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-");
+        f.setImageURLSuffix("px.png");
+        f.setValueIconHeight(20);
+        f.setValueIconWidth(80);
+        LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
+        valueMap.put("1", "");
+        valueMap.put("2", "");
+        valueMap.put("3", "");
+        valueMap.put("4", "");
+        valueMap.put("5", "");
+        valueMap.put("6", "");
+        valueMap.put("7", "");
+        valueMap.put("8", "");
+        valueIcons.put("1", "1");
+        valueIcons.put("2", "2");
+        valueIcons.put("3", "3");
+        valueIcons.put("4", "4");
+        valueIcons.put("5", "5");
+        valueIcons.put("6", "6");
+        valueIcons.put("7", "7");
+        valueIcons.put("8", "8");
+        f.setValueIcons(valueIcons);
+        f.setValueMap(valueMap);
+        return f;
+    }
+
+
     /**
      * Static method to convert a color from RGB to HTML notation.
      * @param rgb String in RGB notation.

http://dive4elements.wald.intevation.org