Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/range/DischargeInfoDataSource.java @ 1602:f30919997e57
Added helper input table to state 'timerange' input in hist. discharge curves.
flys-client/trunk@3940 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 06 Feb 2012 16:11:10 +0000 |
parents | |
children | 0cc2c3d89a9d |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/range/DischargeInfoDataSource.java Mon Feb 06 16:11:10 2012 +0000 @@ -0,0 +1,43 @@ +package de.intevation.flys.client.client.ui.range; + +import com.google.gwt.core.client.GWT; + +import com.smartgwt.client.data.DataSource; +import com.smartgwt.client.data.DataSourceField; +import com.smartgwt.client.types.DSDataFormat; +import com.smartgwt.client.types.FieldType; + + +public class DischargeInfoDataSource extends DataSource { + + public static final String XPATH_DISCHARGE_DEFAULT = "/discharges/discharge"; + + + public DischargeInfoDataSource(String url, long gauge) { + setDataFormat(DSDataFormat.XML); + setRecordXPath(XPATH_DISCHARGE_DEFAULT); + + DataSourceField desc = new DataSourceField( + "description", FieldType.TEXT, "description"); + + DataSourceField start = new DataSourceField( + "start", FieldType.INTEGER, "start"); + + DataSourceField end = new DataSourceField( + "end", FieldType.INTEGER, "end"); + + setFields(desc, start, end); + setDataURL(getServiceURL(url, gauge)); + } + + + protected String getServiceURL(String server, long gauge) { + String url = GWT.getModuleBaseURL(); + url += "dischargeinfoxml"; + url += "?server=" + server; + url += "&gauge=" + String.valueOf(gauge); + + return url; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :