@EntryPoint public class Bootstrap { @Inject Navigation navigation; @PostConstruct public void buildUI() { navigation.getContentPanel().setWidth("100%"); navigation.getContentPanel().setHeight("100%"); RootPanel.get().add(navigation.getContentPanel()); } }
@Override public void callback(Navigation navigation) { navigation.goTo(toPageWidgetType, state); } });
@Override public void callback(final Navigation navigation) { navigation.goToWithRole(uniquePageRole); } });
private Class<?> getCurrentPage() { if (navigation.getCurrentPage() != null) { return navigation.getCurrentPage().contentType(); } else { // Guaranteed to exist at compile-time. return navigation.getPagesByRole(DefaultPage.class).iterator().next().contentType(); } }
maybeAttachContentPanel(); currentPageToken = request.state; if ((unwrappedComponent instanceof Composite) && (getCompositeWidget((Composite) unwrappedComponent) == null)) { final HandlerRegistration reg = widget.addAttachHandler(new Handler() { @Override pageHiding(unwrappedComponent, widget, request, fireEvent);
/** * Gets the application context used in pushstate URL paths. This application context should match the deployed * application context in your web.xml * * @return The application context. This may return the empty String (but never null). If non-empty, the return value * always starts with a slash and never ends with one. */ public static String getAppContext() { if (PushStateUtil.isPushStateActivated()) return getAppContextFromHostPage(); else return ""; }
private Multimap<String, String> getCurrentPageState() { return navigation.getCurrentState(); }
/** * Returns the URL path for this HistoryToken, that can be parsed by {@link HistoryTokenFactory#parseURL(String)} * <p> * This URL path includes the application context. */ @Override public String toString() { final String url = pattern.printURL(state); final String context = Navigation.getAppContext(); if (!context.isEmpty() && !url.startsWith("/")) { return context + "/" + url; } else { return context + url; } }
@Override public void navigateBackOrHome() { // Guaranteed to exist at compile-time. final PageNode<?> defaultPageNode = navigation.getPagesByRole(DefaultPage.class).iterator().next(); navigateBackOrToPage(defaultPageNode.contentType()); }
/** * Initialize the anchor's href attribute. * * @param toPage * The page type this transition goes to. Not null. * @param state * The page state. Cannot be null (but can be an empty multimap) */ private void initHref(Class<P> toPage, Multimap<String, String> state) { PageNode<P> toPageInstance = navigation.getNavGraph().getPage(toPage); HistoryToken token = htFactory.createHistoryToken(toPageInstance.name(), state); String href = "#" + token.toString(); setHref(href); }
maybeAttachContentPanel(); currentPageToken = request.state; if ((unwrappedComponent instanceof Composite) && (getCompositeWidget((Composite) unwrappedComponent) == null)) { final HandlerRegistration reg = widget.addAttachHandler(new Handler() { @Override pageHiding(unwrappedComponent, widget, request, fireEvent);
private Class<?> getCurrentPage() { if (navigation.getCurrentPage() != null) { return navigation.getCurrentPage().contentType(); } else { // Guaranteed to exist at compile-time. return navigation.getPagesByRole(DefaultPage.class).iterator().next().contentType(); } }
/** * Gets the application context used in pushstate URL paths. This application context should match the deployed * application context in your web.xml * * @return The application context. This may return the empty String (but never null). If non-empty, the return value * always starts with a slash and never ends with one. */ public static String getAppContext() { if (PushStateUtil.isPushStateActivated()) return getAppContextFromHostPage(); else return ""; }
private Multimap<String, String> getCurrentPageState() { return navigation.getCurrentState(); }
/** * Returns the URL path for this HistoryToken, that can be parsed by {@link HistoryTokenFactory#parseURL(String)} * <p> * This URL path includes the application context. */ @Override public String toString() { final String url = pattern.printURL(state); final String context = Navigation.getAppContext(); if (!context.isEmpty() && !url.startsWith("/")) { return context + "/" + url; } else { return context + url; } }
@Override public void navigateBackOrHome() { // Guaranteed to exist at compile-time. final PageNode<?> defaultPageNode = navigation.getPagesByRole(DefaultPage.class).iterator().next(); navigateBackOrToPage(defaultPageNode.contentType()); }
/** * Initialize the anchor's href attribute. * * @param toPage * The page type this transition goes to. Not null. * @param state * The page state. Cannot be null (but can be an empty multimap) */ private void initHref(Class<P> toPage, Multimap<String, String> state) { PageNode<P> toPageInstance = navigation.getNavGraph().getPage(toPage); HistoryToken token = htFactory.createHistoryToken(toPageInstance.name(), state); String href = "#" + token.toString(); setHref(href); }
/** * Programmatically click on the anchor (with alternate page state). * @param state */ public void click(Multimap<String,String> state) { navigation.goTo(toPageWidgetType, state); }
@Override public void callback(final Navigation navigation) { navigation.goToWithRole(uniquePageRole); } });
@Override public NavigationPanel get() { if (!(navigation.getContentPanel() instanceof NavigationPanel)) { throw new RuntimeException("Default navigation panel is not of type: " + NavigationPanel.class.getName() + ". You replaced it with: " + navigation.getContentPanel().getClass().getName()); } return (NavigationPanel) navigation.getContentPanel(); } }