Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java @ 3865:436eec3be6ff
Allow to create a discharge curve from a gauge info
This is only a draft yet.
flys-client/trunk@5639 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 08:57:48 +0000 |
parents | 8e69aca69074 |
children | 6cc5186b9b48 |
comparison
equal
deleted
inserted
replaced
3864:c434dd2e84cf | 3865:436eec3be6ff |
---|---|
15 | 15 |
16 import de.intevation.flys.client.client.event.CollectionChangeEvent; | 16 import de.intevation.flys.client.client.event.CollectionChangeEvent; |
17 import de.intevation.flys.client.client.event.CollectionChangeHandler; | 17 import de.intevation.flys.client.client.event.CollectionChangeHandler; |
18 import de.intevation.flys.client.client.services.ArtifactService; | 18 import de.intevation.flys.client.client.services.ArtifactService; |
19 import de.intevation.flys.client.client.services.ArtifactServiceAsync; | 19 import de.intevation.flys.client.client.services.ArtifactServiceAsync; |
20 import de.intevation.flys.client.client.services.CreateCollectionService; | |
21 import de.intevation.flys.client.client.services.CreateCollectionServiceAsync; | |
20 import de.intevation.flys.client.client.services.DescribeCollectionService; | 22 import de.intevation.flys.client.client.services.DescribeCollectionService; |
21 import de.intevation.flys.client.client.services.DescribeCollectionServiceAsync; | 23 import de.intevation.flys.client.client.services.DescribeCollectionServiceAsync; |
22 import de.intevation.flys.client.client.services.GetArtifactService; | 24 import de.intevation.flys.client.client.services.GetArtifactService; |
23 import de.intevation.flys.client.client.services.GetArtifactServiceAsync; | 25 import de.intevation.flys.client.client.services.GetArtifactServiceAsync; |
24 import de.intevation.flys.client.client.services.RiverService; | 26 import de.intevation.flys.client.client.services.RiverService; |
70 | 72 |
71 /** The GetArtifactService used to open an existing collection. */ | 73 /** The GetArtifactService used to open an existing collection. */ |
72 protected GetArtifactServiceAsync getArtifactService = | 74 protected GetArtifactServiceAsync getArtifactService = |
73 GWT.create(GetArtifactService.class); | 75 GWT.create(GetArtifactService.class); |
74 | 76 |
77 /** The CreateCollectionServiceAsync used to create a new collection */ | |
78 protected CreateCollectionServiceAsync collectionService = | |
79 GWT.create(CreateCollectionService.class); | |
75 | 80 |
76 /** The menu bar at the top of the application. */ | 81 /** The menu bar at the top of the application. */ |
77 protected MainMenu menu; | 82 protected MainMenu menu; |
78 | 83 |
79 /** The content window. It takes the whole space beneath the menu bar. */ | 84 /** The content window. It takes the whole space beneath the menu bar. */ |
438 GWT.log("Successfully created a new artifact."); | 443 GWT.log("Successfully created a new artifact."); |
439 } | 444 } |
440 }); | 445 }); |
441 } | 446 } |
442 | 447 |
448 public void newGaugeDischargeCurve(String river, Long gaugeref) { | |
449 Config config = Config.getInstance(); | |
450 | |
451 final String locale = config.getLocale(); | |
452 final String riv = river; | |
453 final Long ref = gaugeref; | |
454 final FLYS flys = this; | |
455 | |
456 User user = getCurrentUser(); | |
457 | |
458 if (user == null) { | |
459 SC.warn(MSG.error_not_logged_in()); | |
460 return; | |
461 } | |
462 | |
463 collectionService.create(locale, user.identifier(), | |
464 new AsyncCallback<Collection>() { | |
465 @Override | |
466 public void onFailure(Throwable caught) { | |
467 GWT.log("Could not create new collection."); | |
468 SC.warn(MSG.getString(caught.getMessage())); | |
469 } | |
470 | |
471 @Override | |
472 public void onSuccess(Collection collection) { | |
473 GWT.log("Successfully created a new collection."); | |
474 final Collection col = collection; | |
475 artifactService.createGaugeDischargeCurverArtifact( | |
476 col, locale, riv, ref, | |
477 new AsyncCallback<Artifact>() { | |
478 @Override | |
479 public void onFailure(Throwable caught) { | |
480 GWT.log("Could not create the new artifact."); | |
481 SC.warn(MSG.getString(caught.getMessage())); | |
482 } | |
483 | |
484 @Override | |
485 public void onSuccess(Artifact artifact) { | |
486 GWT.log("Successfully created a new artifact."); | |
487 CollectionView view = new CollectionView(flys, | |
488 col, artifact); | |
489 workspace.addView("new-project", view); | |
490 | |
491 view.addCollectionChangeHandler(getProjectList()); | |
492 } | |
493 }); | |
494 } | |
495 }); | |
496 } | |
443 | 497 |
444 @Override | 498 @Override |
445 public void onCollectionChange(CollectionChangeEvent event) { | 499 public void onCollectionChange(CollectionChangeEvent event) { |
446 Collection oldC = event.getOldValue(); | 500 Collection oldC = event.getOldValue(); |
447 | 501 |