comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java @ 4133:c722c08cf502

Merged heads.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 15 Oct 2012 09:31:50 +0200
parents 360e22afb98b
children
comparison
equal deleted inserted replaced
4132:f6c73ee1b7f1 4133:c722c08cf502
1 package de.intevation.flys.client.client.ui; 1 package de.intevation.flys.client.client.ui;
2
3 import com.google.gwt.core.client.GWT;
4 import com.google.gwt.user.client.rpc.AsyncCallback;
5
6 import com.smartgwt.client.data.Record;
7 import com.smartgwt.client.types.ListGridFieldType;
8 import com.smartgwt.client.widgets.Canvas;
9 import com.smartgwt.client.widgets.events.ClickEvent;
10 import com.smartgwt.client.widgets.grid.ListGrid;
11 import com.smartgwt.client.widgets.grid.ListGridField;
12 import com.smartgwt.client.widgets.grid.ListGridRecord;
13 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
14 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
15 import com.smartgwt.client.widgets.layout.HLayout;
16 import com.smartgwt.client.widgets.layout.VLayout;
17
18 import de.intevation.flys.client.client.Config;
19 import de.intevation.flys.client.client.FLYSConstants;
20 import de.intevation.flys.client.client.event.StepForwardEvent;
21 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
22 import de.intevation.flys.client.client.services.RemoveArtifactServiceAsync;
23 import de.intevation.flys.client.shared.model.Artifact;
24 import de.intevation.flys.client.shared.model.Collection;
25 import de.intevation.flys.client.shared.model.Data;
26 import de.intevation.flys.client.shared.model.DataItem;
27 import de.intevation.flys.client.shared.model.DataList;
28 import de.intevation.flys.client.shared.model.DefaultData;
29 import de.intevation.flys.client.shared.model.DefaultDataItem;
30 import de.intevation.flys.client.shared.model.Recommendation;
31 import de.intevation.flys.client.shared.model.Recommendation.Facet;
32 import de.intevation.flys.client.shared.model.Recommendation.Filter;
33 import de.intevation.flys.client.shared.model.User;
2 34
3 import java.util.ArrayList; 35 import java.util.ArrayList;
4 import java.util.List; 36 import java.util.List;
5 import java.util.Map; 37 import java.util.Map;
6 import java.util.Set; 38 import java.util.Set;
7
8 import com.google.gwt.core.client.GWT;
9 import com.google.gwt.user.client.rpc.AsyncCallback;
10
11 import com.smartgwt.client.data.Record;
12 import com.smartgwt.client.types.ListGridFieldType;
13 import com.smartgwt.client.widgets.Canvas;
14 import com.smartgwt.client.widgets.layout.HLayout;
15 import com.smartgwt.client.widgets.layout.VLayout;
16 import com.smartgwt.client.widgets.grid.ListGrid;
17 import com.smartgwt.client.widgets.grid.ListGridField;
18 import com.smartgwt.client.widgets.grid.ListGridRecord;
19 import com.smartgwt.client.widgets.events.ClickEvent;
20 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
21 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
22
23 import de.intevation.flys.client.shared.model.Artifact;
24 import de.intevation.flys.client.shared.model.Collection;
25 import de.intevation.flys.client.shared.model.Data;
26 import de.intevation.flys.client.shared.model.DataItem;
27 import de.intevation.flys.client.shared.model.DefaultData;
28 import de.intevation.flys.client.shared.model.DefaultDataItem;
29 import de.intevation.flys.client.shared.model.DataList;
30 import de.intevation.flys.client.shared.model.User;
31
32 import de.intevation.flys.client.client.FLYSConstants;
33 import de.intevation.flys.client.client.event.StepForwardEvent;
34 import de.intevation.flys.client.shared.model.Recommendation;
35 import de.intevation.flys.client.shared.model.Recommendation.Facet;
36 import de.intevation.flys.client.shared.model.Recommendation.Filter;
37
38 import de.intevation.flys.client.client.Config;
39 import de.intevation.flys.client.client.services.LoadArtifactService;
40 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
41 import de.intevation.flys.client.client.services.RemoveArtifactService;
42 import de.intevation.flys.client.client.services.RemoveArtifactServiceAsync;
43 39
44 // TODO Probably better to branch off AbstractUIProvider. 40 // TODO Probably better to branch off AbstractUIProvider.
45 // TODO Merge with other datacage-widget impls. 41 // TODO Merge with other datacage-widget impls.
46 /** 42 /**
47 * Panel containing a Grid and a "next" button. The Grid is fed by a 43 * Panel containing a Grid and a "next" button. The Grid is fed by a
48 * DatacagePairWidget which is put in the input-helper area. 44 * DatacagePairWidget which is put in the input-helper area.
49 */ 45 */
50 public class DatacageTwinPanel 46 public class DatacageTwinPanel
51 extends TextProvider { 47 extends TextProvider {
48
49 private static final long serialVersionUID = 8906629596491827857L;
52 50
53 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); 51 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class);
54 52
55 protected String dataName; 53 protected String dataName;
56 54
245 243
246 differencesList.setFields(new ListGridField[] {nameField, 244 differencesList.setFields(new ListGridField[] {nameField,
247 capitalField, removeField}); 245 capitalField, removeField});
248 246
249 differencesList.addRecordClickHandler(new RecordClickHandler() { 247 differencesList.addRecordClickHandler(new RecordClickHandler() {
248 @Override
250 public void onRecordClick(final RecordClickEvent event) { 249 public void onRecordClick(final RecordClickEvent event) {
251 // Just handle remove-clicks 250 // Just handle remove-clicks
252 if(!event.getField().getName().equals(removeField.getName())) { 251 if(!event.getField().getName().equals(removeField.getName())) {
253 return; 252 return;
254 } 253 }
368 for(final String uuid: artifactIdsToRemove) { 367 for(final String uuid: artifactIdsToRemove) {
369 removeArtifactService.remove(this.collection, 368 removeArtifactService.remove(this.collection,
370 uuid, 369 uuid,
371 locale, 370 locale,
372 new AsyncCallback<Collection>() { 371 new AsyncCallback<Collection>() {
372 @Override
373 public void onFailure(Throwable caught) { 373 public void onFailure(Throwable caught) {
374 GWT.log("RemoveArtifact (" + uuid + ") failed."); 374 GWT.log("RemoveArtifact (" + uuid + ") failed.");
375 } 375 }
376 @Override
376 public void onSuccess(Collection collection) { 377 public void onSuccess(Collection collection) {
377 GWT.log("RemoveArtifact succeeded"); 378 GWT.log("RemoveArtifact succeeded");
378 } 379 }
379 }); 380 });
380 } 381 }
385 toClone, 386 toClone,
386 //"staticwkms" and "waterlevel" 387 //"staticwkms" and "waterlevel"
387 null, 388 null,
388 locale, 389 locale,
389 new AsyncCallback<Artifact[]>() { 390 new AsyncCallback<Artifact[]>() {
391 @Override
390 public void onFailure(Throwable caught) { 392 public void onFailure(Throwable caught) {
391 GWT.log("Failure of cloning with factories!"); 393 GWT.log("Failure of cloning with factories!");
392 } 394 }
395 @Override
393 public void onSuccess(Artifact[] artifacts) { 396 public void onSuccess(Artifact[] artifacts) {
394 GWT.log("Successfully cloned " + toClone.length + 397 GWT.log("Successfully cloned " + toClone.length +
395 " with factories."); 398 " with factories.");
396 399
397 fireStepForwardEvent(new StepForwardEvent( 400 fireStepForwardEvent(new StepForwardEvent(

http://dive4elements.wald.intevation.org