Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DistanceInfoDataSource.java @ 8865:0d7c8c943b60 3.2.x
URL-encode URLs (potentially) containing invalid characters.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 22 Jan 2018 16:38:32 +0100 |
parents | ea9eef426962 |
children |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui.range; |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import com.google.gwt.core.client.GWT; |
8865
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
12 import com.google.gwt.http.client.URL; |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.data.DataSource; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import com.smartgwt.client.data.DataSourceField; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.types.DSDataFormat; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.types.FieldType; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 public class DistanceInfoDataSource extends DataSource { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public static final String XPATH_DISTANCE_DEFAULT = "/distances/distance"; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 public DistanceInfoDataSource(String url, String river, String filter) { |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 setDataFormat(DSDataFormat.XML); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 setRecordXPath(XPATH_DISTANCE_DEFAULT); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 DataSourceField desc = new DataSourceField( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 "description", FieldType.TEXT, "description"); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 DataSourceField from = new DataSourceField( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 "from", FieldType.TEXT, "from"); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 DataSourceField to = new DataSourceField( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 "to", FieldType.TEXT, "to"); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 DataSourceField side = new DataSourceField( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 "riverside", FieldType.TEXT, "riverside"); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 DataSourceField top = new DataSourceField( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 "top", FieldType.TEXT, "top"); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 DataSourceField bottom = new DataSourceField( |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 "bottom", FieldType.TEXT, "bottom"); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 setFields(desc, from, to, side, top, bottom); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 setDataURL(getServiceURL(url, river, filter)); |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
8865
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
52 protected String getServiceURL( |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
53 String server, |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
54 String river, |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
55 String filter |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
56 ) { |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
57 String url = URL.encode(GWT.getModuleBaseURL() |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
58 + "distanceinfoxml" |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
59 + "?server=" + server |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
60 + "&river=" + river |
0d7c8c943b60
URL-encode URLs (potentially) containing invalid characters.
Tom Gottfried <tom@intevation.de>
parents:
5993
diff
changeset
|
61 + "&filter=" + filter); |
782
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 return url; |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
4a7ece57f44c
#159 The tables in the WQ panel for calculation 4 are now filled with data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |