comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1472:a2b0b2af529f

Tell master-artifact of collection when cross-section-master changed kilometer. flys-client/trunk@3517 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 22 Dec 2011 07:17:52 +0000
parents eef55d18f424
children fb2fefe0325f
comparison
equal deleted inserted replaced
1471:e125f889cf2f 1472:a2b0b2af529f
41 41
42 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync; 42 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync;
43 import de.intevation.flys.client.client.services.FeedServiceAsync; 43 import de.intevation.flys.client.client.services.FeedServiceAsync;
44 import de.intevation.flys.client.client.services.LoadArtifactService; 44 import de.intevation.flys.client.client.services.LoadArtifactService;
45 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; 45 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
46
47 import de.intevation.flys.client.client.ui.CollectionView;
46 48
47 49
48 50
49 /** 51 /**
50 * ThemePanel much like ChartThemePanel, but shows an "Actions" column, 52 * ThemePanel much like ChartThemePanel, but shows an "Actions" column,
124 if (firstCSUuid == null) { 126 if (firstCSUuid == null) {
125 firstCSUuid = theme.getArtifact(); 127 firstCSUuid = theme.getArtifact();
126 } 128 }
127 if (!value.equals("0")) { 129 if (!value.equals("0")) {
128 setCurrentCSMaster(theme.getArtifact()); 130 setCurrentCSMaster(theme.getArtifact());
129 GWT.log("found a master: " + currentCSMasterUUID + "/" + theme.getDescription()); 131 GWT.log("found a master: " + currentCSMasterUUID
132 + "/" + theme.getDescription());
130 return theme.getDescription(); 133 return theme.getDescription();
131 } 134 }
132 } 135 }
133 } 136 }
134 // There is none selected. Take the first one. 137 // There is none selected. Take the first one.
247 } 250 }
248 return bestMatch; 251 return bestMatch;
249 } 252 }
250 253
251 254
252 /** Feed the master (WINFO) artifact with the km of the crosssection,
253 * such that it can be displayed in the diagrams subtitle. */
254 public void sendFeed(double kmD) {
255 ;
256 }
257
258 /** Feed a single artifact with the km of the crosssection to display. */ 255 /** Feed a single artifact with the km of the crosssection to display. */
259 public void sendFeed(FacetRecord facetRecord, double kmD) { 256 public void sendFeed(final String artUUID, final double kmD) {
260 Config config = Config.getInstance(); 257 Config config = Config.getInstance();
261 final String locale = config.getLocale(); 258 final String locale = config.getLocale();
262 259
263 Data[] feedData = 260 Data[] feedData =
264 DefaultData.createSimpleStringDataArray("cross_section.km", 261 DefaultData.createSimpleStringDataArray("cross_section.km",
265 Double.valueOf(kmD).toString()); 262 Double.valueOf(kmD).toString());
266 263
267 disable(); 264 disable();
268 feedService.feed( 265 feedService.feed(
269 locale, 266 locale,
270 new DefaultArtifact( 267 new DefaultArtifact(
271 facetRecord.getTheme().getArtifact(), 268 artUUID,
272 "TODO:hash"), 269 "TODO:hash"),
273 feedData, 270 feedData,
274 new AsyncCallback<Artifact>() { 271 new AsyncCallback<Artifact>() {
275 @Override 272 @Override
276 public void onFailure(Throwable caught) { 273 public void onFailure(Throwable caught) {
278 SC.warn(MSG.getString(caught.getMessage())); 275 SC.warn(MSG.getString(caught.getMessage()));
279 enable(); 276 enable();
280 } 277 }
281 @Override 278 @Override
282 public void onSuccess(Artifact artifact) { 279 public void onSuccess(Artifact artifact) {
283 GWT.log("Successfully fed"); 280 GWT.log("Successfully fed with km");
284 requestRedraw(); 281 requestRedraw();
285 // TODO also feed the winfo/masterartifact? (for plot subtitle) 282 // Also feed the winfo/masterartifact (for plot subtitle)
286 enable(); 283 if (artUUID.equals(getCurrentCSMaster())
284 && !artUUID.equals(view.getArtifact().getUuid())) {
285 sendFeed(view.getArtifact().getUuid(), kmD);
286 }
287 else {
288 enable();
289 }
287 } 290 }
288 }); 291 });
289 } 292 }
290 293
291 294
351 selected_km); 354 selected_km);
352 GWT.log("Got single km for " + dbid + ", it is " 355 GWT.log("Got single km for " + dbid + ", it is "
353 + closest); 356 + closest);
354 SpinnerItem item = (SpinnerItem) ce.getItem(); 357 SpinnerItem item = (SpinnerItem) ce.getItem();
355 item.setValue(closest); 358 item.setValue(closest);
356 sendFeed(facetRecord, closest); 359 sendFeed(facetRecord.getTheme().getArtifact(),
360 closest);
357 } 361 }
358 }); 362 });
359 } 363 }
360 }; 364 };
361 return handler; 365 return handler;

http://dive4elements.wald.intevation.org