annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java @ 909:794d1af42987

Clone Artifacts and add them to the current Collection in the WspDatacagePanel. flys-client/trunk@2766 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 15 Sep 2011 16:02:23 +0000
parents 3ef7205b814e
children d0500e993218
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
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
62 /**
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
63 * 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
64 * 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
65 * 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
66 *
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
67 * @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
68 */
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
69 @Override
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
70 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
71 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
72 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
73 // 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
74 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
75 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
76 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
77 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
78 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
79
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
80 // 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
81 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
82 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
83 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
84 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
85 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
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
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
88 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
89 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
90 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
91 }
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 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
95 else {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
96 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
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 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
102 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
103 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
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 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
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
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
109 /**
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
110 * 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
111 * 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
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 * @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
114 */
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
115 @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
116 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
117 // 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
118 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
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
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
121
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
122 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
123 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
124 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
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 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
127
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
128 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
129 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
130 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
131 }
909
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
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
134 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
135 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
136
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
137 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
138 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
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 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
141 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
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 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
144 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
145 break;
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 }
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 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
150 }
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
151 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org