当前位置: 首页>>代码示例>>Java>>正文


Java StandardExpressions类代码示例

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


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

示例1: doProcess

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的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

示例2: getNewLocalVariables

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
protected Map<String, Object> getNewLocalVariables(Arguments arguments, Element element) {
    initServices(arguments);
    FieldWrapper fieldWrapper = new FieldWrapper();
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue("fieldBuilder"));
    String fieldBuilder = (String) expression.execute(arguments.getConfiguration(), arguments);

    if (fieldBuilder != null) {
        RuleBuilderFieldService ruleBuilderFieldService = ruleBuilderFieldServiceFactory.createInstance(fieldBuilder);
        if (ruleBuilderFieldService != null) {
            fieldWrapper = ruleBuilderFieldService.buildFields();
        }
    }
    
    Map<String, Object> newVars = new HashMap<String, Object>();
    newVars.put("fieldWrapper", fieldWrapper);
    return newVars;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:21,代码来源:AdminFieldBuilderProcessor.java

示例3: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    String href = "#";
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    AdminSection section = (AdminSection) expression.execute(arguments.getConfiguration(), arguments);
    if (section != null) {
        HttpServletRequest request = ((SpringWebContext) arguments.getContext()).getHttpServletRequest();

        href = request.getContextPath() + section.getUrl();
    }
    
    Map<String, String> attrs = new HashMap<String, String>();
    attrs.put("href", href);
    return attrs;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:18,代码来源:AdminSectionHrefProcessor.java

示例4: modifyModelAttributes

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
protected void modifyModelAttributes(Arguments arguments, Element element) {
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue("itemId"));
    String itemId = String.valueOf(expression.execute(arguments.getConfiguration(), arguments));
    RatingSummary ratingSummary = ratingService.readRatingSummary(itemId, RatingType.PRODUCT);
    if (ratingSummary != null) {
        addToModel(arguments, getRatingsVar(element), ratingSummary);
    }
    
    Customer customer = CustomerState.getCustomer();
    ReviewDetail reviewDetail = null;
    if (!customer.isAnonymous()) {
        reviewDetail = ratingService.readReviewByCustomerAndItem(customer, itemId);
    }
    if (reviewDetail != null) {
        addToModel(arguments, "currentCustomerReview", reviewDetail);
    }
    
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:21,代码来源:RatingsProcessor.java

示例5: getNewLocalVariables

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
protected Map<String, Object> getNewLocalVariables(Arguments arguments, Element element) {
    initServices(arguments);
    HashMap<String, String> productOptionDisplayValues = new HashMap<String, String>();
    Map<String, Object> newVars = new HashMap<String, Object>();
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue("orderItem"));
    Object item = expression.execute(arguments.getConfiguration(), arguments);
    if (item instanceof DiscreteOrderItem) {
        DiscreteOrderItem orderItem = (DiscreteOrderItem) item;

        for (String i : orderItem.getOrderItemAttributes().keySet()) {
            for (ProductOption option : orderItem.getProduct().getProductOptions()) {
                if (option.getAttributeName().equals(i) && !StringUtils.isEmpty(orderItem.getOrderItemAttributes().get(i).toString())) {
                    productOptionDisplayValues.put(option.getLabel(), orderItem.getOrderItemAttributes().get(i).toString());
                }
            }
        }
    }
    newVars.put("productOptionDisplayValues", productOptionDisplayValues);

    return newVars;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:24,代码来源:ProductOptionDisplayProcessor.java

示例6: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    Map<String, String> attrs = new HashMap<String, String>();
    
    BroadleafRequestContext blcContext = BroadleafRequestContext.getBroadleafRequestContext();
    HttpServletRequest request = blcContext.getRequest();
    
    String baseUrl = request.getRequestURL().toString();
    Map<String, String[]> params = new HashMap<String, String[]>(request.getParameterMap());
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    Integer page = (Integer) expression.execute(arguments.getConfiguration(), arguments);
    if (page != null && page > 1) {
        params.put(ProductSearchCriteria.PAGE_NUMBER, new String[] { page.toString() });
    } else {
        params.remove(ProductSearchCriteria.PAGE_NUMBER);
    }
    
    String url = ProcessorUtils.getUrl(baseUrl, params);
    
    attrs.put("href", url);
    return attrs;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:26,代码来源:PaginationPageLinkProcessor.java

