Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java @ 788:dfbc6693247e
Integrated a stacked panel on the right side of the ParameterList that enables users to see calculation results and the helper panel at the same time.
flys-client/trunk@2289 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 06 Jul 2011 12:31:32 +0000 |
parents | 3ae0facd4cab |
children | e8be9a188e64 |
comparison
equal
deleted
inserted
replaced
787:4e0b73b7113b | 788:dfbc6693247e |
---|---|
7 | 7 |
8 import com.google.gwt.core.client.GWT; | 8 import com.google.gwt.core.client.GWT; |
9 import com.google.gwt.user.client.rpc.AsyncCallback; | 9 import com.google.gwt.user.client.rpc.AsyncCallback; |
10 | 10 |
11 import com.smartgwt.client.types.VerticalAlignment; | 11 import com.smartgwt.client.types.VerticalAlignment; |
12 import com.smartgwt.client.types.VisibilityMode; | |
12 import com.smartgwt.client.util.SC; | 13 import com.smartgwt.client.util.SC; |
13 import com.smartgwt.client.widgets.Canvas; | 14 import com.smartgwt.client.widgets.Canvas; |
14 import com.smartgwt.client.widgets.layout.HLayout; | 15 import com.smartgwt.client.widgets.layout.HLayout; |
16 import com.smartgwt.client.widgets.layout.SectionStack; | |
17 import com.smartgwt.client.widgets.layout.SectionStackSection; | |
15 import com.smartgwt.client.widgets.layout.VLayout; | 18 import com.smartgwt.client.widgets.layout.VLayout; |
16 import com.smartgwt.client.widgets.tab.Tab; | 19 import com.smartgwt.client.widgets.tab.Tab; |
17 | 20 |
18 import de.intevation.flys.client.shared.model.Artifact; | 21 import de.intevation.flys.client.shared.model.Artifact; |
19 import de.intevation.flys.client.shared.model.ArtifactDescription; | 22 import de.intevation.flys.client.shared.model.ArtifactDescription; |
97 protected VLayout topLayout; | 100 protected VLayout topLayout; |
98 protected VLayout oldItems; | 101 protected VLayout oldItems; |
99 protected VLayout currentItems; | 102 protected VLayout currentItems; |
100 protected VLayout exportModes; | 103 protected VLayout exportModes; |
101 protected VLayout report; | 104 protected VLayout report; |
102 protected Canvas helperPanel; | 105 protected VLayout helperPanel; |
103 protected Canvas tablePanel; | 106 protected VLayout tablePanel; |
104 protected Canvas reportPanel; | 107 protected Canvas reportPanel; |
105 | 108 |
106 public ParameterList(FLYS flys, CollectionView cView, String title) { | 109 public ParameterList(FLYS flys, CollectionView cView, String title) { |
107 super(title); | 110 super(title); |
108 | 111 |
151 } | 154 } |
152 | 155 |
153 | 156 |
154 protected void init() { | 157 protected void init() { |
155 HLayout rootLayout = new HLayout(); | 158 HLayout rootLayout = new HLayout(); |
156 tablePanel = new Canvas(); | |
157 rootLayout.setMembersMargin(20); | 159 rootLayout.setMembersMargin(20); |
158 | 160 |
159 VLayout left = new VLayout(); | 161 VLayout left = new VLayout(); |
160 | 162 |
161 if (old == null || old.size() == 0) { | 163 if (old == null || old.size() == 0) { |
175 | 177 |
176 reportPanel = new Canvas(); | 178 reportPanel = new Canvas(); |
177 reportPanel.setHeight("*"); | 179 reportPanel.setHeight("*"); |
178 report.addMember(reportPanel); | 180 report.addMember(reportPanel); |
179 | 181 |
180 // This canvas is used to render helper widgets | |
181 helperPanel = new Canvas(); | |
182 helperPanel.setWidth("*"); | |
183 helperPanel.setHeight100(); | |
184 | |
185 rootLayout.addMember(left); | 182 rootLayout.addMember(left); |
186 rootLayout.addMember(helperPanel); | 183 rootLayout.addMember(createSectionStack()); |
187 | 184 |
188 topLayout.addMember(rootLayout); | 185 topLayout.addMember(rootLayout); |
189 if (artifact == null) { | 186 if (artifact == null) { |
190 Canvas moduleSelection = renderNew(); | 187 Canvas moduleSelection = renderNew(); |
191 moduleSelection.setLayoutAlign(VerticalAlignment.TOP); | 188 moduleSelection.setLayoutAlign(VerticalAlignment.TOP); |
192 currentItems.addMember(moduleSelection); | 189 currentItems.addMember(moduleSelection); |
193 } | 190 } |
194 | 191 |
195 setPane(topLayout); | 192 setPane(topLayout); |
193 } | |
194 | |
195 | |
196 protected SectionStack createSectionStack() { | |
197 SectionStack stack = new SectionStack(); | |
198 stack.setHeight100(); | |
199 stack.setCanResizeSections(true); | |
200 stack.setVisibilityMode(VisibilityMode.MULTIPLE); | |
201 | |
202 // This canvas is used to render helper widgets | |
203 final SectionStackSection helperSection = new SectionStackSection(); | |
204 helperSection.setExpanded(false); | |
205 helperSection.setTitle(MSG.helperPanelTitle()); | |
206 helperPanel = new VLayout() { | |
207 public void addMember(Canvas component) { | |
208 super.addMember(component); | |
209 helperSection.setExpanded(true); | |
210 } | |
211 | |
212 public void removeMembers(Canvas[] components) { | |
213 super.removeMembers(components); | |
214 helperSection.setExpanded(false); | |
215 } | |
216 }; | |
217 helperPanel.setWidth100(); | |
218 helperPanel.setHeight100(); | |
219 helperSection.setItems(helperPanel); | |
220 | |
221 // This canvas is used to render calculation results | |
222 final SectionStackSection tableSection = new SectionStackSection(); | |
223 tableSection.setExpanded(false); | |
224 tableSection.setTitle(MSG.calcTableTitle()); | |
225 tablePanel = new VLayout() { | |
226 public void addMember(Canvas component) { | |
227 super.addMember(component); | |
228 tableSection.setExpanded(true); | |
229 } | |
230 | |
231 public void removeMembers(Canvas[] components) { | |
232 super.removeMembers(components); | |
233 tableSection.setExpanded(false); | |
234 } | |
235 }; | |
236 tablePanel.setHeight100(); | |
237 tablePanel.setWidth100(); | |
238 tableSection.setItems(tablePanel); | |
239 | |
240 stack.setSections(helperSection, tableSection); | |
241 | |
242 return stack; | |
196 } | 243 } |
197 | 244 |
198 | 245 |
199 protected void setArtifact(Artifact artifact) { | 246 protected void setArtifact(Artifact artifact) { |
200 Artifact tmp = this.artifact; | 247 Artifact tmp = this.artifact; |
515 * @param event The ParameterChangeEvent. | 562 * @param event The ParameterChangeEvent. |
516 */ | 563 */ |
517 public void onParameterChange(ParameterChangeEvent event) { | 564 public void onParameterChange(ParameterChangeEvent event) { |
518 GWT.log("ParameterList.onParameterChange"); | 565 GWT.log("ParameterList.onParameterChange"); |
519 | 566 |
520 for (Canvas c: helperPanel.getChildren()) { | 567 Canvas[] c = helperPanel.getMembers(); |
521 helperPanel.removeChild(c); | 568 if (c != null && c.length > 0) { |
569 helperPanel.removeMembers(c); | |
522 } | 570 } |
523 | 571 |
524 Artifact art = event.getNewValue(); | 572 Artifact art = event.getNewValue(); |
525 ArtifactDescription desc = art.getArtifactDescription(); | 573 ArtifactDescription desc = art.getArtifactDescription(); |
526 | 574 |
679 /** | 727 /** |
680 * Adds a table to the parameterlist to show calculated data. | 728 * Adds a table to the parameterlist to show calculated data. |
681 * | 729 * |
682 * @param table The table data panel. | 730 * @param table The table data panel. |
683 */ | 731 */ |
684 public void setPanel (TableDataPanel table) { | 732 public void setTable(TableDataPanel table) { |
685 tablePanel = table.create(); | 733 removeTable(); |
686 tablePanel.setHeight100(); | 734 |
687 tablePanel.setWidth100(); | 735 Canvas c = table.create(); |
688 helperPanel.addChild(tablePanel); | 736 c.setHeight100(); |
737 c.setWidth100(); | |
738 | |
739 tablePanel.addMember(c); | |
740 } | |
741 | |
742 | |
743 public boolean hasTable() { | |
744 Canvas[] members = tablePanel.getMembers(); | |
745 | |
746 return members != null && members.length > 0; | |
689 } | 747 } |
690 | 748 |
691 | 749 |
692 /** | 750 /** |
693 * Removes the table from the parameter list. | 751 * Removes the table from the parameter list. |
694 */ | 752 */ |
695 public void removePanel() { | 753 public void removeTable() { |
696 topLayout.removeMember(tablePanel); | 754 Canvas[] members = tablePanel.getMembers(); |
697 } | 755 |
698 | 756 if (members != null && members.length > 0) { |
699 | 757 tablePanel.removeMembers(members); |
700 public boolean hasPanel() { | 758 } |
701 return topLayout.hasMember(tablePanel); | |
702 } | 759 } |
703 } | 760 } |
704 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 761 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |