comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java @ 557:92c200887b20

#21 There might be just a single window for each project now. Users can't open a project twice. flys-client/trunk@2083 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 08 Jun 2011 13:21:46 +0000
parents e763d8efd42f
children 62b65b7b5c7c
comparison
equal deleted inserted replaced
556:046f43e1d305 557:92c200887b20
1 package de.intevation.flys.client.client.ui; 1 package de.intevation.flys.client.client.ui;
2 2
3 import com.smartgwt.client.widgets.Canvas; 3 import com.smartgwt.client.widgets.Canvas;
4 4
5 import java.util.ArrayList; 5 import java.util.HashMap;
6 import java.util.List; 6 import java.util.Map;
7 7
8 8
9 /** 9 /**
10 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 10 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
11 */ 11 */
18 /** The number of pixels used to move windows.*/ 18 /** The number of pixels used to move windows.*/
19 public static int WINDOW_OFFSET = 20; 19 public static int WINDOW_OFFSET = 20;
20 20
21 21
22 /** A map that contains the open CollectionViews. */ 22 /** A map that contains the open CollectionViews. */
23 protected List<CollectionView> views; 23 protected Map<String, CollectionView> views;
24 24
25 25
26 /** 26 /**
27 * The default constructor creates an empty FLYSWorkspace with no 27 * The default constructor creates an empty FLYSWorkspace with no
28 * CollectionViews opened. 28 * CollectionViews opened.
29 */ 29 */
30 public FLYSWorkspace() { 30 public FLYSWorkspace() {
31 views = new ArrayList<CollectionView>(); 31 views = new HashMap<String, CollectionView>();
32 } 32 }
33 33
34 34
35 /** 35 /**
36 * This method adds a new CollectionView to this workspace and stores a 36 * This method adds a new CollectionView to this workspace and stores a
37 * reference in {@link views}. 37 * reference in {@link views}.
38 * 38 *
39 * @param collectionView A new CollectionView. 39 * @param collectionView A new CollectionView.
40 */ 40 */
41 public void addView(CollectionView collectionView) { 41 public void addView(String uuid, CollectionView collectionView) {
42 int num = views != null ? views.size() : 0; 42 int num = views != null ? views.size() : 0;
43 int factor = num % MAX_WINDOWS; 43 int factor = num % MAX_WINDOWS;
44 44
45 collectionView.moveTo(factor * WINDOW_OFFSET, factor * WINDOW_OFFSET); 45 collectionView.moveTo(factor * WINDOW_OFFSET, factor * WINDOW_OFFSET);
46 46
47 views.add(collectionView); 47 views.put(uuid, collectionView);
48 addChild(collectionView); 48 addChild(collectionView);
49 }
50
51
52 public void removeProject(String uuid) {
53 views.remove(uuid);
54 }
55
56
57 public void bringUp(String uuid) {
58 CollectionView view = views.get(uuid);
59
60 view.show();
49 } 61 }
50 } 62 }
51 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org