Package javax.swing.text

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


                    || key == StyleConstants.StrikeThrough) {

                    value = createTextDecoration(converted, key, value);
                    key = CSS.Attribute.TEXT_DECORATION;
                }
                converted.addAttribute(key, value);
            } else {
                if (!(value instanceof CSS.PropertyValueConverter)) {
                    value = cssKey.getConverter().toCSS(value);
                }
                if (value != null) {
View Full Code Here


            } else {
                if (!(value instanceof CSS.PropertyValueConverter)) {
                    value = cssKey.getConverter().toCSS(value);
                }
                if (value != null) {
                    converted.addAttribute(cssKey, value);
                }
            }
        }
        return super.addAttributes(getEmptySet(), converted);
    }
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

            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

        error.getStartPosition(),
        error.getLength(),
        doc.getStyle(styleConfig.getName()),
        true);
    SimpleAttributeSet attributes = new SimpleAttributeSet();
    attributes.addAttribute(MWPaneFormatter.ATTRIBUTE_INFO, error);
    attributes.addAttribute(MWPaneFormatter.ATTRIBUTE_UUID, UUID.randomUUID());
    doc.setCharacterAttributes(
        error.getStartPosition(),
        error.getLength(),
        attributes, false);
View Full Code Here

        error.getLength(),
        doc.getStyle(styleConfig.getName()),
        true);
    SimpleAttributeSet attributes = new SimpleAttributeSet();
    attributes.addAttribute(MWPaneFormatter.ATTRIBUTE_INFO, error);
    attributes.addAttribute(MWPaneFormatter.ATTRIBUTE_UUID, UUID.randomUUID());
    doc.setCharacterAttributes(
        error.getStartPosition(),
        error.getLength(),
        attributes, false);
View Full Code Here

      }
      localTextPane.getDocument().remove(startOffset - offsetBefore, endOffset + offsetAfter - startOffset + offsetBefore);
      localTextPane.getDocument().insertString(startOffset - offsetBefore, newText, localElement.getAttributes());
      if ((offsetBefore != 0) || (offsetAfter != 0)) {
        SimpleAttributeSet attr = new SimpleAttributeSet();
        attr.addAttribute(MWPaneFormatter.ATTRIBUTE_TEXT, textAttr);
        localTextPane.getStyledDocument().setCharacterAttributes(
            startOffset - offsetBefore, newText.length(), attr, false);
      }
      localTextPane.setCaretPosition(startOffset - offsetBefore);
      localTextPane.moveCaretPosition(startOffset - offsetBefore + newText.length());
View Full Code Here

                      getAttributes() + " pos: " + getCurrentPos());
            }
        }
        if (tag.fictional()) {
            SimpleAttributeSet attrs = new SimpleAttributeSet();
            attrs.addAttribute(HTMLEditorKit.ParserCallback.IMPLIED,
                               Boolean.TRUE);
            callback.handleStartTag(tag.getHTMLTag(), attrs,
                                    getBlockStartPosition());
        } else {
            callback.handleStartTag(tag.getHTMLTag(), getAttributes(),
View Full Code Here

                          + getAttributes() + " pos: " + getCurrentPos());
                }
            }
            if (tag.fictional()) {
                SimpleAttributeSet attrs = new SimpleAttributeSet();
                attrs.addAttribute(HTMLEditorKit.ParserCallback.IMPLIED,
                                   Boolean.TRUE);
                callback.handleSimpleTag(tag.getHTMLTag(), attrs,
                                         getBlockStartPosition());
            } else {
                callback.handleSimpleTag(tag.getHTMLTag(), getAttributes(),
View Full Code Here

          getAttributes() + " pos: " + getCurrentPos());
      }
  }
  if (tag.fictional()) {
      SimpleAttributeSet attrs = new SimpleAttributeSet();
      attrs.addAttribute(HTMLEditorKit.ParserCallback.IMPLIED,
             Boolean.TRUE);
      callback.handleStartTag(tag.getHTMLTag(), attrs,
            getBlockStartPosition());
  } else {
      callback.handleStartTag(tag.getHTMLTag(), getAttributes(),
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.