Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java @ 533:34103ab9fe60
Moved the toolbar stuff of the chart panel into an own class.
flys-client/trunk@2024 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 27 May 2011 13:48:25 +0000 |
parents | 0ba7c43e7b62 |
children | e08777967bad |
comparison
equal
deleted
inserted
replaced
532:0ba7c43e7b62 | 533:34103ab9fe60 |
---|---|
2 | 2 |
3 import java.util.Date; | 3 import java.util.Date; |
4 | 4 |
5 import com.google.gwt.core.client.GWT; | 5 import com.google.gwt.core.client.GWT; |
6 | 6 |
7 import com.smartgwt.client.widgets.Button; | |
8 import com.smartgwt.client.widgets.Canvas; | 7 import com.smartgwt.client.widgets.Canvas; |
9 import com.smartgwt.client.widgets.Img; | 8 import com.smartgwt.client.widgets.Img; |
10 import com.smartgwt.client.widgets.Label; | 9 import com.smartgwt.client.widgets.Label; |
11 | 10 |
12 import com.smartgwt.client.widgets.layout.HLayout; | 11 import com.smartgwt.client.widgets.layout.HLayout; |
13 import com.smartgwt.client.widgets.layout.VLayout; | 12 import com.smartgwt.client.widgets.layout.VLayout; |
14 | 13 |
15 import com.smartgwt.client.widgets.events.ClickEvent; | |
16 import com.smartgwt.client.widgets.events.ClickHandler; | |
17 import com.smartgwt.client.widgets.events.CloseClickHandler; | |
18 import com.smartgwt.client.widgets.events.CloseClientEvent; | |
19 import com.smartgwt.client.widgets.events.ResizedEvent; | 14 import com.smartgwt.client.widgets.events.ResizedEvent; |
20 import com.smartgwt.client.widgets.events.ResizedHandler; | 15 import com.smartgwt.client.widgets.events.ResizedHandler; |
21 | 16 |
22 import de.intevation.flys.client.shared.model.Artifact; | |
23 import de.intevation.flys.client.shared.model.Collection; | 17 import de.intevation.flys.client.shared.model.Collection; |
24 import de.intevation.flys.client.shared.model.OutputMode; | 18 import de.intevation.flys.client.shared.model.OutputMode; |
25 import de.intevation.flys.client.client.Config; | 19 import de.intevation.flys.client.client.Config; |
26 import de.intevation.flys.client.client.FLYSConstants; | |
27 import de.intevation.flys.client.client.event.OutputParameterChangeEvent; | 20 import de.intevation.flys.client.client.event.OutputParameterChangeEvent; |
28 import de.intevation.flys.client.client.event.OutputParameterChangeHandler; | 21 import de.intevation.flys.client.client.event.OutputParameterChangeHandler; |
29 import de.intevation.flys.client.client.ui.CollectionView; | 22 import de.intevation.flys.client.client.ui.CollectionView; |
30 import de.intevation.flys.client.client.ui.DatacageWindow; | |
31 import de.intevation.flys.client.client.ui.OutputTab; | 23 import de.intevation.flys.client.client.ui.OutputTab; |
32 | 24 |
33 | 25 |
34 /** | 26 /** |
35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
41 public static final int DEFAULT_CHART_WIDTH = 600; | 33 public static final int DEFAULT_CHART_WIDTH = 600; |
42 public static final int DEFAULT_CHART_HEIGHT = 500; | 34 public static final int DEFAULT_CHART_HEIGHT = 500; |
43 | 35 |
44 public static final int THEMEPANEL_MIN_WIDTH = 200; | 36 public static final int THEMEPANEL_MIN_WIDTH = 200; |
45 | 37 |
46 | |
47 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); | |
48 | 38 |
49 | 39 |
50 /** The canvas that wraps the chart toolbar.*/ | 40 /** The canvas that wraps the chart toolbar.*/ |
51 protected Canvas tbarPanel; | 41 protected Canvas tbarPanel; |
52 | 42 |
70 OutputMode mode, | 60 OutputMode mode, |
71 CollectionView collectionView | 61 CollectionView collectionView |
72 ){ | 62 ){ |
73 super(title, collection, mode); | 63 super(title, collection, mode); |
74 | 64 |
75 tbarPanel = new Canvas(); | |
76 left = new Canvas(); | 65 left = new Canvas(); |
77 right = new Canvas(); | 66 right = new Canvas(); |
67 tbarPanel = new ChartToolbar(collectionView); | |
78 | 68 |
79 tbarPanel.setBorder("1px solid black"); | |
80 tbarPanel.setHeight(30); | |
81 left.setBorder("1px solid black"); | 69 left.setBorder("1px solid black"); |
82 left.setWidth(THEMEPANEL_MIN_WIDTH); | 70 left.setWidth(THEMEPANEL_MIN_WIDTH); |
83 left.setMinWidth(THEMEPANEL_MIN_WIDTH); | 71 left.setMinWidth(THEMEPANEL_MIN_WIDTH); |
84 right.setWidth("*"); | 72 right.setWidth("*"); |
85 | 73 |
97 ChartThemePanel ctp = new ChartThemePanel(collection, mode); | 85 ChartThemePanel ctp = new ChartThemePanel(collection, mode); |
98 ctp.addOutputParameterChangeHandler(this); | 86 ctp.addOutputParameterChangeHandler(this); |
99 | 87 |
100 right.addChild(createChartPanel()); | 88 right.addChild(createChartPanel()); |
101 left.addChild(ctp); | 89 left.addChild(ctp); |
102 tbarPanel.addChild( | |
103 createTBarPanel(collectionView)); | |
104 | 90 |
105 vLayout.addMember(tbarPanel); | 91 vLayout.addMember(tbarPanel); |
106 vLayout.addMember(hLayout); | 92 vLayout.addMember(hLayout); |
107 | 93 |
108 setPane(vLayout); | 94 setPane(vLayout); |
138 for (Canvas child: children) { | 124 for (Canvas child: children) { |
139 right.removeChild(child); | 125 right.removeChild(child); |
140 } | 126 } |
141 | 127 |
142 right.addChild(createChartPanel(right.getWidth(), right.getHeight())); | 128 right.addChild(createChartPanel(right.getWidth(), right.getHeight())); |
143 } | |
144 | |
145 | |
146 protected Canvas createTBarPanel( | |
147 final CollectionView collectionView | |
148 ) { | |
149 HLayout hLayout = new HLayout(); | |
150 hLayout.setWidth100(); | |
151 hLayout.setHeight100(); | |
152 hLayout.setMembersMargin(10); | |
153 | |
154 Button datacage = new Button(MSG.databasket()); | |
155 datacage.setHeight(20); | |
156 | |
157 hLayout.setMargin(5); | |
158 hLayout.addMember(datacage); | |
159 datacage.addClickHandler(new ClickHandler() { | |
160 public void onClick(ClickEvent event) { | |
161 GWT.log("Clicked 'datacage' button."); | |
162 openDatacageWindow( | |
163 collectionView.getArtifact()); | |
164 } | |
165 }); | |
166 | |
167 return hLayout; | |
168 } | |
169 | |
170 protected void openDatacageWindow(Artifact artifact) { | |
171 final DatacageWindow dc = new DatacageWindow(artifact); | |
172 dc.addCloseClickHandler(new CloseClickHandler() { | |
173 public void onCloseClick(CloseClientEvent event) { | |
174 dc.destroy(); | |
175 } | |
176 }); | |
177 dc.show(); | |
178 } | 129 } |
179 | 130 |
180 | 131 |
181 protected Canvas createChartPanel() { | 132 protected Canvas createChartPanel() { |
182 return createChartPanel(DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT); | 133 return createChartPanel(DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT); |