Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Element


        sfiAttrs.setFormat(sfi);

        protocol.openSpatialFormatIterator(buffer, sfiAttrs);

        Element table = buffer.closeElement("table");
        checkTableAttributes(table);
    }
View Full Code Here


        cipAttrs.setFormat(pane);

        protocol.openColumnIteratorPane(buffer, cipAttrs);

        buffer.closeElement("tr");
        Element table = buffer.closeElement("table");
        checkTableAttributes(table);
    }
View Full Code Here

        gridAttrs.setStyles(StylesBuilder.getDeprecatedStyles());
        gridAttrs.setFormat(pane);

        protocol.openGrid(buffer, gridAttrs);

        Element table = buffer.closeElement("table");
        checkTableAttributes(table);
    }
View Full Code Here

        TableAttributes tableAttrs = new TableAttributes();
        tableAttrs.setStyles(StylesBuilder.getInitialValueStyles());

        protocol.openTable(buffer, tableAttrs);

        Element table = buffer.closeElement("table");
        checkTableAttributes(table);
    }
View Full Code Here

        dom.initialise();
        PaneAttributes attributes = new PaneAttributes();
        Pane pane = new Pane(null);
        attributes.setPane(pane);

        Element body;
        body = dom.openStyledElement("body", attributes);

        dom.appendEncoded("Example");

        protocol.closePane(dom, attributes);
View Full Code Here

     * is working properly.
     *
     * @throws com.volantis.mcs.protocols.ProtocolException
     */
    public void testAddEventAttributeUserScript() throws ProtocolException {
        Element element = domFactory.createElement();
        String attributeName = "event";
        ScriptAssetReference userScript =
                new LiteralScriptAssetReference("userscript");
        String internalScript = null;
        protocol.addEventAttribute(element, attributeName, userScript,
                internalScript);
        String attributeValue = element.getAttributeValue(attributeName);
        assertEquals("script attribute", userScript.getScript(), attributeValue);
    }
View Full Code Here

        Pane pane = new Pane(CANVAS_LAYOUT);
        attrs.setPane(pane);

        attrs.setStyles(StylesBuilder.getDeprecatedStyles());
        Element element = domFactory.createStyledElement(attrs.getStyles());
        element.setName(elementName);
        invokeMethod.invoke(element, attrs);

        String actual;
        actual = DOMUtilities.toString(element);
        String optionalOptimizeAttributes =
                (expectOptimize ? " OPTIMIZE=\"little impact\"" : "");
        assertXMLEquals("No styles",
                        "<" + elementName +
                        optionalOptimizeAttributes +
                        expectedUnstyledAttributes +
                        additionalAttributes + "/>",
                        actual);

        attrs.setStyles(createTestPaneStyles());
        element = domFactory.createStyledElement(attrs.getStyles());
        element.setName(elementName);
        invokeMethod.invoke(element, attrs);

        actual = DOMUtilities.toString(element);

        if (protocol.supportsStyleSheets()) {
View Full Code Here

    protected void doTestCreateEnclosingElement(
            PaneAttributes attributes,
            String expected)
            throws Exception {
        TestDOMOutputBuffer dom = new TestDOMOutputBuffer();
        Element element = dom.openStyledElement("td", attributes);

//        if (elementClassAttributes != null) {
//            element.setAttribute("class", elementClassAttributes);
//        }
View Full Code Here

    protected void doTestUseEnclosingTableCell(
            PaneAttributes attributes,
            String expected)
            throws Exception {
        TestDOMOutputBuffer dom = new TestDOMOutputBuffer();
        Element element = dom.openStyledElement("td", attributes);

//        if (elementClassAttributes != null) {
//            element.setAttribute("class", elementClassAttributes);
//        }

        // Pane attributes can't be null, must contain a valid pane.
        attributes.setPane(new Pane(new CanvasLayout()));

        protocol.useEnclosingTableCell(dom, attributes);

        String actual = DOMUtilities.toString(dom.getRoot());
        assertEquals("Result shouild match\n" +
                     "EXPECTED: " + expected + "\n" +
                     "ACTUAL  : " + actual + "\n", expected, actual);
        final MutablePropertyValues attributePropertyValues =
            attributes.getStyles().getPropertyValues();
        final MutablePropertyValues elementPropertyValues =
            element.getStyles().getPropertyValues();
        final StylePropertyDefinitions stylePropertyDefinitions =
            attributePropertyValues.getStylePropertyDefinitions();
        final int count = stylePropertyDefinitions.count();
        for (int i = 0; i < count; i++) {
            final StyleProperty styleProperty =
View Full Code Here

    public void notestCheckPaneCellAttributes() throws Exception {
        Pane pane = new Pane(null);
        PaneAttributes attributes = new PaneAttributes();
        TestDOMOutputBuffer dom = new TestDOMOutputBuffer();

        Element element = dom.openStyledElement("td", attributes);

        attributes.setPane(pane);
       
        // No width set, return DO_NOTHING.
        PaneRendering result;
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.DO_NOTHING,
                     result);

        // No width set to zero, return DO_NOTHING.
//        attributes.setWidth("0");
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.DO_NOTHING,
                     result);

        // If the width isn't 100% (or zero) and the element has no width
        // attribute set already, we can use the enclosing table cell.
//        attributes.setWidth("10");
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.USE_ENCLOSING_TABLE_CELL,
                     result);

        // If the enclosing cell is null we need to use a table.
//        attributes.setWidth("10");
        result = protocol.checkPaneCellAttributes(null, attributes);
        assertEquals("Expected ",
                     PaneRendering.USE_TABLE,
                     result);

        // If the width isn't 100% (or zero) and the element has a width
        // attribute set already, we need to use a table.
//        attributes.setWidth("10");
        element.setAttribute("width", "40");
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.USE_TABLE,
                     result);

        // If the width is 100% we should return DO_NOTHING.
//        attributes.setWidth("100");
//        attributes.setWidthUnits(PaneAttributes.WIDTH_UNITS_VALUE_PERCENT);
        element.setAttribute("width", "40");
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.DO_NOTHING,
                     result);

        // If the style class has been set on the element and the attributes
        // and we do not support multiple style classes we should return
        // CREATE_ENCLOSING_ELEMENT.
