Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java @ 577:ded285064e43
#118 Added a further radio button to select 'Q at Gauge' to the WQ panel.
flys-client/trunk@2145 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 17 Jun 2011 11:14:02 +0000 |
parents | 92c200887b20 |
children | 62b65b7b5c7c |
rev | line source |
---|---|
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import com.smartgwt.client.widgets.Canvas; |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
557
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
5 import java.util.HashMap; |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
6 import java.util.Map; |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 /** |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 */ |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 public class FLYSWorkspace extends Canvas { |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
279
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
14 /** The maximal number of windows that fit into the browser view when an |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
15 * offset is used to move windows initially.*/ |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
16 public static int MAX_WINDOWS = 10; |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
17 |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
18 /** The number of pixels used to move windows.*/ |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
19 public static int WINDOW_OFFSET = 20; |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
20 |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
21 |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 /** A map that contains the open CollectionViews. */ |
557
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
23 protected Map<String, CollectionView> views; |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 /** |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 * The default constructor creates an empty FLYSWorkspace with no |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * CollectionViews opened. |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 */ |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 public FLYSWorkspace() { |
557
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
31 views = new HashMap<String, CollectionView>(); |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 } |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 /** |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * This method adds a new CollectionView to this workspace and stores a |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 * reference in {@link views}. |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 * |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 * @param collectionView A new CollectionView. |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 */ |
557
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
41 public void addView(String uuid, CollectionView collectionView) { |
279
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
42 int num = views != null ? views.size() : 0; |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
43 int factor = num % MAX_WINDOWS; |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
44 |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
45 collectionView.moveTo(factor * WINDOW_OFFSET, factor * WINDOW_OFFSET); |
e763d8efd42f
ISSUE-34 Limit the windows which are moved to the right lower corner to 10.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
273
diff
changeset
|
46 |
557
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
47 views.put(uuid, collectionView); |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 addChild(collectionView); |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 } |
557
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
50 |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
51 |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
52 public void removeProject(String uuid) { |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
53 views.remove(uuid); |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
54 } |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
55 |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
56 |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
57 public void bringUp(String uuid) { |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
58 CollectionView view = views.get(uuid); |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
59 |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
60 view.show(); |
92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
279
diff
changeset
|
61 } |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |