• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IProcessableElementTag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.thymeleaf.model.IProcessableElementTag的典型用法代码示例。如果您正苦于以下问题:Java IProcessableElementTag类的具体用法?Java IProcessableElementTag怎么用?Java IProcessableElementTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IProcessableElementTag类属于org.thymeleaf.model包,在下文中一共展示了IProcessableElementTag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getContents

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
static Contents getContents(final ITemplateContext context,
                            final IProcessableElementTag tag) {
    final Contents contents;
    final String from = tag.getAttributeValue(ATTR_FROM);
    if (from != null) {
        final IEngineConfiguration configuration = context.getConfiguration();
        final IStandardExpressionParser parser = getExpressionParser(configuration);
        final IStandardExpression expression = parser.parseExpression(context, from);
        contents = (Contents) expression.execute(context);
    } else {
        Object contentsVar = context.getVariable(DEFAULT_VAR_CONTENTS);
        if (contentsVar != null) {
            contents = (Contents) contentsVar;
        } else {
            contents = null;
        }
    }
    if (contents != null) {
        return contents;
    } else {
        throw new IllegalStateException(
                "Unable to get RxComposer Contents. " +
                        "You should either provide a template variable named 'contents' or " +
                        "provide it using attribute 'from': '<rxc:fragment from='${myContents}' position='A' />");
    }
}
 
开发者ID:otto-de,项目名称:rx-composer,代码行数:27,代码来源:RxcFragmentElementProcessor.java


示例2: shouldReturnContent

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Test
public void shouldReturnContent() throws IOException {
    Contents contents = contentsBuilder()
            .add(someContent(A))
            .build();

    final ITemplateContext context = mock(ITemplateContext.class);
    //when(context.getVariable("debugMode")).thenReturn(FALSE);
    when(context.getVariable("contents")).thenReturn(contents);

    final IProcessableElementTag tag = mock(IProcessableElementTag.class);
    when(tag.getAttributeValue("position")).thenReturn("A");


    final IElementTagStructureHandler structureHandler = mock(IElementTagStructureHandler.class);

    //when
    new RxcFragmentElementProcessor().doProcess(context, tag, structureHandler);

    //then
    verify(structureHandler).replaceWith("Some Content", false);
}
 
开发者ID:otto-de,项目名称:rx-composer,代码行数:23,代码来源:RxcFragmentElementProcessorTest.java


示例3: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(
		final ITemplateContext context, final IProcessableElementTag tag,
		final IElementTagStructureHandler structureHandler) {

	final String allRolesStr = tag.getAttributeValue("name");

	final String[] roles = StringUtils.split(allRolesStr, DELIMITER);

	if(ShiroFacade.hasAllRoles(roles)){
		structureHandler.removeTags();
	} else {
		structureHandler.removeElement();
	}

}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:17,代码来源:HasRoleElementTagProcessor.java


示例4: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag,
		final AttributeName attributeName, final String attributeValue,
		final IElementTagStructureHandler structureHandler) {

	IStandardExpressionParser expressionParser = StandardExpressions
			.getExpressionParser(context.getConfiguration());

	IStandardExpression expression = expressionParser.parseExpression(context, attributeValue);
	Boolean enabled = (Boolean) expression.execute(context);

	if (enabled) {
		expression = expressionParser.parseExpression(context, "@{/resources/konker/images/enabled.svg}");
	} else {
		expression = expressionParser.parseExpression(context, "@{/resources/konker/images/disabled.svg}");
	}

	structureHandler.setAttribute("src", (String) expression.execute(context));
	structureHandler.setAttribute("class", (String) "enabled-img");

}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:21,代码来源:EnabledImageTagProcessor.java


示例5: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的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);
}
 
开发者ID:jpenren,项目名称:thymeleaf-spring-data-dialect,代码行数:25,代码来源:PaginationSummaryAttrProcessor.java


