Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Element


     /**
     * Test that a paragraph containing a 1 column table with that has
     * a columns attribute value of 2 has the table removed.
     */
    public void testFixGridTable1ColumnTable() throws Exception {
        Element p = domFactory.createElement();
        p.setName("BLOCK");
        int[] columns = {1, 1};
        Element table = createTable(2, columns);
        p.addTail(table);

        Document doc = domFactory.createDocument();
        doc.addNode(p);

View Full Code Here


     * Test that a paragraph containing a 3 column table with an incorrect
     * column attribute value has the correct column attribute after processing,
     * but is otherwise unchanged.
     */
    public void testFixGridTableBadColumnAttTable() throws Exception {
        Element p = domFactory.createElement();
        p.setName("BLOCK");
        int[] columns = {2, 3};
        Element table = createTable(2, columns);
        p.addTail(table);

        // the expected table should contain the correct value for
        // the column attribute
        table.setAttribute("columns", "3");
        Document doc = domFactory.createDocument();
        doc.addNode(p);
        String expected = DOMUtilities.toString(doc);

        // add the duff column attribute value in the table to be fixed
        table.setAttribute("columns", "200");

        transformer.fixTable(table);

        assertEquals(expected, DOMUtilities.toString(doc));
    }
View Full Code Here

        populateEmulateEmphasisTags();

        initializeTransformer();
        Document orig = domFactory.createDocument();
        Element wml = generateTestWML();
        orig.addNode(wml);

        transformer.transformElement(wml);

        String expected =
View Full Code Here

     * #testTransformElementWithEmulatedElements.
     *
     * @return the root element for use in tests
     */
    private Element generateTestWML() {
        Element wml = domFactory.createElement();
        wml.setName("wml");
        Element card = domFactory.createElement();
        card.setName("card");
        card.setAttribute("title", "the test title");

        Element p = domFactory.createElement();
        p.setName("BLOCK");
        p.setAttribute("align", "center");
        card.addTail(p);

        Element a = domFactory.createElement();
        a.setName("a");
        a.setAttribute("href", "wtai://wp/mc;20405050606");
        Text t = domFactory.createText();
        t.append("20405050606");
        a.addHead(t);
        p.addTail(a);

        Element anchor = domFactory.createElement();
        anchor.setName("anchor");
        anchor.setAttribute("href", "wtai://wp/mc;20405050606");
        anchor.addHead(t);
        p.addTail(anchor);

        String[] tags = {"big", "b", "em", "i", "small", "strong", "u"};

        for (int i = 0; i < tags.length; i++) {
            Element tag = domFactory.createElement();
            tag.setName(tags[i]);
            Text text = domFactory.createText();
            text.append("This is " + tags[i] + " text.");
            tag.addHead(text);
            p.addTail(tag);
        }

        wml.addHead(card);
        return wml;
View Full Code Here

        PaneAttributes paneAttributes = new PaneAttributes();
        paneAttributes.setStyles(StylesBuilder.getDeprecatedStyles());
        paneAttributes.setPane(pane);

        protocol.openPaneTable(buffer, paneAttributes);
        Element elem = buffer.getCurrentElement();

        System.out.println("Open Pane Table: " + DOMUtilities.toString(elem));
        if (protocol.supportsStyleSheets()) {
            assertTrue("There should be a div element",
                    "div".equals(elem.getName()));
        } else {
            assertFalse("There should be no div element",
                    "div".equals(elem.getName()));
         }
    }
View Full Code Here

        Styles paneStyles = StylesBuilder.getSparseStyles("padding: 10px");
        paneAttributes.setStyles(paneStyles);
        paneAttributes.setPane(pane);

        protocol.openPaneTable(buffer, paneAttributes);
        Element tableElement = (Element) buffer.getRoot().getHead();
        assertTrue("Root element should be a table", "table".equals(tableElement.getName()));
        String cellPadding = tableElement.getAttributeValue("cellpadding");
        assertNotNull("Table should have cell padding attribute set", cellPadding);
        assertEquals("Cell padding should be 10 pixels", "10", cellPadding);

        Styles tableStyles = tableElement.getStyles();
        assertNull("Table should have no padding (bottom)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_BOTTOM));
        assertNull("Table should have no padding (top)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_TOP));
        assertNull("Table should have no padding (left)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_LEFT));
        assertNull("Table should have no padding (right)",
                tableStyles.getPropertyValues().
                getSpecifiedValue(StylePropertyDetails.PADDING_RIGHT));

        // We test for the computed values being null - the current
        // implementation sets them to null. In theory having the default value
        // for the computed value here should be acceptable.
        assertNull("Table should have no padding (bottom)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_BOTTOM));
        assertNull("Table should have no padding (top)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_TOP));
        assertNull("Table should have no padding (left)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_LEFT));
        assertNull("Table should have no padding (right)",
                tableStyles.getPropertyValues().
                getComputedValue(StylePropertyDetails.PADDING_RIGHT));

        Element rowElement = (Element) tableElement.getHead();
        Element cellElement = (Element) rowElement.getHead();

        Styles cellStyles = cellElement.getStyles();
        StyleValue expectedPadding = StyleValueFactory.getDefaultInstance().
            getLength(null, 10, LengthUnit.PX);
        // Check the computed values for the table cell (since these are the
        // values that will be displayed
        assertEquals("Cell should have 10px padding (bottom)", expectedPadding,
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);
        pane.setName(PANE_NAME);
        attributes = new PaneAttributes();
        attributes.setStyles(StylesBuilder.getDeprecatedStyles());
        attributes.setPane(pane);

        protocol.openPane(buffer, attributes);

        // We expect absolutely no markup to be rendered for a pane that has
        // no attributes and no styling
        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);
        pane.setName(PANE_NAME);

        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);

        el = buffer.closeElement("div");
//        assertEquals("Invalid class attribute on div",
//                     "VE-pane-fred", el.getAttributeValue("class"));

        el = buffer.closeElement("td");
//        assertNull("Invalid class attribute on td",
//                   el.getAttributeValue("class"));
        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("Class attribute on table", el.getAttributeValue("class"));
        assertNull("bgcolor on table", 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"));
    }
View Full Code Here

        element = (Element) buffer.popElement().getHead();

        OptionGroupTitleChecker checker = new OptionGroupTitleChecker();

        Element child = getSelectElement(element);

        checker.checkElement(child, expectedTitle);
    }
View Full Code Here

        protocol.doSelectInput(attributes);

        element = buffer.popElement();
        element = (Element) element.getHead();

        Element selectElement = getSelectElement(element);
        assertNull("The select tag has an accesskey attribute when it" +
                   "should not.",
                   selectElement.getAttributeValue("accesskey"));
        assertEquals("name", selectElement.getAttributeValue("name"));
        assertEquals("select", selectElement.getName());
        assertNull("ivalue attribute should be null",
                   selectElement.getAttributeValue("ivalue"));
        assertEquals("false", selectElement.getAttributeValue("multiple"));
    }
View Full Code Here

        DissectingPaneAttributes atts = setupDissectingPaneTests();

        protocol.setDissecting(true);
        protocol.openDissectingPane(buffer, atts);

        Element el = null;
        try {
            el = buffer.closeElement
                    (DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT);
        } catch (IllegalStateException ise) {
            fail(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT +
                    " element not found.");
        }

        DissectableAreaIdentity dissectableAreaIdentity
                = ((DissectableAreaAttributes) el.getAnnotation()).
                getIdentity();
        // check that all the attributes have been written out
        assertEquals("Invalid inclusion path attribute",
                atts.getInclusionPath(),
                dissectableAreaIdentity.getInclusionPath());
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.