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


Java LexicalUnit.SAC_INTEGER属性代码示例

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


在下文中一共展示了LexicalUnit.SAC_INTEGER属性的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 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,代码行数:22,代码来源:StrokeMiterlimitManager.java

示例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 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,代码行数:19,代码来源:OpacityManager.java

示例3: createColorComponent

/**
 * Creates a color component from a lexical unit.
 */
protected Value createColorComponent(LexicalUnit lu) throws DOMException {
    switch (lu.getLexicalUnitType()) {
    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_PERCENTAGE:
        return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE,
                              lu.getFloatValue());
    }
    throw createInvalidRGBComponentUnitDOMException
        (lu.getLexicalUnitType());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:20,代码来源:AbstractColorManager.java

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

示例5: getFloatValue

/**
 * Return a float representation of the receiver's value.
 * 
 * @param valueType
 *            a short representing the value type, see
 *            {@link CSSValue#getCssValueType()}
 */
public float getFloatValue(short valueType) throws DOMException {
	// If it's actually a SAC_INTEGER return the integer value, callers tend
	// to expect and cast
	// There is no getIntegerFloat(short)
	// TODO Not sure the purpose of arg valyeType, its not referenced in
	// this method
	if (value.getLexicalUnitType() == LexicalUnit.SAC_INTEGER)
		return value.getIntegerValue();
	// TODO not sure what to do if it's not one of the lexical unit types
	// that are specified in LexicalUnit#getFloatValue()
	// ie. SAC_DEGREE, SAC_GRADIAN, SAC_RADIAN, SAC_MILLISECOND, SAC_SECOND,
	// SAC_HERTZ or SAC_KILOHERTZ
	return value.getFloatValue();
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:21,代码来源:Measure.java

示例6: 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());
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:35,代码来源:Measure.java

示例7: 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();
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:28,代码来源:Measure.java

示例8: getColorValue

/**
 * Creates a float value usable as a component of an RGBColor.
 */
