Package com.astamuse.asta4d.extnode

Examples of com.astamuse.asta4d.extnode.GroupNode


    public ElementUtil() {
    }

    public final static Element text(String text) {
        TextNode node = new TextNode(text, "");
        Element wrap = new GroupNode();
        wrap.appendChild(node);
        return wrap;
    }
View Full Code Here


        List<Node> children = body.childNodes();
        return wrapElementsToSingleNode(children);
    }

    public final static Element wrapElementsToSingleNode(List<Node> elements) {
        Element groupNode = new GroupNode();
        List<Node> list = new ArrayList<Node>(elements);
        for (Node node : list) {
            node.remove();
            groupNode.appendChild(node);
        }
        return groupNode;
    }
View Full Code Here

            }
        }

        RenderUtil.applySnippets(doc);

        Element grp = new GroupNode();
        List<Node> children = new ArrayList<>(doc.body().childNodes());
        for (Node node : children) {
            node.remove();
            grp.appendChild(node);
        }

        return grp;
    }
View Full Code Here

        Document embedDoc = embedTarget.getDocumentClone();
        /*
                Elements children = embedDoc.body().children();
                Element wrappingNode = ElementUtil.wrapElementsToSingleNode(children);
        */
        Element wrappingNode = new GroupNode();
        // retrieve all the blocks that misincluded into head
        Element head = embedDoc.head();
        Elements headChildren = head.children();
        List<Node> tempList = new ArrayList<>();
        String tagName;
        for (Element child : headChildren) {
            if (StringUtil.in(child.tagName(), "script", "link", ExtNodeConstants.BLOCK_NODE_TAG)) {
                child.remove();
                wrappingNode.appendChild(child);
            }
        }

        Element body = embedDoc.body();
        Elements bodyChildren = body.children();
        ElementUtil.appendNodes(wrappingNode, new ArrayList<Node>(bodyChildren));

        // copy all the attrs to the wrapping group node
        Iterator<Attribute> attrs = elem.attributes().iterator();
        Attribute attr;
        while (attrs.hasNext()) {
            attr = attrs.next();
            wrappingNode.attr(attr.getKey(), attr.getValue());
        }

        // a embed template file may by included many times in same parent
        // template, so we have to avoid duplicated snippet refs
        resetSnippetRefs(wrappingNode);
View Full Code Here

        Document embedDoc = embedTarget.getDocumentClone();
        /*
                Elements children = embedDoc.body().children();
                Element wrappingNode = ElementUtil.wrapElementsToSingleNode(children);
        */
        Element wrappingNode = new GroupNode();
        // retrieve all the blocks that misincluded into head
        Element head = embedDoc.head();
        Elements headChildren = head.children();
        List<Node> tempList = new ArrayList<>();
        String tagName;
        for (Element child : headChildren) {
            if (StringUtil.in(child.tagName(), "script", "link", ExtNodeConstants.BLOCK_NODE_TAG)) {
                child.remove();
                wrappingNode.appendChild(child);
            }
        }

        Element body = embedDoc.body();
        Elements bodyChildren = body.children();
        ElementUtil.appendNodes(wrappingNode, new ArrayList<Node>(bodyChildren));

        // copy all the attrs to the wrapping group node
        Iterator<Attribute> attrs = elem.attributes().iterator();
        Attribute attr;
        while (attrs.hasNext()) {
            attr = attrs.next();
            wrappingNode.attr(attr.getKey(), attr.getValue());
        }

        // a embed template file may by included many times in same parent
        // template, so we have to avoid duplicated snippet refs
        resetSnippetRefs(wrappingNode);
View Full Code Here

import com.astamuse.asta4d.render.transformer.ElementTransformer;

public class ElementRemover extends ElementTransformer {

    public ElementRemover() {
        super(new GroupNode());
    }
View Full Code Here

        Document embedDoc = embedTarget.getDocumentClone();
        /*
                Elements children = embedDoc.body().children();
                Element wrappingNode = ElementUtil.wrapElementsToSingleNode(children);
        */
        Element wrappingNode = new GroupNode(ExtNodeConstants.GROUP_NODE_ATTR_TYPE_EMBED_WRAPPER);
        // retrieve all the blocks that misincluded into head
        Element head = embedDoc.head();
        Elements headChildren = head.children();
        List<Node> tempList = new ArrayList<>();
        String tagName;
        for (Element child : headChildren) {
            if (StringUtil.in(child.tagName(), "script", "link", ExtNodeConstants.BLOCK_NODE_TAG)) {
                child.remove();
                wrappingNode.appendChild(child);
            }
        }

        Element body = embedDoc.body();
        Elements bodyChildren = body.children();
        ElementUtil.appendNodes(wrappingNode, new ArrayList<Node>(bodyChildren));

        // copy all the attrs to the wrapping group node
        Iterator<Attribute> attrs = elem.attributes().iterator();
        Attribute attr;
        while (attrs.hasNext()) {
            attr = attrs.next();
            wrappingNode.attr(attr.getKey(), attr.getValue());
        }

        // a embed template file may by included many times in same parent
        // template, so we have to avoid duplicated snippet refs
        resetSnippetRefs(wrappingNode);
View Full Code Here

import com.astamuse.asta4d.render.transformer.ElementTransformer;

public class ElementRemover extends ElementTransformer {

    public ElementRemover(Object originalData) {
        super(new GroupNode(), originalData);
    }
View Full Code Here

    public ElementRemover(Object originalData) {
        super(new GroupNode(), originalData);
    }

    public ElementRemover() {
        super(new GroupNode(), null);
    }
View Full Code Here

    protected Element transform(Element elem, Renderer content) {
        Element result = ElementUtil.safeClone(elem);

        // add a dummy parent so that the result element can be replaced by the
        // sub renderer.
        GroupNode wrapper = new GroupNode();
        wrapper.appendChild(result);
        RenderUtil.apply(result, content);

        return wrapper;
    }
View Full Code Here

TOP

Related Classes of com.astamuse.asta4d.extnode.GroupNode

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.