import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
public class BasicPlace extends Place {
public class BasicPlaceTokenizer implements PlaceTokenizer
{
// Instance of a BasicPlace that will be returned
// for a null token
private BasicPlace place;
// Init this tokenizer with a subclass of BasicPlace
public BasicPlaceTokenizer(BasicPlace basicPlace) {
this.place = basicPlace;
}
@Override
public Place getPlace(String token) {
return this.place;
}
@Override
public String getToken(Place place) {
// BasicPlaces have no state so we can always
// return null. By default, GWT creates a
// URL containing the class name of the Place
// so we don't have to worry about that part.
return null;
}
}
}
Along with this, you'll have to use a TokenizerFactory which provides
a method to obtain the BasicPlaceTokenizer for each sub-class,
something like this:
PlaceTokenizer<MyBasicPlaceSubclass> getMySubclassPlaceTokenizer()
{
return new BasicPlaceTokenizer(new MyBasicPlaceSubclass());
}
In retrospect, BasicPlace likely doesn't buy you much. It's probably
just as easy to create a PlaceTokenizer for each Place in your app as
shown in the article.
/dmc
> --
> 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-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
David Chandler
Developer Programs Engineer, Google Web Toolkit
http://googlewebtoolkit.blogspot.com/
On 13 Tháng Mười Một, 00:12, David Chandler <drfibona...@google.com>
wrote: