Java Code Examples for org.w3c.css.sac.LexicalUnit#SAC_INHERIT
The following examples show how to use
org.w3c.css.sac.LexicalUnit#SAC_INHERIT .
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: FontSizeManager.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 { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return CSSValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT: String s = lu.getStringValue().toLowerCase().intern(); Object v = values.get(s); if (v == null) { throw createInvalidIdentifierDOMException(s); } return (Value) v; default: break; } return super.createValue(lu, engine); }
Example 2
Source File: IdentifierManager.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 { switch ( lu.getLexicalUnitType( ) ) { case LexicalUnit.SAC_INHERIT : return CSSValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_IDENT : String s = lu.getStringValue( ).toLowerCase( ).intern( ); Object v = getIdentifiers( ).get( s ); if ( v == null ) { throw createInvalidIdentifierDOMException( lu .getStringValue( ) ); } return (Value) v; default : throw createInvalidLexicalUnitDOMException( lu .getLexicalUnitType( ) ); } }
Example 3
Source File: Measure.java From tm4e with Eclipse Public License 1.0 | 5 votes |
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()); }
Example 4
Source File: Measure.java From tm4e with Eclipse Public License 1.0 | 5 votes |
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(); }
Example 5
Source File: StringManager.java From birt with Eclipse Public License 1.0 | 5 votes |
public Value createValue( LexicalUnit lu, CSSEngine engine ) throws DOMException { switch ( lu.getLexicalUnitType( ) ) { case LexicalUnit.SAC_INHERIT : return CSSValueConstants.INHERIT_VALUE; default : return new StringValue( CSSPrimitiveValue.CSS_STRING, lu .getStringValue( ) ); } }
Example 6
Source File: IntegerManager.java From birt with Eclipse Public License 1.0 | 5 votes |
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch( lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return CSSValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_INTEGER: return new FloatValue( CSSPrimitiveValue.CSS_NUMBER, lu.getIntegerValue()); default: throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); } }
Example 7
Source File: ColumnRuleReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { if ( unit.getLexicalUnitType() == LexicalUnit.SAC_INHERIT ) { Map map = new HashMap(); map.put( ColumnStyleKeys.COLUMN_RULE_COLOR, CSSInheritValue.getInstance() ); map.put( ColumnStyleKeys.COLUMN_RULE_STYLE, CSSInheritValue.getInstance() ); map.put( ColumnStyleKeys.COLUMN_RULE_WIDTH, CSSInheritValue.getInstance() ); return map; } return super.createValues( unit ); }
Example 8
Source File: WhitespaceReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { // http://cheeaun.phoenity.com/weblog/2005/06/whitespace-and-generated-content.html // is a good overview about the whitespace stuff .. CSSValue whitespace; CSSValue textWrap; if ( unit.getLexicalUnitType() == LexicalUnit.SAC_INHERIT ) { whitespace = CSSInheritValue.getInstance(); textWrap = CSSInheritValue.getInstance(); } else if ( unit.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) { String strVal = unit.getStringValue(); if ( strVal.equalsIgnoreCase( "normal" ) ) { whitespace = WhitespaceCollapse.COLLAPSE; textWrap = TextWrap.NORMAL; } else if ( strVal.equalsIgnoreCase( "pre" ) ) { whitespace = WhitespaceCollapse.PRESERVE; textWrap = TextWrap.SUPPRESS; } else if ( strVal.equalsIgnoreCase( "pre-line" ) ) { whitespace = WhitespaceCollapse.PRESERVE_BREAKS; textWrap = TextWrap.NORMAL; } else if ( strVal.equalsIgnoreCase( "pre-wrap" ) ) { whitespace = WhitespaceCollapse.PRESERVE; textWrap = TextWrap.NORMAL; } else { return null; } } else { return null; } Map map = new HashMap(); map.put( TextStyleKeys.WHITE_SPACE_COLLAPSE, whitespace ); map.put( TextStyleKeys.TEXT_WRAP, textWrap ); return map; }
Example 9
Source File: VisibleFormatManager.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}. */ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return CSSValueConstants.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 && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { do { sb.append(' '); sb.append(lu.getStringValue()); lu = lu.getNextLexicalUnit(); } while (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT); result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, sb.toString())); } else { String id = sb.toString(); String s = id.toLowerCase().intern(); CSSValue v = (CSSValue) 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(); } } }
Example 10
Source File: FontFamilyManager.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}. */ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return CSSValueConstants.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 && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) { do { sb.append(' '); sb.append(lu.getStringValue()); lu = lu.getNextLexicalUnit(); } while (lu != null && lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT); result.append(new StringValue(CSSPrimitiveValue.CSS_STRING, sb.toString())); } else { String id = sb.toString(); String s = id.toLowerCase().intern(); CSSValue v = (CSSValue) 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(); } } }
Example 11
Source File: CSSValue.java From birt with Eclipse Public License 1.0 | 4 votes |
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; }