annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/ChartOutputTab.java @ 101:f7967d12ce6e

Removed useless imports. flys-client/trunk@1617 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 30 Mar 2011 07:54:07 +0000
parents c8cd1b918901
children 7ea004d0ffbc
rev   line source
75
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
78
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
3 import com.google.gwt.core.client.GWT;
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
4
75
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import com.smartgwt.client.widgets.Canvas;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import com.smartgwt.client.widgets.Img;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import com.smartgwt.client.widgets.layout.HLayout;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.flys.client.shared.model.Collection;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import de.intevation.flys.client.shared.model.OutputMode;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import de.intevation.flys.client.client.Config;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 /**
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 */
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 public class ChartOutputTab extends OutputTab {
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 /** The canvas that wraps the theme editor.*/
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 protected Canvas left;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 /** The canvas that wraps the chart.*/
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 protected Canvas right;
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 /**
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 * The default constructor to create a new ChartOutputTab.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 *
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 * @param title The title of this tab.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 * @param collection The Collection which this chart belongs to.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * @param mode The OutputMode.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 */
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public ChartOutputTab(String title, Collection collection, OutputMode mode){
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 super(title, collection, mode);
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 left = new Canvas();
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 right = new Canvas();
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 left.setWidth("25%");
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 right.setWidth("*");
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 HLayout hLayout = new HLayout();
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 hLayout.setWidth100();
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 hLayout.setHeight100();
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 hLayout.setMembersMargin(10);
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 hLayout.addMember(left);
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 hLayout.addMember(right);
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 Img chart = getChartImg();
78
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
51 chart.setWidth100();
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
52 chart.setHeight100();
75
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 right.addChild(chart);
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 setPane(hLayout);
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 }
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 /**
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 * Builds the chart image and returns it.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 *
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 * @return the chart image.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 */
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 protected Img getChartImg() {
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 return new Img(getImgUrl());
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 }
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 /**
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 * Builds the URL that points to the chart image.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 *
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 * @return the URL to the chart image.
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 */
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 protected String getImgUrl() {
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 Config config = Config.getInstance();
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 String server = config.getServerUrl();
78
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
78 String uuid = collection.getItem(0).identifier();
87
c8cd1b918901 Bugfix: Step back will remove duplicated output tab and an extended chart image URL bypasses the browser cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 85
diff changeset
79 String hash = collection.getItem(0).hash();
78
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
80
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
81 String imgUrl = GWT.getModuleBaseURL();
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
82 imgUrl += "chart";
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
83 imgUrl += "?target=chart";
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
84 imgUrl += "&server=" + server;
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
85 imgUrl += "&mode=img";
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
86 imgUrl += "&width=600";
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
87 imgUrl += "&height=400";
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
88 imgUrl += "&points=false";
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
89 imgUrl += "&uuid=" + uuid;
87
c8cd1b918901 Bugfix: Step back will remove duplicated output tab and an extended chart image URL bypasses the browser cache.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 85
diff changeset
90 imgUrl += "&hash=" + hash;
78
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
91
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
92 GWT.log("IMAGE URL = " + imgUrl);
75
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 // TODO Build the correct url that points to the OUT() resource of the
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 // collection.
78
9ca5160cf080 Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 75
diff changeset
96 return imgUrl;
75
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 }
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 }
571843833129 Added a panel that will be used to display chart output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org