示例7: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    Map<String, String> attrs = new HashMap<String, String>();
    
    BroadleafRequestContext blcContext = BroadleafRequestContext.getBroadleafRequestContext();
    HttpServletRequest request = blcContext.getRequest();
    
    String baseUrl = request.getRequestURL().toString();
    Map<String, String[]> params = new HashMap<String, String[]>(request.getParameterMap());
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    SearchFacetDTO facet = (SearchFacetDTO) expression.execute(arguments.getConfiguration(), arguments);
    
    String key = facet.getFacet().getField().getAbbreviation();
    params.remove(key);
    params.remove(ProductSearchCriteria.PAGE_NUMBER);
    
    String url = ProcessorUtils.getUrl(baseUrl, params);
    
    attrs.put("href", url);
    return attrs;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:25,代码来源:RemoveFacetValuesLinkProcessor.java

示例8: parse

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
public static Object parse(final Arguments arguments, final String attributeValue, boolean escape) {

        final Configuration configuration = arguments.getConfiguration();
        final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);

        final IStandardExpression expression = expressionParser.parseExpression(configuration, arguments, attributeValue);

        final Object result;
        if (escape) {
            result = expression.execute(configuration, arguments);
        }
        else {
            result = expression.execute(configuration, arguments, StandardExpressionExecutionContext.UNESCAPED_EXPRESSION);
        }

        return result;
    }
 
开发者ID:af-not-found,项目名称:blog-java2,代码行数:18,代码来源:ProcessorUtil.java

示例9: isVisible

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
protected boolean isVisible(final Arguments arguments, final Element element, final String attributeName) {

    String attributeValue = element.getAttributeValue(attributeName);

    if (StringUtils.indexOf(attributeValue, "isAdminPage") != -1) {
        Object context = arguments.getContext();
        if (context instanceof SpringWebContext) {
            SpringWebContext webContext = (SpringWebContext) context;
            HttpServletRequest httpServletRequest = webContext.getHttpServletRequest();
            boolean val = StringUtils.indexOf(httpServletRequest.getRequestURI(), "/_admin/") != -1;
            attributeValue = StringUtils.replace(attributeValue, "isAdminPage", Boolean.toString(val));
        }
    }

    final Configuration configuration = arguments.getConfiguration();
    final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);

    final IStandardExpression expression = expressionParser.parseExpression(configuration, arguments, attributeValue);
    final Object value = expression.execute(configuration, arguments);

    final boolean visible = EvaluationUtil.evaluateAsBoolean(value);

    return visible;
}
 
开发者ID:af-not-found,项目名称:blog-java2,代码行数:26,代码来源:MyFunctionDialect.java

示例10: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
protected Map<String, String> getModifiedAttributeValues(
        Arguments arguments, Element element, String attributeName) {
    final String attributeValue = element.getAttributeValue(attributeName);

    final Configuration configuration = arguments.getConfiguration();
    final IStandardExpressionParser expressionParser =
            StandardExpressions.getExpressionParser(configuration);

    final IStandardExpression expression =
            expressionParser.parseExpression(configuration, arguments, attributeValue);

    final Set<String> newAttributeNames =
            new HashSet<String>(Arrays.asList("id", "name"));

    final Object valueForAttributes = expression.execute(configuration, arguments);

    final Map<String,String> result =
            new HashMap<String,String>(newAttributeNames.size() + 1, 1.0f);
    for (final String newAttributeName : newAttributeNames) {
        result.put(newAttributeName,
                (valueForAttributes == null? "" : valueForAttributes.toString()));
    }

    return result;
}
 
开发者ID:onBass-naga,项目名称:spring-boot-samples,代码行数:27,代码来源:IdNameProcessor.java

示例11: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    Map<String, String> attrs = new HashMap<String, String>();
    
    SparkRequestContext blcContext = SparkRequestContext.getSparkRequestContext();
    HttpServletRequest request = blcContext.getRequest();
    
    String baseUrl = request.getRequestURL().toString();
    Map<String, String[]> params = new HashMap<String, String[]>(request.getParameterMap());
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    Integer page = (Integer) expression.execute(arguments.getConfiguration(), arguments);
    if (page != null && page > 1) {
        params.put(ProductSearchCriteria.PAGE_NUMBER, new String[] { page.toString() });
    } else {
        params.remove(ProductSearchCriteria.PAGE_NUMBER);
    }
    
    String url = ProcessorUtils.getUrl(baseUrl, params);
    
    attrs.put("href", url);
    return attrs;
}
 
