Package org.thymeleaf.dom

Examples of org.thymeleaf.dom.Element


        addPlayButton();
        addPaginationDiv();
    }

    private void addClearDiv() {
        Element div = new Element("div");
        div.setAttribute("class", "clearfix");
        element.addChild(div);
    }
View Full Code Here


    private void addPlayButton() {
        addButton("play");
    }

    private void addButton(String label) {
        Element anchor = new Element("a");
        String id = "carousel-" + label;
        anchor.setAttribute("id", id);
        String className = label;
        anchor.setAttribute("class", className);
        anchor.setAttribute("href", "#");
        String messageTipKey = label + ".tip";
        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

    protected void execute() {
        String attributeText = element.getAttributeValue(attributeName);
        String tabId = JsDialectUtil.expressionValue(arguments, attributeText).toString();
        // Initialize and retrieve tab container
        Element tabContainer = initializeTabContainer(arguments.getDocument(), tabId);
        // Add nextTab event to last form element
        addNextTab(element, tabId);
        // Add tab anchor
        addTabAnchor(arguments.getDocument(), tabContainer, element);
        // Housekeeping
View Full Code Here

     * }
     * </pre>
     */
    private Element initializeTabContainer(Document document, String tabId) {
        // Find tab container
        Element tabContainer = DomUtils.getElementById(document, "div", tabId);
        if (tabContainer == null) {
            throw new TemplateProcessingException("Tab container with id -" + tabId + "- not found");
        }
        // Find first child
        String ulId = tabId + "-tab-ul";
        Element ul = DomUtils.getElementById(document, "ul", ulId);
        if (ul == null) {
            // Add ul
            ul = new Element("ul");
            ul.setAttribute("id", ulId);
            if (tabContainer.hasChildren()) {
                tabContainer.insertBefore(tabContainer.getFirstElementChild(), ul);
            } else {
                tabContainer.addChild(ul);
            }
View Full Code Here

        anchor.addChild(span);
        element.addChild(anchor);
    }

    private void addPaginationDiv() {
        Element div = new Element("div");
        div.setAttribute("id", "carousel-pagination");
        div.setAttribute("class", "pagination");
        element.addChild(div);
    }
View Full Code Here

    private void addTabAnchor(Document document, Element tabContainer, Element element) {
        // Get tab title and id
        String tabTitle = element.getAttributeValue("title");
        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

        element.addChild(div);
    }

    /** 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

     */
    private void addNextTab(Element element, String tabId) {
        // FIXME: remove input hidden ocurrences
        List<Element> formElements = DomUtils.getElementsByTagNames(element, "input", "select", "textarea");
        if (!formElements.isEmpty()) {
            Element lastElement = formElements.get(formElements.size() - 1);
            String value = "nextTab(event, '" + tabId + "')";
            if (notEmpty(lastElement.getAttributeValue("onkeypress"))) {
                value += "; " + lastElement.getAttributeValue("onkeypress");
            }
            lastElement.setAttribute("onkeypress", value);
        }
    }
View Full Code Here

        } else {
            elementClass += " ";
        }
        elementClass += mainCssClass;
        element.setAttribute("class", elementClass);
        Element counterDiv = new Element("div");
        String counterId = DomUtils.getOrCreateId(arguments.getDocument(), counterDiv, "counter-");
        element.addChild(counterDiv);
        Element timeUnitDiv = new Element("div");
        timeUnitDiv.setAttribute("class", "timeUnits");
        timeUnitDiv.addChild(createDiv("countdown.days"));
        timeUnitDiv.addChild(createDiv("countdown.hours"));
        timeUnitDiv.addChild(createDiv("countdown.minutes"));
        timeUnitDiv.addChild(createDiv("countdown.seconds"));
        element.addChild(timeUnitDiv);
        Element br = new Element("br");
        element.addChild(br);
        return counterId;
    }
View Full Code Here

        element.addChild(br);
        return counterId;
    }

    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.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.