Basic Problem Using ClientScripting [message #1085290] |
Mon, 12 August 2013 14:14  |
Eclipse User |
|
|
|
I'm trying to use ClientScripting for the first time. I'm following the insrtuctions in the RAP wiki, and I must be missing something.
I have a SWT Label instance, and I want to add a listener on the client side to detect MouseEnter and MouseExit events. I'm supposed to add the ClientListener instance on the Java widget, specifying the event type, per the wiki example
widget.addListener( SWT.Verify, new ClientListener( javascript) );
The wiki says that MouseEnter and MouseExit events are supported on the client side, but I don't see how to specify them in the Java API. The only static members in the SWT class that refer to mouse events are MouseDoubleClick, MouseDown, and MouseUp.
So I tried adding a MouseDown listener, just to see if at least that works. I added the following line
label.addListener(SWT.MouseDown, (Listener) new ClientListener("function handleEvent(event) {console.log('mouse down');}"));
and I get this exception
java.lang.ClassNotFoundException: org.eclipse.rap.rwt.internal.remote.RemoteObjectFactory cannot be found by org.eclipse.rap.clientscripting_0.1.100.20130109-1900
There are no dependency issues shown when I click Validate on the Bundles tab of the Rap launcher. I'm using RAP 2.1 and the latest version of clientscripting from the incubator p2 repo (0.1.100).
I should also point out that the widget is running in a fragment project, since there is an RCP version of the app. When the RAP fragment is present, it replaces my Label class with a class that is the same except that it adds the ClientListener to the Label instance . The fragment has a dependency on the clientscripting plugin, and I tried re-exporting the dependency.
edit: I just tried it without single-sourcing it. With just a plugin and no fragment, I get the same exception.
[Updated on: Mon, 12 August 2013 15:54] by Moderator
|
|
|
|
Re: Basic Problem Using ClientScripting [message #1085348 is a reply to message #1085340] |
Mon, 12 August 2013 16:07  |
Eclipse User |
|
|
|
I guess the RAP version of SWT just left the static members out that refer to the types of mouse listeners not supported on the server side in RAP. Seems like it would be a good idea to have them there, since client scripting supports them. I put hard-coded int values in the call to addListener, per the values of the static members in the RCP version of the SWT class, and that works.
label.addListener(6, (Listener) new ClientListener("function handleEvent(event) {console.log('mouse enter');}"));
label.addListener(7, (Listener) new ClientListener("function handleEvent(event) {console.log('mouse exit');}"));
|
|
|
Powered by
FUDForum. Page generated in 0.26160 seconds