]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - UiContext.java
82b60612404b565875b3faeb51e0dc77bf810b2b
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 RWT
.getUISession().setLocale(locale
);
25 /** Can always be null */
26 @SuppressWarnings("unchecked")
27 public static <T
> T
getData(String key
) {
28 Display display
= getDisplay();
31 return (T
) display
.getData(key
);
34 public static void setData(String key
, Object value
) {
35 Display display
= getDisplay();
37 throw new SingleSourcingException(
38 "Not display available in RAP context");
39 display
.setData(key
, value
);
42 private static Display
getDisplay() {
43 return Display
.getCurrent();