# HG changeset patch # User Ingo Weinzierl # Date 1316102130 0 # Node ID a680ccec5dd6da5c4131e8f8e34e4048407e4ca9 # Parent 24d15c2e0da31b7a8a3c6e071300deab8c140c13 Create new collections initially when starting a new project. flys-client/trunk@2765 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 24d15c2e0da3 -r a680ccec5dd6 flys-client/ChangeLog --- a/flys-client/ChangeLog Thu Sep 15 15:28:31 2011 +0000 +++ b/flys-client/ChangeLog Thu Sep 15 15:55:30 2011 +0000 @@ -1,3 +1,15 @@ +2011-09-15 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/client/ui/CollectionView.java: + Create a new collection if no Collection is given while initializing a + CollectionView. This is necessary, because a Collection is required in + states that try to add cloned Artifacts (as it is the case in + WspDatacagePanel). + + !! NOTE: This changes the behaviour - before, Collections have been + created when a Collection has Outputs. Now, a Collection is initially + created when the user starts a new project. !! + 2011-09-15 Raimund Renkert Issue199 diff -r 24d15c2e0da3 -r a680ccec5dd6 flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Thu Sep 15 15:28:31 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Thu Sep 15 15:55:30 2011 +0000 @@ -118,6 +118,10 @@ * @param collection The collection to be displayed. */ public CollectionView(FLYS flys) { + // do this first because it takes longer than the other stuff in here. + User user = flys.getCurrentUser(); + createNewCollection(user.identifier()); + this.flys = flys; this.tabs = new TabSet(); this.outputTabs = new HashMap(); @@ -221,19 +225,7 @@ public void onSuccess(Collection collection) { GWT.log("Successfully created a new collection."); - setCollection(collection); - - Artifact artifact = getArtifact(); - addArtifactToCollection(artifact); - // Load recommendations, if any. - ArtifactDescription desc = - artifact.getArtifactDescription(); - Recommendation[] recom = desc.getRecommendations(); - - if (recom != null && collection != null) { - loadRecommendedArtifacts(recom); - } } }); } @@ -359,11 +351,7 @@ loadRecommendedArtifacts(recom); } - if (outs != null && c == null) { - User user = getFlys().getCurrentUser(); - createNewCollection(user.identifier()); - } - else if (c != null) { + if (c != null) { Config config = Config.getInstance(); String url = config.getServerUrl(); String locale = config.getLocale(); @@ -399,12 +387,17 @@ } + protected void setCollection(Collection collection) { + setCollection(collection, false); + } + + /** * Set the current collection. * * @param collection The new collection. */ - protected void setCollection(Collection collection) { + protected void setCollection(Collection collection, boolean suppress) { if (collection != null && this.collection == null) { flys.getWorkspace().addView(collection.identifier(), this); } @@ -413,7 +406,10 @@ this.collection = collection; setTitle(collection.getName() + " (UUID: " + collection.identifier() + ")"); - fireCollectionChangeEvent(tmp, this.collection); + + if (!suppress) { + fireCollectionChangeEvent(tmp, this.collection); + } } @@ -555,7 +551,7 @@ } - protected void addArtifactToCollection(final Artifact artifact) { + public void addArtifactToCollection(final Artifact artifact) { Config config = Config.getInstance(); final String url = config.getServerUrl(); final String locale = config.getLocale();