Eclipse Rich Ajax Platform
Release 1.3

org.eclipse.rwt
Class RWT

java.lang.Object
  extended byorg.eclipse.rwt.RWT

public final class RWT
extends Object

This class provides access to aspects of RWT which are not part of the SWT API as RAP needs some additions regarding the server and client communication. It is responsible for providing access to the ISessionStore and the HttpServletRequest.

Since:
1.0
See Also:
ILifeCycle, ISessionStore, IResourceManager, HttpServletRequest, HttpServletResponse

Nested Class Summary
static class RWT.NLS
          This utility class helps to provide a similar approach for compile safe native language support than NLS does.
 
Field Summary
static String ACTIVE_KEYS
          The property to use in Display.setData() in order to activate global key events for certain key sequences.
 
Method Summary
static IApplicationStore getApplicationStore()
          Returns the IApplicationStore instance that represents the web context's global data storage area.
static IBrowserHistory getBrowserHistory()
          Returns an instance if IBrowserHistory that provides support for the browser's history.
static ILifeCycle getLifeCycle()
          Returns the instance of the life cycle which is currently processed.
static Locale getLocale()
          Returns the preferred Locale that the client will accept content in.
static HttpServletRequest getRequest()
          Returns the HttpServletRequest that is currently processed.
static IResourceManager getResourceManager()
          Returns the instance of the currently available IResourceManager
static HttpServletResponse getResponse()
          Returns the HttpServletResponse that is mapped to the currently processed request.
static IServiceManager getServiceManager()
          Returns a manager to add and remove IServiceHandlers.
static IServiceStore getServiceStore()
          Returns the IServiceStore that is mapped to the currently processed request.
static ISessionStore getSessionStore()
          Returns the ISessionStore of the HttpSession to which the currently processed request belongs.
static ISettingStore getSettingStore()
          Returns the setting store instance for this session.
static void requestThreadExec(Runnable runnable)
          Executes the run method of the given runnable on the request thread.
static void setLocale(Locale locale)
          Sets the preferred Locale that the client will accept content in to current session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIVE_KEYS

public static final String ACTIVE_KEYS
The property to use in Display.setData() in order to activate global key events for certain key sequences. The value for this property has to be an array of Strings, each representing a key sequence. When this property is set on the display, the client will be instructed to issue events for the given key sequences. These key events can be captured using Display.addFilter().

Valid strings for key sequences consist of one or more keys, separated by +. Keys can be identified by their character, i.e. upper case letters, digits, or one of the special characters , . / \ [ ] ` '. Moreover, the following keywords can be used to refer to special keys: BACKSPACE, TAB, RETURN, ENTER, ESCAPE, SPACE, PAGE_UP, PAGE_DOWN, END, HOME, ARROW_LEFT, ARROW_UP, ARROW_RIGHT, ARROW_DOWN, INSERT, DELETE, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Valid modifier keys are SHIFT, ALT, and CTRL.

Examples: "A", "F12", "CTRL+1", "ALT+ARROW_DOWN", "ALT+SHIFT+X".

Example code for implementing a key binding:

 display.setData( RWT.ACTIVE_KEYS, new String[] { "CTRL+1", "CTRL+2" } );
 display.addFilter( SWT.KeyDown, new Listener() {
   public void handleEvent( Event event ) {
     boolean ctrlPressed = ( event.stateMask & SWT.Ctrl ) != 0;
     if( ctrlPressed && event.character == '1' ) {
       // handle Ctrl+1
     }
   }
 } );
 

Since:
1.4
See Also:
Display.setData(String,Object), Display.addFilter(int, Listener), Constant Field Values
Method Detail

getLifeCycle

public static ILifeCycle getLifeCycle()
Returns the instance of the life cycle which is currently processed.

Returns:
instance of ILifeCycle

getResourceManager

public static IResourceManager getResourceManager()
Returns the instance of the currently available IResourceManager

Returns:
instance of IResourceManager

getServiceManager

public static IServiceManager getServiceManager()
Returns a manager to add and remove IServiceHandlers.

Returns:
the IServiceManager

getSettingStore

public static ISettingStore getSettingStore()
Returns the setting store instance for this session.

Returns:
a ISettingStore; never null
Since:
1.1

getServiceStore

public static IServiceStore getServiceStore()
Returns the IServiceStore that is mapped to the currently processed request.

Returns:
IServiceStore

getSessionStore

public static ISessionStore getSessionStore()
Returns the ISessionStore of the HttpSession to which the currently processed request belongs.

Returns:
instance of ISessionStore

getApplicationStore

public static IApplicationStore getApplicationStore()
Returns the IApplicationStore instance that represents the web context's global data storage area.

Returns:
instance of IApplicationStore
Since:
1.4

getRequest

public static HttpServletRequest getRequest()
Returns the HttpServletRequest that is currently processed.

Returns:
instance of HttpServletRequest

getResponse

public static HttpServletResponse getResponse()
Returns the HttpServletResponse that is mapped to the currently processed request.

Returns:
instance of HttpServletResponse

getLocale

public static Locale getLocale()
Returns the preferred Locale that the client will accept content in. This is either the Locale that was set in session-scope using the setLocale(Locale) method or the locale based on the Accept-Language HTTP header of the current request. If neither the Locale was set programmatically, nor the client request provides an Accept-Language header, this method returns the default locale for the server.

Returns:
the preferred Locale for the client.
See Also:
setLocale(Locale)

setLocale

public static void setLocale(Locale locale)
Sets the preferred Locale that the client will accept content in to current session. The value set can be retrieved with the getLocale() method.

See Also:
getLocale()

getBrowserHistory

public static IBrowserHistory getBrowserHistory()
Returns an instance if IBrowserHistory that provides support for the browser's history.

Returns:
the browser history support implementation
Since:
1.3
See Also:
IBrowserHistory

requestThreadExec

public static void requestThreadExec(Runnable runnable)
Executes the run method of the given runnable on the request thread. This method may only be called from the UI thread.

NOTE: This API is provisional and may change without further notice.

Parameters:
runnable - the code to be executed on the request thread
Throws:
SWTException -
  • ERROR_THREAD_INVALID_ACCESS - if not called from the UI thread
Since:
1.3

Eclipse Rich Ajax Platform
Release 1.3

Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2011. All rights reserved.