@Override public void revealRelativePlace(final int level) { if (locked) { defferedNavigation = () -> revealRelativePlace(level); return; } if (!getLock()) { return; } placeHierarchy = truncatePlaceHierarchy(level); int hierarchySize = placeHierarchy.size(); if (hierarchySize == 0) { unlock(); revealDefaultPlace(); } else { PlaceRequest request = placeHierarchy.get(hierarchySize - 1); doRevealPlace(request, true); } }
private void handleTokenChange(final String historyToken) { if (locked) { defferedNavigation = () -> handleTokenChange(historyToken); return; } if (!getLock()) { return; } try { if (historyToken.trim().isEmpty()) { unlock(); revealDefaultPlace(); } else { placeHierarchy = tokenFormatter.toPlaceRequestHierarchy(historyToken); doRevealPlace(getCurrentPlaceRequest(), true); } } catch (TokenFormatException e) { unlock(); error(historyToken); NavigationEvent.fire(this, null); } }
@Override public void revealPlaceHierarchy( final List<PlaceRequest> placeRequestHierarchy) { if (locked) { defferedNavigation = () -> revealPlaceHierarchy(placeRequestHierarchy); return; } if (!getLock()) { return; } if (placeRequestHierarchy.size() == 0) { unlock(); revealDefaultPlace(); } else { placeHierarchy = placeRequestHierarchy; doRevealPlace(getCurrentPlaceRequest(), true); } }
/** * Fires the {@link PlaceRequestInternalEvent} for the given {@link PlaceRequest}. Do not call this method directly, * instead call {@link #revealPlace(PlaceRequest)} or a related method. * * @param request The {@link PlaceRequest} to fire. * @param updateBrowserUrl {@code true} If the browser URL should be updated, {@code false} otherwise. */ protected void doRevealPlace(PlaceRequest request, boolean updateBrowserUrl) { PlaceRequestInternalEvent requestEvent = new PlaceRequestInternalEvent(request, updateBrowserUrl); fireEvent(requestEvent); if (!requestEvent.isHandled()) { unlock(); error(tokenFormatter.toHistoryToken(placeHierarchy)); } else if (!requestEvent.isAuthorized()) { unlock(); illegalAccess(tokenFormatter.toHistoryToken(placeHierarchy)); } }