Re: Wait for server call

2009-09-14 Thread Angel

If I do it, the user interface shows in browser before the combo fill
values...  :(
The user interface show a empty combo.


On Sep 14, 11:38 am, Norman Maurer  wrote:
> You should do it like this:
>
> BDServiceAsync service = GWT.create(BDService.class);
>        service.fillCombo("text", new AsyncCallback>(){
>                 public void onFailure(Throwable caught) {
>                 }
>                 public void onSuccess(Map result) {
>                     // I access to the database for data. to get de
>  combo values.
>                     combo.setValues(result);
>                 }
>         });
>
> Bye,
> Norman
>
> 2009/9/14 Angel :
>
>
>
>
>
> > Sorry, I will relaunch the question
>
> > [CODE]
>
> > // At this point I built the user interface.
> > // I have a combo and others elements...
> > Map comboValues = new Map()
>
> > BDServiceAsync service = GWT.create(BDService.class);
> >        service.fillCombo("text", new AsyncCallback>
> > (){
> >                public void onFailure(Throwable caught) {
> >                }
> >                public void onSuccess(Map result) {
> >                    // I access to the database for data. to get de
> > combo values.
> >                    comboValues = result;
> >                }
> >        });
> > // shouldwaitfor the call to the server
> > combo.setValues(comboValues);
> > // the flow continues
>
> > [/CODE]
>
> > Sorry for my english!
>
> > On Sep 14, 6:05 am, Sripathi Krishnan 
> > wrote:
> >> Simplest answer - put the System.out.println() within the onSuccess() 
> >> method
> >> -:)
>
> >> Longer answer -
> >> You are trying to make an asynchronous call into a synchronous one. Its a
> >> question that has been asked many times, and the answer is - don't try to 
> >> do
> >> it.  Read the document at 
> >> -http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication...
> >> more details on this subject.
>
> >> --Sri
>
> >> 2009/9/13 Angel 
>
> >> > I have this code, which sends a call to the server. This call takes a
> >> > few seconds to complete.
> >> > I should not run System.out.println until the call ends.
>
> >> > I do this? How Iwaitfor the server?
> >> > thanks
>
> >> > [CODE]
> >> > String value="nothing";
> >> > BDServiceAsync service = GWT.create(BDService.class);
> >> >        service.myCall("text", new AsyncCallback>(){
>
> >> >                public void onFailure(Throwable caught) {
>
> >> >                }
>
> >> >                public void onSuccess(Map result) {
> >> >                        // This takes a few seconds to complete.
> >> >                                        value="hola";
>
> >> >                }
> >> >        });
>
> >> > // shouldwaitfor the call to the server
> >> > System.out.println("value="+value);
>
> >> > [/CODE]- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Wait for server call

2009-09-14 Thread Norman Maurer

You should do it like this:

BDServiceAsync service = GWT.create(BDService.class);
   service.fillCombo("text", new AsyncCallback>(){
public void onFailure(Throwable caught) {
}
public void onSuccess(Map result) {
// I access to the database for data. to get de
 combo values.
combo.setValues(result);
}
});

Bye,
Norman


2009/9/14 Angel :
>
> Sorry, I will relaunch the question
>
> [CODE]
>
> // At this point I built the user interface.
> // I have a combo and others elements...
> Map comboValues = new Map()
>
>
> BDServiceAsync service = GWT.create(BDService.class);
>        service.fillCombo("text", new AsyncCallback>
> (){
>                public void onFailure(Throwable caught) {
>                }
>                public void onSuccess(Map result) {
>                    // I access to the database for data. to get de
> combo values.
>                    comboValues = result;
>                }
>        });
> // should wait for the call to the server
> combo.setValues(comboValues);
> // the flow continues
>
> [/CODE]
>
> Sorry for my english!
>
> On Sep 14, 6:05 am, Sripathi Krishnan 
> wrote:
>> Simplest answer - put the System.out.println() within the onSuccess() method
>> -:)
>>
>> Longer answer -
>> You are trying to make an asynchronous call into a synchronous one. Its a
>> question that has been asked many times, and the answer is - don't try to do
>> it.  Read the document at 
>> -http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication...
>> more details on this subject.
>>
>> --Sri
>>
>> 2009/9/13 Angel 
>>
>>
>>
>>
>>
>> > I have this code, which sends a call to the server. This call takes a
>> > few seconds to complete.
>> > I should not run System.out.println until the call ends.
>>
>> > I do this? How I wait for the server?
>> > thanks
>>
>> > [CODE]
>> > String value="nothing";
>> > BDServiceAsync service = GWT.create(BDService.class);
>> >        service.myCall("text", new AsyncCallback>(){
>>
>> >                public void onFailure(Throwable caught) {
>>
>> >                }
>>
>> >                public void onSuccess(Map result) {
>> >                        // This takes a few seconds to complete.
>> >                                        value="hola";
>>
>> >                }
>> >        });
>>
>> > // should wait for the call to the server
>> > System.out.println("value="+value);
>>
>> > [/CODE]
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Wait for server call

