Package com.astamuse.asta4d.extnode

Examples of com.astamuse.asta4d.extnode.GroupNode


            Object result = future.get();
            Transformer<?> transformer = TransformerFactory.generateTransformer(result);
            return transformer.invoke(elem);
        } catch (InterruptedException | ExecutionException e) {
            logger.error("Failed retrieve result from future:" + e.getMessage(), e);
            return new 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(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

    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

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.