]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - UiContext.java
ebececf154cae3d0bed8b6f2d209761cf56c5ad7
1 package org
.argeo
.eclipse
.ui
.specific
;
3 import java
.util
.Locale
;
5 import javax
.servlet
.http
.HttpServletRequest
;
7 import org
.eclipse
.rap
.rwt
.RWT
;
8 import org
.eclipse
.swt
.widgets
.Display
;
10 /** Singleton class providing single sources infos about the UI context. */
11 public class UiContext
{
13 public static HttpServletRequest
getHttpRequest() {
14 return RWT
.getRequest();
17 public static Locale
getLocale() {
18 return RWT
.getUISession().getLocale();
21 public static void setLocale(Locale locale
) {
22 if (Display
.getCurrent() != null)
23 RWT
.getUISession().setLocale(locale
);
26 /** Can always be null */
27 @SuppressWarnings("unchecked")
28 public static <T
> T
getData(String key
) {
29 Display display
= getDisplay();
32 return (T
) display
.getData(key
);
35 public static void setData(String key
, Object value
) {
36 Display display
= getDisplay();
38 throw new SingleSourcingException(
39 "Not display available in RAP context");
40 display
.setData(key
, value
);
43 private static Display
getDisplay() {
44 return Display
.getCurrent();