Jens,

thanks a lot! I was also reading this:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/a58c31280fc8a537
and had some similar idea like yours; only using an interface instead
of the abstract ``PhotoPlace``.

But was I was wondering about while reading the thread above: we have
lots of ``PlaceTokenizer``, all without a Prefix annotation. How does
it come this works?

$ ack --type=java --ignore-dir=target --ignore-dir=test 'implements
PlaceTokenizer' . -B1
vz-gwt-main/src/main/java/net/vz/studivz/mobile/client/places/
StartPlace.java
17-
18:    public static class Tokenizer implements
PlaceTokenizer<StartPlace> {

vz-gwt-widgets/src/main/java/net/vz/common/widgets/client/places/
AdExamplePlace.java
20-
21:    public static class Tokenizer implements
PlaceTokenizer<AdExamplePlace> {

vz-gwt-widgets/src/main/java/net/vz/common/widgets/client/places/
BoardMessageCreatePlace.java
42-
43:    public static class Tokenizer implements
PlaceTokenizer<BoardMessageCreatePlace> {

vz-gwt-widgets/src/main/java/net/vz/common/widgets/client/places/
BoardPlace.java
25-
26:    public static class Tokenizer implements
PlaceTokenizer<BoardPlace> {
...

Cheers :) Andi



On 11 Jul., 16:51, Jens <[email protected]> wrote:
> If you add "-gen <path/folder>" to your compiler args (or to dev mode args)
> you can see what GWT generates for you. That often helps to understand whats
> going on under the hood. If I remember correctly GWT generates a
> PlaceHistoryMapper for you that contains a long if - else if - else if ....
> - else block which checks all the prefixes you have defined in your
> tokenizers against the prefix in the url and then uses the corresponding
> tokenizer. If you have two tokenizer with the same prefix the code generator
> does not know which tokenizer to use for a given url.
>
> In your case you would just have a single PhotoPlace (with its
> PhotoPlaceTokenizer) whose tokens would be AlbumList and Detail. In your
> ActivityMapper you could return different activities based on the token.
> Alternatively you can create an abstract PhotoPlace and let PhotoDetailPlace
> and PhotoAlbumListPlace extend from it. Then create a PhotoPlaceTokenizer
> that extends Tokenizer<PhotoPlace> and you are now in charge of both places
> in the same Tokenizer. That way you have moved some logic from
> ActivityMapper into the Tokenizer (basically the if that dispatches the
> token to return the correct activity will now return the correct place based
> on the token).
>
> -- J.

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

Reply via email to