Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.DOMFactory


    public void testIgnoreElementWithNoStyles() throws IOException,
            SAXException {

        // 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
View Full Code Here


     * @return the flattened table cell
     */
    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();
View Full Code Here

    /**
     * Verify that an element with a non null id attribute cannot be removed.
     */
    public void testIsElementEligibleForRemovalElementWithId() {
        DOMFactory factory = DOMFactory.getDefaultInstance();
        Element div = factory.createElement("div");
        div.setAttribute("id", "myID");

        HTML_iModeDivRemover divRemover = new HTML_iModeDivRemover();
        assertEquals(false, divRemover.isDivEligibleForRemoval(div));
    }
View Full Code Here

    /**
     * Verify that an element with a non null align attribute cannot be
     * removed, unless it has the same value as the parent align attribute.
     */
    public void testIsElementEligibleForRemovalElementWithAlign() {
        DOMFactory factory = DOMFactory.getDefaultInstance();
        Element div = factory.createElement("div");
        div.setAttribute("align", "left");
        Element innerDiv = factory.createElement("div");
        innerDiv.setAttribute("align", "left");
        div.addHead(innerDiv);

        HTML_iModeDivRemover divRemover = new HTML_iModeDivRemover();
        assertEquals(true, divRemover.isDivEligibleForRemoval(innerDiv));
View Full Code Here

    /**
     * Verify that a non null element with a null id and align attribute can
     * be removed.
     */
    public void testIsElementEligibleForRemovalElement() {
        DOMFactory factory = DOMFactory.getDefaultInstance();
        Element div = factory.createElement("div");

        HTML_iModeDivRemover divRemover = new HTML_iModeDivRemover();
        assertEquals(true, divRemover.isDivEligibleForRemoval(div));
    }
View Full Code Here

     */
    public Node getSiblingInstance() {
        Node result = null;

        if (sibling != null) {
            DOMFactory factory = sibling.getDOMFactory();
            if (sibling instanceof Element) {
                Element element;
                Element prototype = (Element)sibling;

                element = factory.createElement();

                element.copy(prototype);

                result = element;
            } else if (sibling instanceof Text) {
                Text text;
                Text prototype = (Text)sibling;

                text = factory.createText();

                text.append(prototype.getContents(), 0, prototype.getLength());
                text.setEncoded(prototype.isEncoded());

                result = text;
View Full Code Here

        // This element should be a <li>.

        // now inside a supported list: ul, ol, nl, etc
        final Styles styles = element.getStyles();
        if (styles != null) {
            DOMFactory domFactory = element.getDOMFactory();
            Element div = domFactory.createElement(DIV);
            div.setStyles(styles);

            // Clear the display property as this is not a list-item
            // any more.
            styles.getPropertyValues()
View Full Code Here

    public void visit(Element element) {

        // now inside a supported list: ul, ol, nl, etc
        final Styles styles = element.getStyles();
        if (styles != null) {
            DOMFactory domFactory = element.getDOMFactory();
            Element tr = domFactory.createElement(TR);
            tr.setStyles(styles);

            // Clear the display property as this is not a list-item
            // any more.
            styles.getPropertyValues()
View Full Code Here

     * for the com.volantis.mcs.protocols.VolantisProtocol class.
     */
    public void notestWriteProtocolString() throws Exception {
        final VolantisProtocol protocol = getProtocol();

        DOMFactory domFactory = DOMFactory.getDefaultInstance();
        final Document document = domFactory.createDocument();

        MethodInvoker invoker = new MethodInvoker() {
            public void invoke() {
                protocol.writeProtocolString(document);
            }
View Full Code Here

        listItemStyles = stylesMerger.merge(markerStyles, listItemStyles);

        // Update the list item styles associated with the element.
        element.setStyles(listItemStyles);

        DOMFactory domFactory = element.getDOMFactory();
        // add the children of the list item to the span, and the span to
        // the list item

        // Make sure that the content properties do not have a
        // display: list-item
        contentStyles.getPropertyValues().setComputedValue(
                StylePropertyDetails.DISPLAY, DisplayKeywords.INLINE);
        Element contents = domFactory.createElement(SPAN);
        contents.setStyles(contentStyles);

        // Add the list item children to the contents element.
        element.addChildrenToTail(contents);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom.DOMFactory

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.