Eclipse Rich Ajax Platform Release 1.3

## org.eclipse.rwt.lifecycle
Class UICallBack

    java.lang.Object
      org.eclipse.rwt.lifecycle.UICallBack

public final class UICallBack
extends java.lang.Object

A utility class that provides some static helper methods to perform commonly needed tasks with respect to background thread management.

Since:
  1.0

Method Summary
`static void` `activate(java.lang.String id)` To allow automatic UI-updates by server side background threads activate the UICallBack mechanism.
`static void` `deactivate(java.lang.String id)` To allow automatic UI-updates by server side background threads activate the UICallBack mechanism.
`static void` `runNonUIThreadWithFakeContext(Display display, java.lang.Runnable runnable)` Sometimes a background thread needs to access values that are stored in the session object that started the thread.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### runNonUIThreadWithFakeContext

    public static void runNonUIThreadWithFakeContext(Display display,
                                                     java.lang.Runnable runnable)

  Sometimes a background thread needs to access values that are stored in the session object that started the thread. In particular these values may be stored in session singletons. Accessing these singletons directly from the background thread would fail. This method fakes the missing request context and allows the runnable code to access those singletons.

  Parameters:
    `display` - The display that is bound to the session that contains the data to which the current thread should get access.
    `runnable` - The runnable that contains the critical code that needs to have access to a request context.
  See Also:
    `SessionSingletonBase`, `org.eclipse.rwt.internal.service.ContextProvider`

### activate

    public static void activate(java.lang.String id)

  To allow automatic UI-updates by server side background threads activate the UICallBack mechanism. Call this method before the start of a thread and `deactivate(java.lang.String)` at the end. Each activation needs a session unique identifier as a kind of reference pointer to be able to decide when all background threads are finished.

  Note: this method can only be called in the UI-Thread of an RWT application.

  Parameters:
    `id` - A session unique identifier to trace the activation and deactivation. Must not be `null`.
  See Also:
    `Display.syncExec(java.lang.Runnable)`, `Display.asyncExec(java.lang.Runnable)`, `Display.getThread()`, `Display.wake()`

### deactivate

    public static void deactivate(java.lang.String id)

  To allow automatic UI-updates by server side background threads activate the UICallBack mechanism. Call `deactivate(java.lang.String)` method before the start of a thread and deactivateUICallBack at the end. Each activation needs a session unique identifier as a kind of reference pointer to be able to decide when all background threads are finished.

  Note: this method can only be called in the UI-Thread of an RWT application.

  Parameters:
    `id` - A session unique identifier to trace the activation and deactivation. Must not be `null`
  See Also:
    `Display.syncExec(java.lang.Runnable)`, `Display.asyncExec(java.lang.Runnable)`, `Display.getThread()`, `Display.wake()`

Eclipse Rich Ajax Platform Release 1.3

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