Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java @ 247:4a684d29404f
Implemented the createOld() of WQAdaptedInputPanel.
flys-client/trunk@1832 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 05 May 2011 09:33:15 +0000 |
parents | ccba1a0b743e |
children | e4f0bef52689 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Thu May 05 08:09:03 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Thu May 05 09:33:15 2011 +0000 @@ -8,12 +8,14 @@ import com.google.gwt.core.client.GWT; import com.smartgwt.client.types.TitleOrientation; +import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.fields.events.BlurHandler; import com.smartgwt.client.widgets.form.fields.events.BlurEvent; import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; +import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.shared.model.Data; @@ -37,6 +39,12 @@ { public static final String FIELD_WQ_MODE = "wq_mode"; + public static final String GAUGE_SEPARATOR = ":"; + + public static final String GAUGE_PART_SEPARATOR = ";"; + + public static final String VALUE_SEPARATOR = ","; + /** The message class that provides i18n strings.*/ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -70,8 +78,79 @@ public Canvas createOld(DataList dataList) { - // TODO IMPLEMENT ME - return new Label("Ich hab schon was eingegeben."); + List<Data> all = dataList.getAll(); + Data wqData = getData(all, "wq_values"); + Data wqMode = getData(all, "wq_mode"); + + Canvas back = getBackButton(dataList.getState()); + + HLayout valLayout = new HLayout(); + HLayout modeLayout = new HLayout(); + VLayout vlayout = new VLayout(); + + Label wqLabel = new Label(dataList.getLabel()); + Label modeLabel = new Label(""); + + wqLabel.setValign(VerticalAlignment.TOP); + + wqLabel.setWidth(200); + wqLabel.setHeight(25); + modeLabel.setHeight(25); + modeLabel.setWidth(200); + + valLayout.addMember(wqLabel); + valLayout.addMember(createOldWQValues(wqData)); + valLayout.addMember(back); + modeLayout.addMember(modeLabel); + + vlayout.addMember(valLayout); + vlayout.addMember(modeLayout); + + return vlayout; + } + + + protected Canvas createOldWQValues(Data wqData) { + VLayout layout = new VLayout(); + + DataItem item = wqData.getItems()[0]; + String value = item.getStringValue(); + + String[] gauges = value.split(GAUGE_SEPARATOR); + + for (String gauge: gauges) { + HLayout h = new HLayout(); + + String[] parts = gauge.split(GAUGE_PART_SEPARATOR); + String[] values = parts[2].split(VALUE_SEPARATOR); + + Label l = new Label(parts[0] + " - " + parts[1] + ": "); + + StringBuilder sb = new StringBuilder(); + boolean first = true; + + for (String v: values) { + if (!first) { + sb.append(", "); + } + + sb.append(v); + + first = false; + } + + Label v = new Label(sb.toString()); + + l.setWidth(65); + v.setWidth(65); + + h.addMember(l); + h.addMember(v); + + layout.addMember(h); + } + + return layout; } @@ -143,7 +222,7 @@ wqvalue = createValueString(key, values); } else { - wqvalue += ":" + createValueString(key, values); + wqvalue += GAUGE_SEPARATOR + createValueString(key, values); } }