changeset 600:347cf4a5a486

Open projects are removed from screen if the user deletes them (via project list). flys-client/trunk@2205 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 22 Jun 2011 13:39:15 +0000
parents 1dbffe4c6d12
children 3cf6ee30207c
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java
diffstat 4 files changed, 40 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Jun 22 12:50:20 2011 +0000
+++ b/flys-client/ChangeLog	Wed Jun 22 13:39:15 2011 +0000
@@ -1,3 +1,15 @@
+2011-06-22  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ProjectList.java:
+	  If an open project is removed (via context menu) the related
+	  CollectionView is removed from screen.
+
+	* src/main/java/de/intevation/flys/client/client/FLYS.java: Added a method
+	  that returns the current FLYSWorkspace.
+
+	* src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java:
+	  Added a method that destroys a CollectionView if it is open.
+
 2011-06-22  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/DoCollectionAction.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Wed Jun 22 12:50:20 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Wed Jun 22 13:39:15 2011 +0000
@@ -190,6 +190,16 @@
 
 
     /**
+     * Returns the projects workspace that contains all project windows.
+     *
+     * @return the FLYSWorkspace.
+     */
+    public FLYSWorkspace getWorkspace() {
+        return workspace;
+    }
+
+
+    /**
      * Returns a list of rivers supported by the artifact server.
      *
      * @return a list of rivers supported by the artifact server.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java	Wed Jun 22 12:50:20 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java	Wed Jun 22 13:39:15 2011 +0000
@@ -60,5 +60,21 @@
         view.show();
         view.restore();
     }
+
+
+    /**
+     * Removes a project from workspace (view) and clears its reference from
+     * hash map.
+     *
+     * @param uuid The project's uuid.
+     */
+    public void destroyProject(String uuid) {
+        CollectionView project = views.get(uuid);
+
+        if (project != null) {
+            removeProject(uuid);
+            project.destroy();
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Wed Jun 22 12:50:20 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Wed Jun 22 13:39:15 2011 +0000
@@ -381,7 +381,7 @@
      *
      * @param c The Collection that should be deleted.
      */
-    protected void deleteCollection(Collection c) {
+    protected void deleteCollection(final Collection c) {
         if (c == null) {
             return;
         }
@@ -402,6 +402,7 @@
             }
 
             public void onSuccess(Void v) {
+                flys.getWorkspace().destroyProject(c.identifier());
                 updateUserCollections();
             }
         });

http://dive4elements.wald.intevation.org