annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java @ 3521:ffbdd093da74

Fixed size for GetFeatureInfoWindow. flys-client/trunk@5307 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 30 Aug 2012 08:59:41 +0000
parents 8d38a1e097c2
children ebf47e4adea5
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
1278
4c3329db2536 Bugfix: #328 The datacage used for waterlevel selection now fetches W facets (waterlevels) only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1268
diff changeset
34 public static final String WATERLEVEL_OUTS = "waterlevels";
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
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 *
3363
8d38a1e097c2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
74 * @param e The ClickEvent.
909
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 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
83 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
84 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
85
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
86 // 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
87 loadService.load(
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1278
diff changeset
88 c, r, "winfo", locale,
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
89 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
90 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
91 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
92 }
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 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
95 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
96 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
97 }
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 else {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
102 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
103 }
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 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
108 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
109 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
110
3521
ffbdd093da74 Fixed size for GetFeatureInfoWindow.
Christian Lins <christian.lins@intevation.de>
parents: 3363
diff changeset
111 return recoms.size() > 0 ? recoms.get(0) : null;
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
112 }
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 * 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
117 * 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
118 *
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
119 * @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
120 */
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
121 @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
122 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
123 // 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
124 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
125 }
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 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
129 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
130 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
131
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
132 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
133
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
134 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
135 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
136 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
137 }
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
138
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 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
141 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
142
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
143 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
144 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
145
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
146 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
147 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
148
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
149 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
150 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
151 break;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
152 }
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 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
156 }
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
157 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org