diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ChartPropertiesEditor.java @ 7597:fca46ce8e4f5

(issue1225) Implement Magic labels. There is now a new value in the chartsettings "Suggested Label" which is hidden in the property editor. A suggested label is the label that combines the label's of all processors that wrote data to an axis. This suggested label is set as the label when the user has not overwritten the label.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 25 Nov 2013 14:58:14 +0100
parents 480fb71ab73f
children 8580f222dfb2
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ChartPropertiesEditor.java	Mon Nov 25 14:53:50 2013 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ChartPropertiesEditor.java	Mon Nov 25 14:58:14 2013 +0100
@@ -188,6 +188,12 @@
         PropertyGroup origPg = (PropertyGroup)orig;
 
         if (pg.getName().equals("axis")) {
+            for (Property prop: origPg.getProperties()) {
+                GWT.log("Found: " + prop.getName());
+            }
+            for (Property prop: pg.getProperties()) {
+                GWT.log("Found new: " + prop.getName());
+            }
             // Certain axis shall be skipped (W/Q-Diagrams cm-axis especially).
             String outputName = tab.getOutputName();
             if (outputName.equals("fix_wq_curve") || outputName.equals("computed_discharge_curve")
@@ -213,6 +219,18 @@
             title.setValue(
                 ((StringProperty)origPg.getPropertyByName("label")).getValue());
 
+            StringProperty suggestedLabel =
+                (StringProperty)pg.getPropertyByName("suggested-label");
+            FormItem sugLabel = null;
+
+            if (suggestedLabel != null) {
+                // X Axis does not have a suggested label
+                // otherwise add an hidden property for suggestedLabel
+                sugLabel = createStringProperty(suggestedLabel);
+                sugLabel.setValue(
+                    ((StringProperty)origPg.getPropertyByName("suggested-label")).getValue());
+            }
+
             IntegerProperty fontsize =
                 (IntegerProperty)pg.getPropertyByName("font-size");
             FormItem fs = createIntegerProperty(fontsize);

http://dive4elements.wald.intevation.org