private <C> void navigate(final PageNode<C> toPageInstance) { navigate(toPageInstance, ImmutableListMultimap.<String, String> of()); }
private <C> void navigate(final PageNode<C> toPageInstance) { navigate(toPageInstance, ImmutableListMultimap.<String, String> of()); }
private <C> void handleQueuedRequests(final Request<C> request, final boolean fireEvent) { if (queuedRequests.isEmpty()) { // No new navigation requests were recorded in the lifecycle methods. // This is the page which has to be displayed and the browser's history // can be updated. redirectDepth = 0; HistoryWrapper.newItem(request.state.toString(), fireEvent); } else { // Process all navigation requests captured in the lifecycle methods. while (queuedRequests.size() != 0) { navigate(queuedRequests.poll(), fireEvent); } } }
private <C> void handleQueuedRequests(final Request<C> request, final boolean fireEvent) { if (queuedRequests.isEmpty()) { // No new navigation requests were recorded in the lifecycle methods. // This is the page which has to be displayed and the browser's history // can be updated. redirectDepth = 0; HistoryWrapper.newItem(request.state.toString(), fireEvent); } else { // Process all navigation requests captured in the lifecycle methods. while (queuedRequests.size() != 0) { navigate(queuedRequests.poll(), fireEvent); } } }
/** * Same as {@link #goTo(Class, Multimap)} but then with the page name. * * @param toPage * the name of the page node to lookup and display. */ public void goTo(final String toPage) { PageNode<?> toPageInstance = null; try { toPageInstance = navGraph.getPage(toPage); navigate(toPageInstance); } catch (final RedirectLoopException e) { throw e; } catch (final RuntimeException e) { navigationErrorHandler.handleInvalidPageNameError(e, toPage); } }
/** * Looks up the PageNode instance of the page that has the unique role set and makes the widget visible in the content * area. * * @param role * The unique role of the page that needs to be displayed. */ public void goToWithRole(final Class<? extends UniquePageRole> role) { PageNode<?> toPageInstance = null; try { toPageInstance = navGraph.getPageByRole(role); navigate(toPageInstance); } catch (final RedirectLoopException e) { throw e; } catch (final RuntimeException e) { navigationErrorHandler.handleError(e, role); } }
/** * Same as {@link #goTo(Class, Multimap)} but then with the page name. * * @param toPage * the name of the page node to lookup and display. */ public void goTo(final String toPage) { PageNode<?> toPageInstance = null; try { toPageInstance = navGraph.getPage(toPage); navigate(toPageInstance); } catch (final RedirectLoopException e) { throw e; } catch (final RuntimeException e) { navigationErrorHandler.handleInvalidPageNameError(e, toPage); } }
/** * Looks up the PageNode instance of the page that has the unique role set and makes the widget visible in the content * area. * * @param role * The unique role of the page that needs to be displayed. */ public void goToWithRole(final Class<? extends UniquePageRole> role) { PageNode<?> toPageInstance = null; try { toPageInstance = navGraph.getPageByRole(role); navigate(toPageInstance); } catch (final RedirectLoopException e) { throw e; } catch (final RuntimeException e) { navigationErrorHandler.handleError(e, role); } }
private <C> void navigate(final PageNode<C> toPageInstance, final Multimap<String, String> state) { final HistoryToken token = historyTokenFactory.createHistoryToken(toPageInstance.name(), state); logger.debug("Navigating to " + toPageInstance.name() + " at url: " + token.toString()); navigate(new Request<>(toPageInstance, token), true); }
private <C> void navigate(final PageNode<C> toPageInstance, final Multimap<String, String> state) { final HistoryToken token = historyTokenFactory.createHistoryToken(toPageInstance.name(), state); logger.debug("Navigating to " + toPageInstance.name() + " at url: " + token.toString()); navigate(new Request<>(toPageInstance, token), true); }
/** * Looks up the PageNode instance that provides content for the given widget type, sets the state on that page, then * makes the widget visible in the content area. * * @param toPage * The content type of the page node to look up and display. Normally, this is a Widget subclass that has * been annotated with {@code @Page}. * @param state * The state information to set on the page node before showing it. Normally the map keys correspond with the * names of fields annotated with {@code @PageState} in the widget class, but this is not required. */ public <C> void goTo(final Class<C> toPage, final Multimap<String, String> state) { PageNode<C> toPageInstance = null; try { toPageInstance = navGraph.getPage(toPage); navigate(toPageInstance, state); } catch (final RedirectLoopException e) { throw e; } catch (final RuntimeException e) { if (toPageInstance == null) // This is an extremely unlikely case, so throwing an exception is preferable to going through the navigation error handler. throw new PageNotFoundException("There is no page of type " + toPage.getName() + " in the navigation graph."); else navigationErrorHandler.handleInvalidPageNameError(e, toPageInstance.name()); } }
/** * Looks up the PageNode instance that provides content for the given widget type, sets the state on that page, then * makes the widget visible in the content area. * * @param toPage * The content type of the page node to look up and display. Normally, this is a Widget subclass that has * been annotated with {@code @Page}. * @param state * The state information to set on the page node before showing it. Normally the map keys correspond with the * names of fields annotated with {@code @PageState} in the widget class, but this is not required. */ public <C> void goTo(final Class<C> toPage, final Multimap<String, String> state) { PageNode<C> toPageInstance = null; try { toPageInstance = navGraph.getPage(toPage); navigate(toPageInstance, state); } catch (final RedirectLoopException e) { throw e; } catch (final RuntimeException e) { if (toPageInstance == null) // This is an extremely unlikely case, so throwing an exception is preferable to going through the navigation error handler. throw new PageNotFoundException("There is no page of type " + toPage.getName() + " in the navigation graph."); else navigationErrorHandler.handleInvalidPageNameError(e, toPageInstance.name()); } }