Sunday, March 25, 2012

Re: attempting to understand PlaceTokenizer

Thanks, Thomas.  I had read this before, but it hadn't clicked with me.  I see now that MyPlace.Tokenizer.getPlace() is called on the back and forward arrows. 

After much re-reading, I believe that I've been over-thinking this. There doesn't seem to be any place in my current app where getToken() and getPlace() need to do anything more complex than acting on the token--just return or create a new place with it, no parsing, no rebuilding necessary. I'm trying to imagine doing something else, and I don't see it. 

However, I suppose it's possible to "fool" the history by altering the token such that the back button takes you somewhere else entirely. Is this correct?

On Saturday, March 24, 2012 6:22:43 AM UTC-4, Thomas Broyer wrote:
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/-/AmJ2qscr2RgJ.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate