changeset 1294:94d4f040da3a

Bugfix: #326 Made the process of opening existing project more robust if the collection has no artifact set. flys-client/trunk@2909 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 10 Oct 2011 06:38:35 +0000
parents e88cd17b3420
children d9cb362b8b34
files flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java
diffstat 2 files changed, 33 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Fri Oct 07 13:39:35 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Mon Oct 10 06:38:35 2011 +0000
@@ -346,6 +346,22 @@
 
                 public void onSuccess(Collection c) {
                     final Collection collection = c;
+
+                    if (collection.getItemLength() == 0) {
+                        CollectionView view = new CollectionView(
+                            FLYS.this, collection, null);
+
+                        view.addCollectionChangeHandler(
+                            getProjectList());
+                        view.addCloseClickHandler(
+                            new CloseCollectionViewHandler(
+                                FLYS.this, collectionID));
+
+                        workspace.addView(collectionID, view);
+
+                        return;
+                    }
+
                     final CollectionItem   item = c.getItem(0);
 
                     if (item == null) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Fri Oct 07 13:39:35 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Mon Oct 10 06:38:35 2011 +0000
@@ -156,11 +156,19 @@
         this.handlers      = new ArrayList<CollectionChangeHandler>();
         this.outHandlers   = new ArrayList<OutputModesChangeHandler>();
         this.layout        = new VLayout();
-        this.parameterList = new ParameterList(
-            flys,
-            this,
-            messages.getString(artifact.getName()),
-            artifact);
+
+        if (artifact != null) {
+            this.parameterList = new ParameterList(
+                flys,
+                this,
+                messages.getString(artifact.getName()),
+                artifact);
+        }
+        else {
+            this.parameterList = new ParameterList(
+                flys, this, messages.new_project());
+        }
+
         this.artifactsQueue     = 0;
         this.newRecommendations = new Stack<Recommendation>();
 
@@ -176,7 +184,10 @@
         init();
 
         setCollection(collection);
-        setArtifact(artifact);
+
+        if (artifact != null) {
+            setArtifact(artifact);
+        }
     }
 
 

http://dive4elements.wald.intevation.org