开发者ID:akdasari,项目名称:SparkCommerce,代码行数:26,代码来源:PaginationPageLinkProcessor.java

示例12: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    Map<String, String> attrs = new HashMap<String, String>();
    
    SparkRequestContext blcContext = SparkRequestContext.getSparkRequestContext();
    HttpServletRequest request = blcContext.getRequest();
    
    String baseUrl = request.getRequestURL().toString();
    Map<String, String[]> params = new HashMap<String, String[]>(request.getParameterMap());
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    SearchFacetDTO facet = (SearchFacetDTO) expression.execute(arguments.getConfiguration(), arguments);
    
    String key = facet.getFacet().getField().getAbbreviation();
    params.remove(key);
    params.remove(ProductSearchCriteria.PAGE_NUMBER);
    
    String url = ProcessorUtils.getUrl(baseUrl, params);
    
    attrs.put("href", url);
    return attrs;
}
 
开发者ID:akdasari,项目名称:SparkCommerce,代码行数:25,代码来源:RemoveFacetValuesLinkProcessor.java

示例13: getNewLocalVariables

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
protected Map<String, Object> getNewLocalVariables(Arguments arguments, Element element) {
    FieldWrapper fieldWrapper = new FieldWrapper();
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue("fieldBuilder"));
    String fieldBuilder = (String) expression.execute(arguments.getConfiguration(), arguments);

    if (fieldBuilder != null) {
        RuleBuilderFieldService ruleBuilderFieldService = ruleBuilderFieldServiceFactory.createInstance(fieldBuilder);
        if (ruleBuilderFieldService != null) {
            fieldWrapper = ruleBuilderFieldService.buildFields();
        }
    }
    
    Map<String, Object> newVars = new HashMap<String, Object>();
    newVars.put("fieldWrapper", fieldWrapper);
    return newVars;
}
 
开发者ID:takbani,项目名称:blcdemo,代码行数:20,代码来源:AdminFieldBuilderProcessor.java

示例14: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    Map<String, String> attrs = new HashMap<String, String>();
    
    BroadleafRequestContext blcContext = BroadleafRequestContext.getBroadleafRequestContext();
    HttpServletRequest request = blcContext.getRequest();
    
    String baseUrl = request.getRequestURL().toString();
    Map<String, String[]> params = new HashMap<String, String[]>(request.getParameterMap());
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    Integer page = (Integer) expression.execute(arguments.getConfiguration(), arguments);
    if (page != null && page > 1) {
        params.put(SearchCriteria.PAGE_NUMBER, new String[] { page.toString() });
    } else {
        params.remove(SearchCriteria.PAGE_NUMBER);
    }
    
    String url = ProcessorUtils.getUrl(baseUrl, params);
    
    attrs.put("href", url);
    return attrs;
}
 
开发者ID:takbani,项目名称:blcdemo,代码行数:26,代码来源:PaginationPageLinkProcessor.java

示例15: getModifiedAttributeValues

import org.thymeleaf.standard.expression.StandardExpressions; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    Map<String, String> attrs = new HashMap<String, String>();
    
    BroadleafRequestContext blcContext = BroadleafRequestContext.getBroadleafRequestContext();
    HttpServletRequest request = blcContext.getRequest();
    
    String baseUrl = request.getRequestURL().toString();
    Map<String, String[]> params = new HashMap<String, String[]>(request.getParameterMap());
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    SearchFacetDTO facet = (SearchFacetDTO) expression.execute(arguments.getConfiguration(), arguments);
    
    String key = facet.getFacet().getField().getAbbreviation();
    params.remove(key);
    params.remove(SearchCriteria.PAGE_NUMBER);
    
    String url = ProcessorUtils.getUrl(baseUrl, params);
    
    attrs.put("href", url);
    return attrs;
}
 
开发者ID:takbani,项目名称:blcdemo,代码行数:25,代码来源:RemoveFacetValuesLinkProcessor.java


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