/** * Returns a {@link NavigationState} object representing the URI for the {@code node} * * @param node * @return */ @Override public synchronized NavigationState navigationState(T node) { return uriHandler.navigationState(uri(node)); }
/** * This appears a bit circular, but the {@link URIFragmentHandler} sets the rules for how fragments are constructed. Updates according to whether * {@link #fragmentChanged} or {@link #partsChanged} is true. If both are true, {@link #fragmentChanged} takes precedence * * @param handler the fragment handler used to make the update * @return this for fluency */ public void update(URIFragmentHandler handler) { updateInProgress = true; if (fragmentChanged) { handler.updateParts(this); } else { if (partsChanged) { handler.updateFragment(this); } } log.debug("State has not been changed, no update needed"); }
uriHandler.updateFragment(navigationState); .isEmpty()) { navigationState.virtualPage(userSitemap.standardPageURI(StandardPageKey.Public_Home)); uriHandler.updateFragment(navigationState);
uriHandler.updateFragment(navigationState); log.debug("Navigating to navigation state: {}", navigationState.getFragment()); .isEmpty()) { navigationState.virtualPage(userSitemap.standardPageURI(StandardPageKey.Public_Home)); uriHandler.updateFragment(navigationState);
@Override public Optional<NavigationState> changedNavigationState(Navigator navigator, UserStatusChangeSource source) { return Optional.of(uriFragmentHandler.navigationState(userSitemap.standardPageURI(StandardPageKey.Log_Out))); } }
/** * This appears a bit circular, but the {@link URIFragmentHandler} sets the rules for how fragments are constructed. Updates according to whether * {@link #fragmentChanged} or {@link #partsChanged} is true. If both are true, {@link #fragmentChanged} takes precedence * * @param handler the fragment handler used to make the update * @return this for fluency */ public void update(URIFragmentHandler handler) { updateInProgress = true; if (fragmentChanged) { handler.updateParts(this); } else { if (partsChanged) { handler.updateFragment(this); } } log.debug("State has not been changed, no update needed"); }
/** * Returns a {@link NavigationState} object representing the URI for the {@code node} * * @param node * @return */ @Override public synchronized NavigationState navigationState(T node) { return uriHandler.navigationState(uri(node)); }
/** * Returns true if the sitemap contains {@code uri}. Only the virtual page part of the URI is used, parameters are * ignored * * @param uri * @return */ @Override public synchronized boolean hasUri(String uri) { NavigationState navigationState = uriHandler.navigationState(uri); return hasUri(navigationState); }
/** * Returns the {@link SitemapNode} associated with {@code uri}, or the closest available if one cannot be found for * the full URI. "Closest" means the node which matches the most segments of the URI. Returns null if no match at * all is found * * @param uri * @return */ @Override public synchronized T nodeNearestFor(String uri) { return nodeNearestFor(uriHandler.navigationState(uri)); }
/** * Returns the {@link SitemapNode} associated with {@code uri}, or null if none found * * @param uri * @return */ @Override public synchronized T nodeFor(String uri) { return uriMap.get(uriHandler.navigationState(uri) .getVirtualPage()); }
/** * Returns the {@link SitemapNode} associated with {@code uri}, or the closest available if one cannot be found for * the full URI. "Closest" means the node which matches the most segments of the URI. Returns null if no match at * all is found * * @param uri * @return */ @Override public synchronized T nodeNearestFor(String uri) { return nodeNearestFor(uriHandler.navigationState(uri)); }
/** * Returns the {@link SitemapNode} associated with {@code uri}, or null if none found * * @param uri * @return */ @Override public synchronized T nodeFor(String uri) { return uriMap.get(uriHandler.navigationState(uri) .getVirtualPage()); }
/** * Takes a URI fragment, checks for any redirects defined by the {@link Sitemap}, then calls * {@link #navigateTo(NavigationState)} to change the view * * @see Navigator#navigateTo(java.lang.String) */ @Override public void navigateTo(String fragment) { log.debug("Navigating to fragment: {}", fragment); // set up the navigation state NavigationState navigationState = uriHandler.navigationState(fragment); navigateTo(navigationState); }
@Override public Optional<NavigationState> changedNavigationState(Navigator navigator, UserStatusChangeSource source) { return Optional.of(uriFragmentHandler.navigationState(userSitemap.standardPageURI(StandardPageKey.Log_Out))); } }
/** * Returns true if the sitemap contains {@code uri}. Only the virtual page part of the URI is used, parameters are * ignored * * @param uri * @return */ @Override public synchronized boolean hasUri(String uri) { NavigationState navigationState = uriHandler.navigationState(uri); return hasUri(navigationState); }
/** * returns a list of {@link SitemapNode} matching the virtual page of the {@code navigationState} provided. Uses * the * {@link URIFragmentHandler} to get URI path segments and {@link Sitemap} to obtain the node chain. * {@code allowPartialPath} determines how a partial match is handled (see * {@link Sitemap#nodeChainForSegments(List, boolean)} javadoc * * @param uri * @return */ @Override public synchronized List<T> nodeChainForUri(String uri, boolean allowPartialPath) { return nodeChainFor(uriHandler.navigationState(uri), allowPartialPath); }
/** * returns a list of {@link SitemapNode} matching the virtual page of the {@code navigationState} provided. Uses * the * {@link URIFragmentHandler} to get URI path segments and {@link Sitemap} to obtain the node chain. * {@code allowPartialPath} determines how a partial match is handled (see * {@link Sitemap#nodeChainForSegments(List, boolean)} javadoc * * @param uri * @return */ @Override public synchronized List<T> nodeChainForUri(String uri, boolean allowPartialPath) { return nodeChainFor(uriHandler.navigationState(uri), allowPartialPath); }
/** * Takes a URI fragment, checks for any redirects defined by the {@link Sitemap}, then calls * {@link #navigateTo(NavigationState)} to change the view * * @see Navigator#navigateTo(java.lang.String) */ @Override public void navigateTo(String fragment) { log.debug("Navigating to fragment: {}", fragment); publishPageLoadingMessage(); // set up the navigation state NavigationState navigationState = uriHandler.navigationState(fragment); navigateTo(navigationState); }
/** * Replaces uriFragmentChanged. This was required by Vaadin 8, as the {@link Page.PopStateEvent} returns the full uri as a String, whereas its predecessor returned only the fragment * * @param event */ @Override public void uriChanged(Page.PopStateEvent event) { log.debug("URI change received from Vaadin Page, with event.uri = {}", event.getUri()); URI uri = URI.create(event.getUri()); NavigationState navigationState = uriHandler.navigationState(uri); navigateTo(navigationState); }
@Override public void error(Throwable error) { log.debug("A {} Error has been thrown, reporting via the Error View", error.getClass() .getName()); NavigationState navigationState = uriHandler.navigationState("error"); ViewChangeBusMessage viewChangeBusMessage = new ViewChangeBusMessage(previousNavigationState, navigationState); ErrorView view = viewFactory.get(ErrorView.class); view.setError(error); changeView(view, viewChangeBusMessage); }