Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/MainMenu.java @ 2983:725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
flys-client/trunk@4991 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 13 Jul 2012 11:31:25 +0000 |
parents | 0ba7c43e7b62 |
children | c179cd02177d |
comparison
equal
deleted
inserted
replaced
2982:d2a54ae0016b | 2983:725470fc57d2 |
---|---|
1 package de.intevation.flys.client.client.ui; | 1 package de.intevation.flys.client.client.ui; |
2 | 2 |
3 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
4 import com.google.gwt.i18n.client.LocaleInfo; | 4 import com.google.gwt.i18n.client.LocaleInfo; |
5 import com.google.gwt.user.client.Window; | 5 import com.google.gwt.user.client.Window; |
6 | |
7 import com.smartgwt.client.types.Alignment; | 6 import com.smartgwt.client.types.Alignment; |
8 import com.smartgwt.client.util.BooleanCallback; | 7 import com.smartgwt.client.util.BooleanCallback; |
9 import com.smartgwt.client.util.SC; | 8 import com.smartgwt.client.util.SC; |
10 import com.smartgwt.client.widgets.Button; | 9 import com.smartgwt.client.widgets.Button; |
11 import com.smartgwt.client.widgets.Label; | 10 import com.smartgwt.client.widgets.Label; |
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 21 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
23 */ | 22 */ |
24 public class MainMenu extends HLayout { | 23 public class MainMenu extends HLayout { |
25 | 24 |
26 /** The interface that provides i18n messages. */ | 25 /** The interface that provides i18n messages. */ |
27 private FLYSConstants messages = GWT.create(FLYSConstants.class); | 26 private final FLYSConstants messages = GWT.create(FLYSConstants.class); |
28 | 27 |
29 /** An instance to FLYS.*/ | 28 /** An instance to FLYS.*/ |
30 protected FLYS flys; | 29 protected FLYS flys; |
31 | 30 |
32 /** The user that is currently logged in. */ | 31 /** The user that is currently logged in. */ |
64 logout = new Button(messages.logout()); | 63 logout = new Button(messages.logout()); |
65 language = new Button(messages.switch_language()); | 64 language = new Button(messages.switch_language()); |
66 info = new Button(messages.info()); | 65 info = new Button(messages.info()); |
67 | 66 |
68 newProject.addClickHandler(new ClickHandler() { | 67 newProject.addClickHandler(new ClickHandler() { |
68 @Override | |
69 public void onClick(ClickEvent event) { | 69 public void onClick(ClickEvent event) { |
70 GWT.log("Clicked 'New Project' button."); | 70 GWT.log("Clicked 'New Project' button."); |
71 createNewProject(); | 71 createNewProject(); |
72 } | 72 } |
73 }); | 73 }); |
74 | 74 |
75 projectList.addClickHandler(new ClickHandler() { | 75 projectList.addClickHandler(new ClickHandler() { |
76 @Override | |
76 public void onClick(ClickEvent event) { | 77 public void onClick(ClickEvent event) { |
77 GWT.log("Clicked 'Open ProjectList' button."); | 78 GWT.log("Clicked 'Open ProjectList' button."); |
78 ProjectList list = getFlys().getProjectList(); | 79 ProjectList list = getFlys().getProjectList(); |
79 if (list.isVisible()) | 80 if (list.isVisible()) |
80 list.hide(); | 81 list.hide(); |
82 list.show(); | 83 list.show(); |
83 } | 84 } |
84 }); | 85 }); |
85 | 86 |
86 logout.addClickHandler(new ClickHandler() { | 87 logout.addClickHandler(new ClickHandler() { |
88 @Override | |
87 public void onClick(ClickEvent event) { | 89 public void onClick(ClickEvent event) { |
88 GWT.log("Clicked 'logout' button."); | 90 GWT.log("Clicked 'logout' button."); |
89 GWT.log("IMPLEMENT the 'logout' function."); | 91 GWT.log("IMPLEMENT the 'logout' function."); |
90 } | 92 } |
91 }); | 93 }); |
92 | 94 |
93 language.addClickHandler(new ClickHandler() { | 95 language.addClickHandler(new ClickHandler() { |
96 @Override | |
94 public void onClick(ClickEvent event) { | 97 public void onClick(ClickEvent event) { |
95 LocaleInfo info = LocaleInfo.getCurrentLocale(); | 98 LocaleInfo info = LocaleInfo.getCurrentLocale(); |
96 final String currentLocale = info.getLocaleName(); | 99 final String currentLocale = info.getLocaleName(); |
97 final String newLocale = currentLocale.equals("de") | 100 final String newLocale = currentLocale.equals("de") |
98 ? "en" | 101 ? "en" |
99 : "de"; | 102 : "de"; |
100 | 103 |
101 SC.confirm(messages.warning(), messages.warning_language(), | 104 SC.confirm(messages.warning(), messages.warning_language(), |
102 new BooleanCallback() { | 105 new BooleanCallback() { |
106 @Override | |
103 public void execute(Boolean value) { | 107 public void execute(Boolean value) { |
104 if (value) { | 108 if (value) { |
105 switchLanguage(currentLocale, newLocale); | 109 switchLanguage(currentLocale, newLocale); |
106 } | 110 } |
107 } | 111 } |
108 }); | 112 }); |
109 } | 113 } |
110 }); | 114 }); |
111 | 115 |
112 info.addClickHandler(new ClickHandler() { | 116 info.addClickHandler(new ClickHandler() { |
117 @Override | |
113 public void onClick(ClickEvent event) { | 118 public void onClick(ClickEvent event) { |
114 GWT.log("Clicked 'info' button."); | 119 GWT.log("Clicked 'info' button."); |
115 GWT.log("IMPLEMENT the 'open info panel' function."); | 120 GWT.log("IMPLEMENT the 'open info panel' function."); |
116 } | 121 } |
117 }); | 122 }); |
224 * @param newLocale The new locale string (e.g. "de"). | 229 * @param newLocale The new locale string (e.g. "de"). |
225 */ | 230 */ |
226 protected void switchLanguage(String currentLocale, String newLocale) { | 231 protected void switchLanguage(String currentLocale, String newLocale) { |
227 String newLocation = Window.Location.getHref(); | 232 String newLocation = Window.Location.getHref(); |
228 | 233 |
229 String oldLocation = newLocation; | |
230 | |
231 if (newLocation.endsWith("/")) { | 234 if (newLocation.endsWith("/")) { |
232 newLocation = newLocation.substring(0, newLocation.length()-1); | 235 newLocation = newLocation.substring(0, newLocation.length()-1); |
233 } | 236 } |
234 | 237 |
235 String replace = null; | 238 String replace = null; |