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 15:59 Go to next message
Stefan M is currently offline Stefan M
Messages: 29
Registered: September 2012
Junior 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 07:24 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1290
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 04:17 Go to previous messageGo to next message
Stefan M is currently offline Stefan M
Messages: 29
Registered: September 2012
Junior 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 04:19]

Report message to a moderator

Re: Clientscripting: Trigger traverse programmatically [message #1065086 is a reply to message #1064604] Mon, 24 June 2013 05:48 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 379
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 06:10 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 379
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 10:47 Go to previous message
Stefan M is currently offline Stefan M
Messages: 29
Registered: September 2012
Junior Member
Thank you for your quick reaction.
I implemented the solution now in our application, it works fine.

Thanks,
Stefan
Previous Topic:RAP-2.1 How to display image on the loading page?
Next Topic:RAP 2.1 + Virgo 3.6.2: illegalState Exception
Goto Forum:
  


Current Time: Thu Jul 24 23:51:00 EDT 2014

Powered by FUDForum. Page generated in 0.02664 seconds