Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WspDatacagePanel.java @ 6617:67b4728723df
Do not fiddle with the factory name of recommendations for differences anymore.
This fixes differences of regular winfo artifacts and I have not yet observed
side effects, as the factories from the meta-data seem to be all correct.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 19 Jul 2013 10:04:47 +0200 |
parents | 663c159f3b43 |
children | f4c13fbde072 |
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 |
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
|
44 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
|
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 | 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()) { |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
90 // 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
|
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 |
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 // 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
|
103 loadService.load( |
1425
bc06a671ef60
Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1278
diff
changeset
|
104 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
|
105 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
|
106 @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
|
107 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
|
108 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
|
109 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
|
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 |
4130
df8ac7ff6b1a
Improve warning when user does not select a waterlevel calculation (#914)
Christian Lins <christian.lins@intevation.de>
parents:
3534
diff
changeset
|
112 @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
|
113 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
|
114 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
|
115 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
|
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 ); |
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 else { |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
121 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
|
122 } |
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 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
|
127 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
|
128 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
|
129 |
3521
ffbdd093da74
Fixed size for GetFeatureInfoWindow.
Christian Lins <christian.lins@intevation.de>
parents:
3363
diff
changeset
|
130 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
|
131 } |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
132 |
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 * 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
|
136 * 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
|
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 * @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
|
139 */ |
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
|
140 @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
|
141 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
|
142 // 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
|
143 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
|
144 } |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
145 |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
146 |
6580 | 147 /** 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
|
148 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
|
149 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
|
150 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
|
151 |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
152 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
|
153 |
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
|
154 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
|
155 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
|
156 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
|
157 } |
909
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
158 |
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 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
|
161 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
|
162 |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
163 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
|
164 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
|
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 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
|
167 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
|
168 |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
169 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
|
170 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
|
171 break; |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
172 } |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
173 } |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
174 |
794d1af42987
Clone Artifacts and add them to the current Collection in the WspDatacagePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
901
diff
changeset
|
175 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
|
176 } |
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
|
177 } |
3ef7205b814e
Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |