public class OwnRouteTokenFormatter extends Object implements com.gwtplatform.mvp.shared.proxy.TokenFormatter
TokenFormatter with support for route like place names.
Instead of wiring a hierarchy of several places bound to multiple presenters this implements a flat structure where every history token is bound to a single presenter.
Usage:
Replace the default binding to ParameterTokenFormatter with
OwnRouteTokenFormatter. In case you use GWTPs
DefaultModule:
install(new DefaultModule(DefaultPlaceManager.class, RouteTokenFormatter.class));
Now all @NameToken's are treated as routes. Routes are expected to start with an '/' and can contain path parameters as well as query parameters.
@NameToken("/user/{userId}/privacy") // Token for PrivacyPresenter@NameToken("/user/{userId}/privacy/profile") // Token for PrivacyProfilePresenter@NameToken("/user/{userId}/privacy/photos") // Token for PrivacyPhotosPresenter
Static-parts of an route tie stronger than parameter-parts. This way following works:
@NameToken("/{vanityId}") // Token for VanityUrlPresenter@NameToken("/privacy") // Token for PrivacyPresenter
Note: For the moment this is implemented on top of the hierarchical-place API to not an big structural changes prior 1.0 release.
| Modifier and Type | Method and Description |
|---|---|
String |
toHistoryToken(List<com.gwtplatform.mvp.shared.proxy.PlaceRequest> placeRequestHierarchy) |
com.gwtplatform.mvp.shared.proxy.PlaceRequest |
toPlaceRequest(String placeToken) |
List<com.gwtplatform.mvp.shared.proxy.PlaceRequest> |
toPlaceRequestHierarchy(String historyToken) |
String |
toPlaceToken(com.gwtplatform.mvp.shared.proxy.PlaceRequest placeRequest) |
public String toPlaceToken(com.gwtplatform.mvp.shared.proxy.PlaceRequest placeRequest) throws com.gwtplatform.mvp.shared.proxy.TokenFormatException
toPlaceToken in interface com.gwtplatform.mvp.shared.proxy.TokenFormattercom.gwtplatform.mvp.shared.proxy.TokenFormatExceptionpublic String toHistoryToken(List<com.gwtplatform.mvp.shared.proxy.PlaceRequest> placeRequestHierarchy) throws com.gwtplatform.mvp.shared.proxy.TokenFormatException
toHistoryToken in interface com.gwtplatform.mvp.shared.proxy.TokenFormattercom.gwtplatform.mvp.shared.proxy.TokenFormatExceptionpublic com.gwtplatform.mvp.shared.proxy.PlaceRequest toPlaceRequest(String placeToken) throws com.gwtplatform.mvp.shared.proxy.TokenFormatException
toPlaceRequest in interface com.gwtplatform.mvp.shared.proxy.TokenFormattercom.gwtplatform.mvp.shared.proxy.TokenFormatExceptionpublic List<com.gwtplatform.mvp.shared.proxy.PlaceRequest> toPlaceRequestHierarchy(String historyToken) throws com.gwtplatform.mvp.shared.proxy.TokenFormatException
toPlaceRequestHierarchy in interface com.gwtplatform.mvp.shared.proxy.TokenFormattercom.gwtplatform.mvp.shared.proxy.TokenFormatExceptionCopyright © 2015–2019. All rights reserved.