How to add js for widgets? [message #788812] |
Thu, 02 February 2012 03:59  |
Eclipse User |
|
|
|
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 04:56   |
Eclipse User |
|
|
|
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 #789171 is a reply to message #788909] |
Thu, 02 February 2012 12:37  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03691 seconds