Mercurial > dive4elements > river
changeset 1569:b85761d21975
Get the axes name from collection settings and use them as table header.
flys-client/trunk@3834 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 30 Jan 2012 14:29:49 +0000 |
parents | 2432973ccced |
children | eeee85c4d996 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java |
diffstat | 2 files changed, 38 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Mon Jan 30 13:36:10 2012 +0000 +++ b/flys-client/ChangeLog Mon Jan 30 14:29:49 2012 +0000 @@ -1,3 +1,8 @@ +2012-01-30 Raimund Renkert <raimund.renkert@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java: + Get the axes name from collection settings and use them as header. + 2012-01-30 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java Mon Jan 30 13:36:10 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java Mon Jan 30 14:29:49 2012 +0000 @@ -1,5 +1,7 @@ package de.intevation.flys.client.client.ui.chart; +import java.util.List; + import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONBoolean; import com.google.gwt.json.client.JSONNumber; @@ -49,6 +51,10 @@ import de.intevation.flys.client.shared.model.DefaultArtifact; import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.Recommendation; +import de.intevation.flys.client.shared.model.Settings; +import de.intevation.flys.client.shared.model.Property; +import de.intevation.flys.client.shared.model.PropertyGroup; +import de.intevation.flys.client.shared.model.StringProperty; import de.intevation.flys.client.client.event.RedrawRequestHandler; import de.intevation.flys.client.client.event.RedrawRequestEvent; @@ -188,14 +194,37 @@ } }}; - // TODO X and Y Header depend on the current chart and axis (e.g. W[nn+m]) - // collection.getSettings(outputName).getSettings -> Propertie -> "axis" -> "label" + // Use X and Y as default fallback. + String xAxis = "X"; + String yAxis = "Y"; - ListGridField xField = new ListGridField(PointRecord.ATTRIBUTE_X, "X"); + // Get header text from collection settings. + Settings settings = this.collection.getSettings(outputModeName); + List<Property> axes = settings.getSettings("axes"); + if(axes != null) { + for (Property p: axes) { + PropertyGroup pg = (PropertyGroup)p; + StringProperty id = + (StringProperty)pg.getPropertyByName("id"); + if(id.getValue().equals("X")) { + StringProperty name = + (StringProperty)pg.getPropertyByName("label"); + xAxis = name.getValue(); + } + else if (yAxis.equals("Y")) { + StringProperty name = + (StringProperty)pg.getPropertyByName("label"); + yAxis = name.getValue(); + } + } + } + ListGridField xField = + new ListGridField(PointRecord.ATTRIBUTE_X, xAxis); xField.setType(ListGridFieldType.FLOAT); xField.setCellFormatter(doubleFormat); - ListGridField yField = new ListGridField(PointRecord.ATTRIBUTE_Y, "Y"); + ListGridField yField = + new ListGridField(PointRecord.ATTRIBUTE_Y, yAxis); yField.setType(ListGridFieldType.FLOAT); yField.setCellFormatter(doubleFormat);