Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java @ 4215:c179cd02177d
Logout the current user
Add code to the logout button to remove the current user from the session and to
redirect the browser window to the login page.
Part of flys/issue916 (Logout: "Abmelden" Knopf mit Funktion belegen)
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 23 Oct 2012 09:59:16 +0200 |
parents | 11c589d68f13 |
children | c0a275c581fb |
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 |
4128
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
4 |
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
|
5 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
|
6 |
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
|
7 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
|
8 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
|
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 |
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 /** |
3549
6a8f83c538e3
Merged revisions 5384 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3522
diff
changeset
|
12 * "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
|
13 * @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
|
14 */ |
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
|
15 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
|
16 |
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
|
17 /** 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
|
18 * 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
|
19 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
|
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 /** 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
|
22 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
|
23 |
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
|
24 |
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 /** 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
|
26 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
|
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 |
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 * 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
|
31 * 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
|
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 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
|
34 views = new HashMap<String, CollectionView>(); |
3522
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
35 |
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
36 setWidth("100%"); |
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
37 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
|
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 |
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 /** |
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 * 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
|
43 * 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
|
44 * |
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
|
45 * @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
|
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 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
|
48 collectionView.moveTo(0, 0); |
6eeacd0bbe26
New projects are now maximized by default.
Christian Lins <christian.lins@intevation.de>
parents:
896
diff
changeset
|
49 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
|
50 |
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
|
51 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
|
52 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
|
53 } |
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
|
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 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
|
57 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
|
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 |
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 |
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 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
|
62 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
|
63 |
4128
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
64 if (view != null) { |
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
65 view.show(); |
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
66 view.restore(); |
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
67 } |
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
68 else { |
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
69 GWT.log("FLYSWorkspace.bringUp() failed!"); |
11c589d68f13
Fix for NPE in FLYSWorkspace.bringUp() #933
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
70 } |
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
|
71 } |
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
|
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 |
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 /** |
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 * 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
|
76 * 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
|
77 * |
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 * @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
|
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 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
|
81 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
|
82 |
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
|
83 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
|
84 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
|
85 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
|
86 } |
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
|
87 } |
895
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
88 |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
89 |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
90 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
|
91 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
|
92 view.setTitle(title); |
9acbd3f98262
Update the collection view title when the project name changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
600
diff
changeset
|
93 } |
896
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
94 |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
95 |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
96 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
|
97 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
|
98 return true; |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
99 } |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
100 return false; |
fe23bbf0ea11
Fixed a problem with renaming collection view title and duplicating projects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
895
diff
changeset
|
101 } |
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
|
102 } |
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
|
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |