本文整理汇总了Java中org.displaytag.exception.DecoratorException类的典型用法代码示例。如果您正苦于以下问题:Java DecoratorException类的具体用法?Java DecoratorException怎么用?Java DecoratorException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecoratorException类属于org.displaytag.exception包,在下文中一共展示了DecoratorException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:FormatAwareDecorator.java
示例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() : "";
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:22,代码来源:MultilevelTotalTableDecorator.java
示例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);
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:11,代码来源:LongDateWrapper.java
示例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();
}
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:15,代码来源:Column.java
示例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);
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:16,代码来源:PercentualColumnDecorator.java
示例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;
}
开发者ID:aapotts,项目名称:kuali_rice,代码行数:10,代码来源:LookupColumnDecorator.java
示例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;
}
开发者ID:NCIP,项目名称:caintegrator,代码行数:11,代码来源:DateFormatColumnDecorator.java
示例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>";
}
开发者ID:NCIP,项目名称:caintegrator,代码行数:10,代码来源:DivFormatColumnDecorator.java
示例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));
}
开发者ID:NCIP,项目名称:caintegrator,代码行数:13,代码来源:DateFormatColumnDecoratorTest.java
示例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));
}
开发者ID:NCIP,项目名称:caintegrator,代码行数:11,代码来源:DoubleFormatColumnDecoratorTest.java
示例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);
}
开发者ID:mtpettyp,项目名称:openreports,代码行数:6,代码来源:DateColumnDecorator.java
示例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);
}
开发者ID:mtpettyp,项目名称:openreports,代码行数:6,代码来源:NumberColumnDecorator.java
示例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());
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:10,代码来源:HtmlTableWriter.java
示例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.
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:10,代码来源:ItextTableWriter.java
示例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;
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:60,代码来源:Column.java
示例16: createChoppedAndLinkedValue
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* Calculates the cell content, cropping or linking the value as needed.
* @return String
* @throws ObjectLookupException for errors in bean property lookup
* @throws DecoratorException if a column decorator is used and an exception is thrown during value decoration
*/
@SuppressWarnings("deprecation")
public String createChoppedAndLinkedValue() throws ObjectLookupException, DecoratorException
{
String fullValue = ObjectUtils.toString(getValue(true));
String choppedValue;
// trim the string if a maxLength or maxWords is defined
if (this.header.getMaxLength() > 0)
{
choppedValue = HtmlTagUtil.abbreviateHtmlString(fullValue, this.header.getMaxLength(), false);
}
else if (this.header.getMaxWords() > 0)
{
choppedValue = HtmlTagUtil.abbreviateHtmlString(fullValue, this.header.getMaxWords(), true);
}
else
{
choppedValue = fullValue;
}
// chopped content? add the full content to the column "title" attribute
// note, simply checking that length is less than before can't be enough due to the "..." added if the string is
// cropped
if (!ObjectUtils.equals(fullValue, choppedValue))
{
// clone the attribute map, don't want to add title to all the columns
this.htmlAttributes = (HtmlAttributeMap) this.htmlAttributes.clone();
// add title
this.htmlAttributes.put(TagConstants.ATTRIBUTE_TITLE, HtmlTagUtil.stripHTMLTags(fullValue));
}
if (this.header.getHref() != null)
{
// generates the href for the link
Href colHref = getColumnHref(fullValue);
Anchor anchor = new Anchor(colHref, choppedValue);
choppedValue = anchor.toString();
}
return choppedValue;
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:49,代码来源:Column.java
示例17: createTotalRow
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
protected String createTotalRow(boolean grandTotal)
{
StringBuffer buffer = new StringBuffer(1000);
buffer.append("\n<tr class=\"total\">"); //$NON-NLS-1$
List<HeaderCell> headerCells = tableModel.getHeaderCellList();
for (Iterator<HeaderCell> it = headerCells.iterator(); it.hasNext();)
{
HeaderCell cell = it.next();
Object cssClassObj = cell.getHtmlAttributes().get("class");
String cssClass = cssClassObj != null ? cssClassObj.toString() : StringUtils.EMPTY;
buffer.append("<td"); //$NON-NLS-1$
if (StringUtils.isNotEmpty(cssClass))
{
buffer.append(" class=\""); //$NON-NLS-1$
buffer.append(cssClass);
buffer.append("\""); //$NON-NLS-1$
}
buffer.append(">"); //$NON-NLS-1$
if (cell.isTotaled())
{
String totalPropertyName = cell.getBeanPropertyName();
Object total = grandTotal ? grandTotals.get(totalPropertyName) : subTotals.get(totalPropertyName);
DisplaytagColumnDecorator[] decorators = cell.getColumnDecorators();
for (int j = 0; j < decorators.length; j++)
{
try
{
total = decorators[j].decorate(total, this.getPageContext(), tableModel.getMedia());
}
catch (DecoratorException e)
{
log.warn(e.getMessage(), e);
// ignore, use undecorated value for totals
}
}
buffer.append(total);
}
else if (groupPropertyName != null && groupPropertyName.equals(cell.getBeanPropertyName()))
{
buffer.append(grandTotal ? totalLabel : new MessageFormat(subtotalLabel, this.tableModel
.getProperties()
.getLocale()).format(new Object[]{previousValues.get(groupPropertyName)}));
}
buffer.append("</td>"); //$NON-NLS-1$
}
buffer.append("</tr>"); //$NON-NLS-1$
// reset subtotal
this.subTotals.clear();
return buffer.toString();
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:61,代码来源:TotalTableDecorator.java
示例18: 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
{
return dateFormat.format(columnValue);
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:10,代码来源:DateColumnDecorator.java
示例19: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
/**
* @see org.displaytag.decorator.DisplaytagColumnDecorator#decorate(Object, PageContext, MediaTypeEnum)
*/
@Override
public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException
{
return pageContext.getAttribute("prefix").toString() + media.getName() + " " + columnValue;
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:9,代码来源:PageContextPrefixColumnDecorator.java
示例20: decorate
import org.displaytag.exception.DecoratorException; //导入依赖的package包/类
@Override
public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException
{
return columnValue;
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:6,代码来源:NoDecorationColumnDecorator.java
注:本文中的org.displaytag.exception.DecoratorException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论