Package javax.swing.text.AbstractDocument

Examples of javax.swing.text.AbstractDocument.AbstractElement.addAttribute()


        assertEquals("paragraph", block.getName());
        htmlDoc.lockWrite();

        final String name = "asddsa";
        block = htmlDoc.new BlockElement(null, null);
        block.addAttribute(StyleConstants.NameAttribute, name);
        assertEquals(name, block.getName());
    }

    public void testGetElement() {
        if (isHarmony()) {
View Full Code Here


    public void testTranslateHTMLToCSSVAlignTop() throws Exception {
        AbstractElement branch =
            (AbstractElement)doc.getDefaultRootElement().getElement(0);
        assertEquals("body", branch.getName());

        branch.addAttribute(HTML.Attribute.VALIGN, "top");
        attr = ss.translateHTMLToCSS(branch);
        assertEquals(1, attr.getAttributeCount());
        assertEquals("top",
                     attr.getAttribute(CSS.Attribute.VERTICAL_ALIGN).toString());
    }
View Full Code Here

    public void testTranslateHTMLToCSSVAlignMiddle() throws Exception {
        AbstractElement branch =
            (AbstractElement)doc.getDefaultRootElement().getElement(0);
        assertEquals("body", branch.getName());

        branch.addAttribute(HTML.Attribute.VALIGN, "middle");
        attr = ss.translateHTMLToCSS(branch);
        assertEquals(1, attr.getAttributeCount());
        assertEquals("middle",
                     attr.getAttribute(CSS.Attribute.VERTICAL_ALIGN).toString());
    }
View Full Code Here

    public void testTranslateHTMLToCSSVAlignBottom() throws Exception {
        AbstractElement branch =
            (AbstractElement)doc.getDefaultRootElement().getElement(0);
        assertEquals("body", branch.getName());

        branch.addAttribute(HTML.Attribute.VALIGN, "bottom");
        attr = ss.translateHTMLToCSS(branch);
        assertEquals(1, attr.getAttributeCount());
        assertEquals("bottom",
                     attr.getAttribute(CSS.Attribute.VERTICAL_ALIGN).toString());
    }
View Full Code Here

    public void testTranslateHTMLToCSSVAlignBaseline() throws Exception {
        AbstractElement branch =
            (AbstractElement)doc.getDefaultRootElement().getElement(0);
        assertEquals("body", branch.getName());

        branch.addAttribute(HTML.Attribute.VALIGN, "baseline");
        attr = ss.translateHTMLToCSS(branch);
        assertEquals(1, attr.getAttributeCount());
        assertEquals("baseline",
                     attr.getAttribute(CSS.Attribute.VERTICAL_ALIGN).toString());
    }
View Full Code Here

    public void testTranslateHTMLToCSSWidth() throws Exception {
        AbstractElement branch = (AbstractElement)doc.getParagraphElement(0);
        assertEquals("p", branch.getName());

        branch.addAttribute(HTML.Attribute.WIDTH, "50%");
        attr = ss.translateHTMLToCSS(branch);
        assertEquals(2, attr.getAttributeCount());
        assertEquals("50%",
                     attr.getAttribute(CSS.Attribute.WIDTH).toString());
        assertEquals("0",
View Full Code Here

    public void testTranslateHTMLToCSSHeight() throws Exception {
        AbstractElement branch = (AbstractElement)doc.getParagraphElement(0);
        assertEquals("p", branch.getName());

        branch.addAttribute(HTML.Attribute.HEIGHT, "331");
        attr = ss.translateHTMLToCSS(branch);
        assertEquals(2, attr.getAttributeCount());
        assertEquals("331" + (isHarmony() ? "pt" : ""),
                     attr.getAttribute(CSS.Attribute.HEIGHT).toString());
        assertEquals("0",
View Full Code Here

    public void testTranslateHTMLToCSSStyle() throws Exception {
        AbstractElement branch = (AbstractElement)doc.getParagraphElement(0);
        assertEquals("p", branch.getName());

        branch.addAttribute(CSS.Attribute.BORDER_BOTTOM_WIDTH, "1pt");
        attr = ss.translateHTMLToCSS(branch);
        assertEquals(2, attr.getAttributeCount());
        assertEquals("1pt", attr.getAttribute(CSS.Attribute.BORDER_BOTTOM_WIDTH)
                            .toString());
        assertEquals("0",
View Full Code Here

        assertSame(va, view.getAttributes());
        assertEquals(1, va.getAttributeCount());
        assertEquals("0",
                     va.getAttribute(CSS.Attribute.MARGIN_TOP).toString());

        branch.addAttribute(HTML.Attribute.WIDTH, "200");

        assertFalse(gva.isOccurred());
        assertFalse(th2c.isOccurred());

        view.changedUpdate(new DocumentEvent() {
View Full Code Here

        AbstractElement body =
            (AbstractElement)doc.getDefaultRootElement().getElement(0);
        assertEquals("body", body.getName());
        assertTrue(body instanceof BlockElement);

        body.addAttribute(HTML.Attribute.BGCOLOR, "#ffffff");
        body.addAttribute(HTML.Attribute.BACKGROUND, "bg.jpg");
        body.addAttribute(HTML.Attribute.TEXT, "black");
        body.addAttribute(HTML.Attribute.LINK, "blue");
        body.addAttribute(HTML.Attribute.ALINK, "red");
        body.addAttribute(HTML.Attribute.VLINK, "purple");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.