Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Events in Custom Widgets
Events in Custom Widgets [message #59442] Mon, 12 November 2007 13:27 Go to next message
Eclipse UserFriend
Hi,
I wan't to add an event listner to my custom widget and I wan't to know if
its possible.
My custom widget performes some time consuming tasks on the JS side and I
wanted the Java side to be alerted when they're finished.

As anyone attempted at doing such a thing?

Thanks in advance.

Tiago
Re: Events in Custom Widgets [message #59494 is a reply to message #59442] Tue, 13 November 2007 07:48 Go to previous message
Eclipse UserFriend
Hi Tiago,

this sould be possible without any difficulties.
You need an Event which gets fired (could be defined like this:

events: {

"select" : "qx.event.type.DataEvent"
}
), or you use an existing event type like "execute" or something like that.
then you can add an EventListener to your Component, which notifies the
Servercomponent like that:
this.addEventListener("select",function(e){
var wm = org.eclipse.swt.WidgetManager.getInstance();
var id = wm.findIdByWidget(this);
var req = org.eclipse.swt.Request.getInstance();
req.addParameter(id+".signal",e.getData());
req.send();
});

Whenever your long running task is finished, you notify your event
listener:

this.createDispatchDataEvent("select", "true");

In your LCA, you have the method readData(Widget widget) which gets
called whenever an Request comes in from the client:

Here you can
MyWidgetType type= (MyWidgetType ) widget;
String result= WidgetLCAUtil.readPropertyValue(type, "signal");

if you really want to react only to your special event, you can
maybe test if the value is correct, so if you attach "true" to the
request, here you can test if result == true and then you are done.

I hope that helps, I did this out of my head because no eclipse is
accessible at the moment, so please dont blame me if the code is not 100%
correct, but this way it can be done.

Greetings

Martin
Previous Topic:How to switch back to "normal" target platform after experimenting with RAP?
Next Topic:Again Singletons
Goto Forum:
  


Current Time: Thu May 08 02:24:58 EDT 2025

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

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

Back to the top