diff flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java @ 841:e699adf3b092

Fix loading of recommendations when collection is not yet in place. flys-client/trunk@2561 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 24 Aug 2011 13:21:15 +0000
parents 1b9b7e9ab219
children 78ef14dc1877
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Wed Aug 24 13:17:22 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Wed Aug 24 13:21:15 2011 +0000
@@ -226,6 +226,14 @@
 
                     Artifact artifact = getArtifact();
                     addArtifactToCollection(artifact);
+                    // Load recommendations, if any.
+                    ArtifactDescription desc = 
+                         artifact.getArtifactDescription();
+                    Recommendation[] recom = desc.getRecommendations();
+
+                    if (recom != null && collection != null) {
+                        loadRecommendedArtifacts(recom);
+                    }
                 }
             });
     }
@@ -335,14 +343,14 @@
         OutputMode[] outs        = desc.getOutputModes();
         Recommendation[] recom   = desc.getRecommendations();
 
-        if (recom != null) {
-            loadRecommendedArtifacts(recom);
-        }
-
         setArtifact(art);
 
         Collection c = getCollection();
 
+        if (recom != null && collection != null) {
+            loadRecommendedArtifacts(recom);
+        }
+
         if (outs != null && c == null) {
             User user = getFlys().getCurrentUser();
             createNewCollection(user.identifier());
@@ -612,7 +620,6 @@
             return;
         }
 
-
         for (final Recommendation recommendation: recommendations) {
             if (collection.loadedRecommendation(recommendation)) {
                 continue;

http://dive4elements.wald.intevation.org