Aw: Re: Issue in method anonymous class in GWT

2011-06-07 Thread Jens


You only have a problem if you use GWT.runAsync in your method. If so, 
everything that is inside the RunAsyncCallback.onSuccess method will be 
downloaded as a separate javascript file once your app reaches this point. 
The download will happen in parallel/async in production mode. In dev mode 
you won't see a difference as it will be executed synchronous.


Basically if you take my previous example and wrap the Label creation and 
the label.setText() call into a GWT.runAsync it can happen that onModuleLoad 
finishes and later on the additional code download finishes and the 
onSuccess method is called. Thus onSuccess gets called after onModuleLoad 
finishes. That would result in:


onModuleLoad(): started

onModuleLoad(): finished

Label.setText(): hello world


-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ZmxSUFF5ejlGem9K.
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.



Aw: Re: Issue in method anonymous class in GWT

2011-05-24 Thread Jens
No I assumed you call your model.setRecords() method inside the model() 
method (because thats the only place where you can call it). So in my 
example the call label.setText() would by the model.setRecords() call in 
your example. 

It has to be executed in order. Just imagine your anonymous inner class has 
a getter and possibly does some calculations that have to be done and the 
result of that calculation is used in you outer model() method. Java and 
GWT's Java - Javascript compiler can not rearrange that flow because it 
would easily result in broken code. Using GWT.runAsync or Scheduler.get() in 
your model() method would be the only way to break this flow.


-- 
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.



Aw: Re: Issue in method anonymous class in GWT

2011-05-23 Thread Jens
Maybe I don't get it right but in an entrypoint class:

@Override

public void onModuleLoad() {

System.out.println(onModuleLoad(): started);

Label label = new Label() {

@Override

public void setText(final String text) {

System.out.println(Label.setText():  + text);

super.setText(text);

}

};

label.setText(hello world);

System.out.println(onModuleLoad(): finished);

}


will print to console (at least in GWT dev mode, don't want to compile it 
now):


onModuleLoad(): started

Label.setText(): hello world

onModuleLoad(): finished


Isn't this the same code structure as yours? If so it should work. If not 
you probably missed something in your code example.

-- 
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.