Java Code Examples for org.w3c.dom.css.CSSPrimitiveValue#CSS_IDENT
The following examples show how to use
org.w3c.dom.css.CSSPrimitiveValue#CSS_IDENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BackgroundPositionXManager.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * 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); }
Example 2
Source File: BackgroundPositionYManager.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * 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); }
Example 3
Source File: SpacingManager.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * 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 ); }
Example 4
Source File: BorderWidthManager.java From birt with Eclipse Public License 1.0 | 5 votes |
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 ); }
Example 5
Source File: FontSizeManager.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * 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; }
Example 6
Source File: IdentifierManager.java From birt with Eclipse Public License 1.0 | 5 votes |
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; }
Example 7
Source File: AbstractColorManager.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * 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 ); }