Package org.thymeleaf.dom

Examples of org.thymeleaf.dom.Text


    // If the decorator has no BODY, we can just copy the page BODY
    Element decoratorbody = findElement(decoratorhtml, HTML_ELEMENT_BODY);
    if (decoratorbody == null) {
      decoratorhtml.addChild(contentbody);
      decoratorhtml.addChild(new Text(LINE_SEPARATOR));
      return;
    }

    super.decorate(decoratorbody, contentbody);
  }
View Full Code Here


    // If the decorator has no HEAD, then we can just use the content HEAD
    Element decoratorhead = findElement(decoratorhtml, HTML_ELEMENT_HEAD);
    if (decoratorhead == null) {
      if (contenthead != null) {
        decoratorhtml.insertChild(0, new Text(LINE_SEPARATOR));
        decoratorhtml.insertChild(1, contenthead);

        Element contenttitle = findElement(contenthead, HTML_ELEMENT_TITLE);
        if (contenttitle != null) {
          Element resultingtitle = new Element(HTML_ELEMENT_TITLE);
          extractTitle(contenthead, contenttitle, CONTENT_TITLE, resultingtitle);
          contenthead.insertChild(0, new Text(LINE_SEPARATOR));
          contenthead.insertChild(1, resultingtitle);
        }
      }
      return;
    }
View Full Code Here

   * @param result   The new TITLE element being constructed.
   */
  private static void extractTitle(Element head, Element title, String titlekey, Element result) {

    // Make the result look like the title
    Text titletext = (Text)title.getFirstChild();
    result.clearChildren();
    result.addChild(titletext);

    // Extract any text or processors from the title element's attributes
    if (hasAttribute(title, StandardDialect.PREFIX, StandardUtextAttrProcessor.ATTR_NAME)) {
      result.setNodeProperty(titlekey, getAttributeValue(title,
          StandardDialect.PREFIX, StandardUtextAttrProcessor.ATTR_NAME));
    }
    else if (hasAttribute(title, StandardDialect.PREFIX, StandardTextAttrProcessor.ATTR_NAME)) {
      result.setNodeProperty(titlekey, getAttributeValue(title,
          StandardDialect.PREFIX, StandardTextAttrProcessor.ATTR_NAME));
    }

    // Extract text from a previously set value (deep hierarchies)
    else if (title.hasNodeProperty(titlekey)) {
      result.setNodeProperty(titlekey, title.getNodeProperty(titlekey));
    }

    // Extract text from the title element's content
    else if (titletext != null) {
      result.setNodeProperty(titlekey, titletext.getContent());
    }

    pullAttributes(result, title);
    head.removeChild(title);
  }
View Full Code Here

        if (script == null) {
            script = new Element("script");
            script.setAttribute("type", "text/javascript");
            script.setAttribute("id", blockId);
            String text = "\n//<![CDATA[\n" + eventDeclaration + "(function(){\n});\n//]]>\n";
            script.addChild(new Text(text, false));
            DomUtils.getElementsByTagName(document, "body").get(0).addChild(script);
        }
        // Build indented code
        StringBuilder codeSb = new StringBuilder();
        StringTokenizer lines = new StringTokenizer(code, "\n");
View Full Code Here

        Element resourceElement = new Element(resource.getTag());
        resourceElement.setAttribute(resource.getTypeAttribute(), resource.getTypeValue());
        resourceElement.setAttribute(resource.getUrlAttribute(), resourceUrl);
        if (element != null) {
            head.insertAfter(element, resourceElement);
            head.insertAfter(resourceElement, new Text("\n"));
        } else {
            head.addChild(resourceElement);
            head.addChild(new Text("\n"));
        }
    }
View Full Code Here

                String tabId = DomUtils.getOrCreateId(arguments.getDocument(), div, "tab-");
                // Build li element
                Element li = new Element("li");
                Element a = new Element("a");
                a.setAttribute("href", "#" + tabId);
                a.addChild(new Text(tabTitle));
                li.addChild(a);
                ul.addChild(li);
                // Add next event
                addNextTab(div, tabContainerId);
            }
View Full Code Here

        String anchorTitle = JsDialectUtil.templateMessage(arguments, messageTipKey);
        anchor.setAttribute("title", anchorTitle);
        Element span = new Element("span");
        String messageKey = label;
        String buttonText = JsDialectUtil.templateMessage(arguments, messageKey);
        span.addChild(new Text(buttonText));
        anchor.addChild(span);
        element.addChild(anchor);
    }
View Full Code Here

    /** Adds a separator among links for accesibility. */
    private void addSeparator() {
        Element span = new Element("span");
        span.setAttribute("class", "linkSeparator");
        span.addChild(new Text("|"));
        element.addChild(span);
    }
View Full Code Here

        String tabId = DomUtils.getOrCreateId(document, element, "tab-");
        // Build li element
        Element li = new Element("li");
        Element a = new Element("a");
        a.setAttribute("href", "#" + tabId);
        a.addChild(new Text(tabTitle));
        li.addChild(a);
        // Add li element to tabContainer
        tabContainer.getFirstElementChild().addChild(li);
    }
View Full Code Here

    }

    private Element createDiv(String messageKey) {
        Element div = new Element("div");
        String text = JsDialectUtil.templateMessage(arguments, messageKey);
        Text textElement = new Text(text);
        div.addChild(textElement);
        return div;
    }
View Full Code Here

TOP

Related Classes of org.thymeleaf.dom.Text

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.