comparison flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java @ 5503:b660090b417d

Create a new sq relation project on measurement station record click. * Added new methods to artifact service. * Added new client-side artifact. * Updated UI to have a new row in 'Messstellen-Info'.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 28 Mar 2013 15:21:15 +0100
parents ef289466917a
children
comparison
equal deleted inserted replaced
5502:566eea137330 5503:b660090b417d
512 }); 512 });
513 } 513 }
514 }); 514 });
515 } 515 }
516 516
517 public void newSQRelation(String river, int measurementStation) {
518 Config config = Config.getInstance();
519
520 final String locale = config.getLocale();
521 final String riv = river;
522 final int mStation = measurementStation;
523 final FLYS flys = this;
524
525 User user = getCurrentUser();
526
527 if (user == null) {
528 SC.warn(MSG.error_not_logged_in());
529 return;
530 }
531
532 collectionService.create(locale, user.identifier(),
533 new AsyncCallback<Collection>() {
534 @Override
535 public void onFailure(Throwable caught) {
536 GWT.log("Could not create new collection.");
537 SC.warn(getExceptionString(MSG, caught));
538 }
539
540 @Override
541 public void onSuccess(Collection collection) {
542 GWT.log("Successfully created a new collection.");
543 final Collection col = collection;
544 artifactService.createSQRelationArtifact(
545 col, locale, riv, mStation,
546 new AsyncCallback<Artifact>() {
547 @Override
548 public void onFailure(Throwable caught) {
549 GWT.log("Could not create the new artifact.");
550 SC.warn(getExceptionString(MSG, caught));
551 }
552
553 @Override
554 public void onSuccess(Artifact artifact) {
555 GWT.log("Successfully created a new artifact.");
556 CollectionView view = new CollectionView(flys,
557 col, artifact);
558 workspace.addView(col.identifier(), view);
559
560 view.addCollectionChangeHandler(getProjectList());
561 view.addCloseClickHandler(
562 new CloseCollectionViewHandler(
563 FLYS.this, col.identifier()));
564 projectList.updateUserCollections();
565 }
566 });
567 }
568 });
569 }
570
517 @Override 571 @Override
518 public void onCollectionChange(CollectionChangeEvent event) { 572 public void onCollectionChange(CollectionChangeEvent event) {
519 Collection oldC = event.getOldValue(); 573 Collection oldC = event.getOldValue();
520 574
521 if (oldC == null) { 575 if (oldC == null) {

http://dive4elements.wald.intevation.org