Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Basic Problem Using ClientScripting(How to listen to MouseEnter and MouseExit events)
Basic Problem Using ClientScripting [message #1085290] Mon, 12 August 2013 18:14 Go to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
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 19:54]

Report message to a moderator

Re: Basic Problem Using ClientScripting [message #1085340 is a reply to message #1085290] Mon, 12 August 2013 19:54 Go to previous messageGo to next message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
So it looks like I was pointing to the RAP 2.0 clientscripting repo instead of RAP 2.1. Using version 0.2.0 of the clientscripting plugin resolved the ClassNotFound exception. The code works for a mouse down event, but I still don't know how I can handle a mouse move, mouse enter, or mouse exit event.
Re: Basic Problem Using ClientScripting [message #1085348 is a reply to message #1085340] Mon, 12 August 2013 20:07 Go to previous message
Mark Leone is currently offline Mark LeoneFriend
Messages: 69
Registered: April 2012
Member
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');}"));
Previous Topic:[ANN] Shorter release cycles, RAP 2.2 schedule
Next Topic:Adding a MouseMove Listener to a Remote Object-based Custom Widget
Goto Forum:
  


Current Time: Fri Apr 26 13:57:57 GMT 2024

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

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

Back to the top