Package javax.swing.text.DefaultStyledDocument

Examples of javax.swing.text.DefaultStyledDocument.ElementSpec


    public void testTitleEnd_Impied() throws Exception {
        SimpleAttributeSet attr = new SimpleAttributeSet();
        reader.handleEndTag(Tag.TITLE, 0);
        assertEquals(0, reader.charAttr.getAttributeCount());
        assertEquals(2, reader.parseBuffer.size());
        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(0);
        AttributeSet specAttr;
        checkOpenImpliedSpec(spec);
        spec = (ElementSpec)reader.parseBuffer.get(1);
        specAttr = spec.getAttributes();
        assertEquals(2, specAttr.getAttributeCount());
        checkAttributes(specAttr, StyleConstants.NameAttribute, Tag.TITLE);
        checkAttributes(specAttr, HTML.Attribute.ENDTAG, Boolean.TRUE);
    }
View Full Code Here


        attr.addAttribute("aaaa", "bbbb");
       
        reader.handleStartTag(Tag.LINK, attr, 0);
        assertEquals(2, reader.parseBuffer.size());
        assertEquals(0, reader.charAttr.getAttributeCount());
        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(0);
        AttributeSet specAttr;
        checkOpenImpliedSpec(spec);

        spec = (ElementSpec)reader.parseBuffer.get(1);
        specAttr = spec.getAttributes();
        assertEquals(2, specAttr.getAttributeCount());
        checkAttributes(specAttr, StyleConstants.NameAttribute, Tag.LINK);
        checkAttributes(specAttr, "aaaa", "bbbb");
        checkImplicitContentSpec(spec);
    }
View Full Code Here

        assertEquals(0, reader.charAttr.getAttributeCount());
       
        reader.handleStartTag(Tag.LINK, attr, 0);
        assertEquals(3, reader.parseBuffer.size());
        assertEquals(0, reader.charAttr.getAttributeCount());
        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(2);
        AttributeSet specAttr = spec.getAttributes();
        assertEquals(2, specAttr.getAttributeCount());
        checkAttributes(specAttr, StyleConstants.NameAttribute, Tag.LINK);
        checkAttributes(specAttr, "aaaa", "bbbb");
        checkImplicitContentSpec(spec);
    }
View Full Code Here

    public void testMetaStart() throws Exception {
        SimpleAttributeSet attr = new SimpleAttributeSet();
        reader.handleStartTag(Tag.META, attr, 0);
        assertEquals(0, reader.charAttr.getAttributeCount());
        assertEquals(2, reader.parseBuffer.size());
        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(0);
        AttributeSet specAttr;
        checkOpenImpliedSpec(spec);
       
        spec = (ElementSpec)reader.parseBuffer.get(1);
        specAttr = spec.getAttributes();
        assertEquals(1, specAttr.getAttributeCount());
        checkAttributes(specAttr, StyleConstants.NameAttribute, Tag.META);
        assertSpec(spec, ElementSpec.ContentType, ElementSpec.OriginateDirection, 0, new char[]{' '});
    }
View Full Code Here

        assertEquals(0, reader.charAttr.getAttributeCount());
       
        reader.handleStartTag(Tag.META, attr, 0);
        assertEquals(3, reader.parseBuffer.size());
        assertEquals(0, reader.charAttr.getAttributeCount());
        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(2);
        AttributeSet specAttr = spec.getAttributes();
        assertEquals(2, specAttr.getAttributeCount());
        checkAttributes(specAttr, StyleConstants.NameAttribute, Tag.META);
        checkAttributes(specAttr, "aaaa", "bbbb");
        assertSpec(spec, ElementSpec.ContentType, ElementSpec.OriginateDirection, 0, new char[]{' '});
    }
View Full Code Here

        action = reader.new FormAction();
       
        action.start(Tag.FORM, attr);
        assertEquals(0, reader.charAttr.getAttributeCount());
        assertEquals(2, reader.parseBuffer.size());
        ElementSpec spec = (ElementSpec)reader.parseBuffer.get(0);
        AttributeSet specAttr;
        checkOpenImpliedSpec(spec);
        spec = (ElementSpec)reader.parseBuffer.get(1);
        specAttr = spec.getAttributes();
        assertEquals(2, specAttr.getAttributeCount());
        checkAttributes(specAttr, StyleConstants.NameAttribute, Tag.FORM);
        checkAttributes(specAttr, "aaaa", "bbbb");
        checkImplicitContentSpec(spec);
View Full Code Here

    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        spec1 = new ElementSpec(attrs1, ElementSpec.StartTagType);
        spec2 = new ElementSpec(attrs2, ElementSpec.ContentType, 10);
        spec3 = new ElementSpec(attrs3, ElementSpec.EndTagType, text = "sample text"
                .toCharArray(), 2, 4);
    }
View Full Code Here

    }

    public void testDeepTreeInsert01() throws Exception {
        initStructure();
        ElementSpec[] specs = {
                new ElementSpec(null, ElementSpec.EndTagType), // 0
                new ElementSpec(null, ElementSpec.EndTagType), // 1
                new ElementSpec(null, ElementSpec.StartTagType), // 2
                new ElementSpec(null, ElementSpec.StartTagType), // 3
                new ElementSpec(null, ElementSpec.ContentType, // 4
                        "\n".toCharArray(), 0, 1),
                new ElementSpec(null, ElementSpec.EndTagType), // 5
                new ElementSpec(null, ElementSpec.StartTagType), // 6
        };
        specs[2].setDirection(ElementSpec.JoinNextDirection);
        specs[6].setDirection(ElementSpec.JoinNextDirection);
        doc.insert(1, specs);
        final Element html = doc.getDefaultRootElement();
View Full Code Here

        assertChildren(p, new int[] { 2, 6, 6, 7 });
    }

    public void testDeepTreeInsert02() throws Exception {
        initStructure();
        ElementSpec[] specs = { new ElementSpec(null, ElementSpec.EndTagType), // 0
                new ElementSpec(null, ElementSpec.EndTagType), // 1
                new ElementSpec(null, ElementSpec.StartTagType), // 2
                new ElementSpec(null, ElementSpec.StartTagType), // 3
                new ElementSpec(null, ElementSpec.ContentType, // 4
                        "^".toCharArray(), 0, 1), };
        specs[2].setDirection(ElementSpec.JoinNextDirection);
        specs[3].setDirection(ElementSpec.JoinNextDirection);
        doc.insert(1, specs);
        final Element html = doc.getDefaultRootElement();
View Full Code Here

    }

    public void testDeepTreeInsertSpecs() throws Exception {
        initStructure();
        ElementSpec[] specs = {
                new ElementSpec(null, ElementSpec.ContentType, "\n".toCharArray(), 0, 1),
                new ElementSpec(null, ElementSpec.EndTagType),
                new ElementSpec(null, ElementSpec.EndTagType), };
        doc.insert(0, specs);
        final Element html = doc.getDefaultRootElement();
        assertEquals(2, html.getElementCount());
        final Element head = html.getElement(0);
        assertEquals(1, head.getElementCount());
View Full Code Here

TOP

Related Classes of javax.swing.text.DefaultStyledDocument.ElementSpec

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.