annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQCampaignChart.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQCampaignChart.java@821a02bbfb4e
children 172338b1407f
rev   line source
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
1 package org.dive4elements.river.client.client.ui.sq;
3373
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import com.google.gwt.json.client.JSONNumber;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import com.google.gwt.json.client.JSONObject;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import com.google.gwt.json.client.JSONString;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import com.smartgwt.client.types.Alignment;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.widgets.Img;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.widgets.events.ResizedHandler;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.widgets.layout.VLayout;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
12 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
13 import org.dive4elements.river.client.shared.model.Artifact;
3373
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 public class SQCampaignChart extends VLayout {
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 private final Artifact artifact;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 protected Img chartImg;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 public SQCampaignChart(Artifact artifact, ResizedHandler resizeHandler) {
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 super();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 this.artifact = artifact;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 this.chartImg = new Img();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 addResizedHandler(resizeHandler);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 setAlign(Alignment.CENTER);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 }
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 public void update() {
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 Config config = Config.getInstance();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 String locale = config.getLocale();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 int hWidth = getWidth() - 12;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 int hHeight = getHeight() - 12;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 if ((int) (hHeight * 4f / 3) < hWidth) {
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 hWidth = (int) (hHeight * 4f / 3);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 }
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 else {
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 hHeight = (int) (hWidth * 3f / 4);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 }
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 String river = artifact.getArtifactDescription().getRiver();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 JSONObject jfix = new JSONObject();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 JSONObject jfilter = new JSONObject();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 JSONObject jrName = new JSONObject();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 JSONString jrValue = new JSONString(river);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 JSONObject jextent = new JSONObject();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 JSONNumber jwidth = new JSONNumber(hWidth);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 JSONNumber jheight = new JSONNumber(hHeight);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 jrName.put("name", jrValue);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 jfilter.put("river", jrName);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 jextent.put("width", jwidth);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 jextent.put("height", jheight);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 jfilter.put("extent", jextent);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 jfix.put("sq", jfilter);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 String filter = jfix.toString();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 String imgUrl = GWT.getModuleBaseURL();
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 imgUrl += "sq-km-chart";
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 imgUrl += "?locale=" + locale;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 imgUrl += "&filter=" + filter;
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 if (chartImg != null && hasMember(chartImg)) {
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 chartImg.setWidth(hWidth);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 chartImg.setHeight(hHeight);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 chartImg.setSrc(imgUrl);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 }
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 else {
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 chartImg = new Img(imgUrl, hWidth, hHeight);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 addMember(chartImg);
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 }
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 }
86e69788c946 Added a new UIProvider that allows the input of a time period; the helper panel displays the field campaigns of MINFO's SQ relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 }

http://dive4elements.wald.intevation.org