Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java @ 275:8264b02091ef
ISSUE-56 Display download buttons to export the computed data.
flys-client/trunk@1901 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 11 May 2011 14:29:35 +0000 |
parents | 65735765643d |
children | e92f7ef455d6 |
comparison
equal
deleted
inserted
replaced
274:71a7533555d0 | 275:8264b02091ef |
---|---|
1 package de.intevation.flys.client.client.ui; | 1 package de.intevation.flys.client.client.ui; |
2 | 2 |
3 import java.util.ArrayList; | 3 import java.util.ArrayList; |
4 import java.util.List; | 4 import java.util.List; |
5 import java.util.Map; | |
6 import java.util.Set; | |
5 | 7 |
6 import com.google.gwt.core.client.GWT; | 8 import com.google.gwt.core.client.GWT; |
7 import com.google.gwt.user.client.rpc.AsyncCallback; | 9 import com.google.gwt.user.client.rpc.AsyncCallback; |
8 | 10 |
9 import com.smartgwt.client.types.VerticalAlignment; | 11 import com.smartgwt.client.types.VerticalAlignment; |
13 import com.smartgwt.client.widgets.layout.VLayout; | 15 import com.smartgwt.client.widgets.layout.VLayout; |
14 import com.smartgwt.client.widgets.tab.Tab; | 16 import com.smartgwt.client.widgets.tab.Tab; |
15 | 17 |
16 import de.intevation.flys.client.shared.model.Artifact; | 18 import de.intevation.flys.client.shared.model.Artifact; |
17 import de.intevation.flys.client.shared.model.ArtifactDescription; | 19 import de.intevation.flys.client.shared.model.ArtifactDescription; |
20 import de.intevation.flys.client.shared.model.Collection; | |
18 import de.intevation.flys.client.shared.model.Data; | 21 import de.intevation.flys.client.shared.model.Data; |
19 import de.intevation.flys.client.shared.model.DataItem; | 22 import de.intevation.flys.client.shared.model.DataItem; |
20 import de.intevation.flys.client.shared.model.DataList; | 23 import de.intevation.flys.client.shared.model.DataList; |
21 import de.intevation.flys.client.shared.model.DefaultData; | 24 import de.intevation.flys.client.shared.model.DefaultData; |
22 import de.intevation.flys.client.shared.model.DefaultDataItem; | 25 import de.intevation.flys.client.shared.model.DefaultDataItem; |
26 import de.intevation.flys.client.shared.model.ExportMode; | |
27 import de.intevation.flys.client.shared.model.OutputMode; | |
23 import de.intevation.flys.client.shared.model.River; | 28 import de.intevation.flys.client.shared.model.River; |
24 import de.intevation.flys.client.client.Config; | 29 import de.intevation.flys.client.client.Config; |
25 import de.intevation.flys.client.client.FLYS; | 30 import de.intevation.flys.client.client.FLYS; |
26 import de.intevation.flys.client.client.FLYSConstants; | 31 import de.intevation.flys.client.client.FLYSConstants; |
32 import de.intevation.flys.client.client.event.CollectionChangeEvent; | |
33 import de.intevation.flys.client.client.event.CollectionChangeHandler; | |
27 import de.intevation.flys.client.client.event.HasParameterChangeHandler; | 34 import de.intevation.flys.client.client.event.HasParameterChangeHandler; |
28 import de.intevation.flys.client.client.event.HasStepBackHandlers; | 35 import de.intevation.flys.client.client.event.HasStepBackHandlers; |
29 import de.intevation.flys.client.client.event.HasStepForwardHandlers; | 36 import de.intevation.flys.client.client.event.HasStepForwardHandlers; |
30 import de.intevation.flys.client.client.event.ParameterChangeEvent; | 37 import de.intevation.flys.client.client.event.ParameterChangeEvent; |
31 import de.intevation.flys.client.client.event.ParameterChangeHandler; | 38 import de.intevation.flys.client.client.event.ParameterChangeHandler; |
42 | 49 |
43 | 50 |
44 public class ParameterList | 51 public class ParameterList |
45 extends Tab | 52 extends Tab |
46 implements StepBackHandler, StepForwardHandler, ParameterChangeHandler, | 53 implements StepBackHandler, StepForwardHandler, ParameterChangeHandler, |
47 HasParameterChangeHandler | 54 HasParameterChangeHandler, CollectionChangeHandler |
48 { | 55 { |
49 /** The message class that provides i18n strings.*/ | 56 /** The message class that provides i18n strings.*/ |
50 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); | 57 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
51 | 58 |
52 /** The ArtifactService used to communicate with the Artifact server. */ | 59 /** The ArtifactService used to communicate with the Artifact server. */ |
77 protected UIProvider uiProvider; | 84 protected UIProvider uiProvider; |
78 | 85 |
79 protected VLayout topLayout; | 86 protected VLayout topLayout; |
80 protected VLayout oldItems; | 87 protected VLayout oldItems; |
81 protected VLayout currentItems; | 88 protected VLayout currentItems; |
89 protected VLayout exportModes; | |
82 protected Canvas helperPanel; | 90 protected Canvas helperPanel; |
83 protected Canvas tablePanel; | 91 protected Canvas tablePanel; |
84 | 92 |
85 public ParameterList(FLYS flys, CollectionView cView, String title) { | 93 public ParameterList(FLYS flys, CollectionView cView, String title) { |
86 super(title); | 94 super(title); |
91 parameterHandlers = new ArrayList<ParameterChangeHandler>(); | 99 parameterHandlers = new ArrayList<ParameterChangeHandler>(); |
92 old = new ArrayList<DataList>(); | 100 old = new ArrayList<DataList>(); |
93 topLayout = new VLayout(); | 101 topLayout = new VLayout(); |
94 oldItems = new VLayout(); | 102 oldItems = new VLayout(); |
95 currentItems = new VLayout(); | 103 currentItems = new VLayout(); |
104 exportModes = new VLayout(); | |
96 | 105 |
97 addParameterChangeHandler(this); | 106 addParameterChangeHandler(this); |
98 | 107 |
99 init(); | 108 init(); |
100 } | 109 } |
115 parameterHandlers = new ArrayList<ParameterChangeHandler>(); | 124 parameterHandlers = new ArrayList<ParameterChangeHandler>(); |
116 old = new ArrayList<DataList>(); | 125 old = new ArrayList<DataList>(); |
117 topLayout = new VLayout(); | 126 topLayout = new VLayout(); |
118 oldItems = new VLayout(); | 127 oldItems = new VLayout(); |
119 currentItems = new VLayout(); | 128 currentItems = new VLayout(); |
129 exportModes = new VLayout(); | |
120 | 130 |
121 init(); | 131 init(); |
122 | 132 |
123 addParameterChangeHandler(this); | 133 addParameterChangeHandler(this); |
124 | 134 |
143 left.setMembersMargin(20); | 153 left.setMembersMargin(20); |
144 left.setWidth(300); | 154 left.setWidth(300); |
145 | 155 |
146 left.addMember(oldItems); | 156 left.addMember(oldItems); |
147 left.addMember(currentItems); | 157 left.addMember(currentItems); |
158 left.addMember(exportModes); | |
148 | 159 |
149 // This canvas is used to render helper widgets | 160 // This canvas is used to render helper widgets |
150 helperPanel = new Canvas(); | 161 helperPanel = new Canvas(); |
151 helperPanel.setWidth("*"); | 162 helperPanel.setWidth("*"); |
152 helperPanel.setHeight100(); | 163 helperPanel.setHeight100(); |
371 Canvas c = uiProvider.create(current); | 382 Canvas c = uiProvider.create(current); |
372 c.setLayoutAlign(VerticalAlignment.TOP); | 383 c.setLayoutAlign(VerticalAlignment.TOP); |
373 | 384 |
374 currentItems.addMember(c); | 385 currentItems.addMember(c); |
375 } | 386 } |
387 else { | |
388 currentItems.setHeight(1); | |
389 } | |
376 } | 390 } |
377 | 391 |
378 | 392 |
379 /** | 393 /** |
380 * This method is called if the user clicks on the 'next' button to advance | 394 * This method is called if the user clicks on the 'next' button to advance |
473 } | 487 } |
474 | 488 |
475 addOldDatas(desc.getOldData()); | 489 addOldDatas(desc.getOldData()); |
476 } | 490 } |
477 | 491 |
492 | |
493 public void onCollectionChange(CollectionChangeEvent event) { | |
494 Collection c = event.getNewValue(); | |
495 | |
496 Map<String, OutputMode> outs = c.getOutputModes(); | |
497 Set<String> keys = outs.keySet(); | |
498 | |
499 List<ExportMode> exports = new ArrayList<ExportMode>(); | |
500 | |
501 for (String outname: keys) { | |
502 OutputMode out = outs.get(outname); | |
503 | |
504 if (out instanceof ExportMode) { | |
505 exports.add((ExportMode) out); | |
506 } | |
507 } | |
508 | |
509 updateExportModes(c, exports); | |
510 } | |
511 | |
512 | |
513 protected void updateExportModes(Collection c, List<ExportMode> exports) { | |
514 int num = exports != null ? exports.size() : 0; | |
515 GWT.log("Update export modes: " + num); | |
516 | |
517 exportModes.removeMembers(exportModes.getMembers()); | |
518 | |
519 if (exports.size() > 0) { | |
520 exportModes.addMember(new ExportPanel(c, exports)); | |
521 } | |
522 } | |
523 | |
524 | |
478 /** | 525 /** |
479 * Adds a table to the parameterlist to show calculated data. | 526 * Adds a table to the parameterlist to show calculated data. |
480 * | 527 * |
481 * @param table The table data panel. | 528 * @param table The table data panel. |
482 */ | 529 */ |