This project has retired. For details please refer to its Attic page.
AbstractBaseAttributeRenderer (Tiles 2 2.2.2 API)

org.apache.tiles.renderer.impl
Class AbstractBaseAttributeRenderer

Package class diagram package AbstractBaseAttributeRenderer
java.lang.Object
  extended by org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer
All Implemented Interfaces:
TilesApplicationContextAware, TilesRequestContextFactoryAware, AttributeEvaluatorFactoryAware, AttributeRenderer
Direct Known Subclasses:
AbstractTypeDetectingAttributeRenderer, ChainedDelegateAttributeRenderer, UntypedAttributeRenderer

public abstract class AbstractBaseAttributeRenderer
extends Object
implements AttributeRenderer, TilesRequestContextFactoryAware, TilesApplicationContextAware, AttributeEvaluatorFactoryAware

Base abstract class that manages authorization to display the attribute.

Since:
2.1.0
Version:
$Rev: 791161 $ $Date: 2009-07-04 20:53:36 +0200 (sab, 04 lug 2009) $

Field Summary
protected  TilesApplicationContext applicationContext
          The Tiles application context.
protected  AttributeEvaluatorFactory attributeEvaluatorFactory
          The attribute evaluator factory.
protected  TilesRequestContextFactory contextFactory
          The Tiles request context factory.
 
Constructor Summary
AbstractBaseAttributeRenderer()
           
 
Method Summary
protected  TilesRequestContext getRequestContext(Object... requestItems)
          Creates a Tiles request context from request items.
protected  boolean isPermitted(TilesRequestContext request, Set<String> roles)
          Checks if the current user is in one of the comma-separated roles specified in the role parameter.
 void render(Attribute attribute, TilesRequestContext request)
          Renders an attribute.
 void setApplicationContext(TilesApplicationContext applicationContext)
          Sets the Tiles application context.
 void setAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)
          Sets the attribute evaluator factory.
 void setRequestContextFactory(TilesRequestContextFactory contextFactory)
          Sets the Tiles request context factory.
abstract  void write(Object value, Attribute attribute, TilesRequestContext request)
          Implement this method knowing that the attribute won't be null and it will be authorized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contextFactory

protected TilesRequestContextFactory contextFactory
The Tiles request context factory.

Since:
2.1.1

applicationContext

protected TilesApplicationContext applicationContext
The Tiles application context.

Since:
2.1.0

attributeEvaluatorFactory

protected AttributeEvaluatorFactory attributeEvaluatorFactory
The attribute evaluator factory.

Since:
2.2.0
Constructor Detail

AbstractBaseAttributeRenderer

public AbstractBaseAttributeRenderer()
Method Detail

setRequestContextFactory

public void setRequestContextFactory(TilesRequestContextFactory contextFactory)
Sets the Tiles request context factory.

Specified by:
setRequestContextFactory in interface TilesRequestContextFactoryAware
Parameters:
contextFactory - The Tiles context factory.

setApplicationContext

public void setApplicationContext(TilesApplicationContext applicationContext)
Sets the Tiles application context.

Specified by:
setApplicationContext in interface TilesApplicationContextAware
Parameters:
applicationContext - The Tiles application context.

setAttributeEvaluatorFactory

public void setAttributeEvaluatorFactory(AttributeEvaluatorFactory attributeEvaluatorFactory)
Sets the attribute evaluator factory.

Specified by:
setAttributeEvaluatorFactory in interface AttributeEvaluatorFactoryAware
Parameters:
attributeEvaluatorFactory - The attribute evaluator factory to use.

render

public void render(Attribute attribute,
                   TilesRequestContext request)
            throws IOException
Renders an attribute.

Specified by:
render in interface AttributeRenderer
Parameters:
attribute - The attribute to render.
request - The Tiles request context.
Throws:
IOException - If something goes wrong during rendition.

write

public abstract void write(Object value,
                           Attribute attribute,
                           TilesRequestContext request)
                    throws IOException
Implement this method knowing that the attribute won't be null and it will be authorized.

Parameters:
value - The value of the attribute to be rendered.
attribute - The attribute to render.
request - The Tiles request object.
Throws:
IOException - If something goes wrong during rendition.
Since:
2.1.2

getRequestContext

protected TilesRequestContext getRequestContext(Object... requestItems)
Creates a Tiles request context from request items.

Parameters:
requestItems - The request items.
Returns:
The created Tiles request context.
Since:
2.1.0

isPermitted

protected boolean isPermitted(TilesRequestContext request,
                              Set<String> roles)
Checks if the current user is in one of the comma-separated roles specified in the role parameter.

Parameters:
request - The request context.
roles - The list of roles.
Returns:
true if the current user is in one of those roles.
Since:
2.1.0


Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.