Package org.thymeleaf.dom

Examples of org.thymeleaf.dom.Element


   
    return ProcessorResult.ok();
  }

  private void checkMarkupUsage(Element element) {
    Element parent = (Element) element.getParent();

    if (parent == null || !"div".equals(parent.getNormalizedName())
        || !parent.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":conf")
        || StringUtils.isBlank(parent.getAttributeValue(DataTablesDialect.DIALECT_PREFIX + ":conf"))) {
      throw new DandelionDatatablesException(
          "The element 'div dt:confType=\"...\"' must be inside an element 'div dt:conf=\"tableId\"'.");
    }
  }
View Full Code Here


        configs.get(tableId).put(ConfType.EXTRAHTML, extraHtmls);
      }

      // We add a fake div here, in order to be able to get the content
      // processed
      Element div = new Element("div");
      div.setAttribute(DataTablesDialect.DIALECT_PREFIX + ":tmp", "internalUseExtraHtml");
      div.setAttribute(DataTablesDialect.DIALECT_PREFIX + ":uid", extraHtml.getUid());
      element.getParent().addChild(div);
     
    }
    else {
      throw new ConfigurationProcessingException(
View Full Code Here

           
        }
       
        final NestableNode parent = element.getParent();
       
        final Element inputElement = (Element) element.cloneNode(parent, false);
        inputElement.removeAttribute(attributeName);
       
        inputElement.setAttribute("id", id);
        inputElement.setAttribute("name", name);
        inputElement.setAttribute(
                "value",
                RequestDataValueProcessorUtils.processFormFieldValue(
                        arguments.getConfiguration(), arguments, name, value, "checkbox"));
        if (checked) {
            inputElement.setAttribute("checked", "checked");
        } else {
            inputElement.removeAttribute("checked");
        }
        inputElement.setAllNodeLocalVariables(localVariables);

        parent.insertBefore(element, inputElement);


        if (!isDisabled(inputElement)) {

            final String hiddenName = WebDataBinder.DEFAULT_FIELD_MARKER_PREFIX + name;
            final String hiddenValue = "on";
            final Element hiddenElement = new Element("input");
            hiddenElement.setAttribute("type", "hidden");
            hiddenElement.setAttribute("name", hiddenName);
            hiddenElement.setAttribute(
                    "value",
                    RequestDataValueProcessorUtils.processFormFieldValue(
                            arguments.getConfiguration(), arguments, hiddenName, hiddenValue, "hidden"));
            hiddenElement.setAllNodeLocalVariables(localVariables);

            parent.insertBefore(element, hiddenElement);

        }
View Full Code Here

            if (extraHiddenFields != null && extraHiddenFields.size() > 0) {

                for (final Map.Entry<String,String> extraHiddenField : extraHiddenFields.entrySet()) {

                    final Element extraHiddenElement = new Element("input");
                    extraHiddenElement.setAttribute("type", "hidden");
                    extraHiddenElement.setAttribute("name", extraHiddenField.getKey());
                    extraHiddenElement.setAttribute("value", extraHiddenField.getValue()); // no need to re-apply the processor here

                    element.insertChild(element.numChildren(), extraHiddenElement);

                }
View Full Code Here

                final String name = "_method";
                final String value =
                        RequestDataValueProcessorUtils.processFormFieldValue(
                                arguments.getConfiguration(), arguments, name, method, type);

                final Element hiddenMethodElement = new Element("input");
                hiddenMethodElement.setAttribute("type", type);
                hiddenMethodElement.setAttribute("name", name);
                hiddenMethodElement.setAttribute("value", value);

                element.insertChild(0, hiddenMethodElement);
               
                element.setAttribute("method", "post");
               
View Full Code Here

        final boolean multiple = element.hasAttribute("multiple");
       
        final NestableNode parent = element.getParent();
       
        final Element inputElement = (Element) element.cloneNode(parent, false);
        inputElement.removeAttribute(attributeName);
       
        inputElement.setAttribute("id", id);
        inputElement.setAttribute("name", name);
        inputElement.setAllNodeLocalVariables(localVariables);

        processOptionChildren(inputElement, attributeName, attributeValue);
       
        parent.insertBefore(element, inputElement);
        parent.removeChild(element);
       

        if (multiple && !isDisabled(inputElement)) {

            final String hiddenName = WebDataBinder.DEFAULT_FIELD_MARKER_PREFIX + name;
            final Element hiddenElement = new Element("input");
            hiddenElement.setAttribute("type", "hidden");
            hiddenElement.setAttribute("name", hiddenName);
            hiddenElement.setAttribute(
                    "value",
                    RequestDataValueProcessorUtils.processFormFieldValue(
                            arguments.getConfiguration(), arguments, hiddenName, "1", "hidden"));

            hiddenElement.setAllNodeLocalVariables(localVariables);
           
            parent.insertAfter(inputElement, hiddenElement);
           
        }
       
View Full Code Here

       
        for (final Node child : children) {
           
            if (child != null && child instanceof Element) {
               
                final Element childTag = (Element) child;
                final String childTagName = childTag.getNormalizedName();

                childTag.setProcessable(true);
               
                if ("option".equals(childTagName)) {
                   
                    if (childTag.hasAttribute(selectAttrName)) { // has attribute
                       
                        final String selectAttrInChildValue = childTag.getAttributeValue(selectAttrName);
                       
                        if (selectAttrInChildValue != null) {
                            if (!selectAttrValue.equals(selectAttrInChildValue)) {
                                throw new TemplateProcessingException(
                                        "If specified (which is not required), attribute " +
                                        "\"" + selectAttrName + "\" in \"option\" tag must have " +
                                        "exactly the same value as in its containing \"select\" " +
                                        "tag");
                            }
                        }
                       
                    } else {
                        childTag.setAttribute(selectAttrName, selectAttrValue);
                        childTag.setRecomputeProcessorsImmediately(true);
                    }
                   
                } else if ("optgroup".equals(childTagName)) {

                    processOptionChildren(childTag, selectAttrName, selectAttrValue);
View Full Code Here

           
        }
       
        final NestableNode parent = element.getParent();
       
        final Element inputElement = (Element) element.cloneNode(parent, false);
        inputElement.removeAttribute(attributeName);
       
        inputElement.setAttribute("id", id);
        inputElement.setAttribute("name", name);
        inputElement.setAttribute(
                "value",
                RequestDataValueProcessorUtils.processFormFieldValue(
                        arguments.getConfiguration(), arguments, name, value, "checkbox"));
        if (checked) {
            inputElement.setAttribute("checked", "checked");
        } else {
            inputElement.removeAttribute("checked");
        }
        inputElement.setAllNodeLocalVariables(localVariables);

        parent.insertBefore(element, inputElement);


        if (!isDisabled(inputElement)) {

            final String hiddenName = WebDataBinder.DEFAULT_FIELD_MARKER_PREFIX + name;
            final String hiddenValue = "on";
            final Element hiddenElement = new Element("input");
            hiddenElement.setAttribute("type", "hidden");
            hiddenElement.setAttribute("name", hiddenName);
            hiddenElement.setAttribute(
                    "value",
                    RequestDataValueProcessorUtils.processFormFieldValue(
                            arguments.getConfiguration(), arguments, hiddenName, hiddenValue, "hidden"));
            hiddenElement.setAllNodeLocalVariables(localVariables);

            parent.insertBefore(element, hiddenElement);

        }
View Full Code Here

            if (extraHiddenFields != null && extraHiddenFields.size() > 0) {

                for (final Map.Entry<String,String> extraHiddenField : extraHiddenFields.entrySet()) {

                    final Element extraHiddenElement = new Element("input");
                    extraHiddenElement.setAttribute("type", "hidden");
                    extraHiddenElement.setAttribute("name", extraHiddenField.getKey());
                    extraHiddenElement.setAttribute("value", extraHiddenField.getValue()); // no need to re-apply the processor here

                    element.insertChild(element.numChildren(), extraHiddenElement);

                }
View Full Code Here

                final String name = "_method";
                final String value =
                        RequestDataValueProcessorUtils.processFormFieldValue(
                                arguments.getConfiguration(), arguments, name, method, type);

                final Element hiddenMethodElement = new Element("input");
                hiddenMethodElement.setAttribute("type", type);
                hiddenMethodElement.setAttribute("name", name);
                hiddenMethodElement.setAttribute("value", value);

                element.insertChild(0, hiddenMethodElement);
               
                element.setAttribute("method", "post");
               
View Full Code Here

TOP

Related Classes of org.thymeleaf.dom.Element

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.