Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » UICallBack mechanism
UICallBack mechanism [message #512533] Fri, 05 February 2010 11:53 Go to next message
Erdal Karaca is currently offline Erdal Karaca
Messages: 748
Registered: July 2009
Senior Member
I tried UICallBack.activate/deactivate, but that does not seem to work in this case:

// in a background job:
{
doSomething();
notifyListeners(display)
}

// the listener:
{
display.asyncExec( new Runnable() {
public void run() {
String uuid = UUID.randomUUID().toString();
UICallBack.activate(uuid);
updateUI();
UICallBack.deactivate(uuid);
}
}
}

A background job must notify its listeners that it has finished. Now, in the listener I want to update the ui. When using activate/deactivate, I have this problem: ui is not refreshed until I click somewhere.

Am I right, that I have to call UICallBack.activate before the background job starts and UICallBack.deactive when it has finished?
How to do this if I do not know where the background job is started or if the background job is started somewhere I have no access to?
Re: UICallBack mechanism [message #512880 is a reply to message #512533] Mon, 08 February 2010 04:42 Go to previous message
Rüdiger Herrmann is currently offline Rüdiger Herrmann
Messages: 565
Registered: July 2009
Senior Member
On 05.02.2010 12:53, Erdal Karaca wrote:
> I tried UICallBack.activate/deactivate, but that does not seem to work
> in this case:
>
> // in a background job:
> {
> doSomething();
> notifyListeners(display)
> }
>
> // the listener:
> {
> display.asyncExec( new Runnable() {
> public void run() {
> String uuid = UUID.randomUUID().toString();
> UICallBack.activate(uuid);
> updateUI();
> UICallBack.deactivate(uuid);
> }
> }
> }
>
> A background job must notify its listeners that it has finished. Now, in
> the listener I want to update the ui. When using activate/deactivate, I
> have this problem: ui is not refreshed until I click somewhere.
>
> Am I right, that I have to call UICallBack.activate before the
> background job starts and UICallBack.deactive when it has finished?
You are right, the UICallback must be activated from within the
UI-Thread (i.e. while a "normal" request is running) *before* the
background thread needs to update the UI.

> How to do this if I do not know where the background job is started or
> if the background job is started somewhere I have no access to?
You could start the UICallback "well ahead" (e.g. at session startup) at
the cost of having an extra request that is blocked at the server while
the UICallback is active.
Another approach could be to write some custom Javascript that polls the
server for updates.
Depending on your actual use case there might be other options - feel
free to share...
Previous Topic:[Dialog] L&F 1.3M5
Next Topic:Loading ICO images
Goto Forum:
  


Current Time: Thu Oct 23 21:28:31 GMT 2014

Powered by FUDForum. Page generated in 0.02319 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software