changeset 279:e763d8efd42f

ISSUE-34 Limit the windows which are moved to the right lower corner to 10. flys-client/trunk@1906 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 12 May 2011 07:08:27 +0000
parents f33af25b7490
children b493d606fdef
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java
diffstat 2 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed May 11 16:38:54 2011 +0000
+++ b/flys-client/ChangeLog	Thu May 12 07:08:27 2011 +0000
@@ -1,3 +1,13 @@
+2011-05-12  Ingo Weinzierl <ingo@intevation.de>
+
+	  ISSUE-34
+
+	* src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java:
+	  The number of windows which are moved the right lower browser window
+	  corner is limited to 10 windows now. The 11th window is placed at the
+	  left upper corner again. Window 12-20 are moved with an offset into to
+	  the right lower corner again.
+
 2011-05-11	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/model/DataCageNode.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java	Wed May 11 16:38:54 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java	Thu May 12 07:08:27 2011 +0000
@@ -11,6 +11,14 @@
  */
 public class FLYSWorkspace extends Canvas {
 
+    /** The maximal number of windows that fit into the browser view when an
+     * offset is used to move windows initially.*/
+    public static int MAX_WINDOWS = 10;
+
+    /** The number of pixels used to move windows.*/
+    public static int WINDOW_OFFSET = 20;
+
+
     /** A map that contains the open CollectionViews. */
     protected List<CollectionView> views;
 
@@ -31,11 +39,11 @@
      * @param collectionView A new CollectionView.
      */
     public void addView(CollectionView collectionView) {
-        if (views.size() > 0) {
-          collectionView.moveTo(
-              views.size() * 20,
-              views.size() * 20);
-        }
+        int num    = views != null ? views.size() : 0;
+        int factor = num % MAX_WINDOWS;
+
+        collectionView.moveTo(factor * WINDOW_OFFSET, factor * WINDOW_OFFSET);
+
         views.add(collectionView);
         addChild(collectionView);
     }

http://dive4elements.wald.intevation.org