Thanks for your reply :)

Yeah sure, my Views are already Singleton (maybe someone could tell me
what's the difference using Gin @Singleton or .in(Singleton.class) ?!)
And my Presenters/Activities are Singleton, too.

After reading your thoughts, I'd say, that my Places could be
Singleton, too. 'Cause my menu doesn't allow switching from Place A to
Place A, but they're so small. I think I'll leave them as separate
Objects 'til someone says that it's safe in all cases.


Can you tell me 'how' to use these Place tokens? Are they meant to be
some kind of variables? (like x.html?var=value)? If that's true, I
hope that Google implemented some methods to easily safe and restore
variables and values...



On 12 Okt., 23:34, Jens <jens.nehlme...@gmail.com> wrote:
> Hi,
>
> 1.) The url hash fragment (everything after "#") is by default defined as
> <prefix>:<token>. The prefix can be changed by using the @Prefix annotation
> on your PlaceTokenizers. If you do not use the @Prefix annotation the places
> class name will be used by default (thats what you currently have). Keep in
> mind that the names you provide with the help of the @Prefix annotation must
> be unique.
>
> 2.) You should make your views singleton as they are expensive to construct
> because of DOM operations. An activity is a pretty lightweight class you its
> fine if you recreate it. But of course you could make them also singleton.
>
> 3.) I think places can't be singletons but I am not quite sure about it. My
> first thought ist that PlaceController stores the current place and when you
> call PlaceController.goTo(newPlace) the new place will be compared to the
> current one using equals(). If they are equal nothing will happen.
> If you have singletons and you switch between totally different places
> everything will be fine but if you want to switch between same places with
> different internal states you got a problem because they will always be
> equal. For each place you only have one singleton instance thus you only
> have one state. You can't have a current state and a new state for the same
> place instance (e.g. you are at PlaceA(null) and you want to switch to
> PlaceA(stateValue)).
> Places are pretty small and easy classes, so just create new ones as you
> need them.
>
> -- 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 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.

Reply via email to