Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/minfo/BedHeightsDatacagePanel.java @ 4182:ad2489b595d7
Fix for issue #967
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 16 Oct 2012 12:44:15 +0200 |
parents | 75a3a41a6e51 |
children | 1755a1bfe5ce |
comparison
equal
deleted
inserted
replaced
4151:0182916dcb01 | 4182:ad2489b595d7 |
---|---|
1 package de.intevation.flys.client.client.ui.minfo; | 1 package de.intevation.flys.client.client.ui.minfo; |
2 | 2 |
3 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
4 | |
5 import com.google.gwt.user.client.rpc.AsyncCallback; | 4 import com.google.gwt.user.client.rpc.AsyncCallback; |
6 | 5 |
7 import com.smartgwt.client.data.Record; | 6 import com.smartgwt.client.data.Record; |
8 | |
9 import com.smartgwt.client.widgets.Canvas; | 7 import com.smartgwt.client.widgets.Canvas; |
10 | |
11 import com.smartgwt.client.widgets.events.ClickEvent; | 8 import com.smartgwt.client.widgets.events.ClickEvent; |
12 | |
13 import com.smartgwt.client.widgets.grid.ListGridRecord; | 9 import com.smartgwt.client.widgets.grid.ListGridRecord; |
14 | |
15 import com.smartgwt.client.widgets.layout.HLayout; | 10 import com.smartgwt.client.widgets.layout.HLayout; |
16 import com.smartgwt.client.widgets.layout.VLayout; | 11 import com.smartgwt.client.widgets.layout.VLayout; |
17 | 12 |
18 import de.intevation.flys.client.client.Config; | 13 import de.intevation.flys.client.client.Config; |
19 import de.intevation.flys.client.client.FLYSConstants; | 14 import de.intevation.flys.client.client.FLYSConstants; |
20 | |
21 import de.intevation.flys.client.client.event.StepForwardEvent; | 15 import de.intevation.flys.client.client.event.StepForwardEvent; |
22 | |
23 import de.intevation.flys.client.client.services.LoadArtifactService; | |
24 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; | 16 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; |
25 import de.intevation.flys.client.client.services.RemoveArtifactService; | |
26 import de.intevation.flys.client.client.services.RemoveArtifactServiceAsync; | 17 import de.intevation.flys.client.client.services.RemoveArtifactServiceAsync; |
27 | |
28 import de.intevation.flys.client.client.ui.DatacagePairWidget; | 18 import de.intevation.flys.client.client.ui.DatacagePairWidget; |
29 import de.intevation.flys.client.client.ui.DatacageTwinPanel; | 19 import de.intevation.flys.client.client.ui.DatacageTwinPanel; |
30 import de.intevation.flys.client.client.ui.RecommendationPairRecord; | 20 import de.intevation.flys.client.client.ui.RecommendationPairRecord; |
31 | |
32 import de.intevation.flys.client.shared.model.Artifact; | 21 import de.intevation.flys.client.shared.model.Artifact; |
33 import de.intevation.flys.client.shared.model.Collection; | 22 import de.intevation.flys.client.shared.model.Collection; |
34 import de.intevation.flys.client.shared.model.Data; | 23 import de.intevation.flys.client.shared.model.Data; |
35 import de.intevation.flys.client.shared.model.DataItem; | 24 import de.intevation.flys.client.shared.model.DataItem; |
36 import de.intevation.flys.client.shared.model.DataList; | 25 import de.intevation.flys.client.shared.model.DataList; |
37 | 26 import de.intevation.flys.client.shared.model.Recommendation; |
38 import de.intevation.flys.client.shared.model.Recommendation.Facet; | 27 import de.intevation.flys.client.shared.model.Recommendation.Facet; |
39 import de.intevation.flys.client.shared.model.Recommendation.Filter; | 28 import de.intevation.flys.client.shared.model.Recommendation.Filter; |
40 | |
41 import de.intevation.flys.client.shared.model.Recommendation; | |
42 import de.intevation.flys.client.shared.model.User; | 29 import de.intevation.flys.client.shared.model.User; |
43 | 30 |
44 import java.util.ArrayList; | 31 import java.util.ArrayList; |
45 import java.util.List; | 32 import java.util.List; |
46 import java.util.Map; | 33 import java.util.Map; |
52 * Panel containing a Grid and a "next" button. The Grid is fed by a | 39 * Panel containing a Grid and a "next" button. The Grid is fed by a |
53 * DatacagePairWidget which is put in the input-helper area. | 40 * DatacagePairWidget which is put in the input-helper area. |
54 */ | 41 */ |
55 public class BedHeightsDatacagePanel | 42 public class BedHeightsDatacagePanel |
56 extends DatacageTwinPanel { | 43 extends DatacageTwinPanel { |
44 private static final long serialVersionUID = -4237734158851386530L; | |
57 | 45 |
58 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); | 46 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); |
59 | 47 |
60 /** | 48 /** |
61 * List to track previously selected but now removed pairs. (Needed to | 49 * List to track previously selected but now removed pairs. (Needed to |
82 * Create a recommendation from a string representation of it. | 70 * Create a recommendation from a string representation of it. |
83 * @TODO describe format of input string | 71 * @TODO describe format of input string |
84 * @param from string in format as shown above. | 72 * @param from string in format as shown above. |
85 * @return recommendation from input string. | 73 * @return recommendation from input string. |
86 */ | 74 */ |
75 @Override | |
87 public Recommendation createRecommendationFromString(String from) { | 76 public Recommendation createRecommendationFromString(String from) { |
88 // TODO Construct "real" filter. | 77 // TODO Construct "real" filter. |
89 String[] parts = unbracket(from).split(";"); | 78 String[] parts = unbracket(from).split(";"); |
90 Recommendation.Filter filter = new Recommendation.Filter(); | 79 Recommendation.Filter filter = new Recommendation.Filter(); |
91 Recommendation.Facet facet = new Recommendation.Facet( | 80 Recommendation.Facet facet = new Recommendation.Facet( |
141 | 130 |
142 | 131 |
143 /** | 132 /** |
144 * Add record to list of removed records. | 133 * Add record to list of removed records. |
145 */ | 134 */ |
135 @Override | |
146 public void trackRemoved(Record r) { | 136 public void trackRemoved(Record r) { |
147 RecommendationPairRecord pr = (RecommendationPairRecord) r; | 137 RecommendationPairRecord pr = (RecommendationPairRecord) r; |
148 this.removedPairs.add(pr); | 138 this.removedPairs.add(pr); |
149 } | 139 } |
150 | 140 |
234 for(final String uuid: artifactIdsToRemove) { | 224 for(final String uuid: artifactIdsToRemove) { |
235 removeArtifactService.remove(this.collection, | 225 removeArtifactService.remove(this.collection, |
236 uuid, | 226 uuid, |
237 locale, | 227 locale, |
238 new AsyncCallback<Collection>() { | 228 new AsyncCallback<Collection>() { |
229 @Override | |
239 public void onFailure(Throwable caught) { | 230 public void onFailure(Throwable caught) { |
240 GWT.log("RemoveArtifact (" + uuid + ") failed."); | 231 GWT.log("RemoveArtifact (" + uuid + ") failed."); |
241 } | 232 } |
233 @Override | |
242 public void onSuccess(Collection collection) { | 234 public void onSuccess(Collection collection) { |
243 GWT.log("RemoveArtifact succeeded"); | 235 GWT.log("RemoveArtifact succeeded"); |
244 } | 236 } |
245 }); | 237 }); |
246 } | 238 } |
251 toClone, | 243 toClone, |
252 //"staticwkms" and "waterlevel" | 244 //"staticwkms" and "waterlevel" |
253 null, | 245 null, |
254 locale, | 246 locale, |
255 new AsyncCallback<Artifact[]>() { | 247 new AsyncCallback<Artifact[]>() { |
248 @Override | |
256 public void onFailure(Throwable caught) { | 249 public void onFailure(Throwable caught) { |
257 GWT.log("Failure of cloning with factories!"); | 250 GWT.log("Failure of cloning with factories!"); |
258 } | 251 } |
252 @Override | |
259 public void onSuccess(Artifact[] artifacts) { | 253 public void onSuccess(Artifact[] artifacts) { |
260 GWT.log("Successfully cloned " + toClone.length + | 254 GWT.log("Successfully cloned " + toClone.length + |
261 " with factories."); | 255 " with factories."); |
262 | 256 |
263 fireStepForwardEvent(new StepForwardEvent( | 257 fireStepForwardEvent(new StepForwardEvent( |
270 /** | 264 /** |
271 * Creates part of the String that encodes minuend or subtrahend. | 265 * Creates part of the String that encodes minuend or subtrahend. |
272 * @param artifact Artifacts UUID. | 266 * @param artifact Artifacts UUID. |
273 * @param recommendation Recommendation to wrap in string. | 267 * @param recommendation Recommendation to wrap in string. |
274 */ | 268 */ |
269 @Override | |
275 protected String createDataString( | 270 protected String createDataString( |
276 String artifact, | 271 String artifact, |
277 Recommendation recommendation) | 272 Recommendation recommendation) |
278 { | 273 { |
279 Filter filter = recommendation.getFilter(); | 274 Filter filter = recommendation.getFilter(); |