Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Element


        TableAttributes attributes = new TableAttributes();
        attributes.setStyles(StylesBuilder.getDeprecatedStyles());

        buffer.addStyledElement("table", attributes);
        protocol.openTable(buffer, attributes);
        Element e = buffer.getCurrentElement();
        assertNull(e.getAttributeValue("columns"));
    }
View Full Code Here


        protocol.closeTableCaption(buffer, captionAttributes);
        protocol.closeTable(buffer, tableAttributes);

        assertNotNull("Two elements (table and caption) should be created",
                buffer.getRoot());
        Element firstElement = (Element) buffer.getRoot().getHead();
        assertNotNull("Two elements (table and caption) should be created",
                firstElement.getNext());
        Element secondElement = (Element) firstElement.getNext();
        assertNull("Two elements (table and caption) should be created",
                secondElement.getNext());

        String firstElementExpected = captionExpectedBeforeTable ?
                WMLConstants.BLOCH_ELEMENT : "table";
        String secondElementExpected = captionExpectedBeforeTable ?
                "table" : WMLConstants.BLOCH_ELEMENT;

        assertEquals("First element should be '" + firstElementExpected + "'",
                firstElementExpected, firstElement.getName());
        assertEquals("Second element should be '" + secondElementExpected + "'",
                secondElementExpected, secondElement.getName());
    }
View Full Code Here

    public void testFlattenTableCellWithStylesAndNamedUnstyledParent()
            throws IOException, SAXException, ParserConfigurationException {

        Styles expectedStyles = generateTestColorStyles();

        Element newParent = doFlattenTableCell(expectedStyles,
                false, true, false, true);

        assertNotNull(newParent.getStyles());
        Styles actualStyles = newParent.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, true);

        newParent = doFlattenTableCell(expectedStyles,
                true, true, false, true);
        assertNotNull(newParent.getStyles());
        actualStyles = newParent.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, true);
        Element tail = (Element)newParent.getTail();
        assertNotNull(tail);
        assertEquals("br", tail.getName());


        newParent = doFlattenTableCell(expectedStyles,
                true, false, false, true);

        Element element = ((Element) newParent.getHead());
        assertNotNull(element.getStyles());
        checkFlattenedValues(expectedStyles, actualStyles, false);
        tail = (Element) newParent.getTail();
        assertNotNull(tail);
        assertEquals("br", tail.getName());

        newParent = doFlattenTableCell(expectedStyles,
                false, false, false, true);

        element = ((Element) newParent.getHead());
        assertNotNull(element.getStyles());
    }
View Full Code Here

    public void testFlattenTableCellWithStylesAndNamedStyledParent() {

        Styles expectedStyles = generateTestColorStyles();

        // the table cell should be removed because doInlineDiv was true
        Element newParent = doFlattenTableCell(expectedStyles,
                false, true, true, true);
        assertNotNull(newParent.getStyles());
        Styles actualStyles = newParent.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, true);

        // the table cell should be removed because doInlineDiv was true
        newParent = doFlattenTableCell(expectedStyles, true, true,
                true, true);
        assertNotNull(newParent.getStyles());
        actualStyles = newParent.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, true);
        Element tail = (Element) newParent.getTail();
        assertNotNull(tail);
        assertEquals("br", tail.getName());

        // the table cell should be surrounded by a div because doInlineDiv was false
        newParent = doFlattenTableCell(expectedStyles, true, false,
                true, true);

        Element element = ((Element) newParent.getHead());
        assertNotNull(element.getStyles());
        actualStyles = newParent.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, false);
        tail = (Element) newParent.getTail();
        assertNotNull(tail);
        assertEquals("br", tail.getName());

        // the table cell should be surrounded by a div because doInlineDiv was false
        newParent = doFlattenTableCell(expectedStyles, false, false, true, true);

        element = ((Element) newParent.getHead());
        assertNotNull(element.getStyles());
        actualStyles = newParent.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, false);
    }
