Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333735

Summary: Databinding: observeDelayed does not work as expected
Product: [RT] RAP Reporter: Elias Volanakis <elias>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cbateman, lothar
Version: unspecified   
Target Milestone: 1.5 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Application to reproduce issue none

Description Elias Volanakis CLA 2011-01-07 06:31:14 EST
Using observeDelayed has unexpected behavior in RAP (when compared to RCP).

The delayed binding is executed on the display thread after a user specified delay -- usually not in the current req./resp. cycle. This results in an update of the UI state on the server. However the browser will be out of sync until the next regular request/response.

ISWTObservableValue model = SWTObservables.observeDelayedValue(200,
   SWTObservables.observeText(text, SWT.Modify));
ISWTObservableValue source = SWTObservables.observeText(label);
dbc.bindValue(source, model);

See attached snippet for full example.

As a workaround one can use UICallBack.
Comment 1 Elias Volanakis CLA 2011-01-07 06:31:47 EST
Created attachment 186261 [details]
Application to reproduce issue
Comment 2 Ivan Furnadjiev CLA 2011-04-07 03:35:06 EDT
Fixed in CVS HEAD by activating the UICallBack in SWTDelayedObservableValueDecorator ctor and deactivating it in SWTDelayedObservableValueDecorator#dispose().
Comment 3 Ralf Sternberg CLA 2011-04-10 16:49:30 EDT
The current solution seems to keeps a UICallBack open until the widget is being disposed. In many cases this will result in a UICallBack running for the entire lifetime of the application. I think this solution is less than optimal.

We once had the idea to add the UICallback in Display#timerExec(), which would also help in other cases. By wrapping the timerExec runnable, we could disable the UICallBack immediately after executing the wrapped runnable.
Comment 4 Lothar Werzinger CLA 2011-04-12 20:08:48 EDT
Keeping the UICallback around (that's what we do as a workaround) seems also to negatively impact the clean shutdown of the RAP app when the sesion expires.
We have a getDisplay().disposeExec() resgistered, that get's called if we don't use the UICallback and it does not get called when we use the UICallback workaround.
Comment 5 Ralf Sternberg CLA 2011-05-14 16:24:52 EDT
I'm sorry, but it's too late for 1.4, we have to carry this issue along to 1.5.
Comment 6 Ivan Furnadjiev CLA 2011-11-26 02:31:04 EST
The UICallBack activation/deactivation is no longer needed in SWTDelayedObservableValueDecorator as it is done by Display#timeExec (see bug 364863).