comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java @ 1344:51d4b51a51ed

Added icons to export chart as PNG, PDF and SVG to the ChartToolbar. flys-client/trunk@2998 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 17 Oct 2011 17:33:27 +0000
parents 4782c0ce9cec
children 064fb5d181ea
comparison
equal deleted inserted replaced
1343:0d3d3860beb5 1344:51d4b51a51ed
1 package de.intevation.flys.client.client.ui.chart; 1 package de.intevation.flys.client.client.ui.chart;
2 2
3 import com.google.gwt.core.client.GWT; 3 import com.google.gwt.core.client.GWT;
4 4
5 import com.smartgwt.client.widgets.Button; 5 import com.smartgwt.client.widgets.Button;
6 import com.smartgwt.client.widgets.Canvas;
6 import com.smartgwt.client.widgets.ImgButton; 7 import com.smartgwt.client.widgets.ImgButton;
7 import com.smartgwt.client.widgets.Label; 8 import com.smartgwt.client.widgets.Label;
8 import com.smartgwt.client.widgets.layout.HLayout; 9 import com.smartgwt.client.widgets.layout.HLayout;
9 import com.smartgwt.client.widgets.events.ClickEvent; 10 import com.smartgwt.client.widgets.events.ClickEvent;
10 import com.smartgwt.client.widgets.events.ClickHandler; 11 import com.smartgwt.client.widgets.events.ClickHandler;
13 14
14 import de.intevation.flys.client.shared.model.Artifact; 15 import de.intevation.flys.client.shared.model.Artifact;
15 import de.intevation.flys.client.shared.model.User; 16 import de.intevation.flys.client.shared.model.User;
16 17
17 import de.intevation.flys.client.client.FLYSConstants; 18 import de.intevation.flys.client.client.FLYSConstants;
19 import de.intevation.flys.client.client.FLYSImages;
18 import de.intevation.flys.client.client.ui.CollectionView; 20 import de.intevation.flys.client.client.ui.CollectionView;
19 import de.intevation.flys.client.client.ui.DatacageWindow; 21 import de.intevation.flys.client.client.ui.DatacageWindow;
22 import de.intevation.flys.client.client.ui.ImgLink;
20 23
21 24
22 /** 25 /**
23 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
24 */ 27 */
25 public class ChartToolbar extends HLayout { 28 public class ChartToolbar extends HLayout {
26 29
27 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); 30 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class);
28 31
32 protected static FLYSImages IMG = GWT.create(FLYSImages.class);
33
29 34
30 public static final int PANEL_HEIGHT = 30; 35 public static final int PANEL_HEIGHT = 30;
31 36
32 37
33 protected CollectionView view; 38 protected CollectionView view;
34 39
35 protected ChartOutputTab chartTab; 40 protected ChartOutputTab chartTab;
36 41
37 42
38 protected Button datacage; 43 protected Button datacage;
44
45 protected Canvas downloadPNG;
46
47 protected Canvas downloadPDF;
48
49 protected Canvas downloadSVG;
39 50
40 protected MousePositionPanel position; 51 protected MousePositionPanel position;
41 52
42 protected ZoomboxControl zoombox; 53 protected ZoomboxControl zoombox;
43 54
71 openDatacageWindow(); 82 openDatacageWindow();
72 } 83 }
73 }); 84 });
74 85
75 String baseUrl = GWT.getHostPageBaseURL(); 86 String baseUrl = GWT.getHostPageBaseURL();
87
88 String url = "http://www.heise.de";
89 downloadPNG = new ImgLink(
90 IMG.downloadPNG().getURL(),
91 chartTab.getExportUrl(1280, 1024, "png"),
92 20,
93 20);
94
95 downloadPDF = new ImgLink(
96 IMG.downloadPDF().getURL(),
97 chartTab.getExportUrl(1280, 1024, "pdf"),
98 20,
99 20);
100
101 downloadSVG = new ImgLink(
102 IMG.downloadSVG().getURL(),
103 chartTab.getExportUrl(1280, 1024, "svg"),
104 20,
105 20);
106
76 zoomToMaxExtent.setSrc(baseUrl + MSG.zoom_all()); 107 zoomToMaxExtent.setSrc(baseUrl + MSG.zoom_all());
77 zoomToMaxExtent.setWidth(20); 108 zoomToMaxExtent.setWidth(20);
78 zoomToMaxExtent.setHeight(20); 109 zoomToMaxExtent.setHeight(20);
79 zoomToMaxExtent.setShowDown(false); 110 zoomToMaxExtent.setShowDown(false);
80 zoomToMaxExtent.setShowRollOver(false); 111 zoomToMaxExtent.setShowRollOver(false);
161 spacer.setWidth("*"); 192 spacer.setWidth("*");
162 datacage.setWidth("95px"); 193 datacage.setWidth("95px");
163 position.setWidth("200px"); 194 position.setWidth("200px");
164 195
165 addMember(datacage); 196 addMember(datacage);
197 addMember(downloadPNG);
198 addMember(downloadPDF);
199 addMember(downloadSVG);
166 addMember(zoomToMaxExtent); 200 addMember(zoomToMaxExtent);
167 addMember(historyBack); 201 addMember(historyBack);
168 addMember(zoomOut); 202 addMember(zoomOut);
169 addMember(zoombox); 203 addMember(zoombox);
170 addMember(panControl); 204 addMember(panControl);

http://dive4elements.wald.intevation.org