annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WspDatacagePanel.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/client/ui/WspDatacagePanel.java@821a02bbfb4e
children 172338b1407f
rev   line source
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
1 package org.dive4elements.river.client.client.ui;
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
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 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
4 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
5
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
6 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
7 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
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
10 import org.dive4elements.river.client.client.FLYS;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
11 import org.dive4elements.river.client.client.FLYSConstants;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
12 import org.dive4elements.river.client.client.event.StepForwardEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
13 import org.dive4elements.river.client.client.services.LoadArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
14 import org.dive4elements.river.client.client.services.LoadArtifactServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
15 import org.dive4elements.river.client.shared.model.Artifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
16 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
17 import org.dive4elements.river.client.shared.model.Data;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
18 import org.dive4elements.river.client.shared.model.DataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
19 import org.dive4elements.river.client.shared.model.DefaultData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
20 import org.dive4elements.river.client.shared.model.DefaultDataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
21 import org.dive4elements.river.client.shared.model.Recommendation;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
22 import org.dive4elements.river.client.shared.model.Recommendation.Facet;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
23 import org.dive4elements.river.client.shared.model.Recommendation.Filter;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
24 import org.dive4elements.river.client.shared.model.ToLoad;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
25 import org.dive4elements.river.client.shared.model.User;
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
26
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
27 import java.util.List;
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
28 import java.util.Map;
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
29 import java.util.Set;
909
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
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
34 private static final long serialVersionUID = 2494432743877141135L;
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
35
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
36 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
37
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
38 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
39
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
40
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
41 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
42 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
43
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
44 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
45 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
46
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
47
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 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
49 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
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
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
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 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
54 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
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
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
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 @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
59 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
60 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
61 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
1268
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
64 @Override
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
65 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
66 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
67 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
68 }
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
69
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
70
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
71 /**
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
72 * 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
73 * 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
74 * 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
75 *
3363
8d38a1e097c2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
76 * @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
77 */
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
78 @Override
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
79 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
80 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
81 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
82 // 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
83 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
84 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
85 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
86 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
87
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
88
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
89 if (r == null) {
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
90 SC.warn(MSG.warning_no_wsp_selected());
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
91 return;
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
92 }
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
93
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
94 // 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
95 loadService.load(
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1278
diff changeset
96 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
97 new AsyncCallback<Artifact>() {
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
98 @Override
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
99 public void onFailure(Throwable caught) {
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
100 GWT.log("WspDatacagePanel", caught);
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
101 SC.warn(FLYS.getExceptionString(MSG, caught));
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
102 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
103
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
104 @Override
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
105 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
106 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
107 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
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 );
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 else {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
113 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
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
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
118 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
119 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
120 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
121
3521
ffbdd093da74 Fixed size for GetFeatureInfoWindow.
Christian Lins <christian.lins@intevation.de>
parents: 3363
diff changeset
122 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
123 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
124
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 * 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
128 * 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
129 *
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
130 * @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
131 */
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
132 @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
133 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
134 // 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
135 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
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
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 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
140 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
141 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
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 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
144
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
145 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
146 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
147 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
148 }
909
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
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
151 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
152 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
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 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
155 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
156
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
157 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
158 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
159
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
160 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
161 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
162 break;
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
163 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
164 }
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
165
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
166 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
167 }
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
168 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org