com.stratelia.silverpeas.peasCore.servlets
Class NavigationContext<WEB_COMPONENT_REQUEST_CONTEXT extends WebComponentRequestContext>

java.lang.Object
  extended by com.stratelia.silverpeas.peasCore.servlets.NavigationContext<WEB_COMPONENT_REQUEST_CONTEXT>
Type Parameters:
WEB_COMPONENT_REQUEST_CONTEXT - the type of the web component request context.

public class NavigationContext<WEB_COMPONENT_REQUEST_CONTEXT extends WebComponentRequestContext>
extends Object

This class permits to handle a context according to the user navigation.

The navigation context can be see as a stack of NavigationContext.NavigationStep elements. Each time a new step is defined, it is pushed into the stack. If the step already exists from the stack, then the navigation context is reset to this.

The creation of navigation steps must be defined manually in web controllers by the programmer. For doing, it can use the following tools:

The navigation context can be specified to the path attribute of TAG . In that case, the complete stack of navigation steps is browsed to generate browse bar element parts. NavigationContext.NavigationStep element with no label defined is ignored in this generation treatment.


Nested Class Summary
 class NavigationContext.NavigationStep
          Class that represents the data of a navigation step.
 
Method Summary
 void addListener(NavigationContextListener listener)
          Adds a listener to trigger.
 NavigationContext.NavigationStep clear()
          Clears the navigation context and reset it to the base one.
static
<WEB_COMPONENT_REQUEST_CONTEXT extends WebComponentRequestContext>
NavigationContext<WEB_COMPONENT_REQUEST_CONTEXT>
get(WEB_COMPONENT_REQUEST_CONTEXT context)
          Sets the navigation context to the specified context associated to the current web controller.
 NavigationContext.NavigationStep getBaseNavigationStep()
          Gets the first step of the navigation.
 NavigationContext.NavigationStep getCurrentNavigationStep()
          Gets the current step of the navigation.
 NavigationContext.NavigationStep getPreviousNavigationStep()
          Gets in any cases of navigation the right previous NavigationContext.NavigationStep instance.
 WEB_COMPONENT_REQUEST_CONTEXT getWebComponentRequestContext()
          Gets the context of the request associated to the current web component controller.
 NavigationContext.NavigationStep navigationStepFrom(String stepIdentifier)
          Method to specify a navigation step creation/reset on a HTTP method of a WebComponentController without using the NavigationStep annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static <WEB_COMPONENT_REQUEST_CONTEXT extends WebComponentRequestContext> NavigationContext<WEB_COMPONENT_REQUEST_CONTEXT> get(WEB_COMPONENT_REQUEST_CONTEXT context)
Sets the navigation context to the specified context associated to the current web controller.

Parameters:
context - the context into which the navigation context must be set.

addListener

public void addListener(NavigationContextListener listener)
Adds a listener to trigger.

Parameters:
listener - a listener.

getWebComponentRequestContext

public WEB_COMPONENT_REQUEST_CONTEXT getWebComponentRequestContext()
Gets the context of the request associated to the current web component controller.

Returns:
the above described context.

getPreviousNavigationStep

public NavigationContext.NavigationStep getPreviousNavigationStep()
Gets in any cases of navigation the right previous NavigationContext.NavigationStep instance.

If user has just performed a web treatment that resulting to a navigation step creation or reset, then the returned navigation step is the previous of the one created or reset.

If user has performed a web treatment that not resulting to a navigation step creation or reset, then the previous navigation step returned is the last created or reset.

Returns:
the right previous NavigationContext.NavigationStep as above described.

getCurrentNavigationStep

public NavigationContext.NavigationStep getCurrentNavigationStep()
Gets the current step of the navigation. It is the last created or reset one.

Returns:
the above described navigation step.

getBaseNavigationStep

public NavigationContext.NavigationStep getBaseNavigationStep()
Gets the first step of the navigation. It represents the one of the homepage ("Main").

Returns:
the above described navigation step.

navigationStepFrom

public NavigationContext.NavigationStep navigationStepFrom(String stepIdentifier)
Method to specify a navigation step creation/reset on a HTTP method of a WebComponentController without using the NavigationStep annotation.

When a HTTP method with this annotation is called, one of the following internal treatment is performed:

  • if no navigation step is referenced by specified identifier, then a navigation step is created and referenced with it
  • if a navigation step with specified identifier already exists, then the navigation step stack is reset to this
Then, in any cases, the following internal treatments are performed:

Parameters:
stepIdentifier - the identifier of a navigation step.
Returns:
the NavigationContext.NavigationStep instance related to the specified identifier.

clear

public NavigationContext.NavigationStep clear()
Clears the navigation context and reset it to the base one.

Returns:
result of getBaseNavigationStep()


Copyright © 2016 Silverpeas. All Rights Reserved.