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


Java ProcessorResult类代码示例

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


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

示例1: processElement

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
    StringBuffer sb = new StringBuffer();
    sb.append("<SCRIPT>\n");
    sb.append("  var params = \n  ");
    sb.append(buildContentMap(arguments)).append(";\n  ");
    sb.append(getUncacheableDataFunction(arguments, element)).append(";\n");
    sb.append("</SCRIPT>");
            
    // Add contentNode to the document
    Node contentNode = new Macro(sb.toString());
    element.clearChildren();
    element.getParent().insertAfter(element, contentNode);
    element.getParent().removeChild(element);

    // Return OK
    return ProcessorResult.OK;

}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:20,代码来源:UncacheableDataProcessor.java

示例2: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {

   HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();

   Map<Option<?>, Object> stagingOptions = (Map<Option<?>, Object>) request
         .getAttribute(DataTablesDialect.INTERNAL_BEAN_TABLE_STAGING_OPTIONS);

   // Make the actual attribute processing
   doProcessAttribute(arguments, element, attributeName, stagingOptions);

   // Housekeeping
   element.removeAttribute(attributeName);

   return ProcessorResult.ok();
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:18,代码来源:AbstractTableAttrProcessor.java

示例3: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {

   Map<Option<?>, Object> stagingOptions = (Map<Option<?>, Object>) arguments
         .getLocalVariable(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_OPTIONS);
   Map<Option<?>, Extension> stagingExtensions = (Map<Option<?>, Extension>) arguments
         .getLocalVariable(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_EXTENSIONS);

   // Perform the actual attribute processing
   doProcessAttribute(arguments, element, attributeName, stagingOptions, stagingExtensions);

   // Housekeeping
   element.removeAttribute(attributeName);

   return ProcessorResult.ok();
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:18,代码来源:AbstractColumnAttrProcessor.java

示例4: doProcessElement

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
      HttpServletResponse response, HtmlTable htmlTable) {

   // The HtmlTable is updated with a new row
   if (htmlTable != null) {
      htmlTable.getBodyRows().add(new HtmlRow());
   }

   // Remove internal attribute
   if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":data")) {
      element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":data");
   }

   return ProcessorResult.OK;
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:17,代码来源:TrElProcessor.java

示例5: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
    String[] value = element.getAttributeValue(attributeName).split(":");
    String webjarName = value[0];
    String filePath = value[1];

    element.removeAttribute(attributeName);

    element.setAttribute("th:" + attribute, String.format("@{/{path}/%s(path=${#webjars['%s'].path})}", filePath, webjarName));
    // reevaluate th:src
    element.setRecomputeProcessorsImmediately(true);

    return ProcessorResult.OK;
}
 
开发者ID:Catalysts,项目名称:cat-boot,代码行数:15,代码来源:WebjarsLinkProcessor.java

示例6: processElement

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
/**
 * This method will handle calling the modifyModelAttributes abstract method and return
 * an "OK" processor result
 */
@Override
protected ProcessorResult processElement(final Arguments arguments, final Element element) {
    modifyModelAttributes(arguments, element);
    
    // Remove the tag from the DOM
    final NestableNode parent = element.getParent();
    parent.removeChild(element);
    
    return ProcessorResult.OK;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:15,代码来源:AbstractModelVariableModifierProcessor.java

示例7: processElement

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
    // If the form will be not be submitted with a GET, we must add the CSRF token
    // We do this instead of checking for a POST because post is default if nothing is specified
    if (!"GET".equalsIgnoreCase(element.getAttributeValueFromNormalizedName("method"))) {
        try {
            String csrfToken = eps.getCSRFToken();

            //detect multipart form
            if ("multipart/form-data".equalsIgnoreCase(element.getAttributeValueFromNormalizedName("enctype"))) {
                Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
                        .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValueFromNormalizedName("th:action"));
                String action = (String) expression.execute(arguments.getConfiguration(), arguments);
                String csrfQueryParameter = "?" + eps.getCsrfTokenParameter() + "=" + csrfToken;
                element.removeAttribute("th:action");
                element.setAttribute("action", action + csrfQueryParameter);
            } else {
                Element csrfNode = new Element("input");
                csrfNode.setAttribute("type", "hidden");
                csrfNode.setAttribute("name", eps.getCsrfTokenParameter());
                csrfNode.setAttribute("value", csrfToken);
                element.addChild(csrfNode);
            }

        } catch (ServiceException e) {
            throw new RuntimeException("Could not get a CSRF token for this session", e);
        }
    }
    
    // Convert the <blc:form> node to a normal <form> node
    Element newElement = element.cloneElementNodeWithNewName(element.getParent(), "form", false);
    newElement.setRecomputeProcessorsImmediately(true);
    element.getParent().insertAfter(element, newElement);
    element.getParent().removeChild(element);
    
    return ProcessorResult.OK;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:38,代码来源:FormProcessor.java

