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


Java ProcessorResult.OK属性代码示例

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


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

示例1: processElement

@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,代码行数:19,代码来源:UncacheableDataProcessor.java

示例2: doProcessElement

@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,代码行数:16,代码来源:TrElProcessor.java

示例3: processAttribute

@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,代码行数:14,代码来源:WebjarsLinkProcessor.java

示例4: processElement

/**
 * 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,代码行数:14,代码来源:AbstractModelVariableModifierProcessor.java

示例5: processElement

@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,代码行数:37,代码来源:FormProcessor.java

示例6: processAttribute

@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,代码行数:28,代码来源:ProductOptionValueProcessor.java

示例7: processAttribute

@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,代码行数:13,代码来源:BroadleafCacheProcessor.java

示例8: processAttribute

@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,代码行数:7,代码来源:ConnectionAttrProcessor.java

示例9: doProcessElement

@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
      HttpServletResponse response, HtmlTable htmlTable) {

   String tableId = element.getAttributeValue("id");

   if (tableId != null) {

      String confGroup = (String) RequestUtils.getFromRequest(DataTablesDialect.INTERNAL_CONF_GROUP, request);

      HtmlTable newHtmlTable = new HtmlTable(tableId, request, response, confGroup);
      request.setAttribute(TableConfiguration.class.getCanonicalName(), newHtmlTable.getTableConfiguration());

      // Add a default header row
      newHtmlTable.addHeaderRow();

      // Store the htmlTable POJO as a request attribute, so that all the
      // others following HTML tags can access it and particularly the
      // "finalizing div"
      RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_BEAN_TABLE, newHtmlTable, request);

      // The table node is also saved in the request, to be easily accessed
      // later
      RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_NODE_TABLE, element, request);

      // Map used to store the table local configuration
      RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_BEAN_TABLE_STAGING_OPTIONS,
            new HashMap<Option<?>, Object>(), request);

      // The HTML needs to be updated
      processMarkup(element);

      return ProcessorResult.OK;
   }
   else {
      throw new DandelionException("The 'id' attribute is required by Dandelion-Datatables.");
   }
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:38,代码来源:TableInitializerElProcessor.java

示例10: doProcess

@Override
protected final ProcessorResult doProcess(final Arguments arguments, AttributeData data) {

       if(!isWrapRequired(arguments, data.attributeValue)) {
       	doNotWrap(data.element);
       }
	
	return ProcessorResult.OK;
}
 
开发者ID:connect-group,项目名称:thymesheet-sample,代码行数:9,代码来源:RemoveTagUnlessProcessor.java

示例11: processElement

@Override
protected ProcessorResult processElement(Arguments arguments, Element element)
{
    if (!element.hasNormalizedAttribute("img", "key"))
        return ProcessorResult.OK;

    String imageKey = element.getAttributeValueFromNormalizedName("img", "key");
    String format = element.getAttributeValueFromNormalizedName("img", "format");
    String strWidth = element.getAttributeValueFromNormalizedName("img", "width");
    String strRatio = element.getAttributeValueFromNormalizedName("img", "ratio");
    String quality = element.getAttributeValueFromNormalizedName("img", "quality");

    format = (format != null) ? format.trim() : "jpg";
    strWidth = (strWidth != null) ? strWidth.trim() : "100";
    strRatio = (strRatio != null) ? strRatio.trim() : "0";
    quality = (quality != null) ? quality.trim() : "0.4";

    int width = Integer.parseInt(strWidth);
    int maxWidth = cmsContext.settings.imageMaxWidth;
    double ratio = Double.parseDouble(strRatio);

    if (maxWidth > 0 && width > maxWidth)
        width = maxWidth;

    Element noscript = new Element("noscript");
    Element noscriptImg = new Element("img");
    Element img = new Element("img");

    String imageUrl = String.format("/_image/%s/%s/%s/%s.%s", width, strRatio, quality, imageKey, format);

    noscriptImg.setAttribute("src", imageUrl);

    element.setAttribute("class", "responsive-figure");
    img.setAttribute("class", "js-img");
    int[] size = generateSizeNew(ratio, width, 20);
    img.setAttribute("src", createPlaceholderImage(size[0], size[1]));

    noscript.addChild(noscriptImg);
    element.addChild(noscript);
    element.addChild(img);

    return ProcessorResult.OK;
}
 
开发者ID:dmmikkel,项目名称:Brisk,代码行数:43,代码来源:ResponsiveImageProcessor.java

示例12: doProcessElement

@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
      HttpServletResponse response, HtmlTable htmlTable) {

   if (htmlTable != null) {

      HtmlColumn column = null;
      String content = null;

      if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":csv")
            || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xml")
            || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":pdf")
            || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xls")
            || element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xlsx")) {

         if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":csv")) {
            content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":csv",
                  String.class);
            element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":csv");
            column = new HtmlColumn(ReservedFormat.CSV);
            column.setContent(new StringBuilder(content));
            htmlTable.getLastBodyRow().addColumn(column);
         }
         if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xml")) {
            content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":xml",
                  String.class);
            element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":xml");
            column = new HtmlColumn(ReservedFormat.XML);
            column.setContent(new StringBuilder(content));
            htmlTable.getLastBodyRow().addColumn(column);
         }
         if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":pdf")) {
            content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":pdf",
                  String.class);
            element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":pdf");
            column = new HtmlColumn(ReservedFormat.PDF);
            column.setContent(new StringBuilder(content));
            htmlTable.getLastBodyRow().addColumn(column);
         }
         if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xls")) {
            content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":xls",
                  String.class);
            element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":xls");
            column = new HtmlColumn(ReservedFormat.XLS);
            column.setContent(new StringBuilder(content));
            htmlTable.getLastBodyRow().addColumn(column);
         }
         if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":xlsx")) {
            content = AttributeUtils.parseAttribute(arguments, element, DataTablesDialect.DIALECT_PREFIX + ":xlsx",
                  String.class);
            element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":xlsx");
            column = new HtmlColumn(ReservedFormat.XLSX);
            column.setContent(new StringBuilder(content));
            htmlTable.getLastBodyRow().addColumn(column);
         }
      }
      // If the element contains a Text node, the content of the text node
      // will be displayed in all formats
      else if (element.getFirstChild() instanceof Text) {
         htmlTable.getLastBodyRow().addColumn(((Text) element.getFirstChild()).getContent().trim());
      }
      // Otherwise, an empty cell will be displayed
      else {
         logger.warn("Only cells containing plain text are supported, those containing HTML code are still not!");
         htmlTable.getLastBodyRow().addColumn("");
      }
   }

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

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


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