Class Context<T extends Context<?>>
- java.lang.Object
-
- org.devacfr.maven.skins.reflow.model.Component
-
- org.devacfr.maven.skins.reflow.context.Context<T>
-
- 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 Summary
Constructors Constructor Description Context(ISkinConfig config, ContextType type)Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Context<?>buildContext(ISkinConfig config)Build a context depending of current type of page.FootergetFooter()NavbargetNavbar()ScrollTopgetScrollTop()StringgetType()protected voidinitialize()Allows to initialize the context.protected StringonPreRender(String bodyContent)generic pre-rendering method executed on all components of context.StringpreRender()Allows to execute action before rendering of component.protected Tself()StringtoString()protected TwithType(ContextType type)Sets the type of context.-
Methods inherited from class org.devacfr.maven.skins.reflow.model.Component
addChildren, addCssOptions, getCssClass, getCssOptions, setCssClass
-
-
-
-
Constructor Detail
-
Context
public Context(@Nonnull ISkinConfig config, @Nonnull ContextType type)
Default constructor.- Parameters:
config- a config (can not benull).type- the type of context (can not benull).
-
-
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 benull).- Returns:
- Returns a new instance of
Contextdepending 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
Stringrepresenting the transformed body content. - Since:
- 2.1
-
onPreRender
protected String onPreRender(@Nonnull String bodyContent)
Description copied from class:Componentgeneric pre-rendering method executed on all components of context.- Overrides:
onPreRenderin classComponent- Parameters:
bodyContent- the current body content.- Returns:
- Returns a
Stringrepresenting the transformed body content on pre-rendering.
-
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.
-
-