示例8: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    ProductOptionValue productOptionValue = (ProductOptionValue) expression.execute(arguments.getConfiguration(), arguments);

    ProductOptionValueDTO dto = new ProductOptionValueDTO();
    dto.setOptionId(productOptionValue.getProductOption().getId());
    dto.setValueId(productOptionValue.getId());
    dto.setValueName(productOptionValue.getAttributeValue());
    if (productOptionValue.getPriceAdjustment() != null) {
        dto.setPriceAdjustment(productOptionValue.getPriceAdjustment().getAmount());
    }
    try {
        ObjectMapper mapper = new ObjectMapper();
        Writer strWriter = new StringWriter();
        mapper.writeValue(strWriter, dto);
        element.setAttribute("data-product-option-value", strWriter.toString());
        element.removeAttribute(attributeName);
        return ProcessorResult.OK;
    } catch (Exception ex) {
        LOG.error("There was a problem writing the product option value to JSON", ex);
    }
    
    return null;
    
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:29,代码来源:ProductOptionValueProcessor.java

示例9: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(final Arguments arguments, final Element element, String attributeName) {
    if (shouldCache(arguments, element, attributeName)) {
        fixElement(element, arguments);
        if (checkCacheForElement(arguments, element)) {
            // This template has been cached.
            element.clearChildren();
            element.clearAttributes();
            element.setRecomputeProcessorsImmediately(true);
        }
    }
    return ProcessorResult.OK;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:14,代码来源:BroadleafCacheProcessor.java

示例10: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
    String parameters = element.getAttributeValue(attributeName);
    element.removeAttribute(attributeName);
    Map<String, Object> variables = new ParamsCommand(arguments, parameters).execute();
    return ProcessorResult.setLocalVariables(variables);
}
 
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:8,代码来源:ParamsAttrProcessor.java

示例11: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
    String value = element.getAttributeValue(attributeName);
    String query = ExpressionUtil.expressionValue(arguments, value).toString();
    element.removeAttribute(attributeName);
    Map<String, Object> variables = new QueryCommand(arguments, query).execute();
    return ProcessorResult.setLocalVariables(variables);
}
 
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:9,代码来源:QueryAttrProcessor.java

示例12: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
    String value = element.getAttributeValue(attributeName);
    String query = ExpressionUtil.expressionValue(arguments, value).toString();
    element.removeAttribute(attributeName);
    Map<String, Object> variables = new UpdateCommand(arguments, query).execute();
    return ProcessorResult.setLocalVariables(variables);
}
 
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:9,代码来源:UpdateAttrProcessor.java

示例13: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
    String properties = element.getAttributeValue(attributeName);
    element.removeAttribute(attributeName);
    new ConnectionCommand(arguments, properties).execute();
    return ProcessorResult.OK;
}
 
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:8,代码来源:ConnectionAttrProcessor.java

示例14: processElement

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {

   HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
   HttpServletResponse response = ((IWebContext) arguments.getContext()).getHttpServletResponse();
   HtmlTable htmlTable = (HtmlTable) RequestUtils.getFromRequest(DataTablesDialect.INTERNAL_BEAN_TABLE, request);

   ProcessorResult processorResult = doProcessElement(arguments, element, request, response, htmlTable);
   return processorResult;
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:11,代码来源:AbstractElProcessor.java

示例15: processAttribute

import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings("unchecked")
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {

   HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();

   // A Map<ConfType, Object> is associated with each table id
   Map<String, Map<ConfType, Object>> configs = (Map<String, Map<ConfType, Object>>) RequestUtils.getFromRequest(
         DataTablesDialect.INTERNAL_BEAN_CONFIGS, request);

   String tableId = AttributeUtils.parseStringAttribute(arguments, element, attributeName);

   if (configs != null && configs.containsKey(tableId)) {
      throw new DandelionException("A div with id '" + tableId + "' is already present in the current template.");
   }
   else {
      configs = new HashMap<String, Map<ConfType, Object>>();
   }

   configs.put(tableId, new HashMap<ConfType, Object>());
   RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_BEAN_CONFIGS, configs, request);

   // The node is stored to be easily accessed later during the processing
   RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_NODE_CONFIG, element, request);

   return ProcessorResult.ok();
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:31,代码来源:DivConfAttrProcessor.java


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