com.google.gwt.place.shared.PlaceTokenizer Java Examples
The following examples show how to use
com.google.gwt.place.shared.PlaceTokenizer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MvpController.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private Place getSimplePlace(String token) { int colonAt = token.indexOf(MvpController.PLACE_TOKEN_SEPARATOR); String prefix = token; String rest = null; if (colonAt > 0) { prefix = token.substring(0, colonAt); rest = token.substring(colonAt + 1); } if (!prefix.startsWith(MvpController.PLACE_CROWLER_DELIMITER)) { prefix = MvpController.PLACE_CROWLER_DELIMITER + prefix; } ActivityFactory activityFactory = this.activityFactories.get(prefix); if (activityFactory instanceof PlaceTokenizer) { return ((PlaceTokenizer) activityFactory).getPlace(rest); } return null; }
Example #2
Source File: PlaceHistoryMapperImpl.java From lumongo with Apache License 2.0 | 6 votes |
@Override public Place getPlace(String token) { int separatorAt = token.indexOf(':'); String prefix; String rest; if (separatorAt >= 0) { prefix = token.substring(0, separatorAt); rest = token.substring(separatorAt + 1); } else { prefix = token; rest = null; } PlaceTokenizer<?> tokenizer = tokenizersByPrefix.get(prefix); if (tokenizer != null) { return tokenizer.getPlace(rest); } return null; }
Example #3
Source File: MvpController.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public String getToken(Place place) { if (place == null) { return null; } String parentToken = null; if (place instanceof ViewPlace && ((ViewPlace) place).getParent() != null) { parentToken = this.getToken(((ViewPlace) place).getParent()); } String prefix = MvpUtils.getPlacePrefix(place); String token = null; ActivityFactory activityFactory = this.activityFactories.get(prefix); if (activityFactory instanceof PlaceTokenizer) { token = ((PlaceTokenizer) activityFactory).getToken(place); } String result = ""; if (parentToken != null) { result = parentToken + MvpController.PLACE_SEPARATOR; if (prefix.startsWith("!")) { prefix = prefix.substring(1); } } if (token != null) { result += prefix.length() == 0 ? token : prefix + MvpController.PLACE_TOKEN_SEPARATOR + token; } else { result += prefix; } return result; }
Example #4
Source File: ProxyViewCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
public ProxyViewCreator(JClassType placeType) { this.placeType = placeType; this.packageName = this.placeType.getPackage().getName(); String qualifiedName = this.placeType.getQualifiedSourceName() + ProxyViewCreator.PROXY_SUFFIX; this.viewProxyQualifiedName = qualifiedName.replace(placeType.getName(), placeType.getName().replace('.', '_')); this.viewProxySimpleName = this.viewProxyQualifiedName.replace(this.packageName + ".", ""); this.activityDescrition = placeType.getAnnotation(ActivityDescription.class); this.placeTokenizerClass = this.activityDescrition.placeTokenizer(); if (PlaceTokenizer.class.equals(this.placeTokenizerClass)) { this.placeTokenizerClass = null; this.getClass(); try { Class<? extends ViewPlace> placeClass = (Class<? extends ViewPlace>) Class.forName(this.placeType.getQualifiedSourceName()); for (Class<?> inter : placeClass.getInterfaces()) { if (inter.equals(PlaceTokenizer.class)) { this.placeTokenizerClass = (Class<? extends PlaceTokenizer<?>>) placeClass; } } } catch (ClassNotFoundException e) { this.placeTokenizerClass = null; } } this.viewDecoratorClass = this.activityDescrition.viewDecorator(); if (ViewDecorator.class.equals(this.viewDecoratorClass)) { this.viewDecoratorClass = null; } }
Example #5
Source File: PlaceHistoryMapperImpl.java From lumongo with Apache License 2.0 | 5 votes |
public PlaceHistoryMapperImpl addPlace(PlacePojo placePojo) { String prefix = placePojo.getPrefix(); PlaceTokenizer<Place> tokenizer = (PlaceTokenizer<Place>) placePojo.getTokenizer(); Class<?> placeClass = (Class<?>) placePojo.getPlaceClass(); tokenizersByPrefix.put(prefix, tokenizer); tokenizersByPlace.put(placeClass, tokenizer); prefixesByPlace.put(placeClass, prefix); return this; }
Example #6
Source File: PlaceHistoryMapperImpl.java From lumongo with Apache License 2.0 | 5 votes |
@Override public String getToken(Place place) { PlaceTokenizer<Place> placeTokenizer = tokenizersByPlace.get(place.getClass()); String token = prefixesByPlace.get(place.getClass()); String rest = placeTokenizer.getToken(place); if (rest != null && rest.trim().length() > 0) token += ":" + rest; return token; }
Example #7
Source File: PlacePojo.java From lumongo with Apache License 2.0 | 4 votes |
public PlacePojo(String prefix, PlaceTokenizer<T> tokenizer, Class<T> placeClass) { this.prefix = prefix; this.tokenizer = tokenizer; this.placeClass = placeClass; }
Example #8
Source File: PlacePojo.java From lumongo with Apache License 2.0 | 4 votes |
public PlaceTokenizer<? extends Place> getTokenizer() { return tokenizer; }