本文整理汇总了Java中javax.swing.text.html.CSS.Attribute方法的典型用法代码示例。如果您正苦于以下问题:Java CSS.Attribute方法的具体用法?Java CSS.Attribute怎么用?Java CSS.Attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.html.CSS
的用法示例。
在下文中一共展示了CSS.Attribute方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToHTML40
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Copies the given AttributeSet to a new set, converting
* any CSS attributes found to arguments of an HTML style
* attribute.
*/
private static void convertToHTML40(AttributeSet from, MutableAttributeSet to) {
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
value = value + " " + key + "=" + from.getAttribute(key) + ";";
}
else {
to.addAttribute(key, from.getAttribute(key));
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}
示例2: createFontAttribute
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create/update an HTML <font> tag attribute. The
* value of the attribute should be a MutableAttributeSet so
* that the attributes can be updated as they are discovered.
*/
private static void createFontAttribute(CSS.Attribute a, AttributeSet from, MutableAttributeSet to) {
MutableAttributeSet fontAttr = (MutableAttributeSet) to.getAttribute(HTML.Tag.FONT);
if (fontAttr == null) {
fontAttr = new SimpleAttributeSet();
to.addAttribute(HTML.Tag.FONT, fontAttr);
}
// edit the parameters to the font tag
String htmlValue = from.getAttribute(a).toString();
if (a == CSS.Attribute.FONT_FAMILY) {
fontAttr.addAttribute(HTML.Attribute.FACE, htmlValue);
}
else if (a == CSS.Attribute.FONT_SIZE) {
fontAttr.addAttribute(HTML.Attribute.SIZE, htmlValue);
}
else if (a == CSS.Attribute.COLOR) {
fontAttr.addAttribute(HTML.Attribute.COLOR, htmlValue);
}
}
示例3: createFontAttribute
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create/update an HTML <font> tag attribute. The value of the
* attribute should be a MutableAttributeSet so that the attributes can be
* updated as they are discovered.
*/
private static void createFontAttribute(CSS.Attribute a, AttributeSet from, MutableAttributeSet to) {
MutableAttributeSet fontAttr = (MutableAttributeSet) to.getAttribute(HTML.Tag.FONT);
if (fontAttr == null) {
fontAttr = new SimpleAttributeSet();
to.addAttribute(HTML.Tag.FONT, fontAttr);
}
// edit the parameters to the font tag
String htmlValue = from.getAttribute(a).toString();
if (a == CSS.Attribute.FONT_FAMILY) {
fontAttr.addAttribute(HTML.Attribute.FACE, htmlValue);
} else if (a == CSS.Attribute.FONT_SIZE) {
fontAttr.addAttribute(HTML.Attribute.SIZE, htmlValue);
} else if (a == CSS.Attribute.COLOR) {
fontAttr.addAttribute(HTML.Attribute.COLOR, htmlValue);
}
}
示例4: convertToHTML40
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Copies the given AttributeSet to a new set, converting any CSS attributes
* found to arguments of an HTML style attribute.
*/
private static void convertToHTML40(AttributeSet from, MutableAttributeSet to) {
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
value = value + " " + key + "=" + from.getAttribute(key) + ";";
} else {
to.addAttribute(key, from.getAttribute(key));
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}
示例5: createFontAttribute
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create/update an HTML <font> tag attribute. The
* value of the attribute should be a MutableAttributeSet so
* that the attributes can be updated as they are discovered.
*/
private static void createFontAttribute(CSS.Attribute a, AttributeSet from,
MutableAttributeSet to) {
MutableAttributeSet fontAttr = (MutableAttributeSet)
to.getAttribute(HTML.Tag.FONT);
if (fontAttr == null) {
fontAttr = new SimpleAttributeSet();
to.addAttribute(HTML.Tag.FONT, fontAttr);
}
// edit the parameters to the font tag
String htmlValue = from.getAttribute(a).toString();
if (a == CSS.Attribute.FONT_FAMILY) {
fontAttr.addAttribute(HTML.Attribute.FACE, htmlValue);
} else if (a == CSS.Attribute.FONT_SIZE) {
fontAttr.addAttribute(HTML.Attribute.SIZE, htmlValue);
} else if (a == CSS.Attribute.COLOR) {
fontAttr.addAttribute(HTML.Attribute.COLOR, htmlValue);
}
}
示例6: convertToHTML
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create an older style of HTML attributes. This will convert character
* level attributes that have a StyleConstants mapping over to an HTML
* tag/attribute. Other CSS attributes will be placed in an HTML style
* attribute.
*/
private static void convertToHTML(AttributeSet from, MutableAttributeSet to) {
if (from == null) {
return;
}
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
// default is to store in a HTML style attribute
if (value.length() > 0) {
value = value + "; ";
}
value = value + key + ": " + from.getAttribute(key);
} else {
to.addAttribute(key, from.getAttribute(key));
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}
示例7: writeStyle
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Outputs the named style. <code>outputStyle</code> indicates
* whether or not a style has been output yet. This will return
* true if a style is written.
*/
boolean writeStyle(String name, Style style, boolean outputStyle) throws IOException {
boolean didOutputStyle = false;
Enumeration attributes = style.getAttributeNames();
if (attributes != null) {
while (attributes.hasMoreElements()) {
Object attribute = attributes.nextElement();
if (attribute instanceof CSS.Attribute) {
String value = style.getAttribute(attribute).toString();
if (value != null) {
if (!outputStyle) {
writeStyleStartTag();
outputStyle = true;
}
if (!didOutputStyle) {
didOutputStyle = true;
indent();
write(name);
write(" {");
}
else {
write(";");
}
write(' ');
write(attribute.toString());
write(": ");
write(value);
}
}
}
}
if (didOutputStyle) {
write(" }");
writeLineSeparator();
}
return didOutputStyle;
}
示例8: writeStyle
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Outputs the named style. <code>outputStyle</code> indicates whether or
* not a style has been output yet. This will return true if a style is
* written.
*/
boolean writeStyle(String name, Style style, boolean outputStyle) throws IOException {
boolean didOutputStyle = false;
Enumeration attributes = style.getAttributeNames();
if (attributes != null) {
while (attributes.hasMoreElements()) {
Object attribute = attributes.nextElement();
if (attribute instanceof CSS.Attribute) {
String value = style.getAttribute(attribute).toString();
if (value != null) {
if (!outputStyle) {
writeStyleStartTag();
outputStyle = true;
}
if (!didOutputStyle) {
didOutputStyle = true;
indent();
write(name);
write(" {");
} else {
write(";");
}
write(' ');
write(attribute.toString());
write(": ");
write(value);
}
}
}
}
if (didOutputStyle) {
write(" }");
writeLineSeparator();
}
return didOutputStyle;
}
示例9: removeCharacterAttribute
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Removes a CSS character attribute that has the specified value
* from the {@link JEditorPane}'s current caret position
* or selection.
* <p>
* The val parameter is a {@link String} even though the actual attribute value is not.
* This is because the actual attribute values are not public. Thus, this method checks
* the value via the toString() method</p>
*
* @param editor
* @param atr
* @param val
*/
public static void removeCharacterAttribute(JEditorPane editor, CSS.Attribute atr, String val)
{
HTMLDocument doc;
MutableAttributeSet attr;
try
{
doc = (HTMLDocument)editor.getDocument();
attr = ((HTMLEditorKit)editor.getEditorKit()).getInputAttributes();
}
catch(ClassCastException cce)
{
return;
}
List tokens = tokenizeCharAttribs(doc, editor.getSelectionStart(), editor.getSelectionEnd());
for(Iterator it = tokens.iterator(); it.hasNext();)
{
CharStyleToken t = (CharStyleToken)it.next();
if(t.attrs.isDefined(atr) && t.attrs.getAttribute(atr).toString().equals(val))
{
SimpleAttributeSet sas = new SimpleAttributeSet();
sas.addAttributes(t.attrs);
sas.addAttribute(StyleConstants.NameAttribute, HTML.Tag.CONTENT);
sas.removeAttribute(atr);
doc.setCharacterAttributes(t.offs, t.len, sas, true);
}
}
int pos = editor.getCaretPosition();
attr.addAttributes(doc.getCharacterElement(pos).getAttributes());
attr.removeAttribute(atr);
}
示例10: convertToHTML32
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create an older style of HTML attributes. This will
* convert character level attributes that have a StyleConstants
* mapping over to an HTML tag/attribute. Other CSS attributes
* will be placed in an HTML style attribute.
*/
private static void convertToHTML32(AttributeSet from, MutableAttributeSet to) {
if (from == null) {
return;
}
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
if ((key == CSS.Attribute.FONT_FAMILY)
|| (key == CSS.Attribute.FONT_SIZE)
|| (key == CSS.Attribute.COLOR)) {
createFontAttribute((CSS.Attribute) key, from, to);
}
else if (key == CSS.Attribute.FONT_WEIGHT) {
// add a bold tag is weight is bold
//CSS.FontWeight weightValue = (CSS.FontWeight) from.getAttribute(CSS.Attribute.FONT_WEIGHT);
String weightValue = from.getAttribute(CSS.Attribute.FONT_WEIGHT).toString();
// if (weightValue != null) {
int fweight;
try {
fweight = new Integer(weightValue).intValue();
}
catch (Exception ex) {
fweight = -1;
}
if ((weightValue.toLowerCase().equals("bold")) || (fweight > 400))
to.addAttribute(HTML.Tag.B, SimpleAttributeSet.EMPTY);
//}
}
else if (key == CSS.Attribute.FONT_STYLE) {
String s = from.getAttribute(key).toString();
if (s.indexOf("italic") >= 0) {
to.addAttribute(HTML.Tag.I, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.TEXT_DECORATION) {
String decor = from.getAttribute(key).toString();
if (decor.indexOf("underline") >= 0) {
to.addAttribute(HTML.Tag.U, SimpleAttributeSet.EMPTY);
}
if (decor.indexOf("line-through") >= 0) {
to.addAttribute(HTML.Tag.STRIKE, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.VERTICAL_ALIGN) {
String vAlign = from.getAttribute(key).toString();
if (vAlign.indexOf("sup") >= 0) {
to.addAttribute(HTML.Tag.SUP, SimpleAttributeSet.EMPTY);
}
if (vAlign.indexOf("sub") >= 0) {
to.addAttribute(HTML.Tag.SUB, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.TEXT_ALIGN) {
to.addAttribute(HTML.Attribute.ALIGN, from.getAttribute(key).toString());
}
else {
// default is to store in a HTML style attribute
if (value.length() > 0) {
value = value + "; ";
}
value = value + key + ": " + from.getAttribute(key);
}
}
else {
to.addAttribute(key, from.getAttribute(key));
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}
示例11: convertToHTML32
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create an older style of HTML attributes. This will
* convert character level attributes that have a StyleConstants
* mapping over to an HTML tag/attribute. Other CSS attributes
* will be placed in an HTML style attribute.
*/
private static void convertToHTML32(AttributeSet from, MutableAttributeSet to) {
if (from == null) {
return;
}
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
if ((key == CSS.Attribute.FONT_FAMILY)
|| (key == CSS.Attribute.FONT_SIZE)
|| (key == CSS.Attribute.COLOR)) {
createFontAttribute((CSS.Attribute) key, from, to);
}
else if (key == CSS.Attribute.FONT_WEIGHT) {
// add a bold tag is weight is bold
//CSS.FontWeight weightValue = (CSS.FontWeight) from.getAttribute(CSS.Attribute.FONT_WEIGHT);
String weightValue = from.getAttribute(CSS.Attribute.FONT_WEIGHT).toString();
if (weightValue != null) {
int fweight;
try {
fweight = Integer.parseInt(weightValue);
}
catch (Exception ex) {
fweight = -1;
}
if ((weightValue.toLowerCase().equals("bold")) || (fweight > 400))
to.addAttribute(HTML.Tag.B, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.FONT_STYLE) {
String s = from.getAttribute(key).toString();
if (s.indexOf("italic") >= 0) {
to.addAttribute(HTML.Tag.I, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.TEXT_DECORATION) {
String decor = from.getAttribute(key).toString();
if (decor.indexOf("underline") >= 0) {
to.addAttribute(HTML.Tag.U, SimpleAttributeSet.EMPTY);
}
if (decor.indexOf("line-through") >= 0) {
to.addAttribute(HTML.Tag.STRIKE, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.VERTICAL_ALIGN) {
String vAlign = from.getAttribute(key).toString();
if (vAlign.indexOf("sup") >= 0) {
to.addAttribute(HTML.Tag.SUP, SimpleAttributeSet.EMPTY);
}
if (vAlign.indexOf("sub") >= 0) {
to.addAttribute(HTML.Tag.SUB, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.TEXT_ALIGN) {
to.addAttribute(HTML.Attribute.ALIGN, from.getAttribute(key).toString());
}
else {
// default is to store in a HTML style attribute
if (value.length() > 0) {
value = value + "; ";
}
value = value + key + ": " + from.getAttribute(key);
}
}
else {
to.addAttribute(key, from.getAttribute(key));
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}
示例12: convertToHTML32
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create an older style of HTML attributes. This will
* convert character level attributes that have a StyleConstants
* mapping over to an HTML tag/attribute. Other CSS attributes
* will be placed in an HTML style attribute.
*/
private static void convertToHTML32(AttributeSet from, MutableAttributeSet to) {
if (from == null) {
return;
}
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
if ((key == CSS.Attribute.FONT_FAMILY)
|| (key == CSS.Attribute.FONT_SIZE)
|| (key == CSS.Attribute.COLOR)) {
createFontAttribute((CSS.Attribute) key, from, to);
}
else if (key == CSS.Attribute.FONT_WEIGHT) {
// add a bold tag is weight is bold
//CSS.FontWeight weightValue = (CSS.FontWeight) from.getAttribute(CSS.Attribute.FONT_WEIGHT);
String weightValue = from.getAttribute(CSS.Attribute.FONT_WEIGHT).toString();
if (weightValue != null) {
int fweight;
try {
fweight = new Integer(weightValue).intValue();
}
catch (Exception ex) {
fweight = -1;
}
if ((weightValue.toLowerCase().equals("bold")) || (fweight > 400))
to.addAttribute(HTML.Tag.B, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.FONT_STYLE) {
String s = from.getAttribute(key).toString();
if (s.indexOf("italic") >= 0) {
to.addAttribute(HTML.Tag.I, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.TEXT_DECORATION) {
String decor = from.getAttribute(key).toString();
if (decor.indexOf("underline") >= 0) {
to.addAttribute(HTML.Tag.U, SimpleAttributeSet.EMPTY);
}
if (decor.indexOf("line-through") >= 0) {
to.addAttribute(HTML.Tag.STRIKE, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.VERTICAL_ALIGN) {
String vAlign = from.getAttribute(key).toString();
if (vAlign.indexOf("sup") >= 0) {
to.addAttribute(HTML.Tag.SUP, SimpleAttributeSet.EMPTY);
}
if (vAlign.indexOf("sub") >= 0) {
to.addAttribute(HTML.Tag.SUB, SimpleAttributeSet.EMPTY);
}
}
else if (key == CSS.Attribute.TEXT_ALIGN) {
to.addAttribute(HTML.Attribute.ALIGN, from.getAttribute(key).toString());
}
else {
// default is to store in a HTML style attribute
if (value.length() > 0) {
value = value + "; ";
}
value = value + key + ": " + from.getAttribute(key);
}
}
else {
to.addAttribute(key, from.getAttribute(key));
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}
示例13: convertToHTML32
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create an older style of HTML attributes. This will convert character
* level attributes that have a StyleConstants mapping over to an HTML
* tag/attribute. Other CSS attributes will be placed in an HTML style
* attribute.
*/
private static void convertToHTML32(AttributeSet from, MutableAttributeSet to) {
if (from == null) {
return;
}
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
if ((key == CSS.Attribute.FONT_FAMILY) || (key == CSS.Attribute.FONT_SIZE)
|| (key == CSS.Attribute.COLOR)) {
createFontAttribute((CSS.Attribute) key, from, to);
} else if (key == CSS.Attribute.FONT_WEIGHT) {
// add a bold tag is weight is bold
// CSS.FontWeight weightValue = (CSS.FontWeight)
// from.getAttribute(CSS.Attribute.FONT_WEIGHT);
String weightValue = from.getAttribute(CSS.Attribute.FONT_WEIGHT).toString();
if (weightValue != null) {
int fweight;
try {
fweight = new Integer(weightValue).intValue();
} catch (Exception ex) {
fweight = -1;
}
if ((weightValue.toLowerCase().equals("bold")) || (fweight > 400)) {
to.addAttribute(HTML.Tag.B, SimpleAttributeSet.EMPTY);
}
}
} else if (key == CSS.Attribute.FONT_STYLE) {
String s = from.getAttribute(key).toString();
if (s.indexOf("italic") >= 0) {
to.addAttribute(HTML.Tag.I, SimpleAttributeSet.EMPTY);
}
} else if (key == CSS.Attribute.TEXT_DECORATION) {
String decor = from.getAttribute(key).toString();
if (decor.indexOf("underline") >= 0) {
to.addAttribute(HTML.Tag.U, SimpleAttributeSet.EMPTY);
}
if (decor.indexOf("line-through") >= 0) {
to.addAttribute(HTML.Tag.STRIKE, SimpleAttributeSet.EMPTY);
}
} else if (key == CSS.Attribute.VERTICAL_ALIGN) {
String vAlign = from.getAttribute(key).toString();
if (vAlign.indexOf("sup") >= 0) {
to.addAttribute(HTML.Tag.SUP, SimpleAttributeSet.EMPTY);
}
if (vAlign.indexOf("sub") >= 0) {
to.addAttribute(HTML.Tag.SUB, SimpleAttributeSet.EMPTY);
}
} else if (key == CSS.Attribute.TEXT_ALIGN) {
to.addAttribute(HTML.Attribute.ALIGN, from.getAttribute(key).toString());
} else {
// default is to store in a HTML style attribute
if (value.length() > 0) {
value = value + "; ";
}
value = value + key + ": " + from.getAttribute(key);
}
} else {
to.addAttribute(key, from.getAttribute(key));
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}
示例14: convertToHTML32
import javax.swing.text.html.CSS; //导入方法依赖的package包/类
/**
* Create an older style of HTML attributes. This will
* convert character level attributes that have a StyleConstants
* mapping over to an HTML tag/attribute. Other CSS attributes
* will be placed in an HTML style attribute.
*/
private static void convertToHTML32(AttributeSet from, MutableAttributeSet to) {
if (from == null) {
return;
}
Enumeration keys = from.getAttributeNames();
String value = "";
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof CSS.Attribute) {
if ((key == CSS.Attribute.FONT_FAMILY) ||
(key == CSS.Attribute.FONT_SIZE) ||
(key == CSS.Attribute.COLOR)) {
createFontAttribute((CSS.Attribute)key, from, to);
} else if (key == CSS.Attribute.FONT_WEIGHT) {
// add a bold tag is weight is bold
if (StyleConstants.isBold(from)) {
addAttribute(to, HTML.Tag.B, SimpleAttributeSet.EMPTY);
}
} else if (key == CSS.Attribute.FONT_STYLE) {
String s = from.getAttribute(key).toString();
if (s.contains("italic")) {
addAttribute(to, HTML.Tag.I, SimpleAttributeSet.EMPTY);
}
} else if (key == CSS.Attribute.TEXT_DECORATION) {
String decor = from.getAttribute(key).toString();
if (decor.contains("underline")) {
addAttribute(to, HTML.Tag.U, SimpleAttributeSet.EMPTY);
}
if (decor.contains("line-through")) {
if (value.length() > 0) {value += "; ";}
value += key + ": " + from.getAttribute(key);
if(from.isDefined(STRIKE_COLOR_ATTRIBUTE)) {
if (value.length() > 0) {value += "; ";}
value += key+"-color" + ": " + from.getAttribute(STRIKE_COLOR_ATTRIBUTE);
}
MutableAttributeSet set = new SimpleAttributeSet();
set.addAttribute(HTML.Attribute.STYLE, value);
addAttribute(to, HTML.Tag.FONT, set);
}
} else if (key == CSS.Attribute.VERTICAL_ALIGN) {
String vAlign = from.getAttribute(key).toString();
if (vAlign.contains("sup")) {
addAttribute(to, HTML.Tag.SUP, SimpleAttributeSet.EMPTY);
}
if (vAlign.contains("sub")) {
addAttribute(to, HTML.Tag.SUB, SimpleAttributeSet.EMPTY);
}
} else if (key == CSS.Attribute.TEXT_ALIGN) {
addAttribute(to, HTML.Attribute.ALIGN,
from.getAttribute(key).toString());
} else {
// default is to store in a HTML style attribute
if (value.length() > 0) {
value += "; ";
}
value += key + ": " + from.getAttribute(key);
}
} else {
Object attr = from.getAttribute(key);
if (attr instanceof AttributeSet) {
attr = ((AttributeSet)attr).copyAttributes();
}
addAttribute(to, key, attr);
}
}
if (value.length() > 0) {
to.addAttribute(HTML.Attribute.STYLE, value);
}
}