2009-09-14 Thread Angel

Sorry, I will relaunch the question

[CODE]

// At this point I built the user interface.
// I have a combo and others elements...
Map comboValues = new Map()


BDServiceAsync service = GWT.create(BDService.class);
service.fillCombo("text", new AsyncCallback>
(){
public void onFailure(Throwable caught) {
}
public void onSuccess(Map result) {
// I access to the database for data. to get de
combo values.
comboValues = result;
}
});
// should wait for the call to the server
combo.setValues(comboValues);
// the flow continues

[/CODE]

Sorry for my english!

On Sep 14, 6:05 am, Sripathi Krishnan 
wrote:
> Simplest answer - put the System.out.println() within the onSuccess() method
> -:)
>
> Longer answer -
> You are trying to make an asynchronous call into a synchronous one. Its a
> question that has been asked many times, and the answer is - don't try to do
> it.  Read the document at 
> -http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication...
> more details on this subject.
>
> --Sri
>
> 2009/9/13 Angel 
>
>
>
>
>
> > I have this code, which sends a call to the server. This call takes a
> > few seconds to complete.
> > I should not run System.out.println until the call ends.
>
> > I do this? How I wait for the server?
> > thanks
>
> > [CODE]
> > String value="nothing";
> > BDServiceAsync service = GWT.create(BDService.class);
> >        service.myCall("text", new AsyncCallback>(){
>
> >                public void onFailure(Throwable caught) {
>
> >                }
>
> >                public void onSuccess(Map result) {
> >                        // This takes a few seconds to complete.
> >                                        value="hola";
>
> >                }
> >        });
>
> > // should wait for the call to the server
> > System.out.println("value="+value);
>
> > [/CODE]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Wait for server call

2009-09-13 Thread Paul Robinson

I don't think this has been mentioned for a while...the great
asynchronous beer story :)
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/faca1575f306ba0f

Sripathi Krishnan wrote:
> Simplest answer - put the System.out.println() within the onSuccess()
> method -:)
>
> Longer answer -
> You are trying to make an asynchronous call into a synchronous one.
> Its a question that has been asked many times, and the answer is -
> don't try to do it.  Read the document at -
> http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication.html#DevGuideGettingUsedToAsyncCalls
> for more details on this subject.
>
>
> --Sri
>
>
> 2009/9/13 Angel  >
>
>
> I have this code, which sends a call to the server. This call takes a
> few seconds to complete.
> I should not run System.out.println until the call ends.
>
>
> I do this? How I wait for the server?
> thanks
>
> [CODE]
> String value="nothing";
> BDServiceAsync service = GWT.create(BDService.class);
>service.myCall("text", new AsyncCallback>(){
>
>public void onFailure(Throwable caught) {
>
>}
>
>public void onSuccess(Map result) {
>// This takes a few seconds to complete.
>value="hola";
>
>
>}
>});
>
> // should wait for the call to the server
> System.out.println("value="+value);
>
> [/CODE]
>
>
>
>
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Wait for server call

2009-09-13 Thread Sripathi Krishnan
Simplest answer - put the System.out.println() within the onSuccess() method
-:)

Longer answer -
You are trying to make an asynchronous call into a synchronous one. Its a
question that has been asked many times, and the answer is - don't try to do
it.  Read the document at -
http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication.html#DevGuideGettingUsedToAsyncCallsfor
more details on this subject.


--Sri


2009/9/13 Angel 

>
> I have this code, which sends a call to the server. This call takes a
> few seconds to complete.
> I should not run System.out.println until the call ends.
>
>
> I do this? How I wait for the server?
> thanks
>
> [CODE]
> String value="nothing";
> BDServiceAsync service = GWT.create(BDService.class);
>service.myCall("text", new AsyncCallback>(){
>
>public void onFailure(Throwable caught) {
>
>}
>
>public void onSuccess(Map result) {
>// This takes a few seconds to complete.
>value="hola";
>
>
>}
>});
>
> // should wait for the call to the server
> System.out.println("value="+value);
>
> [/CODE]
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Wait for server call

2009-09-13 Thread Angel

I have this code, which sends a call to the server. This call takes a
few seconds to complete.
I should not run System.out.println until the call ends.


I do this? How I wait for the server?
thanks

[CODE]
String value="nothing";
BDServiceAsync service = GWT.create(BDService.class);
service.myCall("text", new AsyncCallback>(){

public void onFailure(Throwable caught) {

}

public void onSuccess(Map result) {
// This takes a few seconds to complete.
value="hola";


}
});

// should wait for the call to the server
System.out.println("value="+value);

[/CODE]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---