本文整理汇总了Java中org.w3c.css.sac.LexicalUnit.getNextLexicalUnit方法的典型用法代码示例。如果您正苦于以下问题:Java LexicalUnit.getNextLexicalUnit方法的具体用法?Java LexicalUnit.getNextLexicalUnit怎么用?Java LexicalUnit.getNextLexicalUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.css.sac.LexicalUnit
的用法示例。
在下文中一共展示了LexicalUnit.getNextLexicalUnit方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: createCIELabColorValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
private Value createCIELabColorValue(LexicalUnit lu, Value v) {
lu = lu.getParameters();
float l = getColorValue(lu);
lu = lu.getNextLexicalUnit();
expectComma(lu);
lu = lu.getNextLexicalUnit();
float a = getColorValue(lu);
lu = lu.getNextLexicalUnit();
expectComma(lu);
lu = lu.getNextLexicalUnit();
float b = getColorValue(lu);
CIELabColor icc = new CIELabColor(l, a, b);
lu = lu.getNextLexicalUnit();
return icc;
}
示例3: createCIELCHColorValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
private Value createCIELCHColorValue(LexicalUnit lu, Value v) {
lu = lu.getParameters();
float l = getColorValue(lu);
lu = lu.getNextLexicalUnit();
expectComma(lu);
lu = lu.getNextLexicalUnit();
float c = getColorValue(lu);
lu = lu.getNextLexicalUnit();
expectComma(lu);
lu = lu.getNextLexicalUnit();
float h = getColorValue(lu);
CIELCHColor icc = new CIELCHColor(l, c, h);
lu = lu.getNextLexicalUnit();
return icc;
}
示例4: createDeviceColorValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
private Value createDeviceColorValue(LexicalUnit lu, Value v, int expectedComponents) {
lu = lu.getParameters();
boolean nChannel = (expectedComponents <= 0);
DeviceColor col = new DeviceColor(nChannel);
col.append(getColorValue(lu));
LexicalUnit lastUnit = lu;
lu = lu.getNextLexicalUnit();
while (lu != null) {
expectComma(lu);
lu = lu.getNextLexicalUnit();
col.append(getColorValue(lu));
lastUnit = lu;
lu = lu.getNextLexicalUnit();
}
if (!nChannel && expectedComponents != col.getNumberOfColors()) {
throw createInvalidLexicalUnitDOMException(lastUnit.getLexicalUnitType());
}
return col;
}
示例5: 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_FUNCTION:
if (!lu.getFunctionName().equalsIgnoreCase("rect")) {
break;
}
case LexicalUnit.SAC_RECT_FUNCTION:
lu = lu.getParameters();
Value top = createRectComponent(lu);
lu = lu.getNextLexicalUnit();
if (lu == null ||
lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
throw createMalformedRectDOMException();
}
lu = lu.getNextLexicalUnit();
Value right = createRectComponent(lu);
lu = lu.getNextLexicalUnit();
if (lu == null ||
lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
throw createMalformedRectDOMException();
}
lu = lu.getNextLexicalUnit();
Value bottom = createRectComponent(lu);
lu = lu.getNextLexicalUnit();
if (lu == null ||
lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
throw createMalformedRectDOMException();
}
lu = lu.getNextLexicalUnit();
Value left = createRectComponent(lu);
return new RectValue(top, right, bottom, left);
}
throw createMalformedRectDOMException();
}
示例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_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;
}
}
示例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 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;
}
}
示例8: createValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* 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;
}
示例9: 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;
}
示例10: setValues
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* Implements {@link ShorthandManager#setValues(CSSEngine,ShorthandManager.PropertyHandler,LexicalUnit,boolean)}.
*/
public void setValues(CSSEngine eng,
ShorthandManager.PropertyHandler ph,
LexicalUnit lu,
boolean imp)
throws DOMException {
if (lu.getLexicalUnitType() == LexicalUnit.SAC_INHERIT)
return;
LexicalUnit []lus = new LexicalUnit[4];
int cnt=0;
while (lu != null) {
if (cnt == 4)
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
lus[cnt++] = lu;
lu = lu.getNextLexicalUnit();
}
switch (cnt) {
case 1: lus[3] = lus[2] = lus[1] = lus[0]; break;
case 2: lus[2] = lus[0]; lus[3] = lus[1]; break;
case 3: lus[3] = lus[1]; break;
default:
}
ph.property(SVG12CSSConstants.CSS_MARGIN_TOP_PROPERTY, lus[0], imp);
ph.property(SVG12CSSConstants.CSS_MARGIN_RIGHT_PROPERTY, lus[1], imp);
ph.property(SVG12CSSConstants.CSS_MARGIN_BOTTOM_PROPERTY, lus[2], imp);
ph.property(SVG12CSSConstants.CSS_MARGIN_LEFT_PROPERTY, lus[3], imp);
}
示例11: 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_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());
}
示例12: 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;
}
示例13: 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();
}
}
示例14: createValue
import org.w3c.css.sac.LexicalUnit; //导入方法依赖的package包/类
/**
* 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;
}