当前位置: 首页>>代码示例>>Java>>正文


Java LexicalUnit类代码示例

本文整理汇总了Java中org.w3c.css.sac.LexicalUnit的典型用法代码示例。如果您正苦于以下问题:Java LexicalUnit类的具体用法?Java LexicalUnit怎么用?Java LexicalUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LexicalUnit类属于org.w3c.css.sac包,在下文中一共展示了LexicalUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: property

import org.w3c.css.sac.LexicalUnit; //导入依赖的package包/类
@Override
public void property(String name, LexicalUnit value, boolean arg2) throws CSSException {
	if (currentStyle != null) {
		if ("color".equals(name)) {
			currentStyle.setColor(createRGB(value));
		} else if ("background-color".equals(name)) {
			currentStyle.setBackgroundColor(createRGB(value));
		} else if ("font-weight".equals(name)) {
			currentStyle.setBold(value.getStringValue().toUpperCase().contains("BOLD"));
		} else if ("font-style".equals(name)) {
			currentStyle.setItalic(value.getStringValue().toUpperCase().contains("ITALIC"));
		}
		if ("text-decoration".equals(name)) {
			String decoration = value.getStringValue().toUpperCase();
			if (decoration.contains("UNDERLINE")) {
				currentStyle.setUnderline(true);
			}
			if (decoration.contains("LINE-THROUGH")) {
				currentStyle.setStrikeThrough(true);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:24,代码来源:CSSDocumentHandler.java

示例2: dimension

import org.w3c.css.sac.LexicalUnit; //导入依赖的package包/类
/**
 * Converts the current lexical unit to a dimension.
 */
protected LexicalUnit dimension(boolean positive, LexicalUnit prev) {
    try {
        float sgn = (positive) ? 1 : -1;
        String val = scanner.getStringValue();
        int i;
        loop: for (i = 0; i < val.length(); i++) {
            switch (val.charAt(i)) {
            default:
                break loop;
            case '0': case '1': case '2': case '3': case '4':
            case '5': case '6': case '7': case '8': case '9':
            case '.':
            }
        }
        nextIgnoreSpaces();
        return CSSLexicalUnit.createDimension
            (sgn * Float.parseFloat(val.substring(0, i)),
             val.substring(i),
             prev);
    } catch (NumberFormatException e) {
        throw createCSSParseException("number.format");
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:27,代码来源:Parser.java

示例3: getDimensionUnitText

import org.w3c.css.sac.LexicalUnit; //导入依赖的package包/类
/**
 * <b>SAC</b>: Implements {@link LexicalUnit#getDimensionUnitText()}.
 */
public String getDimensionUnitText() {
    switch (lexicalUnitType) {
    case LexicalUnit.SAC_CENTIMETER:  return UNIT_TEXT_CENTIMETER;
    case LexicalUnit.SAC_DEGREE:      return UNIT_TEXT_DEGREE;
    case LexicalUnit.SAC_EM:          return UNIT_TEXT_EM;
    case LexicalUnit.SAC_EX:          return UNIT_TEXT_EX;
    case LexicalUnit.SAC_GRADIAN:     return UNIT_TEXT_GRADIAN;
    case LexicalUnit.SAC_HERTZ:       return UNIT_TEXT_HERTZ;
    case LexicalUnit.SAC_INCH:        return UNIT_TEXT_INCH;
    case LexicalUnit.SAC_KILOHERTZ:   return UNIT_TEXT_KILOHERTZ;
    case LexicalUnit.SAC_MILLIMETER:  return UNIT_TEXT_MILLIMETER;
    case LexicalUnit.SAC_MILLISECOND: return UNIT_TEXT_MILLISECOND;
    case LexicalUnit.SAC_PERCENTAGE:  return UNIT_TEXT_PERCENTAGE;
    case LexicalUnit.SAC_PICA:        return UNIT_TEXT_PICA;
    case LexicalUnit.SAC_PIXEL:       return UNIT_TEXT_PIXEL;
    case LexicalUnit.SAC_POINT:       return UNIT_TEXT_POINT;
    case LexicalUnit.SAC_RADIAN:      return UNIT_TEXT_RADIAN;
    case LexicalUnit.SAC_REAL:        return UNIT_TEXT_REAL;
    case LexicalUnit.SAC_SECOND:      return UNIT_TEXT_SECOND;
    default:
        throw new IllegalStateException("No Unit Text for type: " + 
                                        lexicalUnitType);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:28,代码来源:CSSLexicalUnit.java

示例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_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());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:24,代码来源:FilterManager.java

示例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_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());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:23,代码来源:MaskManager.java

示例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;

    case  LexicalUnit.SAC_INTEGER:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getIntegerValue());

    case  LexicalUnit.SAC_REAL:
        return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
                              lu.getFloatValue());

    default:
        throw createInvalidLexicalUnitDOMException
            (lu.getLexicalUnitType());
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:23,代码来源:StrokeMiterlimitManager.java

示例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_NORMAL_VALUE)) {
            return SVGValueConstants.NORMAL_VALUE;
        }
        throw createInvalidIdentifierDOMException(lu.getStringValue());
    }
    return super.createValue(lu, engine);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:19,代码来源:SpacingManager.java

示例8: parseColor12Function

import org.w3c.css.sac.LexicalUnit; //导入依赖的package包/类
private Value parseColor12Function(LexicalUnit lu, Value v) {
    String functionName = lu.getFunctionName();
    if (functionName.equalsIgnoreCase(ICCNamedColor.ICC_NAMED_COLOR_FUNCTION)) {
        return createICCNamedColorValue(lu, v);
    } else if (functionName.equalsIgnoreCase(CIELabColor.CIE_LAB_COLOR_FUNCTION)) {
        return createCIELabColorValue(lu, v);
    } else if (functionName.equalsIgnoreCase(CIELCHColor.CIE_LCH_COLOR_FUNCTION)) {
        return createCIELCHColorValue(lu, v);
    } else if (functionName.equalsIgnoreCase(DeviceColor.DEVICE_CMYK_COLOR_FUNCTION)) {
        return createDeviceColorValue(lu, v, 4);
    } else if (functionName.equalsIgnoreCase(DeviceColor.DEVICE_RGB_COLOR_FUNCTION)) {
        return createDeviceColorValue(lu, v, 3);
    } else if (functionName.equalsIgnoreCase(DeviceColor.DEVICE_GRAY_COLOR_FUNCTION)) {
        return createDeviceColorValue(lu, v, 1);
    } else if (functionName.equalsIgnoreCase(DeviceColor.DEVICE_NCHANNEL_COLOR_FUNCTION)) {
        return createDeviceColorValue(lu, v, 0);
    }
    return null;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:SVGColorManager.java

示例9: 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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:17,代码来源:SVGColorManager.java

示例10: 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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:18,代码来源:SVGColorManager.java

示例11: 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;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:22,代码来源:SVGColorManager.java

示例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_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());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:27,代码来源:ColorProfileManager.java

示例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 SVGValueConstants.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());
    }
    throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:OpacityManager.java

示例14: 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:
        Object v = values.get(lu.getStringValue().toLowerCase().intern());
        if (v == null) {
            throw createInvalidIdentifierDOMException(lu.getStringValue());
        }
        return (Value)v;
    }
    return super.createValue(lu, engine);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:19,代码来源:BaselineShiftManager.java

示例15: 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:
        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());
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:23,代码来源:IdentifierManager.java


注:本文中的org.w3c.css.sac.LexicalUnit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。