Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Element


     */
    private static String mark = "(c) Volantis Systems Ltd 2004.";

    // Javadoc inherited.
    public void openSpan(DOMOutputBuffer dom, SpanAttributes attributes) {
        Element element = dom.openStyledElement("test-span", attributes);
        addCoreAttributes(attributes, element);
    }
View Full Code Here


        attributes.setPane(outPane);

        protocol.doImage(buffer, attributes);

        // valid src and alt generates <img src="url" alt="text" />
        Element root = buffer.getCurrentElement();
        Element element = (Element) root.getHead();

        DOMAssertionUtilities.assertElement("img", element);
        DOMAssertionUtilities.assertAttributeEquals("localsrc","myImage.jpg",element);
        DOMAssertionUtilities.assertAttributeEquals("alt","Alternate Text",element);
    }
View Full Code Here

        attributes.setPane(outPane);

        protocol.doImage(buffer, attributes);

        // No src with alt text generates <span>text</span>
        Element root = buffer.getCurrentElement();
        Text altText = (Text)root.getHead();
        String txtAltText = new String(altText.getContents(),
                0, expected.length());
        assertEquals("Incorrect Text", expected, txtAltText);
    }
View Full Code Here

        attributes.setPane(outPane);

        protocol.doImage(buffer, attributes);

        // No src and whitespace text generates no output
        Element root = buffer.getCurrentElement();
        Element empty = (Element) root.getHead();
        assertNull("No output should be generated", empty);
    }
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

        privateSetUp();

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

        Element el = null;

        Pane pane = new Pane(null);
        pane.setName(PANE_NAME);
        pane.setBackgroundColour("#ff0000");
        pane.setBorderWidth("15");
View Full Code Here

        privateSetUp();
        context.setDevice(INTERNAL_DEVICE_FACTORY.createInternalDevice(
            new DefaultDevice(DEVICE_NAME, new HashMap(), null)));
       
        DOMOutputBuffer dom = new DOMOutputBuffer();
        Element containerCell;

        dom.initialise();

        containerCell = dom.openElement("td");
        containerCell.setAttribute("valign", "top");

        Pane pane1 = new Pane(null);
        pane1.setName(PANE_NAME);

        PaneAttributes attributes = new PaneAttributes();
        attributes.setStyles(StylesBuilder.getStyles(
                "background-color: #ff0000"));
        attributes.setPane(pane1);

//        context.setStyleClassName(CLASS_NAME);
        protocol.setMarinerPageContext(context);
        protocol.openPane(dom, attributes);

        Element cell = null;
        try {
            cell = dom.closeElement("td");
            dom.closeElement("tr");
            dom.closeElement("table");
        } catch (IllegalStateException e) {
            fail("Expected table/tr/td elements not found");
        }

        if (containerCell != null) {
            if ("td".equals(containerCell.getName())) {
                assertEquals("Vertical alignment should have been preserved",
                             containerCell.getAttributeValue("valign"),
                             cell.getAttributeValue("valign"));
            }
        }
    }
View Full Code Here

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

        Element body;
        // @todo 2005060816 annotate child with style information if it's not inherited from the parent
        body = dom.openStyledElement("body", attributes);
        dom.openElement("table");
        dom.openElement("tr");
        dom.openElement("td");
View Full Code Here

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

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

            // check that all the attributes have been written out
            assertEquals("Invalid inclusion path attribute",
                         el.getAttributeValue
                         (DissectionConstants.INCLUSION_PATH_ATTRIBUTE),
                         atts.getInclusionPath());

            assertEquals("Invalid pane name attribute",
                         el.getAttributeValue
                         (DissectionConstants.DISSECTING_PANE_NAME_ATTRIBUTE),
                         atts.getDissectingPane().getName());

            assertEquals("Invalid next shard shortcut attribute",
                         el.getAttributeValue
                         (DissectionConstants.NEXT_SHARD_SHORTCUT_ATTRIBUTE),
                         nextShortcut);

            assertEquals("Invalid next shard link attribute",
                         el.getAttributeValue
                         (DissectionConstants.NEXT_SHARD_LINK_TEXT_ATTRIBUTE),
                         nextLink);

            assertEquals("Invalid previous shortcut attribute",
                         el.getAttributeValue
                         (DissectionConstants.PREVIOUS_SHARD_SHORTCUT_ATTRIBUTE),
                         prevShortcut);

            assertEquals("Invalid previous link attribute",
                         el.getAttributeValue
                         (DissectionConstants.PREVIOUS_SHARD_LINK_TEXT_ATTRIBUTE),
                         prevLink);

            assertEquals("Invalid next link first attribute",
                         el.getAttributeValue
                         (DissectionConstants.GENERATE_NEXT_LINK_FIRST_ATTRIBUTE),
                         String.valueOf(nextLinkFirst));

            assertEquals("Invalid max contents attribute",
                         el.getAttributeValue
                         (DissectionConstants.MAXIMUM_CONTENT_SIZE_ATTRIBUTE),
                         maxContentSize);
        } else {
            assertTrue("Protocol does not support dissection so no markup " +
                       "should have been generated", buffer.isEmpty());
View Full Code Here

        privateSetUp();

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        ShardLinkAttributes attributes = new ShardLinkAttributes();
        attributes.setStyles(StylesBuilder.getDeprecatedStyles());
        Element anchor;
        Node node;

        buffer.initialise();
        attributes.setHref("http://www.volantis.com/page");
        attributes.setLinkText("Next");
        attributes.setShortcut("N");

        protocol.doShardLink(buffer, attributes);

        node = buffer.getCurrentElement().getHead();

        assertNotNull("Should have found a node",
                      node);

        assertTrue("Node should be an element",
                   node instanceof Element);

        anchor = (Element) node;

        assertEquals("Unexpected type of element found",
                     "a",
                     anchor.getName());
    }
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.