Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Access Widgets via Javascript on client side
Access Widgets via Javascript on client side [message #502726] Wed, 09 December 2009 14:52 Go to next message
Oliver Specht is currently offline Oliver SpechtFriend
Messages: 7
Registered: December 2009
Junior Member
Hi,
I try to access the Widgets on clientside via Javascript. I use the Widgetmanager by:

var wm = org.eclipse.swt.WidgetManager.getInstance();
var widget = wm.findWidgetById();
...

My problem is, that I do not know the IDs of the widgets. Is there any possibility to set the widget IDs? Or any possibility to access the widget by name ore something else?

And: Is there any javascript side documentation (API, Tutorials, ...) for RAP?

Thx,
Oliver
Re: Access Widgets via Javascript on client side [message #502735 is a reply to message #502726] Wed, 09 December 2009 15:03 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Oliver,

you can set the widget-Id in you code:

widget.setData(WidgetUtil.CUSTOM_WIDGET_ID, "MyWidgetId");

Hope that helps,
Stefan.

Oliver Specht schrieb:
> Hi,
> I try to access the Widgets on clientside via Javascript. I use the
> Widgetmanager by:
>
> var wm = org.eclipse.swt.WidgetManager.getInstance();
> var widget = wm.findWidgetById();
> ..
>
> My problem is, that I do not know the IDs of the widgets. Is there any
> possibility to set the widget IDs? Or any possibility to access the
> widget by name ore something else?
>
> And: Is there any javascript side documentation (API, Tutorials, ...)
> for RAP?
>
> Thx,
> Oliver
Re: Access Widgets via Javascript on client side [message #502739 is a reply to message #502726] Wed, 09 December 2009 15:17 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Oliver,

the widget id, used by WidgetManager#findWidgetById( id ) is assigned by
server side on widget creation ( see WidgetManager#newWidget ). You can
get the id:
- on the client: WidgetManager#findIdByWidget( widget )
- on the server: WidgetUtil.getId( widget )

HTH,
Ivan

On 12/9/2009 16:52, Oliver Specht wrote:
> Hi,
> I try to access the Widgets on clientside via Javascript. I use the
> Widgetmanager by:
>
> var wm = org.eclipse.swt.WidgetManager.getInstance();
> var widget = wm.findWidgetById();
> ..
>
> My problem is, that I do not know the IDs of the widgets. Is there any
> possibility to set the widget IDs? Or any possibility to access the
> widget by name ore something else?
>
> And: Is there any javascript side documentation (API, Tutorials, ...)
> for RAP?
>
> Thx,
> Oliver
Re: Access Widgets via Javascript on client side [message #502787 is a reply to message #502726] Wed, 09 December 2009 17:08 Go to previous messageGo to next message
Oliver Specht is currently offline Oliver SpechtFriend
Messages: 7
Registered: December 2009
Junior Member
Hi, all,
thanks for the replies. It seems that the ID is set but does not affect the javascript part.

If I set the ID via WidgetUtil.CUSTOM_WIDGET_ID and debug it on button click, the ID is shown correctly.

If I try to access the element via javascript, it only works by accessing by ID "w175" or "w34" etc.

Does RAP ignore the widget settings?

Greetings,
Oliver
Re: Access Widgets via Javascript on client side [message #502804 is a reply to message #502787] Wed, 09 December 2009 18:27 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Oliver,

sorry, I forgot to mention that you have to set the System-Property
org.eclipse.rwt.enableUITests, too. See this page for more information:

http://www.eclipse.org/rap/noteworthy/news_11.php

Regards,
Stefan.


Oliver Specht schrieb:
> Hi, all,
> thanks for the replies. It seems that the ID is set but does not affect
> the javascript part.
>
> If I set the ID via WidgetUtil.CUSTOM_WIDGET_ID and debug it on button
> click, the ID is shown correctly.
>
> If I try to access the element via javascript, it only works by
> accessing by ID "w175" or "w34" etc.
>
> Does RAP ignore the widget settings?
>
> Greetings,
> Oliver
Re: Access Widgets via Javascript on client side [message #503030 is a reply to message #502804] Thu, 10 December 2009 16:06 Go to previous message
Oliver Specht is currently offline Oliver SpechtFriend
Messages: 7
Registered: December 2009
Junior Member
Hi, Stefan,
works fine, thank you.

Now I have another problem (really tried but did not find out...):

I want to change a Button on client side so it gets new properties that I can query on server side.

In my case I have a button which I trigger via execute(). Before triggering I want to give it a property (key-value pair) I can then query on server side.

Which way do I go? I saw the setUserData() methods, the setProperty...() methods etc. There are so many different possibitlities but nothing worked.

Can you help me out again? Smile

Thank you,
Oliver
Previous Topic:D&D in TreeWiewer
Next Topic:Processing KeyAdapter in RAP
Goto Forum:
  


Current Time: Wed Apr 24 16:53:21 GMT 2024

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

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

Back to the top