Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageTwinPanel.java @ 7581:b2d750a6df9f
issue1606: Handle textstyle property in clients StyleEditorWindow.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 19 Nov 2013 10:17:59 +0100 |
parents | 04cc2dee911e |
children | 5dfb3ff98bc6 |
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; |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import com.google.gwt.core.client.GWT; |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
12 import com.google.gwt.user.client.rpc.AsyncCallback; |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
14 import com.smartgwt.client.data.Record; |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
15 import com.smartgwt.client.types.ListGridFieldType; |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.Canvas; |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
17 import com.smartgwt.client.widgets.events.ClickEvent; |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
18 import com.smartgwt.client.widgets.grid.ListGrid; |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
19 import com.smartgwt.client.widgets.grid.ListGridField; |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
20 import com.smartgwt.client.widgets.grid.ListGridRecord; |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
21 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
22 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
23 import com.smartgwt.client.widgets.layout.HLayout; |
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
24 import com.smartgwt.client.widgets.layout.VLayout; |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
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; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
28 import org.dive4elements.river.client.client.event.StepForwardEvent; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
29 import org.dive4elements.river.client.client.services.LoadArtifactServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
30 import org.dive4elements.river.client.client.services.RemoveArtifactServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
31 import org.dive4elements.river.client.shared.model.Artifact; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
32 import org.dive4elements.river.client.shared.model.Collection; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
33 import org.dive4elements.river.client.shared.model.Data; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
34 import org.dive4elements.river.client.shared.model.DataItem; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
35 import org.dive4elements.river.client.shared.model.DataList; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
36 import org.dive4elements.river.client.shared.model.DefaultData; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
37 import org.dive4elements.river.client.shared.model.DefaultDataItem; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
38 import org.dive4elements.river.client.shared.model.Recommendation; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
39 import org.dive4elements.river.client.shared.model.Recommendation.Facet; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
40 import org.dive4elements.river.client.shared.model.Recommendation.Filter; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
41 import org.dive4elements.river.client.shared.model.User; |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
42 |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
43 import java.util.ArrayList; |
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
44 import java.util.List; |
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
45 import java.util.Map; |
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
46 import java.util.Set; |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 // TODO Probably better to branch off AbstractUIProvider. |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
49 // TODO Merge with other datacage-widget impls. |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
50 /** |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
51 * Panel containing a Grid and a "next" button. The Grid is fed by a |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
52 * DatacagePairWidget which is put in the input-helper area. |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
53 */ |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
54 public class DatacageTwinPanel |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
55 extends TextProvider { |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4127
diff
changeset
|
57 private static final long serialVersionUID = 8906629596491827857L; |
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
4127
diff
changeset
|
58 |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 protected String dataName; |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 protected User user; |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
65 /** ListGrid that displays user-selected pairs to build differences with. */ |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
66 protected ListGrid differencesList; |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
67 |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
68 /** |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
69 * List to track previously selected but now removed pairs. (Needed to |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
70 * be able to identify artifacts that can be removed from the collection. |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
71 */ |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
72 protected List<RecommendationPairRecord> removedPairs = |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
73 new ArrayList<RecommendationPairRecord>(); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
74 |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
75 /** Service handle to clone and add artifacts to collection. */ |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
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); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
78 |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
79 /** Service to remove artifacts from collection. */ |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
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); |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
83 |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 public DatacageTwinPanel(User user) { |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 super(); |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 this.user = user; |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 } |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
90 /** |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
91 * Remove first occurrence of "[" and "]" (if both do occur). |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
92 * @param value String to be stripped of [] (might be null). |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
93 * @return input string but with [ and ] removed, or input string if no |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
94 * brackets were found. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
95 * @see StringUtil.unbracket |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
96 */ |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
97 public static final String unbracket(String value) { |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
98 // null- guard. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
99 if (value == null) return value; |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
100 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
101 int start = value.indexOf("["); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
102 int end = value.indexOf("]"); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
103 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
104 if (start < 0 || end < 0) { |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
105 return value; |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
106 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
107 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
108 value = value.substring(start + 1, end); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
109 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
110 return value; |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
111 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
112 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
113 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
114 /** |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
115 * Create a recommendation from a string representation of it. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
116 * @TODO describe format of input string |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
117 * @param from string in format as shown above. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
118 * @return recommendation from input string. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
119 */ |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
120 public Recommendation createRecommendationFromString(String from) { |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
121 // TODO Construct "real" filter. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
122 String[] parts = unbracket(from).split(";"); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
123 Recommendation.Filter filter = new Recommendation.Filter(); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
124 Recommendation.Facet facet = new Recommendation.Facet( |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
125 parts[1], |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
126 parts[2]); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
127 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
128 List<Recommendation.Facet> facets = new ArrayList<Recommendation.Facet> |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
129 (); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
130 facets.add(facet); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
131 filter.add("longitudinal_section", facets); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
132 Recommendation r = new Recommendation("waterlevel", parts[0], |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
133 this.artifact.getUuid(), filter); |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
134 r.setDisplayName(parts[3]); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1543
diff
changeset
|
135 return r; |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
136 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
137 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
138 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
139 /** |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
140 * Add RecomendationPairRecords from input String to the ListGrid. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
141 */ |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
142 public void populateGridFromString(String from){ |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
143 // Split this string. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
144 // Create according recommendations and display strings. |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
145 String[] recs = from.split("#"); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
146 if (recs.length % 2 != 0) return; |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
147 for (int i = 0; i < recs.length; i+=2) { |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
148 Recommendation minuend = |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
149 createRecommendationFromString(recs[i+0]); |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
150 Recommendation subtrahend = |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
151 createRecommendationFromString(recs[i+1]); |
1363
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
152 |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
153 RecommendationPairRecord pr = new RecommendationPairRecord( |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
154 minuend, subtrahend); |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
155 // This Recommendation Pair comes from the data string and was thus |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
156 // already cloned. |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
157 pr.setIsAlreadyLoaded(true); |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
158 this.differencesList.addData(pr); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
159 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
160 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
161 |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
162 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
163 /** |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
164 * Creates the graphical representation and interaction widgets for the data. |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
165 * @param dataList the data. |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
166 * @return graphical representation and interaction widgets for data. |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
167 */ |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 @Override |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 public Canvas create(DataList dataList) { |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 GWT.log("createData()"); |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 Canvas widget = createWidget(); |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 Canvas submit = getNextButton(); |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 |
1273
6ec804500621
Avoid duplicate clones in w-diff branch by using a set instead of a list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1266
diff
changeset
|
175 VLayout layout = new VLayout(); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
176 HLayout helperLayout = new HLayout(); |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
177 helperLayout.addMember(new DatacagePairWidget(this.artifact, |
6584
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
178 user, "differenceable", differencesList)); |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 layout.addMember(widget); |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 layout.addMember(submit); |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 layout.setMembersMargin(10); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
183 this.helperContainer.addMember(helperLayout); |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
185 // Find old data, if any, handle "diffids". |
1543
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1442
diff
changeset
|
186 Data data = dataList.get(0); |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
187 this.dataName = data.getLabel(); |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
188 for (int i = 0; i < dataList.size(); i++) { |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
189 if (dataList.get(i) != null && dataList.get(i).getItems() != null) { |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
190 if (dataList.get(i).getItems() != null) { |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
191 populateGridFromString( |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
192 dataList.get(i).getItems()[0].getStringValue()); |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
193 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
194 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
195 } |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
196 |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
197 return layout; |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 } |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
199 |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
201 /** |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
202 * Validates the selection. |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
203 * @return List of internationalized errror messages (if any). |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
204 */ |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 @Override |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
206 public List<String> validate() { |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
207 List<String> errors = new ArrayList<String>(); |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
208 if (differencesList.getRecords().length == 0) { |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
209 errors.add(MSG.error_no_waterlevel_pair_selected()); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
210 } |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1305
diff
changeset
|
211 // Check whether minuend and subtrahend are equal. |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
212 for (ListGridRecord record: differencesList.getRecords()) { |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
213 RecommendationPairRecord r = (RecommendationPairRecord) record; |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
214 if (r.getFirst().equals(r.getSecond())) { |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
215 errors.add(MSG.error_same_waterlevels_in_pair()); |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
216 } |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
217 } |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
218 |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
219 return errors; |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
220 } |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
221 |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
222 |
1274
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
223 /** |
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
224 * Creates layout with grid that displays selection inside. |
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
225 */ |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
226 public Canvas createWidget() { |
1274
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
227 VLayout layout = new VLayout(); |
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
228 differencesList = new ListGrid(); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
229 |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
230 differencesList.setCanEdit(false); |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
231 differencesList.setCanSort(false); |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
232 differencesList.setShowHeaderContextMenu(false); |
1274
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
233 differencesList.setHeight(150); |
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
234 differencesList.setShowAllRecords(true); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
235 |
1274
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
236 ListGridField nameField = new ListGridField("first", "Minuend"); |
f76c90b3086f
Make differences (rows of list) in wdiff-gui removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1273
diff
changeset
|
237 ListGridField capitalField = new ListGridField("second", "Subtrahend"); |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
238 // Track removed rows, therefore more or less reimplement |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
239 // setCanRecomeRecords. |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
240 final ListGridField removeField = |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
241 new ListGridField("_removeRecord", "Remove Record"){{ |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
242 setType(ListGridFieldType.ICON); |
1363
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
243 setIcon(GWT.getHostPageBaseURL() + MSG.removeFeature()); |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
244 setCanEdit(false); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
245 setCanFilter(false); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
246 setCanSort(false); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
247 setCanGroupBy(false); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
248 setCanFreeze(false); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
249 setWidth(25); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
250 }}; |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
251 |
1266
ff012a9d9d1d
Employ waterlevelfactory when cloning artifacts for WDifferences-Subtrahend/Minuend-artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
252 differencesList.setFields(new ListGridField[] {nameField, |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
253 capitalField, removeField}); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1543
diff
changeset
|
254 |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
255 differencesList.addRecordClickHandler(new RecordClickHandler() { |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
256 @Override |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
257 public void onRecordClick(final RecordClickEvent event) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
258 // Just handle remove-clicks |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
259 if(!event.getField().getName().equals(removeField.getName())) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
260 return; |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1543
diff
changeset
|
261 } |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
262 trackRemoved(event.getRecord()); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
263 event.getViewer().removeData(event.getRecord()); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
264 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
265 }); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
266 layout.addMember(differencesList); |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
267 |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
268 return layout; |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
269 } |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
270 |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
271 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
272 /** |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
273 * Add record to list of removed records. |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
274 */ |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
275 public void trackRemoved(Record r) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
276 RecommendationPairRecord pr = (RecommendationPairRecord) r; |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
277 this.removedPairs.add(pr); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
278 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
279 |
6591
661faf99d240
issue1394: Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6585
diff
changeset
|
280 /** |
661faf99d240
issue1394: Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6585
diff
changeset
|
281 * Set factory of recommendation such that the correct artifacts will |
661faf99d240
issue1394: Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6585
diff
changeset
|
282 * be cloned for difference calculations. |
661faf99d240
issue1394: Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6585
diff
changeset
|
283 */ |
6584
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
284 public void adjustRecommendation(Recommendation recommendation) { |
7563
04cc2dee911e
flys/issue1503: Evil hack to force loaded of data to be bound to 'w_differences'. TODO: Remove all the broken code from DataCageTwinPanel.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6623
diff
changeset
|
285 // XXX: THIS IS AN EVIL HACK TO MAKE W-DIFFERENCES WORK AGAIN! |
04cc2dee911e
flys/issue1503: Evil hack to force loaded of data to be bound to 'w_differences'. TODO: Remove all the broken code from DataCageTwinPanel.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6623
diff
changeset
|
286 // TODO: Throw all this code away and do it with server side recommendations! |
04cc2dee911e
flys/issue1503: Evil hack to force loaded of data to be bound to 'w_differences'. TODO: Remove all the broken code from DataCageTwinPanel.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6623
diff
changeset
|
287 recommendation.setTargetOut("w_differences"); |
04cc2dee911e
flys/issue1503: Evil hack to force loaded of data to be bound to 'w_differences'. TODO: Remove all the broken code from DataCageTwinPanel.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6623
diff
changeset
|
288 |
6584
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
289 if (recommendation.getIDs() != null) { |
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
290 GWT.log("Setting staticwkms factory for rec with ID " |
6585
967ae6799d98
Fix typos that lead to non-compilability.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6584
diff
changeset
|
291 + recommendation.getIDs()); |
6584
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
292 recommendation.setFactory("staticwkms"); |
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
293 } |
6617
67b4728723df
Do not fiddle with the factory name of recommendations for differences anymore.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6591
diff
changeset
|
294 /* |
67b4728723df
Do not fiddle with the factory name of recommendations for differences anymore.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6591
diff
changeset
|
295 // So far, we do not need to rewrite the factory anymore, |
67b4728723df
Do not fiddle with the factory name of recommendations for differences anymore.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6591
diff
changeset
|
296 // except for staticwkms; probably other cases will pop up later. |
6584
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
297 else if (recommendation.getFactory().equals("winfo")) { |
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
298 GWT.log("Setting waterlevel factory for a winfo rec."); |
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
299 recommendation.setFactory("waterlevel"); |
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
300 } |
6617
67b4728723df
Do not fiddle with the factory name of recommendations for differences anymore.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6591
diff
changeset
|
301 */ |
6584
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
302 else { |
6585
967ae6799d98
Fix typos that lead to non-compilability.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6584
diff
changeset
|
303 GWT.log("Leave rec. id " + recommendation.getIDs() + ", factory " |
6584
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
304 + recommendation.getFactory() + " untouched."); |
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
305 } |
3059d49cc5ce
issue1394: Let client use the new pseudo-out: differenceable, deal with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
306 } |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
307 |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
308 /** |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
309 * Validates data, does nothing if invalid, otherwise clones new selected |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
310 * waterlevels and add them to collection, forward the artifact. |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
311 */ |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
312 @Override |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
313 public void onClick(ClickEvent e) { |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
314 GWT.log("DatacageTwinPanel.onClick"); |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
315 |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
316 List<String> errors = validate(); |
1314
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
317 if (errors != null && !errors.isEmpty()) { |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
318 showErrors(errors); |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
319 return; |
4c716bec7822
Validate selection of pairs in wdiff, show error(s) if invalid.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1308
diff
changeset
|
320 } |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
321 |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
322 Config config = Config.getInstance(); |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
323 String locale = config.getLocale(); |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
324 |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
325 ListGridRecord[] records = differencesList.getRecords(); |
1273
6ec804500621
Avoid duplicate clones in w-diff branch by using a set instead of a list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1266
diff
changeset
|
326 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1305
diff
changeset
|
327 List<Recommendation> ar = new ArrayList<Recommendation>(); |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1305
diff
changeset
|
328 List<Recommendation> all = new ArrayList<Recommendation>(); |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
329 |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
330 for (ListGridRecord record : records) { |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
331 RecommendationPairRecord r = |
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
332 (RecommendationPairRecord) record; |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
333 // Do not add "old" recommendations. |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
334 if (!r.isAlreadyLoaded()) { |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
335 // Check whether one of those is a dike or similar. |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
336 // TODO differentiate and merge: new clones, new, old. |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
337 Recommendation firstR = r.getFirst(); |
6591
661faf99d240
issue1394: Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6585
diff
changeset
|
338 adjustRecommendation(firstR); |
661faf99d240
issue1394: Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6585
diff
changeset
|
339 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
340 Recommendation secondR = r.getSecond(); |
6591
661faf99d240
issue1394: Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6585
diff
changeset
|
341 adjustRecommendation(secondR); |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
342 |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
343 ar.add(firstR); |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
344 ar.add(secondR); |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
345 } |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
346 else { |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
347 all.add(r.getFirst()); |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
348 all.add(r.getSecond()); |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
349 } |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
350 } |
1266
ff012a9d9d1d
Employ waterlevelfactory when cloning artifacts for WDifferences-Subtrahend/Minuend-artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
351 |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
352 final Recommendation[] toClone = ar.toArray(new Recommendation[ar.size()]); |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
353 final Recommendation[] toUse = all.toArray(new Recommendation[all.size()]); |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
354 |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
355 // Find out whether "old" artifacts have to be removed. |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
356 List<String> artifactIdsToRemove = new ArrayList<String>(); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
357 for (RecommendationPairRecord rp: this.removedPairs) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
358 Recommendation first = rp.getFirst(); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
359 Recommendation second = rp.getSecond(); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
360 |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
361 for (Recommendation recommendation: toUse) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
362 if (first != null && first.getIDs().equals(recommendation.getIDs())) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
363 first = null; |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
364 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
365 if (second != null && second.getIDs().equals(recommendation.getIDs())) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
366 second = null; |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
367 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
368 |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
369 if (first == null && second == null) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
370 break; |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
371 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
372 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
373 if (first != null) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
374 artifactIdsToRemove.add(first.getIDs()); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
375 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
376 if (second != null) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
377 artifactIdsToRemove.add(second.getIDs()); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
378 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
379 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
380 |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
381 // Remove old artifacts, if any. Do this asychronously without much |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
382 // feedback. |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
383 for(final String uuid: artifactIdsToRemove) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
384 removeArtifactService.remove(this.collection, |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
385 uuid, |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
386 locale, |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
387 new AsyncCallback<Collection>() { |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
388 @Override |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
389 public void onFailure(Throwable caught) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
390 GWT.log("RemoveArtifact (" + uuid + ") failed."); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
391 } |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
392 @Override |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
393 public void onSuccess(Collection collection) { |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
394 GWT.log("RemoveArtifact succeeded"); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
395 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
396 }); |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
397 } |
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
398 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
399 // Clone new ones (and spawn statics), go forward. |
6623
3999162f474f
DatacageTwinPanel: Show busy-wheel when loading and adding artifacts to collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6617
diff
changeset
|
400 parameterList.lockUI(); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
401 loadArtifactService.loadMany( |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
402 this.collection, |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
403 toClone, |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
404 //"staticwkms" and "waterlevel" |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
405 null, |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
406 locale, |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
407 new AsyncCallback<Artifact[]>() { |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
408 @Override |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
409 public void onFailure(Throwable caught) { |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
410 GWT.log("Failure of cloning with factories!"); |
6623
3999162f474f
DatacageTwinPanel: Show busy-wheel when loading and adding artifacts to collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6617
diff
changeset
|
411 parameterList.unlockUI(); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
412 } |
4127
1e9e7b7d9f15
More fixes for #897: missing resource exceptions when handling other exceptions
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
413 @Override |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
414 public void onSuccess(Artifact[] artifacts) { |
1305
014fc183c640
Fix 'incorrect minuend/subtrahend order' bug in wdiff calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1304
diff
changeset
|
415 GWT.log("Successfully cloned " + toClone.length + |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
416 " with factories."); |
1266
ff012a9d9d1d
Employ waterlevelfactory when cloning artifacts for WDifferences-Subtrahend/Minuend-artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
417 |
ff012a9d9d1d
Employ waterlevelfactory when cloning artifacts for WDifferences-Subtrahend/Minuend-artifacts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
418 fireStepForwardEvent(new StepForwardEvent( |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
419 getData(toClone, artifacts, toUse))); |
6623
3999162f474f
DatacageTwinPanel: Show busy-wheel when loading and adding artifacts to collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6617
diff
changeset
|
420 parameterList.unlockUI(); |
1273
6ec804500621
Avoid duplicate clones in w-diff branch by using a set instead of a list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1266
diff
changeset
|
421 } |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
422 }); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
423 } |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
424 |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
425 |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
426 /** |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
427 * Create Data and DataItem from selection (a long string with identifiers |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
428 * to construct diff-pairs). |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
429 * |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
430 * @param newRecommendations "new" recommendations (did not survive a |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
431 * backjump). |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
432 * @param newArtifacts artifacts cloned from newRecommendations. |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
433 * @param oldRecommendations old recommendations that survived a backjump. |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
434 * |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
435 * @return dataitem with a long string with identifiers to construct |
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1321
diff
changeset
|
436 * diff-pairs. |
1321
cfbfaadf4b6f
Remove Artifacts not needed anymore when reparameterizing w-diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1314
diff
changeset
|
437 */ |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
438 protected Data[] getData( |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
439 Recommendation[] newRecommendations, |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
440 Artifact[] newArtifacts, |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
441 Recommendation[] oldRecommendations) |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
442 { |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
443 // Construct string with info about selections. |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
444 String dataItemString = ""; |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
445 for (int i = 0; i < newRecommendations.length; i++) { |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
446 Recommendation r = newRecommendations[i]; |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
447 Artifact newArtifact = newArtifacts[i]; |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
448 String uuid = newArtifact.getUuid(); |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
449 r.setMasterArtifact(uuid); |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
450 if (i>0) dataItemString += "#"; |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1543
diff
changeset
|
451 |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
452 dataItemString += createDataString(uuid, r); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
453 } |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
454 |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
455 for (int i = 0; i < oldRecommendations.length; i++) { |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
456 Recommendation r = oldRecommendations[i]; |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
457 String uuid = r.getIDs(); |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
458 if (dataItemString.length() > 0) dataItemString += "#"; |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1543
diff
changeset
|
459 |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
460 dataItemString += createDataString(uuid, r); |
1304
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
461 } |
18b0414bde44
Allow reparameterization of W-Diffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1298
diff
changeset
|
462 |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
463 // TODO some hassle could be resolved by using multiple DataItems |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
464 // (e.g. one per pair). |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
465 DataItem item = new DefaultDataItem(dataName, dataName, dataItemString); |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
466 return new Data[] { new DefaultData( |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
467 dataName, null, null, new DataItem[] {item}) }; |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
468 } |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
469 |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
470 |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1305
diff
changeset
|
471 /** |
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1305
diff
changeset
|
472 * Creates part of the String that encodes minuend or subtrahend. |
1363
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
473 * @param artifact Artifacts UUID. |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
474 * @param recommendation Recommendation to wrap in string. |
1307
489e6a82fe84
Partial fix for flys/issue304 (Erweiterte Funktionen W-Differenzen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1305
diff
changeset
|
475 */ |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
476 protected String createDataString( |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
477 String artifact, |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
478 Recommendation recommendation) |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
479 { |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
480 Filter filter = recommendation.getFilter(); |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
481 Facet f = null; |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
482 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
483 if(filter != null) { |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
484 Map<String, List<Facet>> outs = filter.getOuts(); |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
485 Set<Map.Entry<String, List<Facet>>> entries = outs.entrySet(); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
486 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
487 for (Map.Entry<String, List<Facet>> entry: entries) { |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
488 List<Facet> fs = entry.getValue(); |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
489 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
490 f = fs.get(0); |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
491 if (f != null) { |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
492 break; |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
493 } |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
494 } |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
495 |
1363
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
496 return "[" + artifact + ";" |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
497 + f.getName() |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
498 + ";" |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
499 + f.getIndex() |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
500 + ";" |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
501 + recommendation.getDisplayName() + "]"; |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
502 } |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1333
diff
changeset
|
503 else { |
1363
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
504 return "[" |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
505 + artifact |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
506 + ";staticwkms;0;" |
9da7fdfbb80e
Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
507 + recommendation.getDisplayName() + "]"; |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
508 } |
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
867
diff
changeset
|
509 } |
867
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
510 } |
6a2ed979dfcf
Added new UIProvider "DatacageTwinPanel", pass user via UIProviderFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
511 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |