Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java @ 4216:a04862abce42
Don't redirect to the login page without query params
Don't redirect to the login page without query params for the development mode.
Therefore just reload the page after the user object is removed from the session
and GGInAFilter will redirect to the correct long URL.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 23 Oct 2012 10:50:48 +0200 |
parents | c179cd02177d |
children | 9d7497f5be05 |
rev | line source |
---|---|
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
4 import com.google.gwt.i18n.client.LocaleInfo; |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
5 import com.google.gwt.user.client.Window; |
4215
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
6 import com.google.gwt.user.client.rpc.AsyncCallback; |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
7 import com.smartgwt.client.types.Alignment; |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
8 import com.smartgwt.client.util.BooleanCallback; |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
9 import com.smartgwt.client.util.SC; |
532
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
10 import com.smartgwt.client.widgets.Button; |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import com.smartgwt.client.widgets.Label; |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
12 import com.smartgwt.client.widgets.events.ClickEvent; |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
13 import com.smartgwt.client.widgets.events.ClickHandler; |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.layout.HLayout; |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
16 import de.intevation.flys.client.client.FLYS; |
211
b92281182c6b
Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
210
diff
changeset
|
17 import de.intevation.flys.client.client.FLYSConstants; |
4215
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
18 import de.intevation.flys.client.client.services.UserService; |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
19 import de.intevation.flys.client.client.services.UserServiceAsync; |
25
2da6be38d8b6
Added a User interface and a default implementation to handle users in this client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
6
diff
changeset
|
20 import de.intevation.flys.client.shared.model.User; |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 /** |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 */ |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 public class MainMenu extends HLayout { |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 /** The interface that provides i18n messages. */ |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
532
diff
changeset
|
29 private final FLYSConstants messages = GWT.create(FLYSConstants.class); |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
31 /** An instance to FLYS.*/ |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
32 protected FLYS flys; |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
33 |
2
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
34 /** The user that is currently logged in. */ |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
35 protected User currentUser; |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
36 |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
37 /** The label that displays the current logged in user. */ |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
38 protected Label userText; |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
39 |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
40 /** The button to log the current user out.*/ |
532
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
41 protected Button logout; |
2
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
42 |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
43 /** The button to add new projects.*/ |
532
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
44 protected Button newProject; |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
45 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
46 /** The button to open the project list.*/ |
532
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
47 protected Button projectList; |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
48 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
49 /** The button to switch between the english and german version.*/ |
532
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
50 protected Button language; |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
51 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
52 /** The button to open an info panel.*/ |
532
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
53 protected Button info; |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
54 |
4215
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
55 protected UserServiceAsync userService = |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
56 GWT.create(UserService.class); |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
57 |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 /** |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 * The default constructor for creating a new MainMenu. |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 */ |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
61 public MainMenu(FLYS flys) { |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
62 this.flys = flys; |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
63 |
102
33e24b33fc38
Improved the way how to i18n strings in our application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
64 String guest = messages.user() + " " + messages.guest(); |
33e24b33fc38
Improved the way how to i18n strings in our application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
65 |
33e24b33fc38
Improved the way how to i18n strings in our application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
66 userText = new Label(guest); |
532
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
67 newProject = new Button(messages.new_project()); |
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
68 projectList = new Button(messages.manage_projects()); |
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
69 logout = new Button(messages.logout()); |
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
70 language = new Button(messages.switch_language()); |
0ba7c43e7b62
Replaced buttons displayed as labels with real buttons.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
212
diff
changeset
|
71 info = new Button(messages.info()); |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
72 |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
73 newProject.addClickHandler(new ClickHandler() { |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
532
diff
changeset
|
74 @Override |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
75 public void onClick(ClickEvent event) { |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
76 GWT.log("Clicked 'New Project' button."); |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
77 createNewProject(); |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
78 } |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
79 }); |
2
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
80 |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
81 projectList.addClickHandler(new ClickHandler() { |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
532
diff
changeset
|
82 @Override |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
83 public void onClick(ClickEvent event) { |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
84 GWT.log("Clicked 'Open ProjectList' button."); |
88
4d7c6a63602b
Fixed toggle method.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
82
diff
changeset
|
85 ProjectList list = getFlys().getProjectList(); |
94
eb54fb9f5f2c
Fixed some issues.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
88
diff
changeset
|
86 if (list.isVisible()) |
88
4d7c6a63602b
Fixed toggle method.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
82
diff
changeset
|
87 list.hide(); |
82
4c5fa2b0086a
The project list button toggles the project list now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
66
diff
changeset
|
88 else |
88
4d7c6a63602b
Fixed toggle method.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
82
diff
changeset
|
89 list.show(); |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
90 } |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
91 }); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
92 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
93 logout.addClickHandler(new ClickHandler() { |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
532
diff
changeset
|
94 @Override |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
95 public void onClick(ClickEvent event) { |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
96 GWT.log("Clicked 'logout' button."); |
4215
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
97 userService.logoutCurrentUser(new AsyncCallback<Void>() { |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
98 public void onFailure(Throwable caught) { |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
99 } |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
100 |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
101 public void onSuccess(Void result) { |
4216
a04862abce42
Don't redirect to the login page without query params
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4215
diff
changeset
|
102 /* Just reload the page. GGInAFilter is goint to redirect |
a04862abce42
Don't redirect to the login page without query params
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4215
diff
changeset
|
103 * to the correct login page */ |
a04862abce42
Don't redirect to the login page without query params
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4215
diff
changeset
|
104 Window.Location.reload(); |
4215
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
105 } |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
106 }); |
c179cd02177d
Logout the current user
Björn Ricks <bjoern.ricks@intevation.de>
parents:
2983
diff
changeset
|
107 |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
108 } |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
109 }); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
110 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
111 language.addClickHandler(new ClickHandler() { |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
532
diff
changeset
|
112 @Override |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
113 public void onClick(ClickEvent event) { |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
114 LocaleInfo info = LocaleInfo.getCurrentLocale(); |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
115 final String currentLocale = info.getLocaleName(); |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
116 final String newLocale = currentLocale.equals("de") |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
117 ? "en" |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
118 : "de"; |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
119 |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
120 SC.confirm(messages.warning(), messages.warning_language(), |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
121 new BooleanCallback() { |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
532
diff
changeset
|
122 @Override |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
123 public void execute(Boolean value) { |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
124 if (value) { |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
125 switchLanguage(currentLocale, newLocale); |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
126 } |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
127 } |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
128 }); |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
129 } |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
130 }); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
131 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
132 info.addClickHandler(new ClickHandler() { |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
532
diff
changeset
|
133 @Override |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
134 public void onClick(ClickEvent event) { |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
135 GWT.log("Clicked 'info' button."); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
136 GWT.log("IMPLEMENT the 'open info panel' function."); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
137 } |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
138 }); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
139 |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 init(); |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 } |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 |
2
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
144 /** |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
145 * This method is called by the constructor after creating the necessary |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
146 * components. It initializes layout specific stuff like width, height, |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
147 * colors and so on and appends the components. |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
148 */ |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 protected void init() { |
66
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
150 setStyleName("bgBlueDark"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
151 setHeight("25px"); |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
152 setLayoutMargin(5); |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
153 |
66
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
154 newProject.setStyleName("fontLightSmall"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
155 projectList.setStyleName("fontLightSmall"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
156 userText.setStyleName("fontLightSmall"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
157 newProject.setStyleName("fontLightSmall"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
158 logout.setStyleName("fontLightSmall"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
159 language.setStyleName("fontLightSmall"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
160 info.setStyleName("fontLightSmall"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
161 |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
162 projectList.setWidth("140px"); |
a361ce81abcf
Customized style for header and mainmenu.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
28
diff
changeset
|
163 |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
164 HLayout leftPanel = new HLayout(); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
165 leftPanel.setWidth("80%"); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
166 leftPanel.setMembersMargin(5); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
167 leftPanel.addMember(newProject); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
168 leftPanel.addMember(projectList); |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
169 |
28
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
170 userText.setAlign(Alignment.RIGHT); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
171 userText.setWidth(200); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
172 logout.setWidth(70); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
173 info.setWidth(40); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
174 language.setWidth(70); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
175 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
176 HLayout rightPanel = new HLayout(); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
177 rightPanel.setAlign(Alignment.RIGHT); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
178 rightPanel.setMembersMargin(3); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
179 rightPanel.setLayoutRightMargin(5); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
180 rightPanel.addMember(userText); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
181 rightPanel.addMember(logout); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
182 rightPanel.addMember(language); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
183 rightPanel.addMember(info); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
184 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
185 addMember(leftPanel); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
186 addMember(rightPanel); |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
187 } |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
188 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
189 |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
190 /** |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
191 * Returns the FLYS instance stored in this class. |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
192 * |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
193 * @return the flys instance. |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
194 */ |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
195 protected FLYS getFlys() { |
dfdb927b137d
Improved the main menu - added further buttons (clickable labels).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
25
diff
changeset
|
196 return flys; |
2
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
197 } |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
198 |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
199 |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
200 /** |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
201 * Set the current {@link User} and call {@link updateCurrentUser()} |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
202 * afterwards. |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
203 * |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
204 * @param user the new user. |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
205 */ |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
206 public void setCurrentUser(User currentUser) { |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
207 this.currentUser = currentUser; |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
208 |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
209 updateCurrentUser(); |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
210 } |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
211 |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
212 |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
213 /** |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
214 * Update the text field that shows the current user. If no user is |
211
b92281182c6b
Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
210
diff
changeset
|
215 * currently logged in, the text will display {@link FLYSConstants.guest()}. |
2
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
216 */ |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
217 public void updateCurrentUser() { |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
218 String name = currentUser != null |
25
2da6be38d8b6
Added a User interface and a default implementation to handle users in this client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
6
diff
changeset
|
219 ? currentUser.getName() |
2
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
220 : messages.guest(); |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
221 |
bc5d4d2297b9
Introduced a service that retrieves the user who is currently logged in. This user is displayed in the menu bar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
222 GWT.log("Update the current user: " + name); |
102
33e24b33fc38
Improved the way how to i18n strings in our application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
223 |
33e24b33fc38
Improved the way how to i18n strings in our application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
224 String username = messages.user() + " " + name; |
33e24b33fc38
Improved the way how to i18n strings in our application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
94
diff
changeset
|
225 userText.setContents(username); |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 } |
6
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
227 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
228 |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
229 /** |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
230 * Create a new project by calling FLYS.newProject(). |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
231 */ |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
232 protected void createNewProject() { |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
233 flys.newProject(); |
e2b3966b40ca
Added a workspace that handles the collection windows. New button to open a new collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2
diff
changeset
|
234 } |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
235 |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
236 |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
237 /** |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
238 * This method triggers the language switch between the <i>currentLocale</i> |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
239 * and the <i>newLocale</i>. The switch is done by replacing a "locale=" |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
240 * parameter in the url of the application. We could use the GWT UrlBuilder |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
241 * class to create a new URL, but - in my eyes - this class is a bit |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
242 * inconsistens in its implementation. |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
243 * |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
244 * @param currentLocale The current locale string (e.g. "en"). |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
245 * @param newLocale The new locale string (e.g. "de"). |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
246 */ |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
247 protected void switchLanguage(String currentLocale, String newLocale) { |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
248 String newLocation = Window.Location.getHref(); |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
249 |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
250 if (newLocation.endsWith("/")) { |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
251 newLocation = newLocation.substring(0, newLocation.length()-1); |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
252 } |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
253 |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
254 String replace = null; |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
255 String replaceWith = null; |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
256 |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
257 if (newLocation.indexOf("&locale=") >= 0) { |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
258 replace = currentLocale.equals("de") |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
259 ? "&locale=de" |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
260 : "&locale=en"; |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
261 |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
262 replaceWith = "&locale=" + newLocale; |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
263 } |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
264 else if (newLocation.indexOf("?locale=") >= 0) { |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
265 replace = currentLocale.equals("de") |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
266 ? "?locale=de" |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
267 : "?locale=en"; |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
268 |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
269 replaceWith = "?locale=" + newLocale; |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
270 } |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
271 else { |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
272 newLocation += newLocation.indexOf("?") >= 0 |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
273 ? "&locale=" + newLocale |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
274 : "?locale=" + newLocale; |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
275 } |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
276 |
212
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
277 if (replace != null && replaceWith != null) { |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
278 newLocation = newLocation.replace(replace, replaceWith); |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
279 } |
e3ea3c74b7f5
Fixed the function to toggle the language and added a warning dialog that informs the user about the creation of a new session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
211
diff
changeset
|
280 |
210
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
281 Window.open(newLocation, "_self", ""); |
c587903f02a4
Implemented the button to toggle the current locale.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
102
diff
changeset
|
282 } |
1
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 } |
0e22a19852e7
Removed useless auto generated classes and added first ui elements with i18n support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
284 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |