Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Element


        final ProtocolConfigurationImpl protocolConfiguration =
            (ProtocolConfigurationImpl) protocol.getProtocolConfiguration();
        protocolConfiguration.setCSSMedia("handheld");
        final StyleAttributes styleAttributes = new StyleAttributes();
        protocol.openStyle(buffer, styleAttributes);
        final Element head = (Element) buffer.getRoot().getHead();
        assertEquals("handheld", head.getAttributeValue("media"));
        assertEquals("text/css", head.getAttributeValue("type"));
        buffer.appendEncoded(".c {color:red}");
        protocol.closeStyle(buffer, styleAttributes);
        final Comment comment = (Comment) head.getHead();
        assertEquals(".c {color:red}",
            new String(comment.getContents(), 0, comment.getLength()));
    }
View Full Code Here


        final ProtocolConfigurationImpl protocolConfiguration =
            (ProtocolConfigurationImpl) protocol.getProtocolConfiguration();
        protocolConfiguration.setCSSMedia(null);
        final StyleAttributes styleAttributes = new StyleAttributes();
        protocol.openStyle(buffer, styleAttributes);
        final Element head = (Element) buffer.getRoot().getHead();
        assertNull(head.getAttributeValue("media"));
        assertEquals("text/css", head.getAttributeValue("type"));
        buffer.appendEncoded(".c {color:red}");
        protocol.closeStyle(buffer, styleAttributes);
        final Comment comment = (Comment) head.getHead();
        assertEquals(".c {color:red}",
            new String(comment.getContents(), 0, comment.getLength()));
    }
View Full Code Here

    public void doTestDissectionElement(WBSAXDissectionElementProcessor
            processor, String attributeValue) throws Exception {
        // Create <p><da {na}><a href="[url]"/></da></p>
        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();
        Element p = buffer.openElement("p");
        Element da = domFactory.createElement();
        da.setName("da");
        NodeAnnotation na = new NodeAnnotation() {};
        da.setObject(na);
        buffer.openElement(da);
        Element a = buffer.openElement("a");
        a.setAttribute("href", "[url]");
        buffer.closeElement(a);
        buffer.closeElement(da);
        buffer.closeElement(p);
       
        StringWriter out = new StringWriter();
View Full Code Here

                   
                    DOMOutputBuffer dom = locator.getOutputBuffer();

                    // Open a menu element so we can see this renderer in the
                    // output.
                    Element menuElement = dom.openElement("menu");

                    // Iterate over the children in order.
                    renderChildren(menu);

                    // Close the menu element.
View Full Code Here

        privateSetUp();

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        Element el = null;

        Pane pane = null;
        PaneAttributes attributes = null;

        //=============================================================
        // Styles defined = No
        //=============================================================
        pane = new Pane(null);
        attributes = new PaneAttributes();
        attributes.setStyles(StylesBuilder.getDeprecatedStyles());
        attributes.setPane(pane);

        protocol.openPane(buffer, attributes);

        assertSame("The buffer current element should be the root element " +
                   "but was" + buffer.getCurrentElement(),
                   buffer.getRoot(),
                   buffer.getCurrentElement());

        //=============================================================
        // Styles defined = Yes
        //@todo XDIME-CP pass in Styles and check they're correctly propagated through
        //=============================================================
        pane = new Pane(null);

        attributes = new PaneAttributes();
        attributes.setStyles(StylesBuilder.getDeprecatedStyles());
//        attributes.setStyleClass("fred");
//        attributes.setBackgroundColour("#ff0000");
//        attributes.setBorderWidth("1");
//        attributes.setCellPadding("2");
//        attributes.setCellSpacing("3");
        attributes.setPane(pane);

        protocol.openPane(buffer, attributes);
        try {
            // A div will have been opened to render styles because:
            // 1. This protocol supports stylesheets.
            // 2. The pane has a style class "fred".
            // 3. Any of border width/cell padding/cell spacing have non-zero
            //    values.
            // The div will have an appropriate class attribute.
            el = buffer.closeElement("div");
//            assertEquals("Invalid class attribute on div",
//                    "VE-pane-fred", el.getAttributeValue("class"));

            el = buffer.closeElement("td");

            assertNull("bgcolor on td", el.getAttributeValue("bgcolor"));
            assertNull("border on td", el.getAttributeValue("border"));
            assertNull("cellspacing on td", el.getAttributeValue("cellspacing"));
            assertNull("cellpadding on td", el.getAttributeValue("cellpadding"));
            el = buffer.closeElement("tr");
            assertNull("Class attribute on tr", el.getAttributeValue("class"));
            assertNull("bgcolor on tr", el.getAttributeValue("bgcolor"));
            assertNull("border on tr", el.getAttributeValue("border"));
            assertNull("cellspacing on tr", el.getAttributeValue("cellspacing"));
            assertNull("cellpadding on tr", el.getAttributeValue("cellpadding"));
            el = buffer.closeElement("table");
//            assertNull("Invalid class attribute on table",
//                    el.getAttributeValue("class"));
            assertEquals("Invalid bgcolor attribute",
                    "#ff0000", el.getAttributeValue("bgcolor"));
            assertEquals("Invalid border attribute",
                    "1", el.getAttributeValue("border"));
            assertEquals("Invalid cellspacing attribute",
                    "3", el.getAttributeValue("cellspacing"));
            assertEquals("Invalid cellpadding attribute",
                    "2", el.getAttributeValue("cellpadding"));
        } catch (IllegalStateException ise) {
            fail("Error checking element <" + el.getName() + ">");
        }
    }
