Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to add js for widgets?
How to add js for widgets? [message #788812] Thu, 02 February 2012 08:59 Go to next message
sapzqq tyapqz is currently offline sapzqq tyapqzFriend
Messages: 8
Registered: February 2012
Junior Member
I need to add some script for canvas. I did it like following, but it doesn't work.
code in customize LCA class:
@Override
public void renderChanges(Widget widget) throws IOException {
JavaScriptResponseWriter writer =
ContextProvider.getStateInfo().getResponseWriter();
writer
.write("$('#"
+ WidgetUtil.getId(widget)
+ "').bind('mousewheel', function(event, delta, deltaX, deltaY) {alert('wtf!!');});");

...
}
I have imported jquery and mousewheel plugin. I don't how rap works since I can't see any script(for widgets) written by JavaScriptResponseWriter on the client. It seems that these scripts(for widgets) will be evaluated internally.
any advice? Thanks for your attention.
Re: How to add js for widgets? [message #788865 is a reply to message #788812] Thu, 02 February 2012 09:56 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi.

You won't be able to access the client widgets with jquery just like
that. I'm not sure what you want to do exactly, but i recommand you to
look at http://wiki.eclipse.org/RAP/ClientScripting. This project is in
very early development. Its currently missing Java API, which should be
there in a week or so. After that, any questions or suggestions for this
project are welcome.

greetings,
Tim

Am 02.02.2012 09:59, schrieb sapzqq tyapqz:
> I need to add some script for canvas. I did it like following, but it
> doesn't work.
> code in customize LCA class:
> @Override
> public void renderChanges(Widget widget) throws IOException {
> JavaScriptResponseWriter writer =
> ContextProvider.getStateInfo().getResponseWriter();
> writer
> .write("$('#"
> + WidgetUtil.getId(widget)
> + "').bind('mousewheel', function(event, delta, deltaX, deltaY)
> {alert('wtf!!');});");
>
> ...
> } I have imported jquery and mousewheel plugin. I don't how rap works
> since I can't see any script(for widgets) written by
> JavaScriptResponseWriter on the client. It seems that these scripts(for
> widgets) will be evaluated internally.
> any advice? Thanks for your attention.
Re: How to add js for widgets? [message #788909 is a reply to message #788865] Thu, 02 February 2012 11:18 Go to previous messageGo to next message
sapzqq tyapqz is currently offline sapzqq tyapqzFriend
Messages: 8
Registered: February 2012
Junior Member
Hi Tim
There's no content now in the page you provided. Maybe wait for some time.
What I want to do is to add mousewheel listener to canvas. On RCP, we have a canvas which can be zooming with mousewheel event. This does not support in RAP. So I try to do it myself.
The solution I thought is implementing a customized LCA class for the canvas, adding the mousewheel listener and in the handler of js, sending the request to server(this seems possible).
Do you have any idea about this? Thanks for your reply.
Thanks

[Updated on: Thu, 02 February 2012 11:19]

Report message to a moderator

Re: How to add js for widgets? [message #789171 is a reply to message #788909] Thu, 02 February 2012 17:37 Go to previous message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Am 02.02.2012 12:18, schrieb sapzqq tyapqz:

> Hi Tim
> There's no content now in the page you provided. Maybe wait for some time.
There is for me, but it now seems to me its not relevant for your issue.

> What I want to add mousewheel listener to canvas.

I suggest you open an enhancement request on our bugzilla, we can
continue discussion there. Describe what API is missing and perhaps what
your usecase would look like.

Greetings,
Tim
Previous Topic:HTTP Status 404 - ProxyServlet: /tmf_rap/mcrap
Next Topic:show view option enablement
Goto Forum:
  


Current Time: Sat Oct 12 22:21:33 GMT 2024

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

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

Back to the top