Package org.apache.tiles.impl
Class BasicTilesContainer
- java.lang.Object
-
- org.apache.tiles.impl.BasicTilesContainer
-
- All Implemented Interfaces:
AttributeEvaluatorFactoryAware,TilesContainer
public class BasicTilesContainer extends java.lang.Object implements TilesContainer, AttributeEvaluatorFactoryAware
Basic implementation of the tiles container interface. In most cases, this container will be customized by injecting customized services, not necessarily by override the container- Since:
- 2.0
- Version:
- $Rev: 1330672 $ $Date: 2012-04-26 16:58:16 +1000 (Thu, 26 Apr 2012) $
-
-
Constructor Summary
Constructors Constructor Description BasicTilesContainer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendContext(org.apache.tiles.request.Request request)Ends a context, where attribute values are stored independently from others.
It must be called after aTilesContainer.startContext(Request)call.java.lang.Objectevaluate(Attribute attribute, org.apache.tiles.request.Request request)Evaluates the given attribute.org.apache.tiles.request.ApplicationContextgetApplicationContext()Returns the Tiles application context used by this container.AttributeContextgetAttributeContext(org.apache.tiles.request.Request request)Retrive the attribute context of the current request.protected AttributeContextgetContext(org.apache.tiles.request.Request tilesContext)Get attribute context from request.protected java.util.Deque<AttributeContext>getContextStack(org.apache.tiles.request.Request tilesContext)Returns the context stack.DefinitiongetDefinition(java.lang.String definitionName, org.apache.tiles.request.Request request)Returns a definition specifying its name.DefinitionsFactorygetDefinitionsFactory()Returns the definitions factory.PreparerFactorygetPreparerFactory()Returns the preparer factory used by this container.booleanisValidDefinition(java.lang.String definitionName, org.apache.tiles.request.Request request)Determine whether or not the definition exists.protected AttributeContextpopContext(org.apache.tiles.request.Request tilesContext)Pops a context object out of the stack.voidprepare(java.lang.String preparer, org.apache.tiles.request.Request request)Executes a preparer.protected voidpushContext(AttributeContext context, org.apache.tiles.request.Request tilesContext)Pushes a context object in the stack.voidrender(java.lang.String definitionName, org.apache.tiles.request.Request request)Render the given tiles request.voidrender(Attribute attr, org.apache.tiles.request.Request request)Render the given Attribute.voidrender(Definition definition, org.apache.tiles.request.Request request)Renders the specified definition.protected voidrender(org.apache.tiles.request.Request request, AttributeContext attributeContext)Renders the specified attribute context.voidrenderContext(org.apache.tiles.request.Request request)Renders the current context, as it is.voidsetApplicationContext(org.apache.tiles.request.ApplicationContext context)Sets the Tiles application context to use.voidsetAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)Sets the attribute evaluator factory.voidsetDefinitionsFactory(DefinitionsFactory definitionsFactory)Set the definitions factory.voidsetPreparerFactory(PreparerFactory preparerFactory)Set the preparerInstance factory.voidsetRendererFactory(org.apache.tiles.request.render.RendererFactory rendererFactory)Sets the renderer instance factory.AttributeContextstartContext(org.apache.tiles.request.Request request)Starts a new context, where attribute values are stored independently from others.
When the use of the contexts is finished, callTilesContainer.endContext(Request)
-
-
-
Method Detail
-
startContext
public AttributeContext startContext(org.apache.tiles.request.Request request)
Starts a new context, where attribute values are stored independently from others.
When the use of the contexts is finished, callTilesContainer.endContext(Request)- Specified by:
startContextin interfaceTilesContainer- Parameters:
request- The request.- Returns:
- The newly created context.
-
endContext
public void endContext(org.apache.tiles.request.Request request)
Ends a context, where attribute values are stored independently from others.
It must be called after aTilesContainer.startContext(Request)call.- Specified by:
endContextin interfaceTilesContainer- Parameters:
request- The request.
-
renderContext
public void renderContext(org.apache.tiles.request.Request request)
Renders the current context, as it is.- Specified by:
renderContextin interfaceTilesContainer- Parameters:
request- The request.
-
getApplicationContext
public org.apache.tiles.request.ApplicationContext getApplicationContext()
Returns the Tiles application context used by this container.- Specified by:
getApplicationContextin interfaceTilesContainer- Returns:
- the application context for this container.
-
setApplicationContext
public void setApplicationContext(org.apache.tiles.request.ApplicationContext context)
Sets the Tiles application context to use.- Parameters:
context- The Tiles application context.
-
getAttributeContext
public AttributeContext getAttributeContext(org.apache.tiles.request.Request request)
Retrive the attribute context of the current request.- Specified by:
getAttributeContextin interfaceTilesContainer- Parameters:
request- The request.- Returns:
- map of the attributes in the current attribute context.
-
getDefinitionsFactory
public DefinitionsFactory getDefinitionsFactory()
Returns the definitions factory.- Returns:
- The definitions factory used by this container.
-
setDefinitionsFactory
public void setDefinitionsFactory(DefinitionsFactory definitionsFactory)
Set the definitions factory. This method first ensures that the container has not yet been initialized.- Parameters:
definitionsFactory- the definitions factory for this instance.
-
getPreparerFactory
public PreparerFactory getPreparerFactory()
Returns the preparer factory used by this container.- Returns:
- return the preparerInstance factory used by this container.
-
setPreparerFactory
public void setPreparerFactory(PreparerFactory preparerFactory)
Set the preparerInstance factory. This method first ensures that the container has not yet been initialized.- Parameters:
preparerFactory- the preparerInstance factory for this conainer.
-
setRendererFactory
public void setRendererFactory(org.apache.tiles.request.render.RendererFactory rendererFactory)
Sets the renderer instance factory.- Parameters:
rendererFactory- the renderer instance factory for this container.- Since:
- 2.1.0
-
setAttributeEvaluatorFactory
public void setAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)
Sets the attribute evaluator factory.- Specified by:
setAttributeEvaluatorFactoryin interfaceAttributeEvaluatorFactoryAware- Parameters:
attributeEvaluatorFactory- The attribute evaluator factory to use.
-
prepare
public void prepare(java.lang.String preparer, org.apache.tiles.request.Request request)Executes a preparer.- Specified by:
preparein interfaceTilesContainer- Parameters:
preparer- The name of the preparer to execute.request- The request.
-
render
public void render(java.lang.String definitionName, org.apache.tiles.request.Request request)Render the given tiles request.- Specified by:
renderin interfaceTilesContainer- Parameters:
definitionName- the current definition.request- The request.
-
render
public void render(Definition definition, org.apache.tiles.request.Request request)
Renders the specified definition.- Specified by:
renderin interfaceTilesContainer- Parameters:
definition- The definition to render.request- The request context.- Since:
- 2.1.3
-
render
public void render(Attribute attr, org.apache.tiles.request.Request request) throws java.io.IOException
Render the given Attribute.- Specified by:
renderin interfaceTilesContainer- Parameters:
attr- The attribute to render.request- The request.- Throws:
java.io.IOException- If something goes wrong during writing to the output.
-
evaluate
public java.lang.Object evaluate(Attribute attribute, org.apache.tiles.request.Request request)
Evaluates the given attribute.- Specified by:
evaluatein interfaceTilesContainer- Parameters:
attribute- The attribute to evaluate.request- The request.- Returns:
- The evaluated object.
-
isValidDefinition
public boolean isValidDefinition(java.lang.String definitionName, org.apache.tiles.request.Request request)Determine whether or not the definition exists.- Specified by:
isValidDefinitionin interfaceTilesContainer- Parameters:
definitionName- the name of the definition.request- The request.- Returns:
- true if the definition is found.
-
getDefinition
public Definition getDefinition(java.lang.String definitionName, org.apache.tiles.request.Request request)
Returns a definition specifying its name.- Specified by:
getDefinitionin interfaceTilesContainer- Parameters:
definitionName- The name of the definition to find.request- The request context.- Returns:
- The definition, if found.
-
getContextStack
protected java.util.Deque<AttributeContext> getContextStack(org.apache.tiles.request.Request tilesContext)
Returns the context stack.- Parameters:
tilesContext- The Tiles context object to use.- Returns:
- The needed stack of contexts.
- Since:
- 2.0.6
-
pushContext
protected void pushContext(AttributeContext context, org.apache.tiles.request.Request tilesContext)
Pushes a context object in the stack.- Parameters:
context- The context to push.tilesContext- The Tiles context object to use.- Since:
- 2.0.6
-
popContext
protected AttributeContext popContext(org.apache.tiles.request.Request tilesContext)
Pops a context object out of the stack.- Parameters:
tilesContext- The Tiles context object to use.- Returns:
- The popped context object.
- Since:
- 2.0.6
-
getContext
protected AttributeContext getContext(org.apache.tiles.request.Request tilesContext)
Get attribute context from request.- Parameters:
tilesContext- current Tiles application context.- Returns:
- BasicAttributeContext or null if context is not found.
- Since:
- 2.0.6
-
render
protected void render(org.apache.tiles.request.Request request, AttributeContext attributeContext)Renders the specified attribute context.- Parameters:
request- The request context.attributeContext- The context to render.- Throws:
InvalidTemplateException- If the template is not valid.org.apache.tiles.request.render.CannotRenderException- If something goes wrong during rendering.- Since:
- 2.1.3
-
-