comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java @ 1363:9da7fdfbb80e

Fix flys/issue390 (W-Diff: Icon zum Löschen anpassen). flys-client/trunk@3061 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 24 Oct 2011 10:53:39 +0000
parents 01b18db3b288
children baada4879c20
comparison
equal deleted inserted replaced
1362:670fd067bd80 1363:9da7fdfbb80e
135 */ 135 */
136 public void populateGridFromString(String from){ 136 public void populateGridFromString(String from){
137 // Split this string. 137 // Split this string.
138 // Create according recommendations and display strings. 138 // Create according recommendations and display strings.
139 String[] recs = from.split("#"); 139 String[] recs = from.split("#");
140 // TODO real name
141 if (recs.length % 2 != 0) return; 140 if (recs.length % 2 != 0) return;
142 for (int i = 0; i < recs.length; i+=2) { 141 for (int i = 0; i < recs.length; i+=2) {
143 Recommendation minuend = 142 Recommendation minuend =
144 createRecommendationFromString(recs[i+0]); 143 createRecommendationFromString(recs[i+0]);
145 Recommendation subtrahend = 144 Recommendation subtrahend =
146 createRecommendationFromString(recs[i+1]); 145 createRecommendationFromString(recs[i+1]);
147 //minuend.setDisplayName("hum"); subtrahend.setDisplayName("wim"); 146
148 RecommendationPairRecord pr = new RecommendationPairRecord( 147 RecommendationPairRecord pr = new RecommendationPairRecord(
149 minuend, subtrahend); 148 minuend, subtrahend);
150 // This Recommendation Pair comes from the data string and was thus 149 // This Recommendation Pair comes from the data string and was thus
151 // already cloned. 150 // already cloned.
152 pr.setIsAlreadyLoaded(true); 151 pr.setIsAlreadyLoaded(true);
233 // Track removed rows, therefore more or less reimplement 232 // Track removed rows, therefore more or less reimplement
234 // setCanRecomeRecords. 233 // setCanRecomeRecords.
235 final ListGridField removeField = 234 final ListGridField removeField =
236 new ListGridField("_removeRecord", "Remove Record"){{ 235 new ListGridField("_removeRecord", "Remove Record"){{
237 setType(ListGridFieldType.ICON); 236 setType(ListGridFieldType.ICON);
238 // TODO evaluate which icon to use (and how). 237 setIcon(GWT.getHostPageBaseURL() + MSG.removeFeature());
239 //setIcon("images/removeFeature.png");
240 setIcon("[SKIN]/actions/remove.png");
241 setCanEdit(false); 238 setCanEdit(false);
242 setCanFilter(false); 239 setCanFilter(false);
243 setCanSort(false); 240 setCanSort(false);
244 setCanGroupBy(false); 241 setCanGroupBy(false);
245 setCanFreeze(false); 242 setCanFreeze(false);
304 if (!r.isAlreadyLoaded()) { 301 if (!r.isAlreadyLoaded()) {
305 // Check whether one of those is a dike or similar. 302 // Check whether one of those is a dike or similar.
306 // TODO differentiate and merge: new clones, new, old. 303 // TODO differentiate and merge: new clones, new, old.
307 Recommendation firstR = r.getFirst(); 304 Recommendation firstR = r.getFirst();
308 if(firstR.getIDs() != null) { 305 if(firstR.getIDs() != null) {
309 GWT.log("First IDs: " + firstR.getIDs()); 306 GWT.log("First IDs: " + firstR.getIDs() + " factory: " + firstR.getFactory());
310 } 307 }
311 // TODO resolve this hack, fix datacage/recommendation for this case. 308 // TODO resolve this hack, fix datacage/recommendation for this case.
312 if(firstR.getIDs() != null && 309 if(firstR.getIDs() != null &&
313 firstR.getIDs().startsWith("flood_protection")) 310 firstR.getIDs().startsWith("flood_protection"))
314 { 311 {
318 else { 315 else {
319 firstR.setFactory("waterlevel"); 316 firstR.setFactory("waterlevel");
320 } 317 }
321 Recommendation secondR = r.getSecond(); 318 Recommendation secondR = r.getSecond();
322 if(secondR.getIDs() != null) { 319 if(secondR.getIDs() != null) {
323 GWT.log("Second IDs: " + secondR.getIDs()); 320 GWT.log("Second IDs: " + secondR.getIDs() + " factory: " + secondR.getFactory());
324 } 321 }
325 if(secondR.getIDs() != null 322 if(secondR.getIDs() != null
326 && secondR.getIDs().startsWith("flood_protection")) 323 && secondR.getIDs().startsWith("flood_protection"))
327 { 324 {
328 // These do not get cloned but loaded ("spawned"). 325 // These do not get cloned but loaded ("spawned").
455 } 452 }
456 453
457 454
458 /** 455 /**
459 * Creates part of the String that encodes minuend or subtrahend. 456 * Creates part of the String that encodes minuend or subtrahend.
457 * @param artifact Artifacts UUID.
458 * @param recommendation Recommendation to wrap in string.
460 */ 459 */
461 protected String createDataString( 460 protected String createDataString(
462 String artifact, 461 String artifact,
463 Recommendation recommendation) 462 Recommendation recommendation)
464 { 463 {
476 if (f != null) { 475 if (f != null) {
477 break; 476 break;
478 } 477 }
479 } 478 }
480 479
481 // Hell get the creepy name inside. 480 return "[" + artifact + ";"
482 return "[" + artifact + ";" + f.getName() + ";" + f.getIndex() + ";" + recommendation.getDisplayName() + "]"; 481 + f.getName()
482 + ";"
483 + f.getIndex()
484 + ";"
485 + recommendation.getDisplayName() + "]";
483 } 486 }
484 else { 487 else {
485 return "[" + artifact + ";staticwkms;0;" + recommendation.getDisplayName() + "]"; 488 return "["
489 + artifact
490 + ";staticwkms;0;"
491 + recommendation.getDisplayName() + "]";
486 } 492 }
487 } 493 }
488 } 494 }
489 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 495 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org