本文整理汇总了Java中org.displaytag.exception.DecoratorException类的典型用法代码示例。如果您正苦于以下问题:Java DecoratorException类的具体用法?Java DecoratorException怎么用?Java DecoratorException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecoratorException类属于org.displaytag.exception包,在下文中一共展示了DecoratorException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Empty values don't show up properly in HTML. So, the String " " is substituted for an empty or null value of cellValue
* if mediaType is MediaTypeEnum.HTML. If mediaType is not {@link MediaTypeEnum.HTML} and cellValue is not null, then
* <code>CellComparatorHelper.getSanitizedValue(cellValue.toString())</code> is returned.
*
* @param cellValue
* @param pageContext
* @param mediaType
*/
public Object decorate(Object cellValue, PageContext pageContext, MediaTypeEnum mediaType) throws DecoratorException {
if (null == cellValue) {
return getEmptyStringFor(mediaType);
}
final String decoratedOutput;
if (isCollection(cellValue)) {
decoratedOutput = createCollectionString(cellValue);
} else {
decoratedOutput = MediaTypeEnum.HTML.equals(mediaType) ? cellValue.toString() : CellComparatorHelper
.getSanitizedStaticValue(cellValue.toString());
}
return StringUtils.isBlank(decoratedOutput) ? getEmptyStringFor(mediaType) : StringUtils.trim(decoratedOutput);
}
示例2: formatTotal
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
public String formatTotal(HeaderCell header, Object total)
{
Object displayValue = total;
if (header.getColumnDecorators().length > 0)
{
for (int i = 0; i < header.getColumnDecorators().length; i++)
{
DisplaytagColumnDecorator decorator = header.getColumnDecorators()[i];
try
{
displayValue = decorator.decorate(total, this.getPageContext(), tableModel.getMedia());
}
catch (DecoratorException e)
{
logger.warn(e.getMessage(), e);
// ignore, use undecorated value for totals
}
}
}
return displayValue != null ? displayValue.toString() : "";
}
示例3: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* transform the given object into a String representation. The object is supposed to be a date.
* @see org.displaytag.decorator.DisplaytagColumnDecorator#decorate(Object, PageContext, MediaTypeEnum)
*/
@Override
public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException
{
Date date = (Date) columnValue;
return this.dateFormat.format(date);
}
示例4: initialize
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Initialize the cell value.
* @throws ObjectLookupException for errors in bean property lookup
* @throws DecoratorException if a column decorator is used and an exception is thrown during value decoration
* @throws DecoratorException
* @throws ObjectLookupException
*/
public void initialize() throws DecoratorException, ObjectLookupException
{
if (this.stringValue == null)
{
this.stringValue = createChoppedAndLinkedValue();
}
}
示例5: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* @see org.displaytag.decorator.DisplaytagColumnDecorator#decorate(java.lang.Object, javax.servlet.jsp.PageContext,
* org.displaytag.properties.MediaTypeEnum)
*/
@Override
public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException
{
int intValue = ((Number) columnValue).intValue();
if (intValue == 0)
{
intValue = 1;
}
return StringUtils.leftPad(Integer.toString(100 / intValue), 3);
}
示例6: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException {
if (columnValue == null) {
return KewApiConstants.HTML_NON_BREAKING_SPACE;
}
if (columnValue instanceof String && StringUtils.isEmpty(((String)columnValue).trim())) {
return KewApiConstants.HTML_NON_BREAKING_SPACE;
}
return columnValue;
}
示例7: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException {
Matcher matcher = DATE_PATTERN.matcher(columnValue.toString());
if (matcher.find()) {
return matcher.group(2) + DATE_DELIMITER + matcher.group(3) + DATE_DELIMITER + matcher.group(1);
}
return columnValue;
}
示例8: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException {
String value = (String) columnValue;
value = value.replaceAll("\r\n", "");
value = value.trim();
return "<div name=\"truncateDiv\">" + value + "</div>";
}
示例9: testDecorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Test method for {@link gov.nih.nci.caintegrator.web.action.query.DateFormatColumnDecorator#decorate(java.lang.Object, javax.servlet.jsp.PageContext, org.displaytag.properties.MediaTypeEnum)}.
* @throws DecoratorException
*/
@Test
public void testDecorate() throws DecoratorException {
String columnValue = "2001-01-01 extraStuff";
DateFormatColumnDecorator decorator = new DateFormatColumnDecorator();
assertEquals("01/01/2001", (String) decorator.decorate((Object)columnValue, null, MediaTypeEnum.HTML));
columnValue = "invalid";
assertEquals("invalid", (String) decorator.decorate((Object)columnValue, null, MediaTypeEnum.HTML));
}
示例10: testDecorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Test method for {@link gov.nih.nci.caintegrator.application.query.DateFormatColumnDecorator#decorate(java.lang.Object, javax.servlet.jsp.PageContext, org.displaytag.properties.MediaTypeEnum)}.
* @throws DecoratorException
*/
@Test
public void testDecorate() throws DecoratorException {
String columnValue = "0.12345678";
DoubleFormatColumnDecorator decorator = new DoubleFormatColumnDecorator();
assertEquals("0.1235", (String) decorator.decorate((Object)columnValue, null, MediaTypeEnum.HTML));
}
示例11: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
public Object decorate(Object object, PageContext pgeContext, MediaTypeEnum mediaTypeEnum) throws DecoratorException
{
if (object == null) return null;
return dateFormat.format((Date) object);
}
示例12: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
public Object decorate(Object object, PageContext pgeContext, MediaTypeEnum mediaTypeEnum) throws DecoratorException
{
if (object == null) return null;
return format.format(object);
}
示例13: writeColumnOpener
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Writes an HTML table's column-opening tag to a JSP page.
* @see org.displaytag.render.TableWriterTemplate#writeColumnOpener(org.displaytag.model.Column)
*/
@Override
protected void writeColumnOpener(Column column) throws ObjectLookupException, DecoratorException
{
this.write(column.getOpenTag());
}
示例14: writeColumnOpener
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Write a column's opening structure to an iText document.
* @see org.displaytag.render.TableWriterTemplate#writeColumnOpener(org.displaytag.model.Column)
*/
@Override
protected void writeColumnOpener(Column column) throws ObjectLookupException, DecoratorException
{
column.initialize(); // has side effect, setting its stringValue, which affects grouping logic.
}
示例15: getValue
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Gets the value, after calling the table / column decorator is requested.
* @param decorated boolean
* @return Object will never be null if ShowNulls has been set to false
* @throws ObjectLookupException for errors in bean property lookup
* @throws DecoratorException if a column decorator is used and an exception is thrown during value decoration
*/
public Object getValue(boolean decorated) throws ObjectLookupException, DecoratorException
{
Object object = null;
// a static value has been set?
if (this.cell.getStaticValue() != null)
{
object = this.cell.getStaticValue();
}
else if (this.header.getBeanPropertyName() != null)
{
// if a decorator has been set, and if decorator has a getter for the requested property only, check
// decorator
if (decorated
&& this.row.getParentTable().getTableDecorator() != null
&& this.row.getParentTable().getTableDecorator().hasGetterFor(this.header.getBeanPropertyName()))
{
object = LookupUtil.getBeanProperty(
this.row.getParentTable().getTableDecorator(),
this.header.getBeanPropertyName());
}
else
{
// else check underlining object
object = LookupUtil.getBeanProperty(this.row.getObject(), this.header.getBeanPropertyName());
}
}
DisplaytagColumnDecorator[] decorators = this.header.getColumnDecorators();
if (decorated)
{
for (int j = 0; j < decorators.length; j++)
{
object = decorators[j].decorate(object, row.getParentTable().getPageContext(), row
.getParentTable()
.getMedia());
}
}
if (object == null || "null".equals(object)) //$NON-NLS-1$
{
if (!this.header.getShowNulls())
{
object = TagConstants.EMPTY_STRING;
}
}
return object;
}