Saturday, March 24, 2012

Re: attempting to understand PlaceTokenizer

Have a look there: http://tbroyer.posterous.com/gwt-21-places-part-ii

On Thursday, March 22, 2012 6:04:52 PM UTC+1, Thad wrote:

I am trying to understand Places, PlaceTokenizer, and how and when to parse the token. I read about them, look at examples, watch there execution, and still I think I'm missing something. (The examples I follow seem not to fit me--they seem either trivial or too complex to follow.)


I have a Place, MyPlace. It may get a null token, or it may get a token with one or more items--state, id, etc. Examples would be "LIST" or "SHOW_ID;1234". I read from Thomas that "parsing should be done in a PlaceTokenizer" (https://groups.google.com/d/​msg/google-web-toolkit/M5jCI-_​95mQ/JJcClisInRoJ). However if when I do my parsing in MyPlace.Tokenizer.getToken(), the MyPlace that is passed to MyActivity contains the previous values for state and id. My trace looks like


instantiate MyPlace(LIST)

AppActivityMapper.getActivity(​): com.foo.bar.client.place.​MyPlace@be4139

instantiate MyActivity, place: com.foo.bar.client.place.​MyPlace@be4139

starting MyActivity

MyView presenter set


It seems that the instantiation method for MyPlace must parse the token or calls to place.getState() and place.getId() will return values no yet set.


I can see MyPlace.Tokenizer.getToken() being called--though I'm not sure from where--but place.getState() does not return an updated value unless in start() wait with Scheduler.get().​scheduleDeferred() and test the value in execute().


I never see MyPlace.Tokenizer.getPlace() called. What is it used for? *WHEN* is it used (never from what I see).


Currently I'm parsing the token in MyPlace's instantiation method, but it doesn't feel right.


Can anyone clarify this for me?

--
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/-/eCoVZwfGr_8J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment