Errai 3.0.1-SNAPSHOT

org.jboss.errai.ui.nav.client.local
Class Navigation

java.lang.Object
  extended by org.jboss.errai.ui.nav.client.local.Navigation

public class Navigation
extends Object

Central control point for navigating between pages of the application.

Configuration is decentralized: it is based on fields and annotations present in other application classes. This configuration is gathered at compile time.

Author:
Jonathan Fuerth
See Also:
Page, PageState, PageShowing, PageShown, PageHiding, PageHidden

Field Summary
protected  PageNode<com.google.gwt.user.client.ui.IsWidget> currentPage
           
protected  com.google.gwt.user.client.ui.IsWidget currentWidget
           
 
Constructor Summary
Navigation()
           
 
Method Summary
 void cleanUp()
          Public for testability.
 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>
void
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.
 void setErrorHandler(PageNavigationErrorHandler handler)
          Set an error handler that is called in case of a PageNotFoundException error during page navigation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentPage

protected PageNode<com.google.gwt.user.client.ui.IsWidget> currentPage

currentWidget

protected com.google.gwt.user.client.ui.IsWidget currentWidget
Constructor Detail

Navigation

public Navigation()
Method Detail

setErrorHandler

public void setErrorHandler(PageNavigationErrorHandler handler)
Set an error handler that is called in case of a PageNotFoundException error during page navigation.

Parameters:
handler - An error handler for navigation. Setting this to null assigns the DefaultNavigationErrorHandler

cleanUp

@PreDestroy
public void cleanUp()
Public for testability.


goTo

public <W extends com.google.gwt.user.client.ui.IsWidget> void 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.

Parameters:
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.

goTo

public void goTo(String toPage)
Same as goTo(Class, com.google.common.collect.Multimap) but then with the page name.

Parameters:
toPage - the name of the page node to lookup and display.

goToWithRole

public 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.

Parameters:
role - The unique role of the page that needs to be displayed.

getPagesByRole

public Collection<PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> getPagesByRole(Class<? extends PageRole> pageRole)
Return all PageNode instances that have specified pageRole.

Parameters:
pageRole - the role to find PageNodes by
Returns:
All the pageNodes of the pages that have the specific pageRole.

getCurrentPage

public PageNode<com.google.gwt.user.client.ui.IsWidget> getCurrentPage()
Return the current page that is being displayed.

Returns:
the current page

getContentPanel

public com.google.gwt.user.client.ui.IsWidget getContentPanel()
Returns the panel that this Navigation object manages. The contents of this panel will be updated by the navigation system in response to PageTransition requests, as well as changes to the GWT navigation system.

Returns:
The content panel of this Navigation instance. It is not recommended that client code modifies the contents of this panel, because this Navigation instance may replace its contents at any time.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.