Navigation
Linking Places to a Token
Some presenters can be associated to a specific URL. GWTP makes it possible by managing the hash section of the URL. This is whatever comes after the "#" (ie: in http://www.example.com/#/cars
, the hash is /cars
).
Prepare the presenter
In order for a presenter to be a place, a regular Presenter with a proxy has to be created first. From there the following changes are required:
The super-interface has to be changed to
ProxyPlace
;It has to be annotated with
@NameToken("a-unique-token")
. It is possible to configure more than one name token on a single presenter by passing more than one argument to@NameToken
.
Notice that the name token is not hard-coded. Instead the value is extracted to another class named NameTokens
. This is to facilitate reusability and maintainability of name tokens across the application:
Last updated
Was this helpful?