Class Context<T extends Context<?>>

  • Type Parameters:
    T - type of inherrit context object.
    Direct Known Subclasses:
    BodyContext, DocumentContext, FrameContext, PageContext

    public abstract class Context<T extends Context<?>>
    extends Component
    The base class of all contexts depending type of page.
    Since:
    2.0
    Author:
    Christophe Friederich
    • Constructor Detail

      • Context

        public Context​(@Nonnull
                       ISkinConfig config,
                       @Nonnull
                       ContextType type)
        Default constructor.
        Parameters:
        config - a config (can not be null).
        type - the type of context (can not be null).
    • Method Detail

      • buildContext

        @Nonnull
        public static Context<?> buildContext​(@Nonnull
                                              ISkinConfig config)
        Build a context depending of current type of page.
        Parameters:
        config - a config (can not be null).
        Returns:
        Returns a new instance of Context depending of current page.
      • initialize

        protected void initialize()
        Allows to initialize the context.
      • preRender

        public String preRender()
        Allows to execute action before rendering of component.
        Returns:
        Returns the String representing the transformed body content.
        Since:
        2.1
      • onPreRender

        protected String onPreRender​(@Nonnull
                                     String bodyContent)
        Description copied from class: Component
        generic pre-rendering method executed on all components of context.
        Overrides:
        onPreRender in class Component
        Parameters:
        bodyContent - the current body content.
        Returns:
        Returns a String representing the transformed body content on pre-rendering.
      • getNavbar

        public Navbar getNavbar()
        Returns:
        Returns the Navbar.
      • getFooter

        public Footer getFooter()
        Returns:
        Returns the Footer.
      • withType

        protected T withType​(ContextType type)
        Sets the type of context.
        Parameters:
        type - the of context.
        Returns:
        Returns the fluent instance context.
      • getType

        public String getType()
        Returns:
        Returns the type of context of page.
      • self

        protected T self()
        Returns:
        Returns the fluent instance.