Examples of SimpleAttributeSet


Examples of javax.swing.text.SimpleAttributeSet

    }
   
    protected void insertUpdate(final DefaultDocumentEvent event, final AttributeSet attrs) {
        AttributeSet contentAttr = attrs;
        if (contentAttr == null) {
            contentAttr = new SimpleAttributeSet();
            ((SimpleAttributeSet)contentAttr).addAttribute(StyleConstants.NameAttribute, Tag.CONTENT);
        }
        super.insertUpdate(event, contentAttr);
    }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        addDefaultCSSAttribute(Tag.U, CSS.Attribute.TEXT_DECORATION, "underline");
        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);
    }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        assertNull(formView.getComponent());
        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());
        assertNotNull(getModelAttribute(elem));
        assertNull(StyleConstants.getComponent(elem.getAttributes()));

        formView.setParent(editorPane.getUI().getRootView(editorPane));
        assertNull(StyleConstants.getComponent(elem.getAttributes()));
        assertNull(formView.createComponent());
        assertNull(formView.getComponent());
        assertNotNull(getModelAttribute(elem));

        // Element type "password"
        createFormView(FormAttributes.INPUT_TYPE_PASSWORD);
        assertNull(StyleConstants.getComponent(elem.getAttributes()));
        assertNull(StyleConstants.getComponent(elem.getAttributes()));
        Object modelAttribute = getModelAttribute(elem);
        assertNull(formView.getComponent());
        assertSame(elem, formView.getElement());
        assertSame(elem.getAttributes(), formView.getAttributes());
        Component component = formView.createComponent();
        assertNotNull(component);
        assertNull(formView.getComponent());
        assertSame(modelAttribute, getModelAttribute(elem));
        assertNotSame(component, formView.createComponent());
        component = formView.createComponent();

        formView.setParent(editorPane.getUI().getRootView(editorPane));
        assertNotNull(component);
        Component cashedComponent = formView.getComponent();
        assertNotNull(cashedComponent);
        assertSame(cashedComponent, formView.getComponent());
        assertNotSame(component, cashedComponent);
        assertNotSame(component, formView.createComponent());
        assertNotSame(formView.getComponent(), formView.createComponent());
        assertSame(modelAttribute, getModelAttribute(elem));
        assertSame(cashedComponent, formView.getComponent());

        // Check component attribute
        createFormView(FormAttributes.INPUT_TYPE_TEXT);
        assertNull(StyleConstants.getComponent(elem.getAttributes()));
        JButton button = new JButton();
        attrs = new SimpleAttributeSet();
        StyleConstants.setComponent(attrs, button);
        doc.setCharacterAttributes(23, 1, attrs, false);
        assertNotNull(StyleConstants.getComponent(elem.getAttributes()));
        assertNull(formView.getComponent());
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

                component.setPreferredSize(new Dimension(20, 20));
                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

Examples of javax.swing.text.SimpleAttributeSet

    }

    private void checkWithoutlModel(final int offset, final String id,
                                    final String type) {
        elem = doc.getElement(id);
        MutableAttributeSet attrs = new SimpleAttributeSet();
        attrs.addAttributes(elem.getAttributes());
        attrs.removeAttribute(StyleConstants.ModelAttribute);
        doc.setCharacterAttributes(offset, 1, attrs, true);
   
        assertNull(elem.getAttributes().getAttribute(StyleConstants
                                                     .ModelAttribute));
        createFormView(id);
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

    }

    private Element createElement() {
        return new Element() {

            private MutableAttributeSet attrs = new SimpleAttributeSet();

            public AttributeSet getAttributes() {
                return attrs;
            }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

  private void createAttributes() { 
    Priority prio[] = Priority.getAllPossiblePriorities();
   
    attributes = new Hashtable();
    for (int i=0; i<prio.length;i++) {
      MutableAttributeSet att = new SimpleAttributeSet();
      attributes.put(prio[i], att);
      StyleConstants.setFontSize(att,14);
    }
    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.ERROR),Color.red);
    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.WARN),Color.orange);
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

  private void createDefaultFontAttributes() {
    Priority[] prio = Priority.getAllPossiblePriorities();

    fontAttributes = new Hashtable();
    for (int i=0; i<prio.length;i++) {
      MutableAttributeSet att = new SimpleAttributeSet();
      fontAttributes.put(prio[i], att);
      //StyleConstants.setFontSize(att,11);
    }

    setTextColor(Priority.FATAL, Color.red);
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

        {
                sysId = SimplifiedDocbookMarkup.DEFAULT_XML_SYSTEM_ID;
        }
        markup( " \"" + sysId + "\">" );

        MutableAttributeSet att = new SimpleAttributeSet();
        if ( lang != null )
        {
            att.addAttribute( LANG_ATTRIBUTE, lang );
        }
        return att;
    }
View Full Code Here

Examples of javax.swing.text.SimpleAttributeSet

    {
        String numeration = DocbookUtils.docbookListNumbering( numbering );

        paragraph_();

        MutableAttributeSet att = new SimpleAttributeSet();
        att.addAttribute( SimplifiedDocbookMarkup.NUMERATION_ATTRIBUTE, numeration );

        writeStartTag( SimplifiedDocbookMarkup.ORDEREDLIST_TAG, att );
    }
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.