public class NavigationMenuService extends AbstractContexed implements AppContextService<NavigationMenuService>
AppContextService
for building navigation menus.
The top level menu is defined as a comma separated list in the property navigation.list Each name defines a menu node using the properties:
NodeMaker
to make nodeNodeMaker
returns null. The configuration properties of the original node are not automatically inherited.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISABLE_NAVIGATION_ATTR |
static Feature |
FORCE_SERIALISE_FEATURE |
static Feature |
NAVIGATION_MENU_FEATURE |
static Feature |
NAVIGATION_MENU_JS_FEATURE |
static java.lang.String |
NAVIGATIONAL_PREFIX |
conn
Constructor and Description |
---|
NavigationMenuService(AppContext conn) |
Modifier and Type | Method and Description |
---|---|
void |
addChildren(java.util.Set<java.lang.String> seen,
java.lang.String name,
FilteredProperties menu_prop,
NodeMaker maker,
Node n) |
void |
cleanup()
AppContext is being closed. |
void |
disableNavigation(HttpServletRequest request) |
NodeContainer |
getMenu() |
HtmlBuilder |
getNavigation(HttpServletRequest request,
HtmlBuilder builder)
build the navigation element for
|
FilteredProperties |
getProperties() |
java.lang.Class<? super NavigationMenuService> |
getType()
Returns the type of service the class should be registered under.
|
NodeContainer |
makeMenu()
Populate a
NodeContainer with the appropriate navigational Node s for the current user. |
protected Node |
makeNode(java.util.Set<java.lang.String> seen,
java.lang.String name,
FilteredProperties menu_prop) |
void |
resetMenu()
reset the Navigation menu so it is re-calculated for the next page view.
|
static <T,K> Node |
transitionNode(AppContext conn,
TransitionFactory<K,T> provider,
T target,
K key)
Make a node corresponding to a transition a target.
|
static <T,K> Node |
viewNode(AppContext conn,
ViewTransitionFactory<K,T> provider,
T target)
Make a node corresponding to the view url of a target.
|
boolean |
willAddChildren(java.lang.String name,
FilteredProperties menu_prop) |
protected boolean |
willMakeNode(java.lang.String name,
FilteredProperties menu_prop) |
getContext, getLogger, resetLogger
public static final java.lang.String DISABLE_NAVIGATION_ATTR
public static final java.lang.String NAVIGATIONAL_PREFIX
public static final Feature NAVIGATION_MENU_FEATURE
public static final Feature NAVIGATION_MENU_JS_FEATURE
public static final Feature FORCE_SERIALISE_FEATURE
public NavigationMenuService(AppContext conn)
public void cleanup()
AppContextCleanup
AppContext
is being closed.
Only use this for cleanup that can't be handled by
normal garbage collection or for state which is never returned by reference.cleanup
in interface AppContextCleanup
public java.lang.Class<? super NavigationMenuService> getType()
AppContextService
getType
in interface AppContextService<NavigationMenuService>
public NodeContainer getMenu()
public void resetMenu()
public FilteredProperties getProperties()
public NodeContainer makeMenu()
NodeContainer
with the appropriate navigational Node
s for the current user.NodeContainer
for the navigation menu or nullprotected Node makeNode(java.util.Set<java.lang.String> seen, java.lang.String name, FilteredProperties menu_prop)
name
- menu_prop
- protected boolean willMakeNode(java.lang.String name, FilteredProperties menu_prop)
public void addChildren(java.util.Set<java.lang.String> seen, java.lang.String name, FilteredProperties menu_prop, NodeMaker maker, Node n)
seen
- name
- menu_prop
- maker
- n
- public boolean willAddChildren(java.lang.String name, FilteredProperties menu_prop)
public void disableNavigation(HttpServletRequest request)
public HtmlBuilder getNavigation(HttpServletRequest request, HtmlBuilder builder)
builder
- public static <T,K> Node viewNode(AppContext conn, ViewTransitionFactory<K,T> provider, T target)
conn
- provider
- target
- Node
public static <T,K> Node transitionNode(AppContext conn, TransitionFactory<K,T> provider, T target, K key)
conn
- provider
- target
- Node