示例6: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
        String attributeValue, IElementTagStructureHandler structureHandler) {

    if (context instanceof WebEngineContext) {
        Object page = Expressions.evaluate(context, attributeValue);

        if (!(page instanceof Page<?>)) {
            throw new InvalidObjectParameterException(
                    "Parameter " + attributeValue + " is not an Page<?> instance!");
        }

        ((WebEngineContext) context).setVariable(Keys.PAGE_VARIABLE_KEY, page);
    }

}
 
开发者ID:jpenren,项目名称:thymeleaf-spring-data-dialect,代码行数:17,代码来源:PageObjectAttrProcessor.java


示例7: decorate

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
public final String decorate(final IProcessableElementTag tag, final ITemplateContext context) {
    String bundleName = getClass().getSimpleName();
    Locale locale = context.getLocale();
    Page<?> page = PageUtils.findPage(context);

    // previous
    String previousPage = PageUtils.createPageUrl(context, page.getNumber() - 1);
    String prevKey = PageUtils.isFirstPage(page) ? "pager.previous" : "pager.previous.link";
    String prev = Messages.getMessage(bundleName, prevKey, locale, previousPage);

    // next
    String nextPage = PageUtils.createPageUrl(context, page.getNumber() + 1);
    String nextKey = page.isLast() ? "pager.next" : "pager.next.link";
    String next = Messages.getMessage(bundleName, nextKey, locale, nextPage);

    String content = Strings.concat(prev, next);

    return Messages.getMessage(bundleName, "pager", locale, content);
}
 
开发者ID:jpenren,项目名称:thymeleaf-spring-data-dialect,代码行数:20,代码来源:AbstractPagerDecorator.java


示例8: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(ITemplateContext context, IProcessableElementTag tag, AttributeName attributeName,
        String attributeValue, IElementTagStructureHandler structureHandler) {

    String attrValue = String.valueOf(Expressions.evaluate(context, attributeValue)).trim();
    Page<?> page = PageUtils.findPage(context);
    String url = PageUtils.createSortUrl(context, attrValue);

    // Append class to the element if sorted by this field
    Sort sort = page.getSort();
    boolean isSorted = sort != null && sort.getOrderFor(attrValue) != null;
    String clas = isSorted
            ? SORTED_PREFIX.concat(sort.getOrderFor(attrValue).getDirection().toString().toLowerCase())
            : EMPTY;

    structureHandler.setAttribute(HREF, url);
    String currentClass = tag.getAttributeValue(CLASS);
    structureHandler.setAttribute(CLASS, Strings.concat(currentClass, BLANK, clas));
}
 
开发者ID:jpenren,项目名称:thymeleaf-spring-data-dialect,代码行数:20,代码来源:PaginationSortAttrProcessor.java


示例9: it_should_fail_with_invalid_arguments

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Test
public void it_should_fail_with_invalid_arguments() throws NoSuchMethodException {
    final Method method = FlashMessagesElementTagProcessor.class.getDeclaredMethod("doProcess", ITemplateContext.class, IProcessableElementTag.class, IElementTagStructureHandler.class);
    method.setAccessible(true);

    assertThat(method)
        .in(this.sut)
        .willThrowNullPointerException()
        .whenInvokedWithNulls()
        .whenInvokedWith(null, this.mockElementTag, this.mockStructureHandler)
        .whenInvokedWith(this.mockWebEngineContext, null, this.mockStructureHandler)
        .whenInvokedWith(this.mockWebEngineContext, this.mockElementTag, null);

    assertThat(method)
        .in(this.sut)
        .willThrowIllegalArgumentException()
        .whenInvokedWith(this.mockTemplateContext, this.mockElementTag, this.mockStructureHandler);
}
 
开发者ID:jeslopalo,项目名称:flash-messages,代码行数:19,代码来源:FlashMessagesElementTagProcessorSpecs.java


