Send a request from a custom widget [message #550631] |
Tue, 03 August 2010 23:33 |
|
Hi,
I wrote a custom widget and it is sending the changes from the server to the client (browser), but the changes from the client (browser) to the server are not sending.
I based my custom widget in the gmap example, I run the example and noticed that has the same behavior. In the debug I realized the changes are propagated until another control sends the request.
In the JavaScript of the gmap example that sends the value I noticed it only adds the parameter to the request, but it doesn't send the request.
if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
var wm = org.eclipse.swt.WidgetManager.getInstance();
var gmapId = wm.findIdByWidget( this );
var center = this._map.getCenter().toString();
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( gmapId + ".centerLocation", center );
}
So, I found a method in the request object: org.eclipse.swt.Request.getInstance().send(), that sends the request, I added it and it worked.
I have a doubt, is this the right mechanism for sending the request?
And if it is, is just enough the call to the method? or do I need to flush the global queue events or something else?
[Updated on: Tue, 03 August 2010 23:36] Report message to a moderator
|
|
|
Re: Send a request from a custom widget [message #550710 is a reply to message #550631] |
Wed, 04 August 2010 08:00 |
|
Hi,
you are right, the usual pattern is:
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( ... );
req.send();
There should be no need for any extra flushes. The idea is that
parameters can be added to the next request immediately whenever client
state changes, but that the request is sent not before there's a need to
inform the server. As an example, a checkbox without a SelectionListener
would not send a request when checked but add the parameter to the next
request.
Regards, Ralf
Jesus Luna Quiroga wrote:
> Hi, I wrote a custom widget and it is sending the changes from the
> server to the client (browser), but the changes from the client
> (browser) to the server are not sending.
>
> I based my custom widget in the gmap example, I run the example and
> noticed that has the same behavior. In the debug I realized the changes
> are propagated until another control sends the request.
>
> In the JavaScript of the gmap example that sends the value I noticed it
> only adds the parameter to the request, but it doesn't send the request.
>
> if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
> var wm = org.eclipse.swt.WidgetManager.getInstance();
> var gmapId = wm.findIdByWidget( this );
> var center = this._map.getCenter().toString();
> var req = org.eclipse.swt.Request.getInstance();
> req.addParameter( gmapId + ".centerLocation", center );
>
> So, I found a method in the request object:
> org.eclipse.swt.Request.getInstance().send(), that sends the request, I
> added it and it worked.
>
> I have the doubt, is this the right mechanism for sending the request?
> And if it is, is just enough the call to the method? or do I need to
> flush the global queue events?
--
Ralf Sternberg
Need professional support for RAP and RCP?
http://www.eclipsesource.com/support/
Twitter: http://twitter.com/eclipsesource
Blog: http://www.eclipsesource.com/blogs/
|
|
|
Powered by
FUDForum. Page generated in 0.03401 seconds