Package javax.swing.text

Examples of javax.swing.text.AttributeSet


        final Object result = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
        return (result instanceof HTML.Tag) ? (HTML.Tag)result : null;
    }

    private static String getURLString(final Element e) {
        AttributeSet aSet = (AttributeSet)e.getAttributes()
                .getAttribute(HTML.Tag.A);
        return aSet == null
                ? null
                : (String)aSet.getAttribute(HTML.Attribute.HREF);
    }
View Full Code Here


                if (rr == null) {
                    rr = addStyle(selector, null);
                    addStyleToCascadedStyles(selector);
                }
                if (asResolver) {
                    final AttributeSet resolver = rr.getResolveParent();
                    final MutableAttributeSet importedAttrs =
                        resolver instanceof MutableAttributeSet
                        ? (MutableAttributeSet)resolver
                        : addStyle(null, null);
                    importedAttrs.addAttributes(attrs);
View Full Code Here

        int offset = isParagraph(elem) ? elem.getEndOffset() - 1 : elem.getEndOffset();
        insertHTMLText(elem, offset, htmlText);
    }
   
    private boolean isParagraph(final Element elem) {
        final AttributeSet attr = elem.getAttributes();
        return attr != null && Tag.P.equals(attr.getAttribute(StyleConstants.NameAttribute));
    }
View Full Code Here

    protected AbstractElement createDefaultRoot() {
        final BlockElement root = new BlockElement(null, null);
        writeLock();
        try {
            root.addAttribute(StyleConstants.NameAttribute, Tag.HTML);
            AttributeSet attr = getAttributeContext().getEmptySet();
            final BranchElement body = (BranchElement)createBranchElement(root,
                                                                          null);
            body.addAttribute(StyleConstants.NameAttribute, Tag.BODY);
           
            final BranchElement p = (BranchElement)createBranchElement(body, null);
View Full Code Here

                                          final AttributeSet attr) {
        return new BlockElement(parent, attr);
    }
   
    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

        }

        private ElementSpec findLastSpec(final Tag tag) {
            for (int i = parseBuffer.size() - 1; i >= 0; i--) {
                ElementSpec spec = (ElementSpec)parseBuffer.get(i);
                final AttributeSet specAttr = spec.getAttributes();
                if (specAttr != null && specAttr.containsAttribute(StyleConstants.NameAttribute, tag)) {
                    return spec;
                }
            }
            return null;
        }
View Full Code Here

        super.preferenceChanged(this, width, height);
    }

    protected Component createComponent() {
        try {
            final AttributeSet attrs = getElement().getAttributes();
            final FormElement model = (FormElement)attrs
                .getAttribute(StyleConstants.ModelAttribute);

//            if (model == null) {
//                return null;
//            }
View Full Code Here

        }
    }

    private void resetForm(final Form form) {
        FormElement formElement;
        AttributeSet attrs;

        for (int i = 0; i < form.getElementsCount(); i++) {
            formElement = form.getElement(i);

            attrs = formElement.getAttributes();
View Full Code Here

            final View parent = view.getParent();
            if (parent == null) {
                return getDefaultValue();
            }

            final AttributeSet attr = parent.getAttributes();
            final Object fs = attr.getAttribute(Attribute.FONT_SIZE);
            final int fontSize = fs != null ? ((Length)fs).intValue(parent)
                                            : getDefaultValue().intValue();
            int sizeValueIndex;

            // calculation is defined by CSS1, http://www.w3.org/TR/CSS1#length-units
View Full Code Here

        Object resolveRelativeValue(final View view) {
            if (view == null) {
                return ZERO;
            }

            final AttributeSet attr = view.getAttributes();

            switch (relativeUnits) {
            case RELATIVE_UNITS_EM:
            case RELATIVE_UNITS_EX:
                final Object fs = attr.getAttribute(Attribute.FONT_SIZE);
                final float fontSize = fs != null
                                       ? ((Length)fs).floatValue(view)
                                       : FontSize.getDefaultValue().floatValue();

                float result = fontSize * theValue.floatValue();
 
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.