Package org.apache.shale.clay.config.beans

Examples of org.apache.shale.clay.config.beans.ElementBean


    public void testRollup() throws Exception {

        ComponentBean root = createVerbatim(ComponentBean.class, "0");
        for (int i = 1; i < 10; i++) {
            ElementBean child = (ElementBean) createVerbatim(ElementBean.class,
                    String.valueOf(i));
            child.setRenderId(i);
            root.addChild(child);
        }

        ((TemplateConfigBean) htmlTemplateConfigBean).optimizeTree(root);
View Full Code Here


        //   + 6
        //   + 7
        //   + 8
        //   + 9
        ComponentBean root = createVerbatim(ComponentBean.class, "0");
        ElementBean lastChild = null;
        for (int i = 1; i < 5; i++) {
            lastChild = (ElementBean) createVerbatim(ElementBean.class, String
                    .valueOf(i));
            lastChild.setRenderId(i);
            root.addChild(lastChild);
        }

        for (int i = 5; i < 10; i++) {
            ElementBean child = (ElementBean) createVerbatim(ElementBean.class,
                    String.valueOf(i));
            child.setRenderId(i);
            lastChild.addChild(child);
        }

        ((TemplateConfigBean) htmlTemplateConfigBean).optimizeTree(root);
View Full Code Here

        // +7 not verbatim
        // +8
        // +9

        AttributeBean attr = null;
        ElementBean child = null;
        ComponentBean root = createVerbatim(ComponentBean.class, "0");
        // root is not a verbatim
        root.setJsfid("outputText");

        child = (ElementBean) createVerbatim(ElementBean.class, "1");
        child.setRenderId(1);
        root.addChild(child);
       

        child = (ElementBean) createVerbatim(ElementBean.class, "2");
        child.setRenderId(2);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "3");
        child.setRenderId(3);
        // root is not a verbatim
        child.setJsfid("outputText");
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "4");
        child.setRenderId(4);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "5");
        child.setRenderId(5);
        // root is not a verbatim
        child.setJsfid("outputText");
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "6");
        child.setRenderId(6);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "7");
        child.setRenderId(7);
        // root is not a verbatim
        child.setJsfid("outputText");
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "8");
        child.setRenderId(8);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "9");
        child.setRenderId(9);
        root.addChild(child);

        ((TemplateConfigBean) htmlTemplateConfigBean).optimizeTree(root);

        assertEquals("#Children", 7, root.getChildren().size());

        Iterator ci = root.getChildren().iterator();
        int i = 0;
        while (ci.hasNext()) {
            child = (ElementBean) ci.next();

            switch (++i) {
            case 1: {
                // first two nodes merged
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "12", attr.getValue());
                break;
            }
            case 2: {
                // non-verbatim
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "3", attr.getValue());
                break;
            }
            case 3: {
                // verbatim non-adjacent
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "4", attr.getValue());
                break;
            }
            case 4: {
                // non-verbatim
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "5", attr.getValue());
                break;
            }
            case 5: {
                // verbatim non-adjacent
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "6", attr.getValue());
                break;
            }
            case 6: {
                // non-verbatim
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "7", attr.getValue());
                break;
            }
            case 7: {
                // first two nodes merged
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "89", attr.getValue());
                break;
            }
           
View Full Code Here

        ComponentBean bean = xmlTemplateConfigBean.getElement("/address2.xml");
        assertNotNull(bean);
       
        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
            ElementBean child = (ElementBean) ci.next();
           
            AttributeBean attr = null;
            if (child.getId().equals("htmlBegin")) {
                attr = child.getAttribute("value");
                assertEquals("<html>", attr.getValue());
            } else if (child.getId().equals("htmlEnd")) {
                attr = child.getAttribute("value");
                assertEquals("</html>", attr.getValue());
            } else if (child.getId().equals("header")) {
                attr = child.getAttribute("value");
                assertEquals("<head><title>Testing</title></head>", attr.getValue());
            } else if (child.getId().equals("bodyBegin")) {
                attr = child.getAttribute("value");
                assertEquals("<body>", attr.getValue());
            } else if (child.getId().equals("bodyEnd")) {
                attr = child.getAttribute("value");
                assertEquals("</body>", attr.getValue());
            } else if (child.getId().equals("content")) {
                //look for a component that we have setup to test
                checkComponent(child, CUSTOM_HTML_COMPONENTS, true);
            }
        }
       
View Full Code Here

        ComponentBean bean = standardConfigBean.getElement("agentAddressForm");
        assertNotNull(bean);
       
        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
           ElementBean child = (ElementBean) ci.next();
           //look for a component that we have setup to test
           checkComponent(child, CUSTOM_XML_COMPONENTS, true);   
        }
    }
View Full Code Here

        ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address2.html");
        assertNotNull(bean);

        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
           ElementBean child = (ElementBean) ci.next();
           //look for a component that we have setup to test
           checkComponent(child, CUSTOM_HTML_COMPONENTS, true);   
        }
       
    }
View Full Code Here

        ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address1.html");
        assertNotNull(bean);

        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
           ElementBean child = (ElementBean) ci.next();
           //look for a component that we have setup to test
           checkComponent(child, CUSTOM_HTML_COMPONENTS, true);   
        }
       
    }
View Full Code Here

        ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address3.html");
        assertNotNull(bean);

        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
           ElementBean child = (ElementBean) ci.next();
           //look for a component that we have setup to test
           checkComponent(child, CUSTOM_HTML_COMPONENTS, true);   
        }
       
    }
View Full Code Here

        ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address4.html");
        assertNotNull(bean);

        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
           ElementBean child = (ElementBean) ci.next();
           //look for a component that we have setup to test
           checkComponent(child, CUSTOM_HTML_COMPONENTS, true);   
        }
       
    }
View Full Code Here

        ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address5.html");
        assertNotNull(bean);

        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
           ElementBean child = (ElementBean) ci.next();
           //look for a component that we have setup to test
           checkComponent(child, CUSTOM_HTML_COMPONENTS, false);   
        }
       
    }
View Full Code Here

TOP

Related Classes of org.apache.shale.clay.config.beans.ElementBean

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.