Class NavigationContext<C extends WebComponentRequestContext>

  • Type Parameters:
    C - the type of the web component request context.

    public class NavigationContext<C 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 usual needs of the use of a navigation context for a developer is to track the different steps of the user's Web navigation in Silverpeas in order to be able to go back to a previous step (generally a Web page) whatever it is. It is useful when it exists several navigation paths to a given Web page and from which the user can be go back to one of its previous steps of its navigation.

    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.
    • Method Detail

      • get

        public static <T extends WebComponentRequestContextNavigationContext<T> get​(T 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 C 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.
      • insertNewPreviousNavigationStep

        public NavigationContext.NavigationStep insertNewPreviousNavigationStep​(String previousStepIdentifier)
        Method to insert a new previous navigation step on current step. It permits to force manually a previous page url when needed.
        Parameters:
        previousStepIdentifier - the identifier of the new previous navigation step.
        Returns:
        the new previous NavigationContext.NavigationStep instance