annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedHeightsDatacagePanel.java @ 8719:36f52c80b7ac

Deduplicate W / BedHeight Difference selection panel code
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 27 Apr 2015 14:50:38 +0200
parents 5dfb3ff98bc6
children 4c15f98be26c
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.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
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
17 import com.smartgwt.client.util.SC;
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
18 import com.smartgwt.client.widgets.Button;
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
19 import com.smartgwt.client.widgets.Canvas;
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.events.ClickEvent;
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
22 import com.smartgwt.client.widgets.events.ClickHandler;
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
23 import com.smartgwt.client.widgets.grid.ListGridRecord;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
24
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
25 import com.smartgwt.client.widgets.layout.VLayout;
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
26 import com.smartgwt.client.widgets.tree.TreeNode;
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
27
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
28 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
29 import org.dive4elements.river.client.client.FLYSConstants;
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.event.StepForwardEvent;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
32
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
33 import org.dive4elements.river.client.client.services.LoadArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
34 import org.dive4elements.river.client.client.services.LoadArtifactServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
35 import org.dive4elements.river.client.client.services.RemoveArtifactService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
36 import org.dive4elements.river.client.client.services.RemoveArtifactServiceAsync;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
37
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
38 import org.dive4elements.river.client.client.ui.DatacageTwinPanel;
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
39 import org.dive4elements.river.client.client.ui.DatacageWidget;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
40 import org.dive4elements.river.client.client.ui.RecommendationPairRecord;
4183
Christian Lins <christian.lins@intevation.de>
parents: 4182
diff changeset
41
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
42 import org.dive4elements.river.client.shared.model.Artifact;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
43 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
44 import org.dive4elements.river.client.shared.model.DataList;
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
45 import org.dive4elements.river.client.shared.model.ToLoad;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
46
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
47 import org.dive4elements.river.client.shared.model.Recommendation.Facet;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
48 import org.dive4elements.river.client.shared.model.Recommendation.Filter;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
49
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
50 import org.dive4elements.river.client.shared.model.Recommendation;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
51 import org.dive4elements.river.client.shared.model.User;
3535
75a3a41a6e51 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3508
diff changeset
52
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 import java.util.ArrayList;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 import java.util.List;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 import java.util.Map;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 import java.util.Set;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 // TODO Probably better to branch off AbstractUIProvider.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 public class BedHeightsDatacagePanel
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 extends DatacageTwinPanel {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 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
63
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 * 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
66 * 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
67 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 protected List<RecommendationPairRecord> removedPairs =
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 new ArrayList<RecommendationPairRecord>();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 /** 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
72 LoadArtifactServiceAsync loadArtifactService = GWT.create(
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
73 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
74
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 /** Service to remove artifacts from collection. */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 RemoveArtifactServiceAsync removeArtifactService = 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.RemoveArtifactService.class);
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
79 protected DatacageWidget datacage;
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 public BedHeightsDatacagePanel(User user) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 super(user);
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
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 /**
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 * 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
87 * @param dataList the data.
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 * @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
89 */
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 @Override
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 public Canvas create(DataList dataList) {
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 GWT.log("createData()");
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 Canvas widget = createWidget();
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 Canvas submit = getNextButton();
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
96 datacage = new DatacageWidget(
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: 8023
diff changeset
97 this.artifact, user, "minfo_diff_panel", "load-system:true", false);
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
98
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
99 Button plusBtn = new Button(MSG.datacage_add_pair());
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
100 plusBtn.setAutoFit(true);
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
101 plusBtn.addClickHandler(new ClickHandler() {
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
102 @Override
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
103 public void onClick(ClickEvent event) {
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
104 plusClicked();
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
105 }
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
106 });
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 VLayout layout = new VLayout();
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
109 VLayout helperLayout = new VLayout();
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
110 helperLayout.addMember(datacage);
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
111 helperLayout.addMember(plusBtn);
3508
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 layout.addMember(widget);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 layout.addMember(submit);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 layout.setMembersMargin(10);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 this.helperContainer.addMember(helperLayout);
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117
8719
36f52c80b7ac Deduplicate W / BedHeight Difference selection panel code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8298
diff changeset
118 populateGrid(dataList, "bedheight");
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 return layout;
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122
8719
36f52c80b7ac Deduplicate W / BedHeight Difference selection panel code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8298
diff changeset
123 public void adjustRecommendation(Recommendation recommendation) {
36f52c80b7ac Deduplicate W / BedHeight Difference selection panel code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8298
diff changeset
124 recommendation.setFactory("bedheight");
3508
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
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 @Override
8719
36f52c80b7ac Deduplicate W / BedHeight Difference selection panel code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8298
diff changeset
128 protected String createDataString(String artifact, Recommendation recommendation) {
36f52c80b7ac Deduplicate W / BedHeight Difference selection panel code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8298
diff changeset
129 return createDataString(artifact, recommendation, "bedheight");
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 }
7971
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
131
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
132 /**
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
133 * Callback for add-button.
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
134 * Fires to load for every selected element and handler.
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
135 */
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
136 public void plusClicked() {
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
137 List<TreeNode> selection = datacage.getPlainSelection();
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
138
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
139 if (selection == null || selection.isEmpty()) {
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
140 SC.say(MSG.warning());
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
141 return;
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
142 }
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
143
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
144 for (TreeNode node : selection) {
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
145 ToLoad toLoad1 = new ToLoad();
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
146 ToLoad toLoad2 = new ToLoad();
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
147
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
148 String factory = node.getAttribute("factory");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
149 if (factory != null) { // we need at least a factory
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
150 String artifact = node.getAttribute("artifact-id");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
151 String out = node.getAttribute("out");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
152 String name = node.getAttribute("facet");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
153 String ids = node.getAttribute("ids");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
154 String info = node.getAttribute("info");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
155 String targetOut = node.getAttribute("target_out");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
156
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
157 String[] splitIds = ids.split("#");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
158 String[] splitInfo = info.split("#");
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
159 toLoad1.add(artifact,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
160 factory,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
161 out,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
162 name,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
163 splitIds[0],
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
164 splitInfo[0],
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
165 targetOut);
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
166 toLoad2.add(artifact,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
167 factory,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
168 out,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
169 name,
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
170 splitIds[1],
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
171 splitInfo[1],
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
172 targetOut);
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
173 }
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
174 differencesList.addData(new RecommendationPairRecord(
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
175 toLoad1.toRecommendations().get(0),
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
176 toLoad2.toRecommendations().get(0)));
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
177 }
93da474506e7 Changed twin dc panel in bed height deifferences to single dc and use the new differences dc macro.
Raimund Renkert <rrenkert@intevation.de>
parents: 7921
diff changeset
178 }
3508
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 }
60984be9bcfa MINFO: Added UI for minfo differences calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org