org.displaytag.decorator
abstract class: Decorator [javadoc |
source]
java.lang.Object
org.displaytag.decorator.Decorator
Direct Known Subclasses:
HssfTotalWrapper, HtmlTotalWrapper, TableDecoratorDate, TableDecoratorCssRow, Wrapper, TotalTableDecorator, TableDecoratorOne, MultilevelTotalTableDecorator, TableDecorator, ItextTotalWrapper, ListIndexTableDecorator, TotalWrapperTemplate, TableDecoratorTwo
This class provides some basic functionality for all objects which serve as decorators for the objects in the List
being displayed.
Decorator should never be subclassed directly. Use TableDecorator instead
- author:
mraible -
- author:
Fabrizio - Giustina
- version:
$ - Revision: 1084 $ ($Author: fgiust $)
| Field Summary |
|---|
| protected TableModel | tableModel | The table model. |
| Method from org.displaytag.decorator.Decorator Detail: |
public void finish() {
this.pageContext = null;
this.decoratedObject = null;
}
Called at the end of evaluation to clean up instance variable. A subclass of Decorator can override this method
but should always call super.finish() before return |
public Object getDecoratedObject() {
return this.decoratedObject;
}
returns the decorated object. |
public PageContext getPageContext() {
return this.pageContext;
}
returns the page context. |
public boolean hasGetterFor(String propertyName) {
String simpleProperty = propertyName;
// get the simple (not nested) bean property
int indexOfDot = simpleProperty.indexOf('.");
if (indexOfDot > 0)
{
simpleProperty = simpleProperty.substring(0, indexOfDot);
}
Boolean cachedResult = (Boolean) propertyMap.get(getClass().getName()
+ CLASS_PROPERTY_SEPARATOR
+ simpleProperty);
if (cachedResult != null)
{
return cachedResult.booleanValue();
}
// not already cached... check
boolean hasGetter = searchGetterFor(propertyName);
// save in cache
propertyMap.put(getClass().getName() + CLASS_PROPERTY_SEPARATOR + simpleProperty, BooleanUtils
.toBooleanObject(hasGetter));
// and return
return hasGetter;
}
Check if a getter exists for a given property. Uses cached info if property has already been requested. This
method only check for a simple property, if pPropertyName contains multiple tokens only the first part is
evaluated |
public void init(PageContext pageContext,
Object decorated) {
this.pageContext = pageContext;
this.decoratedObject = decorated;
} Deprecated! use - #init(PageContext, Object, TableModel)
Initialize the TableTecorator instance. |
public void init(PageContext pageContext,
Object decorated,
TableModel tableModel) {
// temporary used for backward (source) compatibility
init(pageContext, decorated);
this.tableModel = tableModel;
}
Initialize the TableTecorator instance. |
public boolean searchGetterFor(String propertyName) {
Class type = null;
try
{
// using getPropertyType instead of isReadable since isReadable doesn't support mapped properties.
// Note that this method usually returns null if a property is not found and doesn't throw any exception
// also for non existent properties
type = PropertyUtils.getPropertyType(this, propertyName);
}
catch (IllegalAccessException e)
{
// ignore
}
catch (InvocationTargetException e)
{
// ignore
}
catch (NoSuchMethodException e)
{
// ignore
}
return type != null;
}
Looks for a getter for the given property using introspection. |