comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java @ 1305:014fc183c640

Fix 'incorrect minuend/subtrahend order' bug in wdiff calculation. flys-client/trunk@2939 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 11 Oct 2011 12:20:32 +0000
parents 18b0414bde44
children 489e6a82fe84
comparison
equal deleted inserted replaced
1304:18b0414bde44 1305:014fc183c640
1 package de.intevation.flys.client.client.ui; 1 package de.intevation.flys.client.client.ui;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.HashSet; 4 import java.util.LinkedHashSet;
5 import java.util.List; 5 import java.util.List;
6 import java.util.Map; 6 import java.util.Map;
7 import java.util.Set; 7 import java.util.Set;
8 8
9 import com.google.gwt.core.client.GWT; 9 import com.google.gwt.core.client.GWT;
228 * */ 228 * */
229 GWT.log("DatacageTwinPanel.onClick"); 229 GWT.log("DatacageTwinPanel.onClick");
230 Config config = Config.getInstance(); 230 Config config = Config.getInstance();
231 ListGridRecord[] records = differencesList.getRecords(); 231 ListGridRecord[] records = differencesList.getRecords();
232 232
233 Set<Recommendation> ar = new HashSet<Recommendation>(); 233 // Use LinkedHashSet to keep the order.
234 Set<Recommendation> all = new HashSet<Recommendation>(); 234 Set<Recommendation> ar = new LinkedHashSet<Recommendation>();
235 Set<Recommendation> all = new LinkedHashSet<Recommendation>();
235 for (ListGridRecord record : records) { 236 for (ListGridRecord record : records) {
236 RecommendationPairRecord r = 237 RecommendationPairRecord r =
237 (RecommendationPairRecord) record; 238 (RecommendationPairRecord) record;
238 // Do not add "old" recommendations. 239 // Do not add "old" recommendations.
239 if (!r.isAlreadyLoaded()) { 240 if (!r.isAlreadyLoaded()) {
240 GWT.log("One not yet loaded.");
241 ar.add(r.getFirst()); 241 ar.add(r.getFirst());
242 ar.add(r.getSecond()); 242 ar.add(r.getSecond());
243 } 243 }
244 else { 244 else {
245 GWT.log("One already loaded.");
246 all.add(r.getFirst()); 245 all.add(r.getFirst());
247 all.add(r.getSecond()); 246 all.add(r.getSecond());
248 } 247 }
249 } 248 }
250 249
259 new AsyncCallback<Artifact[]>() { 258 new AsyncCallback<Artifact[]>() {
260 public void onFailure(Throwable caught) { 259 public void onFailure(Throwable caught) {
261 GWT.log("Failure of cloning with waterlevelfactory!"); 260 GWT.log("Failure of cloning with waterlevelfactory!");
262 } 261 }
263 public void onSuccess(Artifact[] artifacts) { 262 public void onSuccess(Artifact[] artifacts) {
264 GWT.log("Success in cloning ("+toClone.length+") with watelevelfactory!"); 263 GWT.log("Successfully cloned " + toClone.length +
264 " with watelevelfactory.");
265 265
266 fireStepForwardEvent(new StepForwardEvent( 266 fireStepForwardEvent(new StepForwardEvent(
267 getData(toClone, artifacts, toUse))); 267 getData(toClone, artifacts, toUse)));
268 } 268 }
269 } ); 269 } );

http://dive4elements.wald.intevation.org