示例10: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(ITemplateContext iTemplateContext,
                         IProcessableElementTag iProcessableElementTag,
                         AttributeName attributeName,
                         String attributeValue,
                         IElementTagStructureHandler iElementTagStructureHandler) {

    final String type = iProcessableElementTag.getAttributeValue("type");
    final String property = iProcessableElementTag.getAttributeValue("property");

    final String text = ShiroFacade.getPrincipalText(type, property);
    final String elementCompleteName = iProcessableElementTag.getElementCompleteName();

    final IModelFactory modelFactory = iTemplateContext.getModelFactory();
    final IModel model = modelFactory.createModel();

    model.add(modelFactory.createOpenElementTag(elementCompleteName));
    model.add(modelFactory.createText(HtmlEscape.escapeHtml5(text)));
    model.add(modelFactory.createCloseElementTag(elementCompleteName));

    iElementTagStructureHandler.replaceWith(model, false);
}
 
开发者ID:theborakompanioni,项目名称:thymeleaf-extras-shiro,代码行数:23,代码来源:PrincipalAttrProcessor.java


示例11: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
 protected void doProcess(
         final ITemplateContext context, final IProcessableElementTag tag,
         final AttributeName attributeName, final String attributeValue,
         final IElementTagStructureHandler structureHandler) {

     final IEngineConfiguration configuration = context.getConfiguration();

     /*
      * Obtain the Thymeleaf Standard Expression parser
      */
     final IStandardExpressionParser parser = StandardExpressions.getExpressionParser(configuration);

     /*
      * Parse the attribute value as a Thymeleaf Standard Expression
      */
     final IStandardExpression expression = parser.parseExpression(context, attributeValue);

     /*
      * Execute the expression just parsed
      */
     final String origurl = (String) expression.execute(context);
     StringBuilder urlBuilder = new StringBuilder(origurl);
	
 	CsrfToken token = (CsrfToken) context.getVariable("_csrf");
 	// token è null quando il csrf è stato disabilitato
 	if (token!=null) { 
 		final String tokenName = token.getParameterName();
 		final String tokenValue = token.getToken();
if (urlBuilder.lastIndexOf("?")>-1) {
	urlBuilder.append("&");
} else {
	urlBuilder.append("?");
}
urlBuilder.append(tokenName).append("=").append(tokenValue);
 	}
 	structureHandler.setAttribute("action", urlBuilder.toString());
     
 }
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:40,代码来源:YadaActionUploadAttrProcessor.java


示例12: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(
        final ITemplateContext context, final IProcessableElementTag tag,
        final AttributeName attributeName, final String attributeValue,
        final IElementTagStructureHandler structureHandler) {

    final IEngineConfiguration configuration = context.getConfiguration();

    /*
     * Obtain the Thymeleaf Standard Expression parser
     */
    final IStandardExpressionParser parser = StandardExpressions.getExpressionParser(configuration);

    /*
     * Parse the attribute value as a Thymeleaf Standard Expression
     */
    final IStandardExpression expression = parser.parseExpression(context, attributeValue);

    /*
     * Execute the expression just parsed
     */
    final String semiurl = (String) expression.execute(context);

    String resultUrl = yadaDialectUtil.getVersionedAttributeValue(context, semiurl);

    /*
     * Set the new value into the 'href' attribute
     */
    if (resultUrl != null) {
    	structureHandler.setAttribute(ATTR_NAME, resultUrl);
    }
}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:33,代码来源:YadaSrcAttrProcessor.java


示例13: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(
        final ITemplateContext context, final IProcessableElementTag tag,
        final AttributeName attributeName, final String attributeValue,
        final IElementTagStructureHandler structureHandler) {

    final IEngineConfiguration configuration = context.getConfiguration();

    /*
     * Obtain the Thymeleaf Standard Expression parser
     */
    final IStandardExpressionParser parser = StandardExpressions.getExpressionParser(configuration);

    /*
     * Parse the attribute value as a Thymeleaf Standard Expression
     */
    final IStandardExpression expression = parser.parseExpression(context, attributeValue);

    /*
     * Execute the expression just parsed
     */
    final String semiurl = (String) expression.execute(context);

    String resultUrl = yadaDialectUtil.getVersionedAttributeValue(context, semiurl);

    /*
     * Set the new value into the 'href' attribute
     */
    if (resultUrl != null) {
    	structureHandler.setAttribute(ATTR_NAME, resultUrl);
    }

}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:34,代码来源:YadaHrefAttrProcessor.java


