annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedHeightsDatacagePanel.java @ 5861:172338b1407f

GWT client: Added copyright header.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 14:30:15 +0200
parents 5aa05a7a34b7
children ea9eef426962
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 *
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
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
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
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.minfo;
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
11 import com.google.gwt.core.client.GWT;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
12
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
13 import com.google.gwt.user.client.rpc.AsyncCallback;
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
14
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
15 import com.smartgwt.client.data.Record;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
16
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
17 import com.smartgwt.client.widgets.Canvas;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
18
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
19 import com.smartgwt.client.widgets.events.ClickEvent;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
20
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
21 import com.smartgwt.client.widgets.grid.ListGridRecord;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
22
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
23 import com.smartgwt.client.widgets.layout.HLayout;
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
24 import com.smartgwt.client.widgets.layout.VLayout;
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
25
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
26 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
27 import org.dive4elements.river.client.client.FLYSConstants;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
28
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
29 import org.dive4elements.river.client.client.event.StepForwardEvent;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
30
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
31 import org.dive4elements.river.client.client.services.LoadArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
32 import org.dive4elements.river.client.client.services.LoadArtifactServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
33 import org.dive4elements.river.client.client.services.RemoveArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
34 import org.dive4elements.river.client.client.services.RemoveArtifactServiceAsync;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
35
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
36 import org.dive4elements.river.client.client.ui.DatacagePairWidget;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
37 import org.dive4elements.river.client.client.ui.DatacageTwinPanel;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
38 import org.dive4elements.river.client.client.ui.RecommendationPairRecord;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
39
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
40 import org.dive4elements.river.client.shared.model.Artifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
41 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
42 import org.dive4elements.river.client.shared.model.Data;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
43 import org.dive4elements.river.client.shared.model.DataItem;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
44 import org.dive4elements.river.client.shared.model.DataList;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
45
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
46 import org.dive4elements.river.client.shared.model.Recommendation.Facet;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
47 import org.dive4elements.river.client.shared.model.Recommendation.Filter;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
48
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
49 import org.dive4elements.river.client.shared.model.Recommendation;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
50 import org.dive4elements.river.client.shared.model.User;
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
51
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 import java.util.ArrayList;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 import java.util.List;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 import java.util.Map;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 import java.util.Set;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 // TODO Probably better to branch off AbstractUIProvider.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 // TODO Merge with other datacage-widget impls.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 * Panel containing a Grid and a "next" button. The Grid is fed by a
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 * DatacagePairWidget which is put in the input-helper area.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 public class BedHeightsDatacagePanel
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 extends DatacageTwinPanel {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 * List to track previously selected but now removed pairs. (Needed to
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 * be able to identify artifacts that can be removed from the collection.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 protected List<RecommendationPairRecord> removedPairs =
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 new ArrayList<RecommendationPairRecord>();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 /** Service handle to clone and add artifacts to collection. */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 LoadArtifactServiceAsync loadArtifactService = GWT.create(
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
77 org.dive4elements.river.client.client.services.LoadArtifactService.class);
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 /** Service to remove artifacts from collection. */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 RemoveArtifactServiceAsync removeArtifactService = GWT.create(
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
81 org.dive4elements.river.client.client.services.RemoveArtifactService.class);
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 public BedHeightsDatacagePanel(User user) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 super(user);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 * Create a recommendation from a string representation of it.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 * @TODO describe format of input string
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 * @param from string in format as shown above.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 * @return recommendation from input string.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 public Recommendation createRecommendationFromString(String from) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 // TODO Construct "real" filter.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 String[] parts = unbracket(from).split(";");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 Recommendation.Filter filter = new Recommendation.Filter();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 Recommendation.Facet facet = new Recommendation.Facet(
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 parts[1],
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 parts[2]);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 List<Recommendation.Facet> facets = new ArrayList<Recommendation.Facet>
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 ();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 facets.add(facet);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 filter.add("longitudinal_section", facets);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 Recommendation r = new Recommendation("bedheight", parts[0],
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 this.artifact.getUuid(), filter);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 r.setDisplayName(parts[3]);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 return r;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 * Creates the graphical representation and interaction widgets for the data.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 * @param dataList the data.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 * @return graphical representation and interaction widgets for data.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 @Override
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 public Canvas create(DataList dataList) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 GWT.log("createData()");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 Data data = dataList.get(0);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 DataItem[] items = data.getItems();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 String value = items[0].getStringValue();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 String filter = "minfo-heights";
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 if (value.equals("epoch")) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 filter = "minfo-heights-epoch";
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 Canvas widget = createWidget();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 Canvas submit = getNextButton();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 VLayout layout = new VLayout();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 HLayout helperLayout = new HLayout();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 helperLayout.addMember(new DatacagePairWidget(this.artifact,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 user, filter, differencesList));
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 layout.addMember(widget);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 layout.addMember(submit);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 layout.setMembersMargin(10);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 this.helperContainer.addMember(helperLayout);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 this.dataName = "diffids";
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 return layout;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 * Add record to list of removed records.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 public void trackRemoved(Record r) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 RecommendationPairRecord pr = (RecommendationPairRecord) r;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 this.removedPairs.add(pr);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 * Validates data, does nothing if invalid, otherwise clones new selected
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 * waterlevels and add them to collection, forward the artifact.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 @Override
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 public void onClick(ClickEvent e) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 GWT.log("DatacageTwinPanel.onClick");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 List<String> errors = validate();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 if (errors != null && !errors.isEmpty()) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 showErrors(errors);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 return;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 Config config = Config.getInstance();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 String locale = config.getLocale();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 ListGridRecord[] records = differencesList.getRecords();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 List<Recommendation> ar = new ArrayList<Recommendation>();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 List<Recommendation> all = new ArrayList<Recommendation>();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 for (ListGridRecord record : records) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 RecommendationPairRecord r =
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 (RecommendationPairRecord) record;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 // Do not add "old" recommendations.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 if (!r.isAlreadyLoaded()) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 // Check whether one of those is a dike or similar.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 // TODO differentiate and merge: new clones, new, old.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 Recommendation firstR = r.getFirst();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 if(firstR.getIDs() != null) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 GWT.log("First IDs: " + firstR.getIDs() + " factory: "
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 + firstR.getFactory());
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 firstR.setFactory("bedheight");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 Recommendation secondR = r.getSecond();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 if(secondR.getIDs() != null) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 GWT.log("Second IDs: " + secondR.getIDs() + " factory: "
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 + secondR.getFactory());
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 secondR.setFactory("bedheight");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 ar.add(firstR);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 ar.add(secondR);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 else {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 all.add(r.getFirst());
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 all.add(r.getSecond());
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 final Recommendation[] toClone = ar.toArray(new Recommendation[ar.size()]);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 final Recommendation[] toUse = all.toArray(new Recommendation[all.size()]);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 // Find out whether "old" artifacts have to be removed.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 List<String> artifactIdsToRemove = new ArrayList<String>();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 for (RecommendationPairRecord rp: this.removedPairs) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 Recommendation first = rp.getFirst();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 Recommendation second = rp.getSecond();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 for (Recommendation recommendation: toUse) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
221 if (first != null && first.getIDs().equals(recommendation.getIDs())) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
222 first = null;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
224 if (second != null && second.getIDs().equals(recommendation.getIDs())) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
225 second = null;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
226 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
227
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
228 if (first == null && second == null) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
229 break;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
230 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
231 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
232 if (first != null) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
233 artifactIdsToRemove.add(first.getIDs());
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
234 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
235 if (second != null) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
236 artifactIdsToRemove.add(second.getIDs());
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
237 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
239
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
240 // Remove old artifacts, if any. Do this asychronously without much
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
241 // feedback.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
242 for(final String uuid: artifactIdsToRemove) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
243 removeArtifactService.remove(this.collection,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
244 uuid,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
245 locale,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
246 new AsyncCallback<Collection>() {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
247 public void onFailure(Throwable caught) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
248 GWT.log("RemoveArtifact (" + uuid + ") failed.");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
249 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
250 public void onSuccess(Collection collection) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
251 GWT.log("RemoveArtifact succeeded");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
252 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
253 });
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
254 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
255
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
256 // Clone new ones (and spawn statics), go forward.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
257 loadArtifactService.loadMany(
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
258 this.collection,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
259 toClone,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
260 //"staticwkms" and "waterlevel"
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
261 null,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
262 locale,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
263 new AsyncCallback<Artifact[]>() {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
264 public void onFailure(Throwable caught) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
265 GWT.log("Failure of cloning with factories!");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
266 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
267 public void onSuccess(Artifact[] artifacts) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
268 GWT.log("Successfully cloned " + toClone.length +
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
269 " with factories.");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
270
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
271 fireStepForwardEvent(new StepForwardEvent(
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
272 getData(toClone, artifacts, toUse)));
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
273 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
274 });
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
275 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
276
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
277
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
278 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
279 * Creates part of the String that encodes minuend or subtrahend.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
280 * @param artifact Artifacts UUID.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
281 * @param recommendation Recommendation to wrap in string.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
282 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
283 protected String createDataString(
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
284 String artifact,
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
285 Recommendation recommendation)
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
286 {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
287 Filter filter = recommendation.getFilter();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
288 Facet f = null;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
289
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
290 if(filter != null) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
291 Map<String, List<Facet>> outs = filter.getOuts();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
292 Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
293
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
294 for (Map.Entry<String, List<Facet>> entry: entries) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
295 List<Facet> fs = entry.getValue();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
296
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
297 f = fs.get(0);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
298 if (f != null) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
299 break;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
300 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
301 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
302
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
303 return "[" + artifact + ";"
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
304 + f.getName()
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
305 + ";"
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
306 + f.getIndex()
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
307 + ";"
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
308 + recommendation.getDisplayName() + "]";
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
309 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
310 else {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
311 return "["
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
312 + artifact
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
313 + ";bedheight;0;"
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
314 + recommendation.getDisplayName() + "]";
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
315 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
316 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
317 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
318 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org