Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Clientscripting: Trigger traverse programmatically
Clientscripting: Trigger traverse programmatically [message #1064346] Tue, 18 June 2013 19:59 Go to next message
Stefan Milchram is currently offline Stefan MilchramFriend
Messages: 33
Registered: September 2012
Member
We do single-sourcing. Our application features extensive validation of user input, for example: Consider a field used to input dates. This field has a maximum lenght of 4 and only digits are allowed. Also, if the input is correct and the maximum number of digits is entered, the focus should be set to the next field.
In RCP this is done using various listeners. As this is very bad for performance (every keystroke would be transfered to the server) we build some generic javascript functions which can validate the given input against a regex. This functions are registered once as a ressource. The code of the clientlistener is just a call of these functiones with the regex as a parameter.
The validation works well, but we do not know how to implement the automatic traverse.
We did not find documentation for the javascript part, so we couldn't check if we can fire a traverse event in javascript.
How could a automatic traverse with clientscripting work?

thanks in advance
Re: Clientscripting: Trigger traverse programmatically [message #1064455 is a reply to message #1064346] Wed, 19 June 2013 11:24 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Stefan,

traversal is not yet supported by the clientscripting, but I think it
should be generally possible. We plan to extend the clientscripting
component in 2.2 and traversal could be a powerful addition for this
component. Feel free to open an enhancement request.

> We did not find documentation for the javascript part, so we couldn't

There's a wiki page [1] for the clientscripting, that is also referenced
on the incubator page.

Best regards,
Ralf

[1] http://wiki.eclipse.org/RAP/ClientScripting

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Clientscripting: Trigger traverse programmatically [message #1064604 is a reply to message #1064455] Thu, 20 June 2013 08:17 Go to previous messageGo to next message
Stefan Milchram is currently offline Stefan MilchramFriend
Messages: 33
Registered: September 2012
Member
I know about the clientscripting wiki, but i did mean documentation on the "general" javascript-part. We thought we could trigger the focus-event ourselves using the general javascript-api of the objects.
As Tim wrote on the eclipsesource-blog:
http://eclipsesource.com/blogs/2013/06/07/rap-client-scripting-phase-ii-33/
we could pass the next widget to the widget which features automatic traversal in RCP. All we would have to do is trigger the focus-event on the passed widget as a click would do.
Would this be a possible solution?

[Updated on: Thu, 20 June 2013 08:19]

Report message to a moderator

Re: Clientscripting: Trigger traverse programmatically [message #1065086 is a reply to message #1064604] Mon, 24 June 2013 09:48 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi.

I think the correct solution would be to implement setFocus or
forceFocus for ClientScripting. Since this seems to be a common use case
I will try to get this done as soon as possible and then post a snippet
in this thread.

Greetings,
Tim

Am 20.06.2013 10:17, schrieb Stefan M:
> I know about the clientscripting wiki, but i did mean documentation on
> the "general" javascript-part. We thought we could trigger the
> focus-event ourselves using the general javascript-api of the objects.
> As Tim wrote on the eclipsesource-blog:
> http://eclipsesource.com/blogs/2013/06/07/rap-client-scripting-phase-ii-33/
> we could pass the next widget to the widget which features automatic
> traversal in RCP. All we would have to do is trigger the focus-event on
> the passed widget as a click would do.
> Would this be a possible solution?

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Clientscripting: Trigger traverse programmatically [message #1065523 is a reply to message #1065086] Wed, 26 June 2013 10:10 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
> I will try to get this done as soon as possible and then post a snippet
> in this thread.

Done. Controls now have a "forceFocus" method[1]. The demo application
in org.eclipse.rap.clientscripting.demo bundle has been updated. Example:

Java:
WidgetDataWhiteList.addKey( "next" );
text.setData( "next", WidgetUtil.getId( next ) );
text.addListener( SWT.XXX, clientListener );

JavaScript:
rap.getObject( event.widget.getData( "next" ) ).forceFocus();


[1]
http://wiki.eclipse.org/RAP/Incubator/ClientScripting#Methods_on_Controls



>
> Greetings,
> Tim
>
> Am 20.06.2013 10:17, schrieb Stefan M:
>> I know about the clientscripting wiki, but i did mean documentation on
>> the "general" javascript-part. We thought we could trigger the
>> focus-event ourselves using the general javascript-api of the objects.
>> As Tim wrote on the eclipsesource-blog:
>> http://eclipsesource.com/blogs/2013/06/07/rap-client-scripting-phase-ii-33/
>>
>> we could pass the next widget to the widget which features automatic
>> traversal in RCP. All we would have to do is trigger the focus-event on
>> the passed widget as a click would do.
>> Would this be a possible solution?
>

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Clientscripting: Trigger traverse programmatically [message #1067608 is a reply to message #1065523] Tue, 09 July 2013 14:47 Go to previous message
Stefan Milchram is currently offline Stefan MilchramFriend
Messages: 33
Registered: September 2012
Member
Thank you for your quick reaction.
I implemented the solution now in our application, it works fine.

Thanks,
Stefan
Previous Topic:Migrating to RAP 2.1-RC3: Extending behaviour of DateTime widget
Next Topic:Has ScrollBar different behaviour in SWT and RWT?
Goto Forum:
  


Current Time: Sat Apr 20 00:16:02 GMT 2024

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

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

Back to the top