Package javax.swing.text

Examples of javax.swing.text.SimpleAttributeSet.addAttribute()


        assertNull( "Non existent attribute ID should return null AttributeSet!",
                    config.getAttributeSet( "a.dummy.attribute" ) );

        MutableAttributeSet expected = new SimpleAttributeSet();
        expected.addAttribute( "font-style", "italic" );
        MutableAttributeSet actual = config.getAttributeSet( "italic" );

        assertTrue( "Wrong AttributeSet returned for italic!", expected.isEqual( actual ) );
    }
View Full Code Here


    /** {@inheritDoc} */
    protected String getTableBlock( String cell, String caption )
    {
        // Using the same set ordering than the JVM
        MutableAttributeSet att = new SimpleAttributeSet();
        att.addAttribute( "frame", "none" );
        att.addAttribute( "rowsep", "0" );
        att.addAttribute( "colsep", "0" );

        return "<table" + SinkUtils.getAttributeString( att ) + "><title>" + caption
            + "</title>" + "<tgroup cols=\"1\"><colspec align=\"center\" />" + "<tbody><row><entry>"
View Full Code Here

    protected String getTableBlock( String cell, String caption )
    {
        // Using the same set ordering than the JVM
        MutableAttributeSet att = new SimpleAttributeSet();
        att.addAttribute( "frame", "none" );
        att.addAttribute( "rowsep", "0" );
        att.addAttribute( "colsep", "0" );

        return "<table" + SinkUtils.getAttributeString( att ) + "><title>" + caption
            + "</title>" + "<tgroup cols=\"1\"><colspec align=\"center\" />" + "<tbody><row><entry>"
            + cell  + "</entry>" + "</row>" + "</tbody></tgroup>" + "</table>";
View Full Code Here

    {
        // Using the same set ordering than the JVM
        MutableAttributeSet att = new SimpleAttributeSet();
        att.addAttribute( "frame", "none" );
        att.addAttribute( "rowsep", "0" );
        att.addAttribute( "colsep", "0" );

        return "<table" + SinkUtils.getAttributeString( att ) + "><title>" + caption
            + "</title>" + "<tgroup cols=\"1\"><colspec align=\"center\" />" + "<tbody><row><entry>"
            + cell  + "</entry>" + "</row>" + "</tbody></tgroup>" + "</table>";
    }
View Full Code Here

        if (true) {
            throw new UnsupportedOperationException("Not implemented");
        }
        AbstractDocument doc = new DefaultStyledDocument();
        SimpleAttributeSet as1 = new SimpleAttributeSet();
        as1.addAttribute("key1", "value1");
        SimpleAttributeSet as2 = new SimpleAttributeSet();
        as2.addAttribute("key2", "value2");
        try {
            doc.insertString(0, "testReplaceSelection", as1);
            doc.insertString(4, "INSERT", as2);
View Full Code Here

        }
        AbstractDocument doc = new DefaultStyledDocument();
        SimpleAttributeSet as1 = new SimpleAttributeSet();
        as1.addAttribute("key1", "value1");
        SimpleAttributeSet as2 = new SimpleAttributeSet();
        as2.addAttribute("key2", "value2");
        try {
            doc.insertString(0, "testReplaceSelection", as1);
            doc.insertString(4, "INSERT", as2);
        } catch (final BadLocationException e) {
            assertFalse("unexpected exception :" + e.getMessage(), true);
View Full Code Here

            impliedBlockOpen = true;
        }

        private MutableAttributeSet createMutableSet(final Object key, final Object value) {
            MutableAttributeSet specAttr = new SimpleAttributeSet();
            specAttr.addAttribute(key, value);
            return specAttr;
        }

        private boolean paragraphOpened() {
            return openedBlocks.contains(PARAGRAPH_TAG) || openedBlocks.contains(Tag.IMPLIED) && impliedBlockOpen;
View Full Code Here

        addDefaultCSSAttribute(Tag.PRE, CSS.Attribute.WHITE_SPACE, "pre");
    }

    private static void addDefaultCSSAttribute(final Tag tag, final CSS.Attribute attr, final String value) {
        SimpleAttributeSet attrSet = new SimpleAttributeSet();
        attrSet.addAttribute(attr, attr.getConverter().toCSS(value));
        DEFAULT_CHARACHTER_ATTRIBUTES.addAttribute(tag, attrSet);
    }

    private static SimpleAttributeSet getDefaultCSSAttributes(final Tag tag) {
        return (SimpleAttributeSet)DEFAULT_CHARACHTER_ATTRIBUTES.getAttribute(tag);
View Full Code Here

        assertNull(getModelAttribute(elem));

        // Wrong element type name
        createFormView(FormAttributes.INPUT_TYPE_SUBMIT);
        MutableAttributeSet attrs = new SimpleAttributeSet();
        attrs.addAttribute(HTML.Attribute.TYPE, "my_type");
        doc.setCharacterAttributes(22, 1, attrs, false);
        assertEquals("my_type",
                     elem.getAttributes().getAttribute(HTML.Attribute.TYPE));
        assertNull(formView.createComponent());
        assertNull(formView.getComponent());
View Full Code Here

                component.setMaximumSize(new Dimension(30, 30));
                return component;
            };
        };
        MutableAttributeSet attrs = new SimpleAttributeSet();
        attrs.addAttribute(HTML.Attribute.TYPE, "my_type");
        doc.setCharacterAttributes(22, 1, attrs, false);
        assertEquals("my_type",
                     elem.getAttributes().getAttribute(HTML.Attribute.TYPE));
        checkFormViewSpans(0, 0, 0, 0);
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.