@ApplicationScoped 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| Constructor and Description |
|---|
Navigation() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp() |
static String |
getAppContext()
Gets the application context used in pushstate URL paths.
|
Multimap<String,String> |
getCurrentState() |
Collection<PageNode<?>> |
getPagesByRole(Class<? extends PageRole> pageRole)
Return all PageNode instances that have specified pageRole.
|
<P> void |
goTo(Class<P> toPage,
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, 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.
|
boolean |
isNavigating()
Are we in the navigation process right now.
|
static void |
setAppContext(String path)
Sets the application context used in pushstate URL paths.
|
void |
setContentDelegation(ContentDelegation contentDelegation) |
void |
setErrorHandler(PageNavigationErrorHandler handler)
Set an error handler that is called in case of a
PageNotFoundException error during
page navigation. |
void |
setNavigationContainer(elemental2.dom.HTMLElement navigationContainer) |
void |
setNavigationContainerSelector(org.jboss.elemento.By selector) |
void |
updateState(Multimap<String,String> state)
Update the state of your existing page without performing a full navigation.
|
public static String getAppContext()
public static void setAppContext(String path)
path - The context path. Never null.@PreDestroy public void cleanUp()
public <P> void goTo(Class<P> toPage, 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, 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 void updateState(Multimap<String,String> state)
public Collection<PageNode<?>> getPagesByRole(Class<? extends PageRole> pageRole)
pageRole - the role to find PageNodes bypublic Multimap<String,String> getCurrentState()
public boolean isNavigating()
public void setErrorHandler(PageNavigationErrorHandler handler)
PageNotFoundException error during
page navigation.handler - An error handler for navigation. Setting this to null assigns the
DefaultNavigationErrorHandlerpublic void setContentDelegation(ContentDelegation contentDelegation)
public void setNavigationContainerSelector(org.jboss.elemento.By selector)
public void setNavigationContainer(elemental2.dom.HTMLElement navigationContainer)
Copyright © 2020 Treblereel. All rights reserved.