View Full Code Here

    public void testFlattenTableCellWithStylesAndUnnamedUnstyledParent()
            throws IOException, SAXException, ParserConfigurationException {

        Styles expectedStyles = generateTestColorStyles();

        Element newParent = doFlattenTableCell(expectedStyles,
                false, true, false, false);

        assertNull(newParent.getStyles());
        Element child = (Element)newParent.getHead();
        assertNotNull(child);
        assertNotNull(child.getStyles());
        Styles actualStyles = child.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, true);

        newParent = doFlattenTableCell(expectedStyles,
                true, true, false, false);
        assertNull(newParent.getStyles());
        child = (Element) newParent.getHead();
        assertNotNull(child);
        assertNotNull(child.getStyles());
        actualStyles = child.getStyles();
        checkFlattenedValues(expectedStyles, actualStyles, true);
        Element tail = (Element) newParent.getTail();
        assertNotNull(tail);
        assertEquals("br", tail.getName());

        newParent = doFlattenTableCell(expectedStyles,
                true, false, false, false);

        Element element = ((Element) newParent.getHead());
        assertNotNull(element.getStyles());
        checkFlattenedValues(expectedStyles, actualStyles, false);
        tail = (Element) newParent.getTail();
        assertNotNull(tail);
        assertEquals("br", tail.getName());

        newParent = doFlattenTableCell(expectedStyles,
                false, false, false, false);

        element = ((Element) newParent.getHead());
        assertNotNull(element.getStyles());
        checkFlattenedValues(expectedStyles, actualStyles, false);
    }
View Full Code Here

     */
    private Element doFlattenTableCell(Styles styles, boolean forceLineBreak,
            boolean doInlineDiv, boolean styledParent, boolean namedParent) {

        DOMFactory domFactory = DOMFactory.getDefaultInstance();
        Element column = domFactory.createElement();
        Element newParent = domFactory.createElement();
        if (namedParent) {
            newParent.setName("div");
        }

        if (styles != null) {
            column.setStyles(styles);
            if (styledParent) {
                newParent.setStyles(styles);
            }
        }

        Element child = domFactory.createElement();
        child.setName("p");
        column.addHead(child);

        MyXHTMLBasicTransformer transformer = new MyXHTMLBasicTransformer();
        DOMProtocol protocol = createProtocol();
        transformer.initialize(protocol);
View Full Code Here

                            "<table>" +
                                "<tr><td>cell2></td></tr>" +
                            "</table>";

        Document dom = getStrictStyledDOMHelper().parse(input);
        Element table = dom.getRootElement();

        Element flattenedTable = doFlattenTable(table, expected);
        assertNull(flattenedTable.getName());
    }
View Full Code Here

                                "<br/>" +
                                "<table><tr><td>cell2></td></tr></table>" +
                            "</div>";

        Document dom = getStrictStyledDOMHelper().parse(input);
        Element table = dom.getRootElement();

        Styles tableStyles = generateTestColorStyles();
        table.setStyles(tableStyles);
        table.setAttribute("styleClass", "testClass");

        Element flattenedTable = doFlattenTable(table, expected2);
        assertTrue("div".equals(flattenedTable.getName()));
    }
View Full Code Here

        Styles originalStyles = input.getStyles();
        MyXHTMLBasicTransformer transformer = new MyXHTMLBasicTransformer();
        DOMProtocol protocol = createProtocol();
        transformer.initialize(protocol);

        Element flattenedTable = transformer.proxyFlattenTable(input, 2, 1);
        assertNotNull("The flattened table should not be null",
                flattenedTable);

        if (originalStyles != null) {
            assertNotNull("The flattened table styles should not be null",
                    flattenedTable.getStyles());
        } else {
            assertNull("The flattened table styles should be null",
                    flattenedTable.getStyles());
        }

        // The styles are not quite the same.

//        assertEquals("The styles on the flattened table should be identical" +
View Full Code Here

                  "</form>" +
                "</body>";

        Document dom = getStrictStyledDOMHelper().parse(input);

        Element body = dom.getRootElement();
        Element form = getChild(body);

        // Get the first-level div, first index. There is only one.
        Element div11 = getChild(form);

        // Get the second-level div, first index. This is the one that contains
        // the other div with the "rateplan change" Text element.
        Element div21 = (Element) getChild(div11).getNext().getNext();

        // Get the second-level div, second index. This is the one that
        // contains the 'Your msisdn' Text element with the bold Element
        // containing the Text '506984444'
        Element div22 = (Element) div21.getNext();

        MyXHTMLBasicTransformer transformer =  new MyXHTMLBasicTransformer();
        transformer.initialize(createProtocol());

        assertFalse("background-color is important visual style",
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.