Package javax.swing.text

Examples of javax.swing.text.AttributeSet


    return;
  }
 
  public
  String getFontName() {
    AttributeSet attrSet = (AttributeSet) attributes.get(Priority.INFO);
    return StyleConstants.getFontFamily(attrSet);
  }
View Full Code Here


    ElementIterator iterator = new ElementIterator(htmlDoc);
    Element element;
    while ((element = iterator.next()) != null)
      {
        AttributeSet attributes = element.getAttributes();
        Object name = attributes.getAttribute(StyleConstants.NameAttribute);
        h.check((name instanceof HTML.Tag),
                true,
                "HTML.Tag is not"
                    + " stored as StyleConstants.NameAttribute in the elements attributes");
      }
View Full Code Here

    testDefaultValues();
  }

  public void testDefaultValues()
  {
    AttributeSet d;
    d = defaulter.getDefaultParameters("FrAmE");
    assertEquals(d.getAttribute("scrolling"), "auto");
    d = defaulter.getDefaultParameters("input");
    assertEquals(d.getAttribute("type"), "text");

    htmlAttributeSet hma = new htmlAttributeSet();
    hma.setResolveParent(d);
    hma.addAttribute("ku", "1");
    hma.addAttribute(Attribute.ACTION, "sleep");

    assertEquals(hma.getAttribute("action"), "sleep");
    assertEquals(hma.getAttribute(Attribute.ACTION), "sleep");
    assertEquals(hma.getAttribute("ku"), "1");

    // Calling the parent:
    assertEquals(hma.getAttribute(Attribute.TYPE), "text");

    d = defaulter.getDefaultParameters("audrius");
    assertEquals(d.getAttribute("scrolling"), null);
  }
View Full Code Here

            int dot = evt.getDot();
            //SwingX #257--ensure display shows the valid attributes
            dot = dot > 0 ? dot - 1 : dot;
           
            Element elem = document.getCharacterElement(dot);
            AttributeSet set = elem.getAttributes();

            // JW: see comment in updateActionState
            ActionManager manager = ActionManager.getInstance();
            manager.setSelected("font-bold", StyleConstants.isBold(set));
            manager.setSelected("font-italic", StyleConstants.isItalic(set));
            manager.setSelected("font-underline", StyleConstants.isUnderline(set));

            elem = document.getParagraphElement(dot);
            set = elem.getAttributes();

            // Update the paragraph selector if applicable.
            if (selector != null) {
                selector.setSelectedItem(set.getAttribute(StyleConstants.NameAttribute));
            }

            switch (StyleConstants.getAlignment(set)) {
                // XXX There is a bug here. the setSelected method
                // should only affect the UI actions rather than propagate
View Full Code Here

        final int start = getSelectionStart();
        final int end = getSelectionEnd();
        final StyledDocument doc = getStyledDocument();

        AttributeSet attrs;

        try {
            if (start != end) {
                attrs = doc.getCharacterElement(start).getAttributes();
View Full Code Here

        try {
            if (start != end) {
                doc.remove(start, end - start);
            }
            //May be these attributes placed in Document ????
            AttributeSet as = (editorKit instanceof StyledEditorKit)
                  ? ((StyledEditorKit)editorKit).getInputAttributes()
                    : null;
            if (s != null) {
                doc.insertString(start, s, as);
            }
View Full Code Here

            final View child = v.getView(item);
            if (!(child instanceof BlockView)) {
                return;
            }

            final AttributeSet attr = child.getAttributes();
            final StyleSheet ss = ((BlockView)child).getStyleSheet();
            Font font = ss.getFont(attr);
            final Color color = ss.getForeground(attr);
            final CSS.ListStyleType listStyle =
                (CSS.ListStyleType)attr.getAttribute(Attribute.LIST_STYLE_TYPE);

            String decorator = null;

            int index;
            if (listStyle == null) {
View Full Code Here

                   ? length.floatValue(view)
                   : CSS.BorderWidthValue.factory.floatValue();
        }

        private float getBorderSideWidth(final int side, final View view) {
            final AttributeSet viewAttr = view.getAttributes();
            CSS.BorderStyle borderStyle =
                (BorderStyle)viewAttr.getAttribute(CSS.Attribute.BORDER_STYLE);
            if (borderStyle == null
                || borderStyle.getSideStyle(side).getIndex()
                   == CSS.BorderStyleValue.NONE) {

                return 0;
View Full Code Here

        }

        class AdvancedCharacterAction extends CharacterAction {
            public void start(final Tag tag, final MutableAttributeSet attr) {
                super.start(tag, attr);
                final AttributeSet attrs = getDefaultCSSAttributes(tag);
                if (attrs != null) {
                    charAttr.addAttributes(attrs);
                }
            }
View Full Code Here

            writeEndHTMLTagIfNeeded(HTML.Tag.B);
        }
    }

    private static String getParagraphStyleName(final Element par) {
        AttributeSet attrs = par.getAttributes();
        Object style = attrs.getAttribute(StyleConstants.ResolveAttribute);
        return style instanceof Style
            ? ((Style)style).getName()
            : StyleContext.DEFAULT_STYLE;
    }
View Full Code Here

TOP

Related Classes of javax.swing.text.AttributeSet

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.