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