Package javax.swing.text.AbstractDocument

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


        final StyleContext context = new StyleContext();
        final Style style = context.addStyle("aStyle", null);
        final AbstractElement par = (AbstractElement) doc.getParagraphElement(5);
        doc.writeLock();
        try {
            par.addAttribute(AttributeSet.ResolveAttribute, style);
            assertSame(style, doc.getLogicalStyle(5));
        } finally {
            doc.writeUnlock();
        }
    }
View Full Code Here


        assertEquals("content", run.getName());
        htmlDoc.lockWrite();

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

    public void testGetResolveParent() {
        AbstractElement parent = htmlDoc.new RunElement(null, null, 0, 0);
View Full Code Here

        final StyleContext context = new StyleContext();
        final Style style = context.addStyle("aStyle", null);
        final AbstractElement par = (AbstractElement) doc.getParagraphElement(5);
        doc.writeLock();
        try {
            par.addAttribute(AttributeSet.ResolveAttribute, style);
            assertSame(style, doc.getLogicalStyle(5));
        } finally {
            doc.writeUnlock();
        }
    }
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

            (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");
        attr = ss.translateHTMLToCSS(body);
View Full Code Here

        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");
        attr = ss.translateHTMLToCSS(body);
        assertSame(NamedStyle.class, attr.getClass());
View Full Code Here

        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");
        attr = ss.translateHTMLToCSS(body);
        assertSame(NamedStyle.class, attr.getClass());
        assertNull(((NamedStyle)attr).getName());
View Full Code Here

        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");
        attr = ss.translateHTMLToCSS(body);
        assertSame(NamedStyle.class, attr.getClass());
        assertNull(((NamedStyle)attr).getName());
        assertEquals(3, attr.getAttributeCount());
View Full Code Here

        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");
        attr = ss.translateHTMLToCSS(body);
        assertSame(NamedStyle.class, attr.getClass());
        assertNull(((NamedStyle)attr).getName());
        assertEquals(3, attr.getAttributeCount());
        assertEquals(isHarmony() ? "url(bg.jpg)" : "bg.jpg",
View Full Code Here

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

        p.addAttribute(HTML.Attribute.BGCOLOR, "#ffffff");
        p.addAttribute(HTML.Attribute.BACKGROUND, "bg.jpg");
        p.addAttribute(HTML.Attribute.TEXT, "black");
        p.addAttribute(HTML.Attribute.LINK, "blue");
        p.addAttribute(HTML.Attribute.ALINK, "red");
        p.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.