public class Navigation extends Object
Configuration is decentralized: it is based on fields and annotations present in other application classes. This configuration is gathered at compile time.
Page
,
PageState
,
PageShowing
,
PageShown
,
PageHiding
,
PageHidden
Modifier and Type | Field and Description |
---|---|
protected PageNode<com.google.gwt.user.client.ui.IsWidget> |
currentPage |
protected HistoryToken |
currentPageToken |
protected com.google.gwt.user.client.ui.IsWidget |
currentWidget |
Constructor and Description |
---|
Navigation() |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
Public for testability.
|
static String |
getAppContext()
Gets the application context used in pushstate URL paths.
|
com.google.gwt.user.client.ui.IsWidget |
getContentPanel()
Returns the panel that this Navigation object manages.
|
PageNode<com.google.gwt.user.client.ui.IsWidget> |
getCurrentPage()
Return the current page that is being displayed.
|
Collection<PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> |
getPagesByRole(Class<? extends PageRole> pageRole)
Return all PageNode instances that have specified pageRole.
|
<W extends com.google.gwt.user.client.ui.IsWidget> |
goTo(Class<W> toPage,
com.google.common.collect.Multimap<String,String> state)
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.
|
void |
goTo(String toPage)
Same as
goTo(Class, com.google.common.collect.Multimap) but then with the page name. |
void |
goToWithRole(Class<? extends UniquePageRole> role)
Looks up the PageNode instance of the page that has the unique role set and makes the widget visible in the content
area.
|
protected String |
inferAppContext(String url) |
static void |
setAppContext(String path)
Sets the application context used in pushstate URL paths.
|
void |
setErrorHandler(PageNavigationErrorHandler handler)
Set an error handler that is called in case of a
PageNotFoundException error during page navigation. |
protected PageNode<com.google.gwt.user.client.ui.IsWidget> currentPage
protected com.google.gwt.user.client.ui.IsWidget currentWidget
protected HistoryToken currentPageToken
public void setErrorHandler(PageNavigationErrorHandler handler)
PageNotFoundException
error during page navigation.handler
- An error handler for navigation. Setting this to null assigns the DefaultNavigationErrorHandler
@PreDestroy public void cleanUp()
public <W extends com.google.gwt.user.client.ui.IsWidget> void goTo(Class<W> toPage, com.google.common.collect.Multimap<String,String> state)
toPage
- The content type of the page node to look up and display. Normally, this is a Widget subclass that has
been annotated with @Page
.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 @PageState
in the widget class, but this is not required.public void goTo(String toPage)
goTo(Class, com.google.common.collect.Multimap)
but then with the page name.toPage
- the name of the page node to lookup and display.public void goToWithRole(Class<? extends UniquePageRole> role)
role
- The unique role of the page that needs to be displayed.public Collection<PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> getPagesByRole(Class<? extends PageRole> pageRole)
pageRole
- the role to find PageNodes bypublic PageNode<com.google.gwt.user.client.ui.IsWidget> getCurrentPage()
public com.google.gwt.user.client.ui.IsWidget getContentPanel()
public static void setAppContext(String path)
path
- The context path. Never null.public static String getAppContext()
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.