本文整理汇总了Java中org.w3c.css.sac.LexicalUnit.SAC_IDENT属性的典型用法代码示例。如果您正苦于以下问题:Java LexicalUnit.SAC_IDENT属性的具体用法?Java LexicalUnit.SAC_IDENT怎么用?Java LexicalUnit.SAC_IDENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.w3c.css.sac.LexicalUnit
的用法示例。
在下文中一共展示了LexicalUnit.SAC_IDENT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ValueConstants.INHERIT_VALUE;
case LexicalUnit.SAC_INTEGER:
return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
lu.getIntegerValue());
case LexicalUnit.SAC_REAL:
return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
lu.getFloatValue());
case LexicalUnit.SAC_IDENT:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NONE_VALUE)) {
return ValueConstants.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:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NORMAL_VALUE)) {
return SVGValueConstants.NORMAL_VALUE;
}
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
return super.createValue(lu, engine);
}
示例4: 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());
}
示例5: 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:
Object v = values.get(lu.getStringValue().toLowerCase().intern());
if (v == null) {
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
return (Value)v;
}
return super.createValue(lu, engine);
}
示例6: 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:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_AUTO_VALUE)) {
return SVGValueConstants.AUTO_VALUE;
}
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
return super.createValue(lu, engine);
}
示例7: 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_IDENT:
String s = lu.getStringValue().toLowerCase().intern();
Object v = getIdentifiers().get(s);
if (v == null) {
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
return (Value)v;
default:
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
}
示例8: 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");
}
示例9: 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());
}
示例10: 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;
default:
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
case LexicalUnit.SAC_IDENT:
String id = lu.getStringValue().toLowerCase().intern();
if (id == CSSConstants.CSS_ACCUMULATE_VALUE) {
return SVGValueConstants.ACCUMULATE_VALUE;
}
if (id != CSSConstants.CSS_NEW_VALUE) {
throw createInvalidIdentifierDOMException(id);
}
ListValue result = new ListValue(' ');
result.append(SVGValueConstants.NEW_VALUE);
lu = lu.getNextLexicalUnit();
if (lu == null) {
return result;
}
result.append(super.createValue(lu, engine));
for (int i = 1; i < 4; i++) {
lu = lu.getNextLexicalUnit();
if (lu == null){
throw createMalformedLexicalUnitDOMException();
}
result.append(super.createValue(lu, engine));
}
return result;
}
}
示例11: isIdentOrNumber
private boolean isIdentOrNumber(LexicalUnit lu) {
short type = lu.getLexicalUnitType();
switch (type) {
case LexicalUnit.SAC_IDENT:
case LexicalUnit.SAC_INTEGER:
return true;
default:
return false;
}
}
示例12: 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:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NONE_VALUE)) {
return SVGValueConstants.NONE_VALUE;
}
throw createInvalidIdentifierDOMException(lu.getStringValue());
default:
ListValue lv = new ListValue(' ');
do {
Value v = super.createValue(lu, engine);
lv.append(v);
lu = lu.getNextLexicalUnit();
if (lu != null &&
lu.getLexicalUnitType() ==
LexicalUnit.SAC_OPERATOR_COMMA) {
lu = lu.getNextLexicalUnit();
}
} while (lu != null);
return lv;
}
}
示例13: createValue
/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_CURRENTCOLOR_VALUE)) {
return SVGValueConstants.CURRENTCOLOR_VALUE;
}
}
Value v = super.createValue(lu, engine);
lu = lu.getNextLexicalUnit();
if (lu == null) {
return v;
}
//If we have more content here, there is a color function after the sRGB color.
if (lu.getLexicalUnitType() != LexicalUnit.SAC_FUNCTION) {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
ListValue result = new ListValue(' ');
result.append(v);
Value colorValue = parseColorFunction(lu, v);
if (colorValue != null) {
result.append(colorValue);
} else {
return v; //use sRGB fallback if an unsupported color function is encountered
}
return result;
}
示例14: createValue
/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_AUTO_VALUE)) {
return SVGValueConstants.AUTO_VALUE;
}
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
return super.createValue(lu, engine);
}
示例15: 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_IDENT:
if (lu.getStringValue().equalsIgnoreCase
(CSSConstants.CSS_NONE_VALUE)) {
return ValueConstants.NONE_VALUE;
}
ListValue lv = new ListValue(' ');
do {
if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
String s = lu.getStringValue().toLowerCase().intern();
Object obj = values.get(s);
if (obj == null) {
throw createInvalidIdentifierDOMException
(lu.getStringValue());
}
lv.append((Value)obj);
lu = lu.getNextLexicalUnit();
} else {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
} while (lu != null);
return lv;
}
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}