comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.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 0f4095a522ab
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 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.ImgButton;
6 import com.smartgwt.client.widgets.Label; 7 import com.smartgwt.client.widgets.Label;
7 import com.smartgwt.client.widgets.layout.HLayout; 8 import com.smartgwt.client.widgets.layout.HLayout;
8 import com.smartgwt.client.widgets.events.ClickEvent; 9 import com.smartgwt.client.widgets.events.ClickEvent;
9 import com.smartgwt.client.widgets.events.ClickHandler; 10 import com.smartgwt.client.widgets.events.ClickHandler;
10 import com.smartgwt.client.widgets.events.CloseClickHandler; 11 import com.smartgwt.client.widgets.events.CloseClickHandler;
37 38
38 protected MousePositionPanel position; 39 protected MousePositionPanel position;
39 40
40 protected ZoomboxControl zoombox; 41 protected ZoomboxControl zoombox;
41 42
43 protected ImgButton zoomToMaxExtent;
44
42 45
43 46
44 public ChartToolbar(CollectionView view, ChartOutputTab chartTab) { 47 public ChartToolbar(CollectionView view, ChartOutputTab chartTab) {
45 super(); 48 super();
46 49
47 this.view = view; 50 this.view = view;
48 this.chartTab = chartTab; 51 this.chartTab = chartTab;
49 52
50 datacage = new Button(MSG.databasket()); 53 datacage = new Button(MSG.databasket());
51 position = new MousePositionPanel(chartTab); 54 position = new MousePositionPanel(chartTab);
52 zoombox = new ZoomboxControl(chartTab); 55 zoombox = new ZoomboxControl(chartTab, MSG.zoom_in());
56 zoomToMaxExtent = new ImgButton();
53 57
54 datacage.addClickHandler(new ClickHandler() { 58 datacage.addClickHandler(new ClickHandler() {
55 public void onClick(ClickEvent event) { 59 public void onClick(ClickEvent event) {
56 GWT.log("Clicked 'datacage' button."); 60 GWT.log("Clicked 'datacage' button.");
57 openDatacageWindow(getArtifact()); 61 openDatacageWindow(getArtifact());
62 }
63 });
64
65 String baseUrl = GWT.getHostPageBaseURL();
66 zoomToMaxExtent.setSrc(baseUrl + MSG.zoom_all());
67 zoomToMaxExtent.setWidth(20);
68 zoomToMaxExtent.setHeight(20);
69 zoomToMaxExtent.setShowDown(false);
70 zoomToMaxExtent.setShowRollOver(false);
71 zoomToMaxExtent.setShowDisabled(false);
72 zoomToMaxExtent.setShowDisabledIcon(true);
73 zoomToMaxExtent.setShowDownIcon(false);
74 zoomToMaxExtent.setShowFocusedIcon(false);
75 zoomToMaxExtent.addClickHandler(new ClickHandler() {
76 public void onClick(ClickEvent event) {
77 getChartOutputTab().resetRanges();
58 } 78 }
59 }); 79 });
60 80
61 zoombox.addZoomHandler(chartTab); 81 zoombox.addZoomHandler(chartTab);
62 82
64 } 84 }
65 85
66 86
67 public Artifact getArtifact() { 87 public Artifact getArtifact() {
68 return view.getArtifact(); 88 return view.getArtifact();
89 }
90
91
92 public ChartOutputTab getChartOutputTab() {
93 return chartTab;
69 } 94 }
70 95
71 96
72 protected void initLayout() { 97 protected void initLayout() {
73 setWidth100(); 98 setWidth100();
80 spacer.setWidth("*"); 105 spacer.setWidth("*");
81 datacage.setWidth("95px"); 106 datacage.setWidth("95px");
82 position.setWidth("200px"); 107 position.setWidth("200px");
83 108
84 addMember(datacage); 109 addMember(datacage);
110 addMember(zoomToMaxExtent);
85 addMember(zoombox); 111 addMember(zoombox);
86 addMember(spacer); 112 addMember(spacer);
87 addMember(position); 113 addMember(position);
88 } 114 }
89 115

http://dive4elements.wald.intevation.org