org.w3c.dom.css.CSSPrimitiveValue#CSS_IDENT源码实例Demo

下面列出了org.w3c.dom.css.CSSPrimitiveValue#CSS_IDENT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: birt   文件: BackgroundPositionXManager.java
/**
 * Implements {@link
 * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
 */
public Value computeValue(CSSStylableElement elt, CSSEngine engine,
		int idx, Value value) {
	if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
		if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
			Value percentage = (Value) percentValues.get(value
					.getStringValue());
			if (percentage != null) {
				return percentage;
			}
			throw createInvalidIdentifierDOMException(value
					.getStringValue());
		}
	}
	return super.computeValue(elt, engine, idx, value);
}
 
源代码2 项目: birt   文件: BackgroundPositionYManager.java
/**
 * Implements {@link
 * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
 */
public Value computeValue(CSSStylableElement elt, CSSEngine engine,
		int idx, Value value) {
	if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
		if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
			Value percentage = (Value) percentValues.get(value
					.getStringValue());
			if (percentage != null) {
				return percentage;
			}
			throw createInvalidIdentifierDOMException(value
					.getStringValue());
		}
	}
	return super.computeValue(elt, engine, idx, value);
}
 
源代码3 项目: birt   文件: SpacingManager.java
/**
 * Implements {@link
 * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
 */
public Value computeValue( CSSStylableElement elt, CSSEngine engine,
		int idx, Value value )
{
	if ( value.getCssValueType( ) == CSSValue.CSS_PRIMITIVE_VALUE )
	{
		if ( value.getPrimitiveType( ) == CSSPrimitiveValue.CSS_IDENT )
		{
			return CSSValueConstants.NUMBER_0;
		}
	}
	return super.computeValue( elt, engine, idx, value );
}
 
源代码4 项目: birt   文件: BorderWidthManager.java
public Value computeValue( CSSStylableElement elt, CSSEngine engine,
		int idx, Value value )
{
	IStyle cs = elt.getComputedStyle( );
	CSSValue borderStyle = null;
	switch ( idx )
	{
		case IStyle.STYLE_BORDER_TOP_WIDTH :
			borderStyle = cs.getProperty( IStyle.STYLE_BORDER_TOP_STYLE );
			break;
		case IStyle.STYLE_BORDER_BOTTOM_WIDTH :
			borderStyle = cs.getProperty( IStyle.STYLE_BORDER_BOTTOM_STYLE );
			break;
		case IStyle.STYLE_BORDER_LEFT_WIDTH :
			borderStyle = cs.getProperty( IStyle.STYLE_BORDER_LEFT_STYLE );
			break;
		case IStyle.STYLE_BORDER_RIGHT_WIDTH :
			borderStyle = cs.getProperty( IStyle.STYLE_BORDER_RIGHT_STYLE );
			break;
	}
	if ( borderStyle == CSSValueConstants.NONE_VALUE
			|| borderStyle == CSSValueConstants.HIDDEN_VALUE )
	{
		return CSSValueConstants.NUMBER_0;
	}
	if ( value.getCssValueType( ) == CSSValue.CSS_PRIMITIVE_VALUE )
	{
		if ( value.getPrimitiveType( ) == CSSPrimitiveValue.CSS_IDENT )
		{
			String ident = value.getStringValue( );
			Value cv = (Value) computedValues.get( ident );
			if ( cv != null )
			{
				value = cv;
			}
		}
	}
	return super.computeValue( elt, engine, idx, value );
}
 
源代码5 项目: birt   文件: FontSizeManager.java
/**
 * Implements {@link
 * ValueManager#createStringValue(short,String,CSSEngine)}.
 */
public CSSPrimitiveValue createStringValue(short type, String value)
		throws DOMException {
	if (type != CSSPrimitiveValue.CSS_IDENT) {
		throw createInvalidStringTypeDOMException(type);
	}
	Object v = values.get(value.toLowerCase().intern());
	if (v == null) {
		throw createInvalidIdentifierDOMException(value);
	}
	return (CSSPrimitiveValue) v;
}
 
源代码6 项目: birt   文件: IdentifierManager.java
protected Value createStringValue( short type, String value, CSSEngine engine )
		throws DOMException
{
	if ( type != CSSPrimitiveValue.CSS_IDENT )
	{
		throw createInvalidStringTypeDOMException( type );
	}
	Object v = getIdentifiers( ).get( value.toLowerCase( ).intern( ) );
	if ( v == null )
	{
		throw createInvalidIdentifierDOMException( value );
	}
	return (Value) v;
}
 
源代码7 项目: birt   文件: AbstractColorManager.java
/**
 * Implements {@link
 * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
 */
public Value computeValue( CSSStylableElement elt, CSSEngine engine,
		int idx, Value value )
{
	if ( value.getCssValueType( ) == CSSValue.CSS_PRIMITIVE_VALUE )
	{
		CSSPrimitiveValue pvalue = (CSSPrimitiveValue) value;
		int primitiveType = pvalue.getPrimitiveType( );
		if ( primitiveType == CSSPrimitiveValue.CSS_IDENT )
		{
			String ident = pvalue.getStringValue( );
			// Search for a direct computed value.
			Value v = (Value) computedValues.get( ident );
			if ( v != null )
			{
				return v;
			}
			// Must be a system color...
			if ( values.get( ident ) == null )
			{
				throw new InternalError( );
			}
			return (Value) engine.getCSSContext( ).getSystemColor( ident );
		}
		if ( primitiveType == CSSPrimitiveValue.CSS_RGBCOLOR )
		{
			RGBColor color = value.getRGBColorValue( );
			CSSPrimitiveValue red = color.getRed( );
			CSSPrimitiveValue green = color.getGreen( );
			CSSPrimitiveValue blue = color.getBlue( );

			return createRGBColor( createColorComponent( red ),
					createColorComponent( green ),
					createColorComponent( blue ) );
		}
	}
	return super.computeValue( elt, engine, idx, value );
}