本文整理汇总了Java中org.w3c.css.sac.LexicalUnit.getStringValue方法的典型用法代码示例。如果您正苦于以下问题:Java LexicalUnit.getStringValue方法的具体用法?Java LexicalUnit.getStringValue怎么用?Java LexicalUnit.getStringValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.css.sac.LexicalUnit
的用法示例。
在下文中一共展示了LexicalUnit.getStringValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* 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
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* 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: createICCNamedColorValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
private Value createICCNamedColorValue(LexicalUnit lu, Value v) {
lu = lu.getParameters();
expectIdent(lu);
String profileName = lu.getStringValue();
lu = lu.getNextLexicalUnit();
expectComma(lu);
lu = lu.getNextLexicalUnit();
expectIdent(lu);
String colorName = lu.getStringValue();
ICCNamedColor icc = new ICCNamedColor(profileName, colorName);
lu = lu.getNextLexicalUnit();
return icc;
}
示例4: createValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* 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());
}
示例5: createICCColorValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
private Value createICCColorValue(LexicalUnit lu, Value v) {
lu = lu.getParameters();
expectIdent(lu);
ICCColor icc = new ICCColor(lu.getStringValue());
lu = lu.getNextLexicalUnit();
while (lu != null) {
expectComma(lu);
lu = lu.getNextLexicalUnit();
icc.append(getColorValue(lu));
lu = lu.getNextLexicalUnit();
}
return icc;
}
示例6: createValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* 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;
}
示例7: createValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* 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;
default:
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
case LexicalUnit.SAC_IDENT:
case LexicalUnit.SAC_STRING_VALUE:
}
ListValue result = new ListValue();
for (;;) {
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_STRING_VALUE:
result.append(new StringValue(CSSPrimitiveValue.CSS_STRING,
lu.getStringValue()));
lu = lu.getNextLexicalUnit();
break;
case LexicalUnit.SAC_IDENT:
StringBuffer sb = new StringBuffer(lu.getStringValue());
lu = lu.getNextLexicalUnit();
if (lu != null && isIdentOrNumber(lu)) {
do {
sb.append(' ');
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_IDENT:
sb.append(lu.getStringValue());
break;
case LexicalUnit.SAC_INTEGER:
//Some font names contain integer values but are not quoted!
//Example: "Univers 45 Light"
sb.append(Integer.toString(lu.getIntegerValue()));
}
lu = lu.getNextLexicalUnit();
} while (lu != null && isIdentOrNumber(lu));
result.append(new StringValue(CSSPrimitiveValue.CSS_STRING,
sb.toString()));
} else {
String id = sb.toString();
String s = id.toLowerCase().intern();
Value v = (Value)values.get(s);
result.append((v != null)
? v
: new StringValue
(CSSPrimitiveValue.CSS_STRING, id));
}
}
if (lu == null)
return result;
if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA)
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
lu = lu.getNextLexicalUnit();
if (lu == null)
throw createMalformedLexicalUnitDOMException();
}
}