comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java @ 1414:3484cbfaf369

Create new Artifacts for selected WMS layers of the ExternalWMSWindow. flys-client/trunk@3304 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 22 Nov 2011 20:13:16 +0000
parents 659a488243da
children dfa2d4753fc0
comparison
equal deleted inserted replaced
1413:0d3bbe4240b1 1414:3484cbfaf369
5 import com.google.gwt.core.client.GWT; 5 import com.google.gwt.core.client.GWT;
6 import com.google.gwt.user.client.rpc.AsyncCallback; 6 import com.google.gwt.user.client.rpc.AsyncCallback;
7 import com.google.gwt.user.client.ui.HorizontalPanel; 7 import com.google.gwt.user.client.ui.HorizontalPanel;
8 import com.google.gwt.user.client.ui.Widget; 8 import com.google.gwt.user.client.ui.Widget;
9 9
10 import com.smartgwt.client.util.SC;
10 import com.smartgwt.client.widgets.Canvas; 11 import com.smartgwt.client.widgets.Canvas;
11 import com.smartgwt.client.widgets.events.ResizedEvent; 12 import com.smartgwt.client.widgets.events.ResizedEvent;
12 import com.smartgwt.client.widgets.events.ResizedHandler; 13 import com.smartgwt.client.widgets.events.ResizedHandler;
13 import com.smartgwt.client.widgets.layout.HLayout; 14 import com.smartgwt.client.widgets.layout.HLayout;
14 import com.smartgwt.client.widgets.layout.VLayout; 15 import com.smartgwt.client.widgets.layout.VLayout;
35 import de.intevation.flys.client.shared.model.DataItem; 36 import de.intevation.flys.client.shared.model.DataItem;
36 import de.intevation.flys.client.shared.model.DataList; 37 import de.intevation.flys.client.shared.model.DataList;
37 import de.intevation.flys.client.shared.model.DefaultData; 38 import de.intevation.flys.client.shared.model.DefaultData;
38 import de.intevation.flys.client.shared.model.DefaultDataItem; 39 import de.intevation.flys.client.shared.model.DefaultDataItem;
39 import de.intevation.flys.client.shared.model.MapConfig; 40 import de.intevation.flys.client.shared.model.MapConfig;
41 import de.intevation.flys.client.shared.model.Recommendation;
40 import de.intevation.flys.client.shared.model.Theme; 42 import de.intevation.flys.client.shared.model.Theme;
41 import de.intevation.flys.client.shared.model.ThemeList; 43 import de.intevation.flys.client.shared.model.ThemeList;
42 import de.intevation.flys.client.shared.model.OutputMode; 44 import de.intevation.flys.client.shared.model.OutputMode;
43 import de.intevation.flys.client.shared.model.WMSLayer; 45 import de.intevation.flys.client.shared.model.WMSLayer;
44 46
45 import de.intevation.flys.client.client.Config; 47 import de.intevation.flys.client.client.Config;
48 import de.intevation.flys.client.client.services.LoadArtifactService;
49 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
46 import de.intevation.flys.client.client.services.StepForwardService; 50 import de.intevation.flys.client.client.services.StepForwardService;
47 import de.intevation.flys.client.client.services.StepForwardServiceAsync; 51 import de.intevation.flys.client.client.services.StepForwardServiceAsync;
48 import de.intevation.flys.client.client.services.MapOutputService; 52 import de.intevation.flys.client.client.services.MapOutputService;
49 import de.intevation.flys.client.client.services.MapOutputServiceAsync; 53 import de.intevation.flys.client.client.services.MapOutputServiceAsync;
50 import de.intevation.flys.client.client.event.RedrawRequestHandler; 54 import de.intevation.flys.client.client.event.RedrawRequestHandler;
62 66
63 public static final String BARRIERS_PARAMETER_KEY = "uesk.barriers"; 67 public static final String BARRIERS_PARAMETER_KEY = "uesk.barriers";
64 68
65 public static final String WSPLGEN_FACET = "floodmap.wsplgen"; 69 public static final String WSPLGEN_FACET = "floodmap.wsplgen";
66 70
71 public static final String EXTERNAL_WMS_FACTORY = "externalwmsfactory";
72
67 73
68 protected StepForwardServiceAsync feedService = 74 protected StepForwardServiceAsync feedService =
69 GWT.create(StepForwardService.class); 75 GWT.create(StepForwardService.class);
70 76
71 protected MapOutputServiceAsync mapService = 77 protected MapOutputServiceAsync mapService =
72 GWT.create(MapOutputService.class); 78 GWT.create(MapOutputService.class);
79
80 /** Service handle to clone and add artifacts to collection. */
81 protected LoadArtifactServiceAsync loadArtifactService =
82 GWT.create(LoadArtifactService.class);
73 83
74 protected MapToolbar controlPanel; 84 protected MapToolbar controlPanel;
75 protected ThemePanel themePanel; 85 protected ThemePanel themePanel;
76 protected Widget mapPanel; 86 protected Widget mapPanel;
77 87
243 253
244 254
245 @Override 255 @Override
246 public void load(List<WMSLayer> toLoad) { 256 public void load(List<WMSLayer> toLoad) {
247 GWT.log("The user wants to add " + toLoad.size() + " new WMS layers."); 257 GWT.log("The user wants to add " + toLoad.size() + " new WMS layers.");
248 // TODO 258
259 int len = toLoad.size();
260
261 Recommendation[] recom = new Recommendation[len];
262
263 for (int i = 0; i < len; i++) {
264 WMSLayer w = toLoad.get(i);
265
266 String ids = w.getServer() + ";" + w.getName() + ";" + w.getTitle();
267 recom[i] = new Recommendation(EXTERNAL_WMS_FACTORY, ids);
268 }
269
270 Collection c = getCollection();
271
272 Config config = Config.getInstance();
273 String locale = config.getLocale();
274
275 loadArtifactService.loadMany(c, recom, EXTERNAL_WMS_FACTORY, locale,
276 new AsyncCallback<Artifact[]>() {
277
278 @Override
279 public void onFailure(Throwable throwable) {
280 SC.warn(throwable.getMessage());
281 }
282
283 @Override
284 public void onSuccess(Artifact[] newArtifacts) {
285 SC.warn("SUCCESS!");
286 }
287 }
288 );
249 } 289 }
250 290
251 291
252 protected void setFloodmap(FloodMap floodMap) { 292 protected void setFloodmap(FloodMap floodMap) {
253 this.floodMap = floodMap; 293 this.floodMap = floodMap;

http://dive4elements.wald.intevation.org