Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java @ 1364:9981ba2ee13a
Display the datacage button in the map toolbar.
flys-client/trunk@3063 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 24 Oct 2011 13:35:30 +0000 |
parents | 064fb5d181ea |
children | 748e7c828d03 |
comparison
equal
deleted
inserted
replaced
1363:9da7fdfbb80e | 1364:9981ba2ee13a |
---|---|
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.Canvas; |
7 import com.smartgwt.client.widgets.ImgButton; | 7 import com.smartgwt.client.widgets.ImgButton; |
8 import com.smartgwt.client.widgets.Label; | 8 import com.smartgwt.client.widgets.Label; |
9 import com.smartgwt.client.widgets.layout.HLayout; | |
10 import com.smartgwt.client.widgets.events.ClickEvent; | 9 import com.smartgwt.client.widgets.events.ClickEvent; |
11 import com.smartgwt.client.widgets.events.ClickHandler; | 10 import com.smartgwt.client.widgets.events.ClickHandler; |
12 import com.smartgwt.client.widgets.events.CloseClickHandler; | |
13 import com.smartgwt.client.widgets.events.CloseClientEvent; | |
14 | |
15 import de.intevation.flys.client.shared.model.Artifact; | |
16 import de.intevation.flys.client.shared.model.User; | |
17 | 11 |
18 import de.intevation.flys.client.client.FLYSConstants; | 12 import de.intevation.flys.client.client.FLYSConstants; |
19 import de.intevation.flys.client.client.FLYSImages; | 13 import de.intevation.flys.client.client.FLYSImages; |
20 import de.intevation.flys.client.client.ui.CollectionView; | 14 import de.intevation.flys.client.client.ui.CollectionView; |
21 import de.intevation.flys.client.client.ui.DatacageWindow; | |
22 import de.intevation.flys.client.client.ui.ImgLink; | 15 import de.intevation.flys.client.client.ui.ImgLink; |
16 import de.intevation.flys.client.client.ui.Toolbar; | |
23 | 17 |
24 | 18 |
25 /** | 19 /** |
26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
27 */ | 21 */ |
28 public class ChartToolbar extends HLayout { | 22 public class ChartToolbar extends Toolbar { |
29 | 23 |
30 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); | 24 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); |
31 | 25 |
32 protected static FLYSImages IMG = GWT.create(FLYSImages.class); | 26 protected static FLYSImages IMG = GWT.create(FLYSImages.class); |
33 | 27 |
34 | 28 |
35 public static final int PANEL_HEIGHT = 30; | 29 public static final int PANEL_HEIGHT = 30; |
36 | 30 |
37 | |
38 protected CollectionView view; | |
39 | 31 |
40 protected ChartOutputTab chartTab; | 32 protected ChartOutputTab chartTab; |
41 | 33 |
42 | 34 |
43 protected Button datacage; | 35 protected Button datacage; |
61 protected PanControl panControl; | 53 protected PanControl panControl; |
62 | 54 |
63 | 55 |
64 | 56 |
65 public ChartToolbar(CollectionView view, ChartOutputTab chartTab) { | 57 public ChartToolbar(CollectionView view, ChartOutputTab chartTab) { |
66 super(); | 58 super(chartTab); |
67 | 59 |
68 this.view = view; | |
69 this.chartTab = chartTab; | 60 this.chartTab = chartTab; |
70 | |
71 datacage = new Button(MSG.databasket()); | 61 datacage = new Button(MSG.databasket()); |
72 position = new MousePositionPanel(chartTab); | 62 position = new MousePositionPanel(chartTab); |
73 zoombox = new ZoomboxControl(chartTab, MSG.zoom_in()); | 63 zoombox = new ZoomboxControl(chartTab, MSG.zoom_in()); |
74 zoomToMaxExtent = new ImgButton(); | 64 zoomToMaxExtent = new ImgButton(); |
75 zoomOut = new ImgButton(); | 65 zoomOut = new ImgButton(); |
77 panControl = new PanControl(chartTab, MSG.pan()); | 67 panControl = new PanControl(chartTab, MSG.pan()); |
78 | 68 |
79 datacage.addClickHandler(new ClickHandler() { | 69 datacage.addClickHandler(new ClickHandler() { |
80 public void onClick(ClickEvent event) { | 70 public void onClick(ClickEvent event) { |
81 GWT.log("Clicked 'datacage' button."); | 71 GWT.log("Clicked 'datacage' button."); |
82 openDatacageWindow(); | 72 openDatacageWindow((ChartOutputTab) getOutputTab()); |
83 } | 73 } |
84 }); | 74 }); |
85 | 75 |
86 String baseUrl = GWT.getHostPageBaseURL(); | 76 String baseUrl = GWT.getHostPageBaseURL(); |
87 | 77 |
164 | 154 |
165 initLayout(); | 155 initLayout(); |
166 } | 156 } |
167 | 157 |
168 | 158 |
169 public Artifact getArtifact() { | |
170 return view.getArtifact(); | |
171 } | |
172 | |
173 public User getUser() { | |
174 return view.getUser(); | |
175 } | |
176 | |
177 | |
178 public ChartOutputTab getChartOutputTab() { | 159 public ChartOutputTab getChartOutputTab() { |
179 return chartTab; | 160 return chartTab; |
180 } | 161 } |
181 | 162 |
182 | 163 |
202 addMember(zoombox); | 183 addMember(zoombox); |
203 addMember(panControl); | 184 addMember(panControl); |
204 addMember(spacer); | 185 addMember(spacer); |
205 addMember(position); | 186 addMember(position); |
206 } | 187 } |
207 | |
208 | |
209 protected void openDatacageWindow() { | |
210 Artifact artifact = getArtifact(); | |
211 User user = getUser(); | |
212 | |
213 String outs = chartTab.getOutputName(); | |
214 | |
215 final DatacageWindow dc = new DatacageWindow( | |
216 artifact, user, outs, view); | |
217 dc.addRedrawRequestHandler(chartTab); | |
218 dc.addCloseClickHandler(new CloseClickHandler() { | |
219 public void onCloseClick(CloseClientEvent event) { | |
220 dc.destroy(); | |
221 } | |
222 }); | |
223 dc.show(); | |
224 } | |
225 } | 188 } |
226 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 189 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |