Errai 3.0.1-SNAPSHOT

org.jboss.errai.ui.nav.client.local.spi
Class NavigationGraph

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

public abstract class NavigationGraph
extends Object

The NavigationGraph is responsible for creating or retrieving instances of Page and PageTransition objects. It is also the central repository for structural information about the interpage navigation in the app (this information is defined in a decentralized way, by classes that implement PageNode and contain injected TransitionTo fields.

The concrete implementation of this class is usually generated at compile-time by scanning for page classes. It is expected to fill in the pagesByName map in its constructor.

Author:
Jonathan Fuerth

Nested Class Summary
protected static class NavigationGraph.PageNodeCreationalCallback<W extends com.google.gwt.user.client.ui.IsWidget>
           
 
Field Summary
protected  AsyncBeanManager bm
           
protected  Map<String,PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> pagesByName
          Maps page names to the classes that implement them.
protected  com.google.common.collect.Multimap<Class<? extends PageRole>,PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> pagesByRole
           
 
Constructor Summary
NavigationGraph()
           
 
Method Summary
<W extends com.google.gwt.user.client.ui.IsWidget>
PageNode<W>
getPage(Class<W> type)
          Returns an instance of the given page type.
<W extends com.google.gwt.user.client.ui.IsWidget>
PageNode<W>
getPage(String name)
          Returns an instance of the given page type.
 PageNode getPageByRole(Class<? extends UniquePageRole> role)
           
 Collection<PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> getPagesByRole(Class<? extends PageRole> role)
          Returns all pages that have the specified role.
 boolean isEmpty()
          Returns true if and only if there are no pages in this nagivation graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bm

protected final AsyncBeanManager bm

pagesByName

protected final Map<String,PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> pagesByName
Maps page names to the classes that implement them. The subclass's constructor is responsible for populating this map.


pagesByRole

protected final com.google.common.collect.Multimap<Class<? extends PageRole>,PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> pagesByRole
Constructor Detail

NavigationGraph

public NavigationGraph()
Method Detail

getPage

public <W extends com.google.gwt.user.client.ui.IsWidget> PageNode<W> getPage(String name)
Returns an instance of the given page type. If the page is an ApplicationScoped bean, the singleton instance of the page will be returned; otherwise (for Dependent-scoped beans) a new instance will be returned.

Parameters:
name - The page name, as defined by the implementation of page.
Returns:
The appropriate instance of the page.

getPage

public <W extends com.google.gwt.user.client.ui.IsWidget> PageNode<W> getPage(Class<W> type)
Returns an instance of the given page type. If the page is an ApplicationScoped bean, the singleton instance of the page will be returned; otherwise (for Dependent-scoped beans) a new instance will be returned.

Parameters:
type - The Class object for the bean that implements the page.
Returns:
The appropriate instance of the page.

getPagesByRole

public Collection<PageNode<? extends com.google.gwt.user.client.ui.IsWidget>> getPagesByRole(Class<? extends PageRole> role)
Returns all pages that have the specified role. In the add page annotation one can specify multiple roles for a page. getPage(Class) PageRole

Parameters:
role - the role used to lookup the pages
Returns:
all pages that have the role set.

getPageByRole

public PageNode getPageByRole(Class<? extends UniquePageRole> role)

isEmpty

public boolean isEmpty()
Returns true if and only if there are no pages in this nagivation graph.


Errai 3.0.1-SNAPSHOT

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