本文整理汇总了Java中org.thymeleaf.processor.element.IElementTagStructureHandler.setBody方法的典型用法代码示例。如果您正苦于以下问题:Java IElementTagStructureHandler.setBody方法的具体用法?Java IElementTagStructureHandler.setBody怎么用?Java IElementTagStructureHandler.setBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.thymeleaf.processor.element.IElementTagStructureHandler
的用法示例。
在下文中一共展示了IElementTagStructureHandler.setBody方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doProcess
import org.thymeleaf.processor.element.IElementTagStructureHandler; //导入方法依赖的package包/类
@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
String attributeValue, IElementTagStructureHandler structureHandler) {
// Compose message with parameters:
// {0} first reg. position
// {1} latest page reg. position
// {2} total elements
// pagination.summary=Showing {0} to {1} of {2} entries
Locale locale = context.getLocale();
Page<?> page = PageUtils.findPage(context);
int firstItem = PageUtils.getFirstItemInPage(page);
int latestItem = PageUtils.getLatestItemInPage(page);
int totalElements = (int) page.getTotalElements();
boolean isEmpty = page.getTotalElements() == 0;
String attrValue = String.valueOf(attributeValue).trim();
String messageTemplate = COMPACT.equals(attrValue) ? COMPACT_MESSAGE_KEY : DEFAULT_MESSAGE_KEY;
String messageKey = isEmpty ? NO_VALUES_MESSAGE_KEY : messageTemplate;
String message = Messages.getMessage(BUNDLE_NAME, messageKey, locale, firstItem, latestItem, totalElements);
structureHandler.setBody(message, false);
}
示例2: doProcess
import org.thymeleaf.processor.element.IElementTagStructureHandler; //导入方法依赖的package包/类
@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
String attributeValue, IElementTagStructureHandler structureHandler) {
Locale locale = context.getLocale();
loadSelectorValues(locale);
String selectorStyle = String.valueOf(attributeValue).trim();
String messageKey = getMessageKey(selectorStyle);
String options = composeSelectorOptions(selectorStyle, context);
String message = Messages.getMessage(BUNDLE_NAME, messageKey, locale, options);
structureHandler.setBody(message, false);
}
示例3: doProcess
import org.thymeleaf.processor.element.IElementTagStructureHandler; //导入方法依赖的package包/类
@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
String attributeValue, IElementTagStructureHandler structureHandler) {
String attrValue = String.valueOf(attributeValue).trim();
PaginationDecorator decorator = PaginationDecoratorRegistry.getInstance().getDecorator(attrValue);
String html = decorator.decorate(tag, context);
boolean isUlNode = Strings.UL.equalsIgnoreCase(tag.getElementCompleteName());
if (isUlNode) {
structureHandler.replaceWith(html, false);
} else {
structureHandler.setBody(html, false);
}
}
示例4: doProcess
import org.thymeleaf.processor.element.IElementTagStructureHandler; //导入方法依赖的package包/类
@Override
protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final Object expressionResult, final IElementTagStructureHandler structureHandler) {
structureHandler.setBody(RelativeDateFormat.format((Date) expressionResult), false);
}
示例5: doProcess
import org.thymeleaf.processor.element.IElementTagStructureHandler; //导入方法依赖的package包/类
@Override
protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final Object expressionResult, final IElementTagStructureHandler structureHandler) {
structureHandler.setBody(PropertiesUtil.getValue(CastUtil.castString(expressionResult)), false);
}