Java Code Examples for org.w3c.css.sac.LexicalUnit#SAC_RGBCOLOR
The following examples show how to use
org.w3c.css.sac.LexicalUnit#SAC_RGBCOLOR .
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: AbstractColorManager.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}. */ public Value createValue( LexicalUnit lu, CSSEngine engine ) throws DOMException { if ( lu.getLexicalUnitType( ) == LexicalUnit.SAC_RGBCOLOR ) { lu = lu.getParameters( ); Value red = createColorComponent( lu ); lu = lu.getNextLexicalUnit( ).getNextLexicalUnit( ); Value green = createColorComponent( lu ); lu = lu.getNextLexicalUnit( ).getNextLexicalUnit( ); Value blue = createColorComponent( lu ); return createRGBColor( red, green, blue ); } return super.createValue( lu, engine ); }
Example 2
Source File: ShortHandProcessor.java From birt with Eclipse Public License 1.0 | 6 votes |
protected String getBackgroundColor( String[] values, CSSEngine engine ) { for ( int i = 0; i < values.length; i++ ) { LexicalUnit u = getUnit( values[i], engine ); if ( u != null ) { if ( u.getLexicalUnitType( ) == LexicalUnit.SAC_RGBCOLOR ) { return values[i]; } else if ( u.getLexicalUnitType( ) == LexicalUnit.SAC_IDENT ) { if ( isIdentifier( values[i], IStyle.STYLE_COLOR, engine ) ) { return values[i]; } } } } return null; }
Example 3
Source File: ShortHandProcessor.java From birt with Eclipse Public License 1.0 | 6 votes |
protected String getBorderColor( String[] values, CSSEngine engine ) { for ( int i = 0; i < values.length; i++ ) { LexicalUnit u = getUnit( values[i], engine ); if ( u != null ) { if ( u.getLexicalUnitType( ) == LexicalUnit.SAC_RGBCOLOR ) { return values[i]; } else if ( u.getLexicalUnitType( ) == LexicalUnit.SAC_IDENT ) { if ( isIdentifier( values[i], IStyle.STYLE_COLOR, engine ) ) { return values[i]; } } } } return CSSConstants.CSS_BLACK_VALUE; }
Example 4
Source File: CSSValueFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public static boolean isFunctionValue( LexicalUnit unit ) { final short lexicalUnitType = unit.getLexicalUnitType(); return ( lexicalUnitType == LexicalUnit.SAC_FUNCTION || lexicalUnitType == LexicalUnit.SAC_COUNTER_FUNCTION || lexicalUnitType == LexicalUnit.SAC_COUNTERS_FUNCTION || lexicalUnitType == LexicalUnit.SAC_RGBCOLOR || lexicalUnitType == LexicalUnit.SAC_RECT_FUNCTION ); }
Example 5
Source File: ColorReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public static CSSValue createColorValue( final LexicalUnit value ) { if ( value.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION || value.getLexicalUnitType() == LexicalUnit.SAC_RGBCOLOR ) { return CSSValueFactory.parseFunction( value ); } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) { // a constant color name return ColorUtil.parseIdentColor( value.getStringValue() ); } return null; }