Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Element


        // Create a document where e1 parent of e2 parent of e3 and where e2
        // has no styles set.
        DOMFactory factory = DOMFactory.getDefaultInstance();
        Document document = factory.createDocument();
        Element root = factory.createElement("root");
        document.addNode(root);
        Element e1 = factory.createElement("e1");
        e1.setStyles(StylesBuilder.getCompleteStyles("line-height: normal"));
        root.addTail(e1);
        Element e2 = factory.createElement("e2");
        e1.addTail(e2);
        Element e3 = factory.createElement("e3");
        e3.setStyles(StylesBuilder.getCompleteStyles("line-height: normal"));
        e2.addTail(e3);

        String expectedStyledElements =
                "[e3,]," + // has been cleared
                "[e2,]," + // no styles
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

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

        if (protocol.isDissectionSupported()) {
            Element el = null;
            try {
                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

    public void testShardLinkStyleClass() throws Exception {
        privateSetUp();

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        ShardLinkAttributes attributes = new ShardLinkAttributes();
        Element anchor;
        Node node;
        String styleClass;

        buffer.initialise();
        attributes.setHref("http://www.volantis.com/page");
        attributes.setLinkText("Next");
        attributes.setShortcut("N");
        // todo XDIME-CP style dissection correctly.
//        attributes.setStyleClass("shardlink");

        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;

        styleClass = anchor.getAttributeValue("class");

        assertEquals("Unexpected type of element found",
                "a",
                anchor.getName());

        assertEquals("Unexpected style class found",
                null, styleClass);
    }
View Full Code Here

        protocol.openAnchor(buffer, attributes);
        protocol.closeAnchor(buffer, attributes);

        // Check that the element generated has appropriate id and name
        // attributes.
        Element root = buffer.getCurrentElement();
        Element element = (Element) root.getHead();
//        // Handle the case where some protocols wrap the tag in another tag.
//        if (!element.getName().equals("a")) {
//            element = (Element) element.getHead();
//        }
        DOMAssertionUtilities.assertElement("a", element);
View Full Code Here

        // Oo the image to generate the markup.
        protocol.doImage(buffer, attributes);

        // Check that the element generated has appropriate id and name
        // attributes.
        Element root = buffer.getCurrentElement();
        Element element = (Element) root.getHead();
//        // Handle the case where some protocols wrap the tag in another tag.
//        if (!element.getName().equals("img")) {
//            element = (Element) element.getHead();
//        }
        DOMAssertionUtilities.assertElement("img", element);
View Full Code Here

     * when necessary.
     */
    public void testAddDefaultCellspacing() throws Throwable {
        final Class classes [] = new Class[]{Element.class};

        Element table = domFactory.createElement();
        table.setName("table");
        PrivateAccessor.invoke(protocol,
                "addDefaultCellspacing",
                classes, new Object[]{table});

        checkTableAttributes(table);

        table = domFactory.createElement();
        table.setName("table");
        table.setAttribute("cellspacing", "5");
        PrivateAccessor.invoke(protocol,
                "addDefaultCellspacing",
                classes, new Object[]{table});
        assertEquals("Cellspacing should be 5",
                "5", table.getAttributeValue("cellspacing"));
    }
View Full Code Here

        if(content==null) {
            content = "cell";
        }

        Element td = domFactory.createElement();
        td.setName("td");
        for(int i=0; i<childCount; i++) {
            Element parent = td;
            if(useParagraph) {
                Element p = domFactory.createElement();
                p.setName("BLOCK");
                parent.addTail(p);
                parent = p;
            }
            if(useNestedParagraph) {
                Element p = domFactory.createElement();
                p.setName("BLOCK");
                parent.addTail(p);
                parent = p;
            }
            Text text = domFactory.createText();
            text.append(content);
View Full Code Here

    // Javadoc inherited
    protected void checkRenderAltText(String altText, DOMOutputBuffer buffer) {
        // The default behaviour in the superclass is to enclose alt text in a
        // paragraph tag.  In vxml we enclose it in block and prompt tags so
        // we override this method to perform that check.
        Element root = buffer.getCurrentElement();
        Element block = checkElementEquals("block", root.getHead());

        Element prompt = checkElementEquals("prompt", block.getHead());

        checkTextEquals(altText, prompt.getHead());
    }
View Full Code Here

        return td;
    }

    protected Element createRow(Element cells[]) {
        Element tr = domFactory.createElement();
        tr.setName("tr");
        for(int i=0; i<cells.length; i++) {
            tr.addTail(cells[i]);
        }

        return tr;
    }
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.