Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java @ 2983:725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
flys-client/trunk@4991 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 13 Jul 2012 11:31:25 +0000 |
parents | a805118fffa6 |
children | 6d749af6a9c2 |
comparison
equal
deleted
inserted
replaced
2982:d2a54ae0016b | 2983:725470fc57d2 |
---|---|
1 package de.intevation.flys.client.client.ui.chart; | 1 package de.intevation.flys.client.client.ui.chart; |
2 | |
3 import java.util.Date; | |
4 import java.util.HashMap; | |
5 import java.util.Map; | |
6 import java.util.Stack; | |
7 | 2 |
8 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
9 import com.google.gwt.user.client.rpc.AsyncCallback; | 4 import com.google.gwt.user.client.rpc.AsyncCallback; |
10 | |
11 import com.smartgwt.client.types.Overflow; | 5 import com.smartgwt.client.types.Overflow; |
12 | |
13 import com.smartgwt.client.widgets.Canvas; | 6 import com.smartgwt.client.widgets.Canvas; |
14 import com.smartgwt.client.widgets.Img; | 7 import com.smartgwt.client.widgets.Img; |
15 | 8 import com.smartgwt.client.widgets.events.ResizedEvent; |
9 import com.smartgwt.client.widgets.events.ResizedHandler; | |
16 import com.smartgwt.client.widgets.layout.HLayout; | 10 import com.smartgwt.client.widgets.layout.HLayout; |
17 import com.smartgwt.client.widgets.layout.VLayout; | 11 import com.smartgwt.client.widgets.layout.VLayout; |
18 | 12 |
19 import com.smartgwt.client.widgets.events.ResizedEvent; | 13 import de.intevation.flys.client.client.Config; |
20 import com.smartgwt.client.widgets.events.ResizedHandler; | 14 import de.intevation.flys.client.client.event.OutputParameterChangeEvent; |
21 | 15 import de.intevation.flys.client.client.event.OutputParameterChangeHandler; |
16 import de.intevation.flys.client.client.event.PanEvent; | |
17 import de.intevation.flys.client.client.event.PanHandler; | |
18 import de.intevation.flys.client.client.event.RedrawRequestEvent; | |
19 import de.intevation.flys.client.client.event.RedrawRequestEvent.Type; | |
20 import de.intevation.flys.client.client.event.RedrawRequestHandler; | |
21 import de.intevation.flys.client.client.event.ZoomEvent; | |
22 import de.intevation.flys.client.client.event.ZoomHandler; | |
23 import de.intevation.flys.client.client.services.ChartInfoService; | |
24 import de.intevation.flys.client.client.services.ChartInfoServiceAsync; | |
25 import de.intevation.flys.client.client.ui.CollectionView; | |
26 import de.intevation.flys.client.client.ui.OutputTab; | |
22 import de.intevation.flys.client.shared.Transform2D; | 27 import de.intevation.flys.client.shared.Transform2D; |
23 import de.intevation.flys.client.shared.model.Axis; | 28 import de.intevation.flys.client.shared.model.Axis; |
24 import de.intevation.flys.client.shared.model.ChartInfo; | 29 import de.intevation.flys.client.shared.model.ChartInfo; |
25 import de.intevation.flys.client.shared.model.Collection; | 30 import de.intevation.flys.client.shared.model.Collection; |
26 import de.intevation.flys.client.shared.model.OutputMode; | 31 import de.intevation.flys.client.shared.model.OutputMode; |
27 import de.intevation.flys.client.shared.model.ZoomObj; | 32 import de.intevation.flys.client.shared.model.ZoomObj; |
28 import de.intevation.flys.client.client.Config; | 33 |
29 import de.intevation.flys.client.client.event.OutputParameterChangeEvent; | 34 import java.util.Date; |
30 import de.intevation.flys.client.client.event.OutputParameterChangeHandler; | 35 import java.util.HashMap; |
31 import de.intevation.flys.client.client.event.PanEvent; | 36 import java.util.Map; |
32 import de.intevation.flys.client.client.event.PanHandler; | 37 import java.util.Stack; |
33 import de.intevation.flys.client.client.event.RedrawRequestHandler; | |
34 import de.intevation.flys.client.client.event.RedrawRequestEvent; | |
35 import de.intevation.flys.client.client.event.RedrawRequestEvent.Type; | |
36 import de.intevation.flys.client.client.event.ZoomEvent; | |
37 import de.intevation.flys.client.client.event.ZoomHandler; | |
38 import de.intevation.flys.client.client.services.ChartInfoService; | |
39 import de.intevation.flys.client.client.services.ChartInfoServiceAsync; | |
40 import de.intevation.flys.client.client.ui.CollectionView; | |
41 import de.intevation.flys.client.client.ui.OutputTab; | |
42 | 38 |
43 | 39 |
44 /** | 40 /** |
45 * Tab representing and showing one Chart-output. | 41 * Tab representing and showing one Chart-output. |
46 * | 42 * |
164 | 160 |
165 right.addResizedHandler(this); | 161 right.addResizedHandler(this); |
166 } | 162 } |
167 | 163 |
168 | 164 |
165 public void toggleThemePanel() { | |
166 this.left.setVisible(!left.isVisible()); | |
167 } | |
168 | |
169 | |
169 /** | 170 /** |
170 * This method is called after the chart panel has resized. It removes the | 171 * This method is called after the chart panel has resized. It removes the |
171 * chart - if existing - and requests a new one with adjusted size. | 172 * chart - if existing - and requests a new one with adjusted size. |
172 * | 173 * |
173 * @param event The resize event. | 174 * @param event The resize event. |
174 */ | 175 */ |
176 @Override | |
175 public void onResized(ResizedEvent event) { | 177 public void onResized(ResizedEvent event) { |
176 updateChartPanel(); | 178 updateChartPanel(); |
177 updateChartInfo(); | 179 updateChartInfo(); |
178 } | 180 } |
179 | 181 |
180 | 182 |
181 /** For RESET type of events, just reset the ranges, otherwise do a | 183 /** For RESET type of events, just reset the ranges, otherwise do a |
182 * complete refresh of panel, info and collection. */ | 184 * complete refresh of panel, info and collection. */ |
185 @Override | |
183 public void onRedrawRequest(RedrawRequestEvent event) { | 186 public void onRedrawRequest(RedrawRequestEvent event) { |
184 if (event.getType() == Type.RESET) { | 187 if (event.getType() == Type.RESET) { |
185 resetRanges(); | 188 resetRanges(); |
186 } | 189 } |
187 else { | 190 else { |
196 * Listens to change event in the chart them panel and updates chart after | 199 * Listens to change event in the chart them panel and updates chart after |
197 * receiving such an event. | 200 * receiving such an event. |
198 * | 201 * |
199 * @param event The OutputParameterChangeEvent. | 202 * @param event The OutputParameterChangeEvent. |
200 */ | 203 */ |
204 @Override | |
201 public void onOutputParameterChanged(OutputParameterChangeEvent event) { | 205 public void onOutputParameterChanged(OutputParameterChangeEvent event) { |
202 updateChartInfo(); | 206 updateChartInfo(); |
203 updateChartPanel(); | 207 updateChartPanel(); |
204 } | 208 } |
205 | 209 |
207 /** | 211 /** |
208 * Listens to zoom events and refreshes the current chart in such case. | 212 * Listens to zoom events and refreshes the current chart in such case. |
209 * | 213 * |
210 * @param evt The ZoomEvent that stores the coordinates for zooming. | 214 * @param evt The ZoomEvent that stores the coordinates for zooming. |
211 */ | 215 */ |
216 @Override | |
212 public void onZoom(ZoomEvent evt) { | 217 public void onZoom(ZoomEvent evt) { |
213 zoomStack.push(new ZoomObj(zoom[0], zoom[1], zoom[2], zoom[3])); | 218 zoomStack.push(new ZoomObj(zoom[0], zoom[1], zoom[2], zoom[3])); |
214 | 219 |
215 xrange[0] = evt.getStartX(); | 220 xrange[0] = evt.getStartX(); |
216 xrange[1] = evt.getEndX(); | 221 xrange[1] = evt.getEndX(); |
280 zoom[2] = divide(subtract(start[1], ymin), yRange); | 285 zoom[2] = divide(subtract(start[1], ymin), yRange); |
281 zoom[3] = divide(subtract(end[1], ymin), yRange); | 286 zoom[3] = divide(subtract(end[1], ymin), yRange); |
282 } | 287 } |
283 | 288 |
284 | 289 |
290 @Override | |
285 public void onPan(PanEvent event) { | 291 public void onPan(PanEvent event) { |
286 if (chartInfo == null) { | 292 if (chartInfo == null) { |
287 return; | 293 return; |
288 } | 294 } |
289 | 295 |
449 view.getCollection(), | 455 view.getCollection(), |
450 locale, | 456 locale, |
451 mode.getName(), | 457 mode.getName(), |
452 getChartAttributes(), | 458 getChartAttributes(), |
453 new AsyncCallback<ChartInfo>() { | 459 new AsyncCallback<ChartInfo>() { |
460 @Override | |
454 public void onFailure(Throwable caught) { | 461 public void onFailure(Throwable caught) { |
455 GWT.log("ChartInfo ERROR: " + caught.getMessage()); | 462 GWT.log("ChartInfo ERROR: " + caught.getMessage()); |
456 } | 463 } |
457 | 464 |
465 @Override | |
458 public void onSuccess(ChartInfo chartInfo) { | 466 public void onSuccess(ChartInfo chartInfo) { |
459 setChartInfo(chartInfo); | 467 setChartInfo(chartInfo); |
460 } | 468 } |
461 }); | 469 }); |
462 } | 470 } |