readData() behaviour [message #80913] |
Wed, 02 April 2008 05:38  |
Eclipse User |
|
|
|
Hi,
(Apologies if this has already been covered in a previous post but I
couldn't find anything)
I'm trying to understand the widget lifecycle and in particular the
readData() method. It appears as though this is only called when the
user selects something e.g. I can see it being called only when my
widget goes out of (or into) focus. What I'd like is for my widget to
(for example) periodically send requests to the server, and for
readData() to be called as soon as one of those requests arrives so that
relevant parts of the UI can be updated. Is this possible?
Thanks,
Mike
|
|
|
|
|
|
|
|
|
|
Re: readData() behaviour [message #81031 is a reply to message #80986] |
Wed, 02 April 2008 13:58  |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
Hi Mike,
as others already said;) the readData method is called whenever a
request is sent. There is no condition under which readData is not
called.
As your code looks like it should do what you expect, I can only
give some guesses:
- can you ensure that the request is actually sent?
Write req.debug( "sent" ); before req.snd() and have the
debug window/Firebug open.
- Is your LCA called at all? The LCA's that is responsibe for
a certain class is resolved by a naming convention. Maybe
there is a typo?
- does the client-side widget-id match the one you expect
on the server-side? (use WidgetUtil#getId(Widget) to determine
server-side id)
Cheers,
Rüdiger
Mike Wrighton wrote:
> Ok here are a few snippets. The actual editor is inside an html page in
> a qx.ui.embed.Iframe. I'm polling the editor code in the html page to
> check for the editor_is_dirty flag, then sending a request:
>
>
> var timer2 = new qx.client.Timer(100);
> timer2.addEventListener("interval", function(e) {
> if (this.getIframeWindow() && this.getIframeWindow().loaded) {
> if(this.getIframeWindow().editor_is_dirty == 1){
> this.getIframeWindow().editor_is_dirty = 0;
> this.fireDirtyEvent();
> }
> }
> }, this);
> timer2.start();
>
>
> fireDirtyEvent : function() {
> var wm = org.eclipse.swt.WidgetManager.getInstance();
> var id = wm.findIdByWidget(this);
> var req = org.eclipse.swt.Request.getInstance();
> req.addParameter(id + ".dirty", "yes");
> req.send();
> }
>
>
> My readData method of my LCA:
>
>
> public void readData( final Widget widget ) {
> final GMap map = (GMap) widget;
> final String isDirty = WidgetLCAUtil.readPropertyValue(map, "dirty");
>
> if (isDirty != null){
> ProcessActionRunner.add(new Runnable(){
> public void run() {
> map.fireDirtyEvent();
> }
> });
> }
>
>
> Hope this makes it clearer.
>
> Mike
>
>
> Martin wrote:
>> Ok then, this should work, how did you implement this, could you post
>> some code?
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04330 seconds