protected float getColorValue(LexicalUnit lu) {
    expectNonNull(lu);
    switch (lu.getLexicalUnitType()) {
    case LexicalUnit.SAC_INTEGER:
        return lu.getIntegerValue();
    case LexicalUnit.SAC_REAL:
        return lu.getFloatValue();
    }
    throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:13,代码来源:SVGColorManager.java

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

示例10: createValue

/**
 * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
 */
public Value createValue(LexicalUnit lu, CSSEngine engine)
    throws DOMException {
    if (lu.getLexicalUnitType() == LexicalUnit.SAC_INTEGER) {
        int i = lu.getIntegerValue();
        switch (i) {
        case 100:
            return ValueConstants.NUMBER_100;
        case 200:
            return ValueConstants.NUMBER_200;
        case 300:
            return ValueConstants.NUMBER_300;
        case 400:
            return ValueConstants.NUMBER_400;
        case 500:
            return ValueConstants.NUMBER_500;
        case 600:
            return ValueConstants.NUMBER_600;
        case 700:
            return ValueConstants.NUMBER_700;
        case 800:
            return ValueConstants.NUMBER_800;
        case 900:
            return ValueConstants.NUMBER_900;
        }
        throw createInvalidFloatValueDOMException(i);
    }
    return super.createValue(lu, engine);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:31,代码来源:FontWeightManager.java

示例11: isNumber

public boolean isNumber() {
    short type = getLexicalUnitType();
    switch (type) {
    case LexicalUnit.SAC_INTEGER:
    case LexicalUnit.SAC_REAL:
    case LexicalUnit.SAC_EM:
    case SCSSLexicalUnit.SAC_LEM:
    case SCSSLexicalUnit.SAC_REM:
    case LexicalUnit.SAC_EX:
    case LexicalUnit.SAC_PIXEL:
    case LexicalUnit.SAC_INCH:
    case LexicalUnit.SAC_CENTIMETER:
    case LexicalUnit.SAC_MILLIMETER:
    case LexicalUnit.SAC_POINT:
    case LexicalUnit.SAC_PICA:
    case LexicalUnit.SAC_PERCENTAGE:
    case LexicalUnit.SAC_DEGREE:
    case LexicalUnit.SAC_GRADIAN:
    case LexicalUnit.SAC_RADIAN:
    case LexicalUnit.SAC_MILLISECOND:
    case LexicalUnit.SAC_SECOND:
    case LexicalUnit.SAC_HERTZ:
    case LexicalUnit.SAC_KILOHERTZ:
    case LexicalUnit.SAC_DIMENSION:
        return true;
    default:
        return false;
    }
}
 
开发者ID:fjalvingh,项目名称:domui,代码行数:29,代码来源:LexicalUnitImpl.java

示例12: IntegerLexicalUnit

/**
 * Creates a new LexicalUnit.
 */
public IntegerLexicalUnit(int val, LexicalUnit prev) {
    super(LexicalUnit.SAC_INTEGER, prev);
    value = val;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:7,代码来源:CSSLexicalUnit.java

示例13: createRectComponent

private Value createRectComponent(LexicalUnit lu) throws DOMException {
    switch (lu.getLexicalUnitType()) {
    case LexicalUnit.SAC_IDENT:
        if (lu.getStringValue().equalsIgnoreCase
            (CSSConstants.CSS_AUTO_VALUE)) {
            return ValueConstants.AUTO_VALUE;
        }
        break;
    case LexicalUnit.SAC_EM:
        return new FloatValue(CSSPrimitiveValue.CSS_EMS,
                              lu.getFloatValue());
    case LexicalUnit.SAC_EX:
        return new FloatValue(CSSPrimitiveValue.CSS_EXS,
                              lu.getFloatValue());
    case LexicalUnit.SAC_PIXEL:
        return new FloatValue(CSSPrimitiveValue.CSS_PX,
                              lu.getFloatValue());
    case LexicalUnit.SAC_CENTIMETER:
        return new FloatValue(CSSPrimitiveValue.CSS_CM,
                              lu.getFloatValue());
    case LexicalUnit.SAC_MILLIMETER:
        return new FloatValue(CSSPrimitiveValue.CSS_MM,
                              lu.getFloatValue());
    case LexicalUnit.SAC_INCH:
        return new FloatValue(CSSPrimitiveValue.CSS_IN,
                              lu.getFloatValue());
    case LexicalUnit.SAC_POINT:
        return new FloatValue(CSSPrimitiveValue.CSS_PT,
                              lu.getFloatValue());
    case LexicalUnit.SAC_PICA:
        return new FloatValue(CSSPrimitiveValue.CSS_PC,
                              lu.getFloatValue());
    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_PERCENTAGE:
        return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE,
                              lu.getFloatValue());
    }
    throw createMalformedRectDOMException();
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:44,代码来源:RectManager.java

示例14: createValue

/**
 * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
 */
public Value createValue(LexicalUnit lu, CSSEngine engine)
    throws DOMException {
    switch (lu.getLexicalUnitType()) {
    case LexicalUnit.SAC_EM:
        return new FloatValue(CSSPrimitiveValue.CSS_EMS,
                              lu.getFloatValue());

    case LexicalUnit.SAC_EX:
        return new FloatValue(CSSPrimitiveValue.CSS_EXS,
                              lu.getFloatValue());

    case LexicalUnit.SAC_PIXEL:
        return new FloatValue(CSSPrimitiveValue.CSS_PX,
                              lu.getFloatValue());

    case LexicalUnit.SAC_CENTIMETER:
        return new FloatValue(CSSPrimitiveValue.CSS_CM,
                              lu.getFloatValue());

    case LexicalUnit.SAC_MILLIMETER:
        return new FloatValue(CSSPrimitiveValue.CSS_MM,
                              lu.getFloatValue());

    case LexicalUnit.SAC_INCH:
        return new FloatValue(CSSPrimitiveValue.CSS_IN,
                              lu.getFloatValue());

    case LexicalUnit.SAC_POINT:
        return new FloatValue(CSSPrimitiveValue.CSS_PT,
                              lu.getFloatValue());

    case LexicalUnit.SAC_PICA:
        return new FloatValue(CSSPrimitiveValue.CSS_PC,
                              lu.getFloatValue());

    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_PERCENTAGE:
        return new FloatValue(CSSPrimitiveValue.CSS_PERCENTAGE,
                              lu.getFloatValue());
    }
    throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:52,代码来源:LengthManager.java

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

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


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