View Full Code Here

        if (elementDetails != null) {
            styles = elementDetails.getStyles();
        }

        DOMOutputBuffer outputBuffer = (DOMOutputBuffer) buffer;
        Element element = outputBuffer.addElement("plain-image");
        if (styles != null) {
            element.setStyles(styles);
        }

        try {
            String url = icon.getNormalURL().getURL();
            element.setAttribute("src", url);
            String altText = getAltText(item);
            if (altText != null) {
                element.setAttribute("alt", altText);
            }
        } catch (AssetReferenceException e) {
            throw new RendererException(e);
        }
View Full Code Here

    public void testOpenCanvas() throws Exception {
        privateSetUp();
        CanvasAttributes attributes = new CanvasAttributes();
        protocol.openCanvas( buffer, attributes );
        Element e = buffer.popElement();
        assertEquals( "Incorrect Element", "wml", e.getName() );
        assertEquals( "Incorrect namespace""http://waptv.com/xsd/wtvml",
                      e.getAttributeValue( "xmlns") );
        assertEquals( "Incorrect schema instance",
                      W3CSchemata.XSI_NAMESPACE,
                      e.getAttributeValue( "xmlns:xsi") );
        assertEquals( "Incorrect schema location",
                      "http://waptv.com/xsd/wtvml_5.0.xsd",
                      e.getAttributeValue( "xsi:schemaLocation") );
    }
View Full Code Here

        StrictStyledDOMHelper helper = new StrictStyledDOMHelper();

        XFTextInputAttributes attributes = new XFTextInputAttributes();
        attributes.setStyles(StylesBuilder.getCompleteStyles("mcs-rows: 3"));

        Element element = domFactory.createElement("input");
        protocol.addTextInputValidation(element, attributes);

        String output = helper.render(element);
        assertEquals("<input format=\"3\"/>", output);
View Full Code Here

        ia.setSrc("http://www.images.com/test/test.jpg");
        ia.setLocalSrc(false);
        protocol.writeImage(ia);

        // Check the image tag and attributes
        Element nullElement = buffer.popElement();
        Element element = (Element) nullElement.getHead();
        assertEquals("img", element.getName());
        assertNull(element.getAttributeValue("localsrc"));
        assertEquals("http://www.images.com/test/test.jpg",
                element.getAttributeValue("src"));
        assertEquals("AltText", element.getAttributeValue("alt"));
    }
View Full Code Here

        ia.setSrc("http://www.images.com/test/test.jpg");
        ia.setLocalSrc(false);
        protocol.writeImage(ia);

        // Check the image tag and attributes
        Element nullElement = buffer.popElement();
        Element element = (Element) nullElement.getHead();
        assertEquals("img", element.getName());
        assertNull(element.getAttributeValue("localsrc"));
        assertEquals("http://www.images.com/test/test.jpg",
                element.getAttributeValue("src"));
        assertEquals("AltText", element.getAttributeValue("alt"));
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.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.