comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java @ 543:9c2cf4811a7d

Added a control to reset the zoom of a chart. In addition, the zoom buttons are displayed as ImgButtons now. flys-client/trunk@2049 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Jun 2011 08:20:22 +0000
parents ed29599e06e5
children feaf6a8881ee
comparison
equal deleted inserted replaced
542:7c57149e8715 543:9c2cf4811a7d
1 package de.intevation.flys.client.client.ui.chart; 1 package de.intevation.flys.client.client.ui.chart;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
5 5
6 import com.google.gwt.core.client.GWT;
7
6 import com.smartgwt.client.types.Positioning; 8 import com.smartgwt.client.types.Positioning;
7 import com.smartgwt.client.types.SelectionType; 9 import com.smartgwt.client.types.SelectionType;
8 import com.smartgwt.client.widgets.Button; 10 import com.smartgwt.client.widgets.ImgButton;
9 import com.smartgwt.client.widgets.Canvas; 11 import com.smartgwt.client.widgets.Canvas;
10 import com.smartgwt.client.widgets.events.MouseDownEvent; 12 import com.smartgwt.client.widgets.events.MouseDownEvent;
11 import com.smartgwt.client.widgets.events.MouseDownHandler; 13 import com.smartgwt.client.widgets.events.MouseDownHandler;
12 import com.smartgwt.client.widgets.events.MouseMoveEvent; 14 import com.smartgwt.client.widgets.events.MouseMoveEvent;
13 import com.smartgwt.client.widgets.events.MouseMoveHandler; 15 import com.smartgwt.client.widgets.events.MouseMoveHandler;
28 * a ZoomEvent is fired. 30 * a ZoomEvent is fired.
29 * 31 *
30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 32 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
31 */ 33 */
32 public class ZoomboxControl 34 public class ZoomboxControl
33 extends Button 35 extends ImgButton
34 implements MouseDownHandler, MouseUpHandler, MouseMoveHandler, HasZoomHandlers 36 implements MouseDownHandler, MouseUpHandler, MouseMoveHandler, HasZoomHandlers
35 { 37 {
36 protected List<ZoomHandler> handlers; 38 protected List<ZoomHandler> handlers;
37 39
38 protected ChartOutputTab chartTab; 40 protected ChartOutputTab chartTab;
41 43
42 protected int[] start; 44 protected int[] start;
43 protected int[] end; 45 protected int[] end;
44 46
45 47
46 public ZoomboxControl(ChartOutputTab chartTab) { 48 public ZoomboxControl(ChartOutputTab chartTab, String imageUrl) {
47 super("Zoombox"); 49 super();
48 50
49 this.handlers = new ArrayList<ZoomHandler>(); 51 this.handlers = new ArrayList<ZoomHandler>();
50 this.chartTab = chartTab; 52 this.chartTab = chartTab;
51 this.start = new int[2]; 53 this.start = new int[2];
52 this.end = new int[2]; 54 this.end = new int[2];
53 this.zoombox = new Canvas(); 55 this.zoombox = new Canvas();
54 56
55 initZoombox(); 57 initZoombox();
56 58
59 String baseUrl = GWT.getHostPageBaseURL();
60 setSrc(baseUrl + imageUrl);
57 setActionType(SelectionType.CHECKBOX); 61 setActionType(SelectionType.CHECKBOX);
62 setSize(20);
63 setShowRollOver(false);
58 setSelected(false); 64 setSelected(false);
59 65
60 chartTab.getChartPanel().addMouseDownHandler(this); 66 chartTab.getChartPanel().addMouseDownHandler(this);
61 chartTab.getChartPanel().addMouseMoveHandler(this); 67 chartTab.getChartPanel().addMouseMoveHandler(this);
62 chartTab.getChartPanel().addMouseUpHandler(this); 68 chartTab.getChartPanel().addMouseUpHandler(this);

http://dive4elements.wald.intevation.org