示例14: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(final ITemplateContext context,
                         final IProcessableElementTag tag,
                         final IElementTagStructureHandler structureHandler) {
    final Contents contents = getContents(context, tag);
    final Position pos = getPosition(context, tag);
    if (contents.get(pos).isAvailable()) {
        structureHandler.replaceWith(contents.get(pos).getBody(), false);
    } else {
        structureHandler.removeTags();
    }
}
 
开发者ID:otto-de,项目名称:rx-composer,代码行数:13,代码来源:RxcFragmentElementProcessor.java


示例15: getPosition

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
static Position getPosition(final ITemplateContext context,
                            final IProcessableElementTag tag) {
    String position = tag.getAttributeValue("position");
    try {
        final IEngineConfiguration configuration = context.getConfiguration();
        final IStandardExpressionParser parser = getExpressionParser(configuration);
        final IStandardExpression expression = parser.parseExpression(context, position);
        return () -> expression.execute(context).toString();
    } catch (final Exception e) {
        return () -> position;
    }
}
 
开发者ID:otto-de,项目名称:rx-composer,代码行数:13,代码来源:RxcFragmentElementProcessor.java


示例16: process

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
public void process(ITemplateContext context, IProcessableElementTag tag, IElementTagStructureHandler structureHandler) {
    IAttribute[] attributes = tag.getAllAttributes();
    for (int i = attributes.length - 1; i >= 0; --i) {
        structureHandler.removeAttribute(attributes[i].getAttributeDefinition().getAttributeName());
    }
    for (IAttribute attribute : attributes) {
        structureHandler.replaceAttribute(attribute.getAttributeDefinition().getAttributeName(), attribute.getAttributeCompleteName(), attribute.getValue(), attribute.getValueQuotes());
    }
}
 
开发者ID:zjnu-acm,项目名称:judge,代码行数:11,代码来源:AttributesInnerWhitespacesProcessor.java


示例17: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(
		final ITemplateContext context, final IProcessableElementTag tag,
		final AttributeName attributeName, final String attributeValue,
		final IElementTagStructureHandler structureHandler) {
	final String[] roles = StringUtils.split(attributeValue, DELIMITER);

	if(!ShiroFacade.hasAnyRoles(roles)){
		structureHandler.removeElement();
	}
}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:12,代码来源:HasAnyRolesAttributeTagProcessor.java


示例18: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(
		final ITemplateContext context, final IProcessableElementTag tag,
		final AttributeName attributeName, final String attributeValue,
		final IElementTagStructureHandler structureHandler) {
	final String[] permissions = StringUtils.split(attributeValue, DELIMITER);

	if(!ShiroFacade.hasAllPermissions(permissions)){
		structureHandler.removeElement();
	}
}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:12,代码来源:HasPermissionAttributeTagProcessor.java


示例19: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(
		final ITemplateContext context, final IProcessableElementTag tag,
		final AttributeName attributeName, final String attributeValue,
		final IElementTagStructureHandler structureHandler) {
	final String[] permissions = StringUtils.split(attributeValue, DELIMITER);

	if(ShiroFacade.hasAnyPermissions(permissions)){
		structureHandler.removeElement();
	}
}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:12,代码来源:lacksPermissionAttributeTagProcessor.java


示例20: doProcess

import org.thymeleaf.model.IProcessableElementTag; //导入依赖的package包/类
@Override
protected void doProcess(
		final ITemplateContext context, final IProcessableElementTag tag,
		final AttributeName attributeName, final String attributeValue,
		final IElementTagStructureHandler structureHandler) {

	if(!ShiroFacade.isGuest()){
		structureHandler.removeElement();
	}
}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:11,代码来源:GuestAttributeTagProcessor.java



注:本文中的org.thymeleaf.model.IProcessableElementTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LettuceConnectionFactory类代码示例发布时间:2022-05-21
下一篇:
Java StandardPatterns类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap