Package javax.swing.text

Examples of javax.swing.text.MutableAttributeSet


                super.start(tag, attr);
               
                final ElementSpec spec = getLastSpec();
                assert spec != null : "we've just created a spec in super.start()";
                FormElement model = null;
                final MutableAttributeSet specAttr = (MutableAttributeSet)spec.getAttributes();
                if (Tag.INPUT.equals(tag)) {
                    model = handleInput(attr, specAttr);
                } else if (Tag.TEXTAREA.equals(tag)) {
                    model = new FormTextModel(getCurrentForm(), attr);
                    openedBlocks.add(Tag.TEXTAREA);
                } else if (Tag.BUTTON.equals(tag)) {
                    model = new FormButtonModel(getCurrentForm(), attr);
                    openedBlocks.add(Tag.BUTTON);
                } else if (Tag.LEGEND.equals(tag)) {
                    openedBlocks.add(Tag.LEGEND);
                    if (openedBlocks.contains(Tag.FIELDSET)) {
                        handleLegend(null, specAttr);
                    }
                } else if (Tag.FIELDSET.equals(tag)) {
                    model = new FormFieldsetModel(getCurrentForm(), attr);
                    openedBlocks.add(Tag.FIELDSET);
                } else if (Tag.SELECT.equals(tag)) {
                    if (FormAttributes.isListSelect(specAttr)) {
                        selectModel = new FormSelectListModel(getCurrentForm(), attr);
                    } else {
                        selectModel = new FormSelectComboBoxModel(getCurrentForm(), attr);
                    }
                    model = selectModel;
                    openedBlocks.add(Tag.SELECT);
                }
                if (model != null) {
                    specAttr.addAttribute(StyleConstants.ModelAttribute, model);
                    assert currentForm != null : "creating model with getCurrentForm() in constructor assures this";
                    currentForm.addElement(model);
                }
            }
View Full Code Here


        }

        public class PreAction extends BlockAction {
            public void start(final Tag tag, final MutableAttributeSet attr) {
                super.start(tag, attr);
                MutableAttributeSet blockAttr = new SimpleAttributeSet(attr);
                SimpleAttributeSet defaultAttr = getDefaultCSSAttributes(tag);
                if (defaultAttr != null) {
                    blockAttr.addAttributes(defaultAttr);
                }
                blockOpen(Tag.IMPLIED, blockAttr);
                impliedBlockOpen = true;
                needImpliedNewLine = true;
            }
View Full Code Here

        }
        super.insertUpdate(event, contentAttr);
    }

    private void processTarget(final Element target, final String src) {
        final MutableAttributeSet targetAttr = (MutableAttributeSet)target.getAttributes();
        writeLock();
        try {
            targetAttr.addAttribute(HTML.Attribute.SRC, src);
        } finally {
            writeUnlock();
        }
        fireChangedUpdate(new DefaultDocumentEvent(target.getStartOffset(), target.getEndOffset() - target.getStartOffset(), EventType.CHANGE));
    }
View Full Code Here

        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());
View Full Code Here

                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

    }

    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

  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

  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

        {
            write( " encoding=\"" + encoding + "\"" );
        }
        write( "?>" );

        MutableAttributeSet atts = new SinkEventAttributeSet();
        atts.addAttribute( "xmlns", XDOC_NAMESPACE );
        atts.addAttribute( "xmlns:xsi", XML_NAMESPACE );
        atts.addAttribute( "xsi:schemaLocation", XDOC_NAMESPACE + " " + XDOC_SYSTEM_ID );

        if ( languageId != null )
        {
            atts.addAttribute( Attribute.LANG.toString(), languageId );
            atts.addAttribute( "xml:lang", languageId );
        }

        if ( attributes != null )
        {
            atts.addAttributes( attributes );
        }

        writeStartTag( DOCUMENT_TAG, atts );

        writeStartTag( PROPERTIES_TAG );
View Full Code Here

     * @see javax.swing.text.html.HTML.Tag#H5
     * @see javax.swing.text.html.HTML.Tag#H6
     */
    protected void onSectionTitle( int depth, SinkEventAttributes attributes )
    {
        MutableAttributeSet atts = SinkUtils.filterAttributes(
                attributes, SinkUtils.SINK_SECTION_ATTRIBUTES  );

        if ( depth == SECTION_LEVEL_3 )
        {
            writeStartTag( H4, atts );
View Full Code Here

TOP

Related Classes of javax.swing.text.MutableAttributeSet

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.