annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java @ 1268:d0500e993218

Force a single selection in the datacage widget for DEMs and WSPs. flys-client/trunk@2821 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 26 Sep 2011 11:04:00 +0000
parents 794d1af42987
children 4c3329db2536
rev   line source
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui;
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
3 import java.util.List;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
4 import java.util.Map;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
5 import java.util.Set;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
6
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
7 import com.google.gwt.core.client.GWT;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
8 import com.google.gwt.user.client.rpc.AsyncCallback;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
9
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
10 import com.smartgwt.client.util.SC;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
11 import com.smartgwt.client.widgets.events.ClickEvent;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
12
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
13 import de.intevation.flys.client.shared.model.Artifact;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
14 import de.intevation.flys.client.shared.model.Collection;
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.client.shared.model.Data;
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.client.shared.model.DataItem;
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.flys.client.shared.model.DefaultData;
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import de.intevation.flys.client.shared.model.DefaultDataItem;
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
19 import de.intevation.flys.client.shared.model.Recommendation;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
20 import de.intevation.flys.client.shared.model.Recommendation.Facet;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
21 import de.intevation.flys.client.shared.model.Recommendation.Filter;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
22 import de.intevation.flys.client.shared.model.ToLoad;
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.client.shared.model.User;
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
25 import de.intevation.flys.client.client.Config;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
26 import de.intevation.flys.client.client.FLYSConstants;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
27 import de.intevation.flys.client.client.event.StepForwardEvent;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
28 import de.intevation.flys.client.client.services.LoadArtifactService;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
29 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
30
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 public class WspDatacagePanel extends DatacagePanel {
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 public static final String WATERLEVEL_OUTS = "longitudinal_section";
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
36 public static final FLYSConstants MSG = GWT.create(FLYSConstants.class);
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
37
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
38
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
39 protected LoadArtifactServiceAsync loadService =
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
40 GWT.create(LoadArtifactService.class);
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
41
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
42 protected Recommendation recommendation;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
43 protected Artifact artifact;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
44
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 public WspDatacagePanel() {
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 super();
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 public WspDatacagePanel(User user) {
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 super(user);
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 @Override
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 public String getOuts() {
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 return WATERLEVEL_OUTS;
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
1268
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
62 @Override
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
63 protected void createWidget() {
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
64 super.createWidget();
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
65 widget.setIsMutliSelectable(false);
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
66 }
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
67
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
68
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
69 /**
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
70 * We need to override this method (defined in AbstractUIProvider) because
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
71 * we have to create a new Artifact specified by the Datacage selection via
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
72 * Async request.
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
73 *
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
74 * @param The ClickEvent.
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
75 */
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
76 @Override
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
77 public void onClick(ClickEvent e) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
78 List<String> errors = validate();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
79 if (errors == null || errors.isEmpty()) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
80 // 1) Fetch selected recommendation
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
81 Config config = Config.getInstance();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
82 final String url = config.getServerUrl();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
83 final String locale = config.getLocale();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
84 final Collection c = this.collection;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
85 final Recommendation r = getSelectedRecommendation();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
86
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
87 // 2) Create, load Artifact and fire event
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
88 loadService.load(
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
89 c, r, "winfo", url, locale,
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
90 new AsyncCallback<Artifact>() {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
91 public void onFailure(Throwable caught) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
92 SC.warn(MSG.getString(caught.getMessage()));
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
93 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
94
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
95 public void onSuccess(Artifact artifact) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
96 fireStepForwardEvent(new StepForwardEvent(
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
97 getData(r, artifact)));
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
98 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
99 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
100 );
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
101 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
102 else {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
103 showErrors(errors);
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
104 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
105 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
106
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
107
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
108 protected Recommendation getSelectedRecommendation() {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
109 ToLoad toLoad = widget.getSelection();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
110 List<Recommendation> recoms = toLoad.toRecommendations();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
111
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
112 return recoms.get(0);
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
113 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
114
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
115
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
116 /**
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
117 * Nothing is done in this method. It returns null, because we serve the
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
118 * Data another way!
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
119 *
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
120 * @return always null!
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
121 */
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 @Override
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 protected Data[] getData() {
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
124 // do nothing here, the Data is fetched on another way in this panel.
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
125 return null;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
126 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
127
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
128
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
129 protected Data[] getData(Recommendation r, Artifact newArtifact) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
130 String uuid = newArtifact.getUuid();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
131 r.setMasterArtifact(uuid);
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
132
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
133 String value = createDataString(uuid, r.getFilter());
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
134
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 DataItem item = new DefaultDataItem(dataName, dataName, value);
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 return new Data[] { new DefaultData(
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 dataName, null, null, new DataItem[] { item }) };
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 }
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
139
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
140
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
141 protected String createDataString(String artifact, Filter filter) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
142 Facet f = null;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
143
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
144 Map<String, List<Facet>> outs = filter.getOuts();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
145 Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
146
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
147 for (Map.Entry<String, List<Facet>> entry: entries) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
148 List<Facet> fs = entry.getValue();
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
149
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
150 f = fs.get(0);
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
151 if (f != null) {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
152 break;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
153 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
154 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
155
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
156 return "[" + artifact + ";" + f.getName() + ";" + f.getIndex() + "]";
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
157 }
901
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org