本文整理汇总了Java中org.w3c.css.sac.LexicalUnit.SAC_URI属性的典型用法代码示例。如果您正苦于以下问题:Java LexicalUnit.SAC_URI属性的具体用法?Java LexicalUnit.SAC_URI怎么用?Java LexicalUnit.SAC_URI使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.css.sac.LexicalUnit
的用法示例。
在下文中一共展示了LexicalUnit.SAC_URI属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createValue
/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_INHERIT:
return SVGValueConstants.INHERIT_VALUE;
case LexicalUnit.SAC_URI:
return new URIValue(lu.getStringValue(),
resolveURI(engine.getCSSBaseURI(),
lu.getStringValue()));
case LexicalUnit.SAC_IDENT:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NONE_VALUE)) {
return SVGValueConstants.NONE_VALUE;
}
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
示例2: createValue
/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_INHERIT:
return ValueConstants.INHERIT_VALUE;
case LexicalUnit.SAC_URI:
return new URIValue(lu.getStringValue(),
resolveURI(engine.getCSSBaseURI(),
lu.getStringValue()));
case LexicalUnit.SAC_IDENT:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NONE_VALUE)) {
return ValueConstants.NONE_VALUE;
}
}
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
示例3: createValue
/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_INHERIT:
return SVGValueConstants.INHERIT_VALUE;
case LexicalUnit.SAC_IDENT:
String s = lu.getStringValue().toLowerCase();
if (s.equals(CSSConstants.CSS_AUTO_VALUE)) {
return SVGValueConstants.AUTO_VALUE;
}
if (s.equals(CSSConstants.CSS_SRGB_VALUE)) {
return SVGValueConstants.SRGB_VALUE;
}
return new StringValue(CSSPrimitiveValue.CSS_IDENT, s);
case LexicalUnit.SAC_URI:
return new URIValue(lu.getStringValue(),
resolveURI(engine.getCSSBaseURI(),
lu.getStringValue()));
}
throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
示例4: getStringValue
public String getStringValue() throws DOMException {
short lexicalUnit = value.getLexicalUnitType();
if ((lexicalUnit == LexicalUnit.SAC_IDENT) || (lexicalUnit == LexicalUnit.SAC_STRING_VALUE)
|| (lexicalUnit == LexicalUnit.SAC_URI))
return value.getStringValue();
// TODO There are more cases to catch of getLexicalUnitType()
throw new UnsupportedOperationException("NOT YET IMPLEMENTED");
}
示例5: getPrimitiveType
public short getPrimitiveType() {
switch (value.getLexicalUnitType()) {
case LexicalUnit.SAC_IDENT:
return CSS_IDENT;
case LexicalUnit.SAC_INTEGER:
case LexicalUnit.SAC_REAL:
return CSS_NUMBER;
case LexicalUnit.SAC_URI:
return CSS_URI;
case LexicalUnit.SAC_PERCENTAGE:
return CSS_PERCENTAGE;
case LexicalUnit.SAC_PIXEL:
return CSS_PX;
case LexicalUnit.SAC_CENTIMETER:
return CSS_CM;
case LexicalUnit.SAC_EM:
return CSS_EMS;
case LexicalUnit.SAC_EX:
return CSS_EXS;
case LexicalUnit.SAC_INCH:
return CSS_IN;
case LexicalUnit.SAC_STRING_VALUE:
return CSS_STRING;
case LexicalUnit.SAC_DIMENSION:
return CSS_DIMENSION;
case LexicalUnit.SAC_OPERATOR_COMMA:
return CSS_CUSTOM; // TODO don't think this is right, see bug
// #278139
case LexicalUnit.SAC_INHERIT:
return CSS_INHERIT;
}
// TODO Auto-generated method stub
throw new UnsupportedOperationException(
"NOT YET IMPLEMENTED - LexicalUnit type: " + value.getLexicalUnitType());
}
示例6: getCssText
public String getCssText() {
// TODO: All LexicalUnit.SAC_OPERATOR_* except for COMMA left undone for
// now as it's not even clear whether they should be treated as measures
// see bug #278139
switch (value.getLexicalUnitType()) {
case LexicalUnit.SAC_INTEGER:
return String.valueOf(value.getIntegerValue());
case LexicalUnit.SAC_REAL:
return String.valueOf(value.getFloatValue());
case LexicalUnit.SAC_PERCENTAGE:
case LexicalUnit.SAC_PIXEL:
case LexicalUnit.SAC_CENTIMETER:
case LexicalUnit.SAC_EM:
case LexicalUnit.SAC_EX:
case LexicalUnit.SAC_PICA:
case LexicalUnit.SAC_POINT:
case LexicalUnit.SAC_INCH:
case LexicalUnit.SAC_DEGREE:
return String.valueOf(value.getFloatValue()) + value.getDimensionUnitText();
case LexicalUnit.SAC_URI:
return "url(" + value.getStringValue() + ")";
case LexicalUnit.SAC_OPERATOR_COMMA:
return ",";
case LexicalUnit.SAC_INHERIT:
return "inherit";
}
return value.getStringValue();
}
示例7: createValue
/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_IDENT:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NONE_VALUE)) {
return SVGValueConstants.NONE_VALUE;
}
// Fall through
default:
return super.createValue(lu, engine);
case LexicalUnit.SAC_URI:
}
String value = lu.getStringValue();
String uri = resolveURI(engine.getCSSBaseURI(), value);
lu = lu.getNextLexicalUnit();
if (lu == null) {
return new URIValue(value, uri);
}
ListValue result = new ListValue(' ');
result.append(new URIValue(value, uri));
if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NONE_VALUE)) {
result.append(SVGValueConstants.NONE_VALUE);
return result;
}
}
Value v = super.createValue(lu, engine);
if (v.getCssValueType() == CSSValue.CSS_CUSTOM) {
ListValue lv = (ListValue)v;
for (int i = 0; i < lv.getLength(); i++) {
result.append(lv.item(i));
}
} else {
result.append(v);
}
return result;
}
示例8: createValue
/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
ListValue result = new ListValue();
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_INHERIT:
return ValueConstants.INHERIT_VALUE;
case LexicalUnit.SAC_URI:
do {
result.append(new URIValue(lu.getStringValue(),
resolveURI(engine.getCSSBaseURI(),
lu.getStringValue())));
lu = lu.getNextLexicalUnit();
if (lu == null) {
throw createMalformedLexicalUnitDOMException();
}
if (lu.getLexicalUnitType() !=
LexicalUnit.SAC_OPERATOR_COMMA) {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
lu = lu.getNextLexicalUnit();
if (lu == null) {
throw createMalformedLexicalUnitDOMException();
}
} while (lu.getLexicalUnitType() == LexicalUnit.SAC_URI);
if (lu.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
// Fall through...
case LexicalUnit.SAC_IDENT:
String s = lu.getStringValue().toLowerCase().intern();
Object v = values.get(s);
if (v == null) {
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
result.append((Value)v);
lu = lu.getNextLexicalUnit();
}
if (lu != null) {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
return result;
}
示例9: 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;
}