annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WspDatacagePanel.java @ 8644:c15cebcf60da

Remove JavaScript greeting exception. This fixes the Error "$wnd.unHighlight" is not a function exception at startup. This apperantly did not do anything (as the function does not exist) and was not necessary (as everything works as expected) So just throw it away.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 27 Mar 2015 19:10:02 +0100
parents 5dfb3ff98bc6
children 5e38e2924c07
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 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
10
909
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.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
12 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
13
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 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
15 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
16
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
17 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
18 import org.dive4elements.river.client.client.FLYS;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
19 import org.dive4elements.river.client.client.FLYSConstants;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
20 import org.dive4elements.river.client.client.event.StepForwardEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
21 import org.dive4elements.river.client.client.services.LoadArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
22 import org.dive4elements.river.client.client.services.LoadArtifactServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
23 import org.dive4elements.river.client.shared.model.Artifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
24 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
25 import org.dive4elements.river.client.shared.model.Data;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
26 import org.dive4elements.river.client.shared.model.DataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
27 import org.dive4elements.river.client.shared.model.DefaultData;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
28 import org.dive4elements.river.client.shared.model.DefaultDataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
29 import org.dive4elements.river.client.shared.model.Recommendation;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
30 import org.dive4elements.river.client.shared.model.Recommendation.Facet;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
31 import org.dive4elements.river.client.shared.model.Recommendation.Filter;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
32 import org.dive4elements.river.client.shared.model.ToLoad;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
33 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
34
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
35 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
36 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
37 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
38
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
39
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 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
41
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
42 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
43
8298
5dfb3ff98bc6 Purge clash of out-names, resulting hacks and tests for not existing outs and give some more meaningful names.
"Tom Gottfried <tom@intevation.de>"
parents: 7885
diff changeset
44 public static final String WATERLEVEL_OUTS = "waterlevels_panel";
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
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
46 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
47
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
48
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
49 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
50 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
51
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
52 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
53 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
54
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
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 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
57 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
58 }
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 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
62 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
63 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 @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
67 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
68 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
69 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
1268
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
72 @Override
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
73 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
74 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
75 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
76 }
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
77
d0500e993218 Force a single selection in the datacage widget for DEMs and WSPs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 909
diff changeset
78
909
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 * We need to override this method (defined in AbstractUIProvider) because
6580
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
81 * we have to create a new Artifact specified by the Datacage selection via
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
82 * 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
83 *
3363
8d38a1e097c2 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
84 * @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
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 @Override
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
87 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
88 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
89 if (errors == null || errors.isEmpty()) {
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
90 // 1) Fetch selected recommendation.
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
91 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
92 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
93 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
94 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
95
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
96
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
97 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
98 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
99 return;
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
100 }
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
101
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
102 // TODO: This could eventually be handled server-side.
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
103 // 2) Create, load Artifact and fire event.
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
104 loadService.load(
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
105 c, r, r.getFactory(), 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
106 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
107 @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
108 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
109 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
110 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
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
4130
df8ac7ff6b1a Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents: 3534
diff changeset
113 @Override
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
114 public void onSuccess(Artifact newArtifact) {
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
115 GWT.log("Created new artifact.");
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
116 fireStepForwardEvent(new StepForwardEvent(
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
117 getData(r, newArtifact)));
909
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 }
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 else {
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
123 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
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
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 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
129 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
130 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
131
3521
ffbdd093da74 Fixed size for GetFeatureInfoWindow.
Christian Lins <christian.lins@intevation.de>
parents: 3363
diff changeset
132 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
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
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
135
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 * 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
138 * 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
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 * @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
141 */
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
142 @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
143 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
144 // 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
145 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
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
6580
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
149 /** Returns a Data Array with one default item. */
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
150 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
151 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
152 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
153
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
154 String value = createDataString(uuid, r);
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
155
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
156 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
157 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
158 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
159 }
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
160
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
161
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
162 protected String createDataString(String artifact, Recommendation recommendation) {
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
163 Facet f = null;
7885
2e30d2c725fa Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7570
diff changeset
164
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
165 // The filter will only be available or previous calculation artifacts.
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
166 Filter filter = recommendation.getFilter();
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
167
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
168 if (filter != null) {
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
169 Map<String, List<Facet>> outs = filter.getOuts();
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
170 Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet();
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
171
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
172 for (Map.Entry<String, List<Facet>> entry: entries) {
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
173 List<Facet> fs = entry.getValue();
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
174
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
175 f = fs.get(0);
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
176 if (f != null) {
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
177 break;
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
178 }
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
179 }
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
180
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
181 return "[" + artifact + ";" + f.getName() + ";" + f.getIndex() + "]";
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
182 }
7570
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
183 else {
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
184 return "[" + artifact + ";" + recommendation.getFactory() + ";" + 0 + "]";
f4c13fbde072 issue1020: Let WspDatacagePanel also handle non-winfo (prev. calc) rec.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6580
diff changeset
185 }
909
794d1af42987 Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 901
diff changeset
186 }
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
187 }
3ef7205b814e Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org