//        attributes.setWidth(null);
        element.setAttribute("class", "elementStyleClass");
//        attributes.setStyleClass("attributeStyleClass");
//        testable.setSupportsMultipleAttributeClasses(false);
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.CREATE_ENCLOSING_ELEMENT,
                     result);

        // Same as above except the support of multiple style classes is
        // set to true.
        // Expect USE_ENCLOSING_TABLE_CELL (classes may be merged).
//        attributes.setWidth(null);
        element.setAttribute("class", "elementStyleClass");
//        attributes.setStyleClass("attributeStyleClass");
//        testable.setSupportsMultipleAttributeClasses(true);
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.USE_ENCLOSING_TABLE_CELL,
                     result);

        // Same as above except the support of multiple style classes is
        // set to true and a valid width has been set. Expect USE_ENCLOSING_TABLE_CELL.
//        attributes.setWidth("10");
        element.setAttribute("class", "elementStyleClass");
        element.removeAttribute("width");
//        attributes.setStyleClass("attributeStyleClass");
//        testable.setSupportsMultipleAttributeClasses(true);
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.USE_ENCLOSING_TABLE_CELL,
                     result);

        // If the style class has been set on the element and the attributes
        // and we do not support multiple style classes and the style classes
        // are the same we should return DO_NOTHING.
//        attributes.setWidth(null);
        element.setAttribute("class", "bg-blue");
//        attributes.setStyleClass("bg-blue");
//        testable.setSupportsMultipleAttributeClasses(false);
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.DO_NOTHING,
                     result);

        // Same as above except style class is contained by element style class
        // already. Expected DO_NOTHING
//        attributes.setWidth(null);
        element.setAttribute("class", "bg-blue");
//        attributes.setStyleClass("VE-test bg-blue");
//        testable.setSupportsMultipleAttributeClasses(false);
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.DO_NOTHING,
                     result);

        // If the style class has been set on the element and the attributes
        // and we do not support multiple style classes we should return
        // USE_TABLE.
//        attributes.setWidth(null);
        element.setAttribute("class", "elementStyleClass");
        element.setAttribute("valign", "center"); // not supported on a div so use a table.
//        attributes.setStyleClass("attributeStyleClass");
//        testable.setSupportsMultipleAttributeClasses(false);
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.CREATE_ENCLOSING_ELEMENT,
                     result);

        // Same as above except the support of multiple style classes is
        // set to true and a valid width has been set.
        // Expect CREATE_ENCLOSING_ELEMENT.
//        attributes.setWidth("10");
        element.setAttribute("class", "elementStyleClass");
        element.removeAttribute("valign");
//        attributes.setStyleClass("attributeStyleClass");
//        testable.setSupportsMultipleAttributeClasses(false);
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.CREATE_ENCLOSING_ELEMENT,
                     result);

        // If the width is 100 pixels we should return USE_TABLE.
//        attributes.setWidth("100");
//        attributes.setWidthUnits(PaneAttributes.WIDTH_UNITS_VALUE_PIXELS);
        element.setAttribute("width", "40");
        result = protocol.checkPaneCellAttributes(element, attributes);
        assertEquals("Expected ",
                     PaneRendering.USE_TABLE,
                     result);
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.