Java Code Examples for org.w3c.css.sac.LexicalUnit#SAC_FUNCTION

The following examples show how to use org.w3c.css.sac.LexicalUnit#SAC_FUNCTION . 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: CropReadHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public CSSValue createValue( StyleKey name, LexicalUnit value ) {
  if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) {
    final String stringValue = value.getStringValue();
    if ( stringValue.equalsIgnoreCase( "auto" ) ||
      stringValue.equalsIgnoreCase( "none" ) ) {
      return CSSAutoValue.getInstance();
    }
  } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION ) {
    if ( value.getFunctionName().equalsIgnoreCase( "inset-rect" ) ) {
      return getRectangle( CSSRectangleType.INSET_RECT, value.getParameters() );
    }
    return null;
  } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_RECT_FUNCTION ) {
    return getRectangle( CSSRectangleType.RECT, value.getParameters() );
  }
  return null;
}
 
Example 2
Source File: OverflowClipReadHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public CSSValue createValue( StyleKey name, LexicalUnit value ) {
  if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) {
    final String stringValue = value.getStringValue();
    if ( stringValue.equalsIgnoreCase( "auto" ) ) {
      return CSSAutoValue.getInstance();
    }
  } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION ) {
    if ( value.getFunctionName().equalsIgnoreCase( "inset-rect" ) ) {
      return getRectangle( CSSRectangleType.INSET_RECT, value.getParameters() );
    }
    return null;
  } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_RECT_FUNCTION ) {
    return getRectangle( CSSRectangleType.RECT, value.getParameters() );
  }
  return null;
}
 
Example 3
Source File: CSSValueFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 4
Source File: ColorReadHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
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;
}
 
Example 5
Source File: CSSValue.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public short getPrimitiveType( )
{
	if ( value instanceof LexicalUnit )
	{
		LexicalUnit lu = (LexicalUnit) value;
		switch ( lu.getLexicalUnitType( ) )
		{
			case LexicalUnit.SAC_INHERIT :
				return CSS_IDENT;
			case LexicalUnit.SAC_INTEGER :
			case LexicalUnit.SAC_REAL :
				return CSS_NUMBER;
			case LexicalUnit.SAC_EM :
				return CSS_EMS;
			case LexicalUnit.SAC_EX :
				return CSS_EXS;
			case LexicalUnit.SAC_PIXEL :
				return CSS_PX;
			case LexicalUnit.SAC_INCH :
				return CSS_IN;
			case LexicalUnit.SAC_CENTIMETER :
				return CSS_CM;
			case LexicalUnit.SAC_MILLIMETER :
				return CSS_MM;
			case LexicalUnit.SAC_POINT :
				return CSS_PT;
			case LexicalUnit.SAC_PICA :
				return CSS_PC;
			case LexicalUnit.SAC_PERCENTAGE :
				return CSS_PERCENTAGE;
			case LexicalUnit.SAC_URI :
				return CSS_URI;
			case LexicalUnit.SAC_DEGREE :
				return CSS_DEG;
			case LexicalUnit.SAC_GRADIAN :
				return CSS_GRAD;
			case LexicalUnit.SAC_RADIAN :
				return CSS_RAD;
			case LexicalUnit.SAC_MILLISECOND :
				return CSS_MS;
			case LexicalUnit.SAC_SECOND :
				return CSS_S;
			case LexicalUnit.SAC_HERTZ :
				return CSS_KHZ;
			case LexicalUnit.SAC_KILOHERTZ :
				return CSS_HZ;
			case LexicalUnit.SAC_IDENT :
				return CSS_IDENT;
			case LexicalUnit.SAC_STRING_VALUE :
				return CSS_STRING;
			case LexicalUnit.SAC_ATTR :
				return CSS_ATTR;
			case LexicalUnit.SAC_UNICODERANGE :
			case LexicalUnit.SAC_SUB_EXPRESSION :
			case LexicalUnit.SAC_FUNCTION :
				return CSS_STRING;
			case LexicalUnit.SAC_DIMENSION :
				return CSS_DIMENSION;
		}
	}
	return CSS_UNKNOWN;
}