Java Swing Text Style resolveAttributes(AttributeSet style)

Here you can find the source of resolveAttributes(AttributeSet style)

Description

resolve Attributes

License

Open Source License

Declaration

public static AttributeSet resolveAttributes(AttributeSet style) 

Method Source Code

//package com.java2s;
/*/*  www.ja v  a 2  s .  c o m*/
 * This file is part of the Scriba source distribution. This is free, open-source 
 * software. For full licensing information, please see the LicensingInformation file
 * at the root level of the distribution.
 *
 * Copyright (c) 2006-2007 Kobrix Software, Inc.
 */

import java.util.Enumeration;

import javax.swing.text.AttributeSet;

import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

public class Main {
    public static AttributeSet resolveAttributes(AttributeSet style) {
        SimpleAttributeSet set = new SimpleAttributeSet();
        if (style != null) {
            Enumeration<?> names = style.getAttributeNames();
            Object value;
            Object key;
            while (names.hasMoreElements()) {
                key = names.nextElement();
                // System.out.println("Util resolveAttributes key=" + key);
                value = style.getAttribute(key);
                // System.out.println("Util resolveAttributes value=" + value);
                if ((!key.equals(StyleConstants.NameAttribute)) && (!key.equals(StyleConstants.ResolveAttribute))
                        && (!key.equals(AttributeSet.ResolveAttribute))
                        && (!key.equals(AttributeSet.NameAttribute))) {
                    set.addAttribute(key, value);
                } else {
                    if (key.equals(StyleConstants.ResolveAttribute) || key.equals(AttributeSet.ResolveAttribute)) {
                        // System.out.println("Util resolveAttributes resolving
                        // key=" + key);
                        set.addAttributes(resolveAttributes((AttributeSet) value));
                    }
                }
            }
        }
        return set;
    }
}

Related

  1. getNextVisualPosition(final View v, final int pos, final Position.Bias b0, final int direction, final Position.Bias[] biasRet)
  2. hasDifferentCharacterAttributes(AttributeSet style, AttributeSet base)
  3. isCentered(AttributeSet attributes)
  4. isLTR(final int level)
  5. overrideStyle(Style originalStyle, Style newStyle)
  6. unRTF(String s)