Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java @ 3835:11d74b9d428a
i18n (#872)
flys-client/trunk@5541 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Thu, 20 Sep 2012 14:17:21 +0000 |
parents | b63e6fdd8cd0 |
children | 11c589d68f13 |
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 /** |
3693
b63e6fdd8cd0
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3522
diff
changeset
|
10 * "Workspace" canvas showing the CollectionViews (subwindows). |
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
|
11 * @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
|
12 */ |
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 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
|
14 |
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
|
15 /** 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
|
16 * 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
|
17 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
|
18 |
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 /** 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
|
20 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
|
21 |
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
|
22 |
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
|
23 /** 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
|
24 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
|
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 /** |
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 * 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
|
29 * 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
|
30 */ |
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
|
31 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
|
32 views = new HashMap<String, CollectionView>(); |
3522
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
33 |
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
34 setWidth("100%"); |
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
35 setHeight("100%"); |
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
|
36 } |
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 |
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 /** |
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 * 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
|
41 * 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
|
42 * |
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
|
43 * @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
|
44 */ |
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
|
45 public void addView(String uuid, CollectionView collectionView) { |
3522
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
46 collectionView.moveTo(0, 0); |
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
47 collectionView.setMaximized(true); |
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
|
48 |
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
|
49 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
|
50 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
|
51 } |
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
|
52 |
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 |
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 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
|
55 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
|
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 |
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 |
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 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
|
60 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
|
61 |
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
|
62 view.show(); |
591
62b65b7b5c7c
Restore the size of project windows if they are brought up to front.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
557
diff
changeset
|
63 view.restore(); |
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
|
64 } |
600
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
65 |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
66 |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
67 /** |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
68 * Removes a project from workspace (view) and clears its reference from |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
69 * hash map. |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
70 * |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
71 * @param uuid The project's uuid. |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
72 */ |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
73 public void destroyProject(String uuid) { |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
74 CollectionView project = views.get(uuid); |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
75 |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
76 if (project != null) { |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
77 removeProject(uuid); |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
78 project.destroy(); |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
79 } |
347cf4a5a486
Open projects are removed from screen if the user deletes them (via project list).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
591
diff
changeset
|
80 } |
895
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
81 |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
82 |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
83 public void updateTitle(String uuid, String title) { |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
84 CollectionView view = views.get(uuid); |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
85 view.setTitle(title); |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
86 } |
896
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
87 |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
88 |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
89 public boolean hasView(String uuid) { |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
90 if(views.get(uuid) != null) { |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
91 return true; |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
92 } |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
93 return false; |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
94 } |
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
|
95 } |
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
|
96 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |