Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java @ 1540:cd88a257a5e6
Minor refactoring.
flys-client/trunk@3759 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 25 Jan 2012 08:29:52 +0000 |
parents | cb5ab84505b7 |
children | 959e1d0df941 |
comparison
equal
deleted
inserted
replaced
1539:28e514c968d6 | 1540:cd88a257a5e6 |
---|---|
14 import de.intevation.flys.client.client.ui.ImgLink; | 14 import de.intevation.flys.client.client.ui.ImgLink; |
15 import de.intevation.flys.client.client.ui.Toolbar; | 15 import de.intevation.flys.client.client.ui.Toolbar; |
16 | 16 |
17 | 17 |
18 /** | 18 /** |
19 * Toolbar with buttons/icons to open datacage, switch to zoom mode, zoom out | |
20 * etc. | |
21 * | |
19 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
20 */ | 23 */ |
21 public class ChartToolbar extends Toolbar { | 24 public class ChartToolbar extends Toolbar { |
22 | 25 |
23 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); | 26 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); |
24 | 27 |
25 | |
26 public static final int PANEL_HEIGHT = 30; | 28 public static final int PANEL_HEIGHT = 30; |
27 | 29 |
28 | |
29 protected ChartOutputTab chartTab; | 30 protected ChartOutputTab chartTab; |
30 | 31 |
31 | |
32 protected Button datacage; | 32 protected Button datacage; |
33 | 33 |
34 protected Canvas downloadPNG; | 34 protected Canvas downloadPNG; |
35 | 35 |
36 protected Canvas downloadPDF; | 36 protected Canvas downloadPDF; |
47 | 47 |
48 protected ImgButton zoomOut; | 48 protected ImgButton zoomOut; |
49 | 49 |
50 protected ImgButton chartProperties; | 50 protected ImgButton chartProperties; |
51 | 51 |
52 protected ImgButton addPoints; | |
53 | |
52 protected PanControl panControl; | 54 protected PanControl panControl; |
53 | |
54 | 55 |
55 | 56 |
56 public ChartToolbar(CollectionView view, ChartOutputTab chartTab) { | 57 public ChartToolbar(CollectionView view, ChartOutputTab chartTab) { |
57 super(chartTab); | 58 super(chartTab); |
58 | 59 |
63 zoomToMaxExtent = new ImgButton(); | 64 zoomToMaxExtent = new ImgButton(); |
64 zoomOut = new ImgButton(); | 65 zoomOut = new ImgButton(); |
65 historyBack = new ImgButton(); | 66 historyBack = new ImgButton(); |
66 panControl = new PanControl(chartTab, MSG.pan()); | 67 panControl = new PanControl(chartTab, MSG.pan()); |
67 chartProperties = new ImgButton(); | 68 chartProperties = new ImgButton(); |
69 addPoints = new ImgButton(); | |
68 | 70 |
69 datacage.addClickHandler(new ClickHandler() { | 71 datacage.addClickHandler(new ClickHandler() { |
70 public void onClick(ClickEvent event) { | 72 public void onClick(ClickEvent event) { |
71 GWT.log("Clicked 'datacage' button."); | 73 GWT.log("Clicked 'datacage' button."); |
72 openDatacageWindow((ChartOutputTab) getOutputTab()); | 74 openDatacageWindow((ChartOutputTab) getOutputTab()); |
92 chartTab.getExportUrl(1280, 1024, "svg"), | 94 chartTab.getExportUrl(1280, 1024, "svg"), |
93 20, | 95 20, |
94 20); | 96 20); |
95 | 97 |
96 zoomToMaxExtent.setSrc(baseUrl + MSG.zoom_all()); | 98 zoomToMaxExtent.setSrc(baseUrl + MSG.zoom_all()); |
97 zoomToMaxExtent.setWidth(20); | 99 adjustImageButton(zoomToMaxExtent); |
98 zoomToMaxExtent.setHeight(20); | |
99 zoomToMaxExtent.setShowDown(false); | |
100 zoomToMaxExtent.setShowRollOver(false); | |
101 zoomToMaxExtent.setShowDisabled(false); | |
102 zoomToMaxExtent.setShowDisabledIcon(true); | |
103 zoomToMaxExtent.setShowDownIcon(false); | |
104 zoomToMaxExtent.setShowFocusedIcon(false); | |
105 zoomToMaxExtent.addClickHandler(new ClickHandler() { | 100 zoomToMaxExtent.addClickHandler(new ClickHandler() { |
106 public void onClick(ClickEvent event) { | 101 public void onClick(ClickEvent event) { |
107 getChartOutputTab().resetRanges(); | 102 getChartOutputTab().resetRanges(); |
108 } | 103 } |
109 }); | 104 }); |
110 | 105 |
111 zoomOut.setSrc(baseUrl + MSG.zoom_out()); | 106 zoomOut.setSrc(baseUrl + MSG.zoom_out()); |
112 zoomOut.setWidth(20); | 107 adjustImageButton(zoomOut); |
113 zoomOut.setHeight(20); | |
114 zoomOut.setShowDown(false); | |
115 zoomOut.setShowRollOver(false); | |
116 zoomOut.setShowDisabled(false); | |
117 zoomOut.setShowDisabledIcon(true); | |
118 zoomOut.setShowDownIcon(false); | |
119 zoomOut.setShowFocusedIcon(false); | |
120 zoomOut.addClickHandler(new ClickHandler() { | 108 zoomOut.addClickHandler(new ClickHandler() { |
121 public void onClick(ClickEvent event) { | 109 public void onClick(ClickEvent event) { |
122 getChartOutputTab().zoomOut(10); | 110 getChartOutputTab().zoomOut(10); |
123 } | 111 } |
124 }); | 112 }); |
125 | 113 |
126 historyBack.setSrc(baseUrl + MSG.zoom_back()); | 114 historyBack.setSrc(baseUrl + MSG.zoom_back()); |
127 historyBack.setWidth(20); | 115 adjustImageButton(historyBack); |
128 historyBack.setHeight(20); | |
129 historyBack.setShowDown(false); | |
130 historyBack.setShowRollOver(false); | |
131 historyBack.setShowDisabled(false); | |
132 historyBack.setShowDisabledIcon(true); | |
133 historyBack.setShowDownIcon(false); | |
134 historyBack.setShowFocusedIcon(false); | |
135 historyBack.addClickHandler(new ClickHandler() { | 116 historyBack.addClickHandler(new ClickHandler() { |
136 public void onClick(ClickEvent event) { | 117 public void onClick(ClickEvent event) { |
137 getChartOutputTab().zoomOut(); | 118 getChartOutputTab().zoomOut(); |
138 } | 119 } |
139 }); | 120 }); |
151 zoombox.deselect(); | 132 zoombox.deselect(); |
152 } | 133 } |
153 }); | 134 }); |
154 | 135 |
155 chartProperties.setSrc(baseUrl + MSG.properties_ico()); | 136 chartProperties.setSrc(baseUrl + MSG.properties_ico()); |
156 chartProperties.setWidth(20); | 137 adjustImageButton(chartProperties); |
157 chartProperties.setHeight(20); | |
158 chartProperties.setShowDown(false); | |
159 chartProperties.setShowRollOver(false); | |
160 chartProperties.setShowDisabled(false); | |
161 chartProperties.setShowDisabledIcon(true); | |
162 chartProperties.setShowDownIcon(false); | |
163 chartProperties.setShowFocusedIcon(false); | |
164 chartProperties.addClickHandler(new ClickHandler() { | 138 chartProperties.addClickHandler(new ClickHandler() { |
165 public void onClick(ClickEvent event) { | 139 public void onClick(ClickEvent event) { |
166 openPropertiesEditor(); | 140 openPropertiesEditor(); |
167 } | 141 } |
168 }); | 142 }); |
169 | 143 |
170 initLayout(); | 144 initLayout(); |
145 } | |
146 | |
147 /** Set width, height and other properties of an imagebutton. */ | |
148 public void adjustImageButton(ImageButton imgButton) { | |
149 imgButton.setWidth(20); | |
150 imgButton.setHeight(20); | |
151 imgButton.setShowDown(false); | |
152 imgButton.setShowRollOver(false); | |
153 imgButton.setShowDisabled(false); | |
154 imgButton.setShowDisabledIcon(true); | |
155 imgButton.setShowDownIcon(false); | |
156 imgButton.setShowFocusedIcon(false); | |
171 } | 157 } |
172 | 158 |
173 | 159 |
174 public ChartOutputTab getChartOutputTab() { | 160 public ChartOutputTab getChartOutputTab() { |
175 return chartTab; | 161 return chartTab; |