本文整理汇总了Java中org.w3c.css.sac.LexicalUnit.SAC_UNICODERANGE属性的典型用法代码示例。如果您正苦于以下问题:Java LexicalUnit.SAC_UNICODERANGE属性的具体用法?Java LexicalUnit.SAC_UNICODERANGE怎么用?Java LexicalUnit.SAC_UNICODERANGE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.css.sac.LexicalUnit
的用法示例。
在下文中一共展示了LexicalUnit.SAC_UNICODERANGE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildString
@Override
public String buildString(BuildStringStrategy strategy) {
short type = getLexicalUnitType();
String text = simpleAsString();
if (text == null) {
switch (type) {
case LexicalUnit.SAC_URI:
text = "url(" + getStringValue() + ")";
break;
case LexicalUnit.SAC_RGBCOLOR:
int[] rgb = getRgb();
if (rgb != null) {
text = ColorUtil.rgbToColorString(rgb);
break;
}
// else fall through to the function branch
case LexicalUnit.SAC_COUNTER_FUNCTION:
case LexicalUnit.SAC_COUNTERS_FUNCTION:
case LexicalUnit.SAC_RECT_FUNCTION:
case LexicalUnit.SAC_FUNCTION:
if (ColorUtil.isColor(this)) {
text = ColorUtil.rgbToColorString(ColorUtil
.colorToRgb(this));
break;
} else if (ColorUtil.isRgba(this) || ColorUtil.isHsla(this)) {
float alpha = params.get(params.size() - 1)
.getContainedValue().getFloatValue();
rgb = ColorUtil.colorToRgb(this);
if (alpha == 0.0f && rgb[0] == 0 && rgb[1] == 0
&& rgb[2] == 0) {
text = "transparent";
break;
} else if (alpha == 1.0f) {
text = ColorUtil.rgbToColorString(ColorUtil
.colorToRgb(this));
break;
} else if (params.size() == 2 || ColorUtil.isHsla(this)) {
String alphaText = alpha == 0.0f ? "0"
: CSS_FLOAT_FORMAT.format(alpha);
text = "rgba(" + rgb[0] + ", " + rgb[1] + ", " + rgb[2]
+ ", " + alphaText + ")";
break;
}
}
text = fname + "(" + params.buildString(strategy) + ")";
break;
case LexicalUnit.SAC_IDENT:
text = getStringValue();
break;
case LexicalUnit.SAC_STRING_VALUE:
// @@SEEME. not exact
text = "\"" + getStringValue() + "\"";
break;
case LexicalUnit.SAC_ATTR:
text = "attr(" + getStringValue() + ")";
break;
case LexicalUnit.SAC_UNICODERANGE:
text = "@@TODO";
break;
case LexicalUnit.SAC_SUB_EXPRESSION:
text = strategy.build(getParameterList());
break;
default:
text = "@unknown";
break;
}
}
return text;
}