Java Code Examples for org.thymeleaf.processor.element.IElementTagStructureHandler#setBody()
The following examples show how to use
org.thymeleaf.processor.element.IElementTagStructureHandler#setBody() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PaginationSummaryAttrProcessor.java From thymeleaf-spring-data-dialect with Apache License 2.0 | 6 votes |
@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); }
Example 2
Source File: ThSysTagProcessor.java From mayday with GNU General Public License v3.0 | 5 votes |
@Override protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName, String attributeValue, IElementTagStructureHandler structureHandler) { final IEngineConfiguration configuration = context.getConfiguration(); final IStandardExpressionParser parser = StandardExpressions.getExpressionParser(configuration); final IStandardExpression expression = parser.parseExpression(context, attributeValue); final String title = (String) expression.execute(context); structureHandler.setBody(title + " - " + MaydayConst.OPTIONS.get("blog_name"), false); }
Example 3
Source File: PageSizeSelectorAttrProcessor.java From thymeleaf-spring-data-dialect with Apache License 2.0 | 5 votes |
@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); }
Example 4
Source File: PaginationAttrProcessor.java From thymeleaf-spring-data-dialect with Apache License 2.0 | 5 votes |
@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); } }
Example 5
Source File: PrettytimeProcessor.java From wenku with MIT License | 4 votes |
@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); }
Example 6
Source File: PropertiesProcessor.java From wenku with MIT License | 4 votes |
@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); }