Java Code Examples for org.w3c.css.sac.LexicalUnit#getNextLexicalUnit()
The following examples show how to use
org.w3c.css.sac.LexicalUnit#getNextLexicalUnit() .
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: TextIndentReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public CSSValue createValue( StyleKey name, LexicalUnit value ) { CSSValue cssvalue = null; if ( value.getLexicalUnitType() == LexicalUnit.SAC_PERCENTAGE ) { cssvalue = CSSNumericValue.createValue( CSSNumericType.PERCENTAGE, value.getFloatValue() ); } else { cssvalue = CSSValueFactory.createLengthValue( value ); } value = value.getNextLexicalUnit(); if ( value != null ) { if ( value.getLexicalUnitType() != LexicalUnit.SAC_IDENT ) { return null; } if ( value.getStringValue().equalsIgnoreCase( "hanging" ) ) { return new CSSValueList( new CSSValue[] { cssvalue, new CSSConstant( "hanging" ) } ); } else { return null; } } return new CSSValueList( new CSSValue[] { cssvalue } ); }
Example 2
Source File: SpacingLimitReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { CSSValue optimum = parseSingleSpacingValue( unit ); if ( optimum == null ) { return null; } unit = unit.getNextLexicalUnit(); CSSValue minimum = parseSingleSpacingValue( unit ); if ( minimum != null ) { unit = unit.getNextLexicalUnit(); } CSSValue maximum = parseSingleSpacingValue( unit ); final Map map = new HashMap(); map.put( getMinimumKey(), minimum ); map.put( TextStyleKeys.X_MAX_LETTER_SPACING, maximum ); map.put( TextStyleKeys.X_OPTIMUM_LETTER_SPACING, optimum ); return map; }
Example 3
Source File: BorderRadiusReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public CSSValue createValue( StyleKey name, LexicalUnit value ) { CSSNumericValue firstValue = CSSValueFactory.createLengthValue( value ); if ( firstValue == null ) { return null; } value = value.getNextLexicalUnit(); CSSNumericValue secondValue; if ( value == null ) { secondValue = firstValue; } else { secondValue = CSSValueFactory.createLengthValue( value ); if ( secondValue == null ) { return null; } } return new CSSValuePair( firstValue, secondValue ); }
Example 4
Source File: FitPositionReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
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(); } } final CSSValue firstPosition = parseFirstPosition( value ); if ( firstPosition == null ) { return null; } value = value.getNextLexicalUnit(); final CSSValue secondPosition = parseSecondPosition( value, firstPosition ); if ( secondPosition == null ) { return null; } return createResultList( firstPosition, secondPosition ); }
Example 5
Source File: BorderSpacingReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public CSSValue createValue( StyleKey name, LexicalUnit value ) { CSSNumericValue firstValue = CSSValueFactory.createLengthValue( value ); if ( firstValue == null ) { return null; } value = value.getNextLexicalUnit(); CSSNumericValue secondValue; if ( value == null ) { secondValue = firstValue; } else { secondValue = CSSValueFactory.createLengthValue( value ); if ( secondValue == null ) { return null; } } return new CSSValuePair( firstValue, secondValue ); }
Example 6
Source File: AbstractCompoundValueReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public synchronized Map createValues( LexicalUnit unit ) { final Map map = new HashMap(); final Map.Entry[] entries = (Map.Entry[]) handlers.entrySet().toArray( new Map.Entry[ handlers.size() ] ); while ( unit != null ) { for ( int i = 0; i < entries.length; i++ ) { Map.Entry entry = entries[ i ]; CSSValueReadHandler valueReadHandler = (CSSValueReadHandler) entry.getValue(); StyleKey key = (StyleKey) entry.getKey(); CSSValue value = valueReadHandler.createValue( key, unit ); if ( value != null ) { map.put( key, value ); break; } } unit = unit.getNextLexicalUnit(); } return map; }
Example 7
Source File: FontEmphasizeReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { CSSValue style = styleReadHandler.createValue( null, unit ); if ( style != null ) { unit = unit.getNextLexicalUnit(); } CSSValue position; if ( unit != null ) { position = positionReadHandler.createValue( null, unit ); } else { position = null; } final Map map = new HashMap(); if ( position != null ) { map.put( FontStyleKeys.FONT_EMPHASIZE_POSITION, position ); } if ( style != null ) { map.put( FontStyleKeys.FONT_EMPHASIZE_STYLE, style ); } return map; }
Example 8
Source File: CSSValue.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Constructor * * @param value * the lexical unit of the value * @param forcePrimitive * status identifying whether the value is forced to be primitive */ public CSSValue( LexicalUnit value, boolean forcePrimitive ) { if ( value.getParameters( ) != null ) { this.value = value; } else if ( forcePrimitive || ( value.getNextLexicalUnit( ) == null ) ) { // We need to be a CSSPrimitiveValue this.value = value; } else { // We need to be a CSSValueList // Values in an "expr" can be seperated by "operator"s, which are // either '/' or ',' - ignore these operators Vector v = new Vector( ); LexicalUnit lu = value; while ( lu != null ) { if ( ( lu.getLexicalUnitType( ) != LexicalUnit.SAC_OPERATOR_COMMA ) && ( lu.getLexicalUnitType( ) != LexicalUnit.SAC_OPERATOR_SLASH ) ) { v.addElement( new CSSValue( lu, true ) ); } lu = lu.getNextLexicalUnit( ); } this.value = v; } }
Example 9
Source File: BorderBreakReadHandler.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 ) { final CSSValue width = CSSValueFactory.createLengthValue( unit ); if ( width != null ) { unit = unit.getNextLexicalUnit(); } final CSSConstant style; if ( unit != null ) { style = (CSSConstant) lookupValue( unit ); if ( style != null ) { unit = unit.getNextLexicalUnit(); } } else { style = null; } final CSSValue color; if ( unit != null ) { color = ColorReadHandler.createColorValue( unit ); } else { color = null; } final Map map = new HashMap(); if ( width != null ) { map.put( BorderStyleKeys.BORDER_BREAK_WIDTH, width ); } if ( style != null ) { map.put( BorderStyleKeys.BORDER_BREAK_STYLE, style ); } if ( color != null ) { map.put( BorderStyleKeys.BORDER_BREAK_COLOR, color ); } return map; }
Example 10
Source File: BorderBottomReadHandler.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 ) { final CSSValue width = widthReadHandler.parseWidth( unit ); if ( width != null ) { unit = unit.getNextLexicalUnit(); } final CSSConstant style; if ( unit != null ) { style = (CSSConstant) lookupValue( unit ); if ( style != null ) { unit = unit.getNextLexicalUnit(); } } else { style = null; } final CSSValue color; if ( unit != null ) { color = ColorReadHandler.createColorValue( unit ); } else { color = null; } final Map map = new HashMap(); if ( width != null ) { map.put( BorderStyleKeys.BORDER_BOTTOM_WIDTH, width ); } if ( style != null ) { map.put( BorderStyleKeys.BORDER_BOTTOM_STYLE, style ); } if ( color != null ) { map.put( BorderStyleKeys.BORDER_BOTTOM_COLOR, color ); } return map; }
Example 11
Source File: BorderLeftReadHandler.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 ) { final CSSValue width = widthReadHandler.parseWidth( unit ); if ( width != null ) { unit = unit.getNextLexicalUnit(); } final CSSConstant style; if ( unit != null ) { style = (CSSConstant) lookupValue( unit ); if ( style != null ) { unit = unit.getNextLexicalUnit(); } } else { style = null; } final CSSValue color; if ( unit != null ) { color = ColorReadHandler.createColorValue( unit ); } else { color = null; } final Map map = new HashMap(); if ( width != null ) { map.put( BorderStyleKeys.BORDER_LEFT_WIDTH, width ); } if ( style != null ) { map.put( BorderStyleKeys.BORDER_LEFT_STYLE, style ); } if ( color != null ) { map.put( BorderStyleKeys.BORDER_LEFT_COLOR, color ); } return map; }
Example 12
Source File: BorderWidthReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { final CSSValue topWidth = parseWidth( unit ); if ( topWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); final CSSValue rightWidth; if ( unit == null ) { rightWidth = topWidth; } else { rightWidth = parseWidth( unit ); if ( rightWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue bottomWidth; if ( unit == null ) { bottomWidth = topWidth; } else { bottomWidth = parseWidth( unit ); if ( bottomWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue leftWidth; if ( unit == null ) { leftWidth = rightWidth; } else { leftWidth = parseWidth( unit ); if ( leftWidth == null ) { return null; } } final Map map = new HashMap(); map.put( BorderStyleKeys.BORDER_TOP_WIDTH, topWidth ); map.put( BorderStyleKeys.BORDER_RIGHT_WIDTH, rightWidth ); map.put( BorderStyleKeys.BORDER_BOTTOM_WIDTH, bottomWidth ); map.put( BorderStyleKeys.BORDER_LEFT_WIDTH, leftWidth ); return map; }
Example 13
Source File: BackgroundSizeReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public CSSValue createValue( StyleKey name, LexicalUnit value ) { ArrayList values = new ArrayList(); while ( value != null ) { CSSValue firstValue; if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) { if ( value.getStringValue().equalsIgnoreCase( "round" ) ) { values.add( createList( CSSAutoValue.getInstance(), CSSAutoValue.getInstance(), BackgroundSize.ROUND ) ); value = CSSValueFactory.parseComma( value ); continue; } if ( value.getStringValue().equalsIgnoreCase( "auto" ) ) { firstValue = CSSAutoValue.getInstance(); } else { return null; } } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_PERCENTAGE ) { firstValue = CSSNumericValue.createValue( CSSNumericType.PERCENTAGE, value.getFloatValue() ); } else { firstValue = CSSValueFactory.createLengthValue( value ); if ( firstValue == null ) { return null; } } value = value.getNextLexicalUnit(); if ( value == null ) { values.add( createList( firstValue, CSSAutoValue.getInstance(), BackgroundSize.ROUND ) ); continue; } CSSValue secondValue; if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) { if ( value.getStringValue().equalsIgnoreCase( "round" ) ) { values.add( createList( firstValue, CSSAutoValue.getInstance(), BackgroundSize.ROUND ) ); value = CSSValueFactory.parseComma( value ); continue; } else if ( value.getStringValue().equalsIgnoreCase( "auto" ) ) { secondValue = CSSAutoValue.getInstance(); } else { return null; } } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA ) { values.add( createList( firstValue, CSSAutoValue.getInstance(), BackgroundSize.ROUND ) ); value = value.getNextLexicalUnit(); continue; } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_PERCENTAGE ) { secondValue = CSSNumericValue.createValue( CSSNumericType.PERCENTAGE, value.getFloatValue() ); } else { secondValue = CSSValueFactory.createLengthValue( value ); if ( secondValue == null ) { return null; } } value = value.getNextLexicalUnit(); if ( value == null ) { values.add( createList( firstValue, secondValue, BackgroundSize.NO_ROUND ) ); } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA ) { values.add( createList( firstValue, secondValue, BackgroundSize.NO_ROUND ) ); value = value.getNextLexicalUnit(); } else if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) { if ( value.getStringValue().equalsIgnoreCase( "round" ) == false ) { return null; } values.add( createList( firstValue, secondValue, BackgroundSize.ROUND ) ); value = CSSValueFactory.parseComma( value ); } else { return null; } } return new CSSValueList( values ); }
Example 14
Source File: TextDecorationReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { final Map map = new HashMap(); map.put( TextStyleKeys.TEXT_UNDERLINE_POSITION, CSSAutoValue.getInstance() ); map.put( TextStyleKeys.TEXT_UNDERLINE_MODE, TextDecorationMode.CONTINUOUS ); map.put( TextStyleKeys.TEXT_OVERLINE_MODE, TextDecorationMode.CONTINUOUS ); map.put( TextStyleKeys.TEXT_LINE_THROUGH_MODE, TextDecorationMode.CONTINUOUS ); map.put( TextStyleKeys.TEXT_UNDERLINE_COLOR, CSSSystemColors.CURRENT_COLOR ); map.put( TextStyleKeys.TEXT_OVERLINE_COLOR, CSSSystemColors.CURRENT_COLOR ); map.put( TextStyleKeys.TEXT_LINE_THROUGH_COLOR, CSSSystemColors.CURRENT_COLOR ); map.put( TextStyleKeys.TEXT_UNDERLINE_WIDTH, CSSAutoValue.getInstance() ); map.put( TextStyleKeys.TEXT_OVERLINE_WIDTH, CSSAutoValue.getInstance() ); map.put( TextStyleKeys.TEXT_LINE_THROUGH_WIDTH, CSSAutoValue.getInstance() ); map.put( TextStyleKeys.TEXT_UNDERLINE_STYLE, TextDecorationStyle.NONE ); map.put( TextStyleKeys.TEXT_OVERLINE_STYLE, TextDecorationStyle.NONE ); map.put( TextStyleKeys.TEXT_LINE_THROUGH_STYLE, TextDecorationStyle.NONE ); while ( unit != null ) { CSSValue constant = lookupValue( unit ); if ( constant == null ) { return null; } if ( constant.getCSSText().equals( "none" ) ) { map.put( TextStyleKeys.TEXT_UNDERLINE_STYLE, TextDecorationStyle.NONE ); map.put( TextStyleKeys.TEXT_OVERLINE_STYLE, TextDecorationStyle.NONE ); map.put( TextStyleKeys.TEXT_LINE_THROUGH_STYLE, TextDecorationStyle.NONE ); return map; } if ( constant.getCSSText().equals( "blink" ) ) { map.put( TextStyleKeys.TEXT_BLINK, new CSSConstant( "blink" ) ); } else if ( constant.getCSSText().equals( "underline" ) ) { map.put( TextStyleKeys.TEXT_UNDERLINE_STYLE, TextDecorationStyle.SOLID ); } else if ( constant.getCSSText().equals( "overline" ) ) { map.put( TextStyleKeys.TEXT_OVERLINE_STYLE, TextDecorationStyle.SOLID ); } else if ( constant.getCSSText().equals( "line-through" ) ) { map.put( TextStyleKeys.TEXT_LINE_THROUGH_STYLE, TextDecorationStyle.SOLID ); } unit = unit.getNextLexicalUnit(); } return map; }
Example 15
Source File: BorderColorReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { final CSSValue topColor = ColorReadHandler.createColorValue( unit ); if ( topColor == null ) { return null; } unit = unit.getNextLexicalUnit(); final CSSValue rightColor; if ( unit == null ) { rightColor = topColor; } else { rightColor = ColorReadHandler.createColorValue( unit ); if ( rightColor == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue bottomColor; if ( unit == null ) { bottomColor = topColor; } else { bottomColor = ColorReadHandler.createColorValue( unit ); if ( bottomColor == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue leftColor; if ( unit == null ) { leftColor = rightColor; } else { leftColor = ColorReadHandler.createColorValue( unit ); if ( leftColor == null ) { return null; } } final Map map = new HashMap(); map.put( BorderStyleKeys.BORDER_TOP_COLOR, topColor ); map.put( BorderStyleKeys.BORDER_RIGHT_COLOR, rightColor ); map.put( BorderStyleKeys.BORDER_BOTTOM_COLOR, bottomColor ); map.put( BorderStyleKeys.BORDER_LEFT_COLOR, leftColor ); return map; }
Example 16
Source File: SizeReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public CSSValue createValue( StyleKey name, LexicalUnit value ) { if ( value.getLexicalUnitType() == LexicalUnit.SAC_IDENT ) { String ident = value.getStringValue(); if ( ident.equalsIgnoreCase( "auto" ) ) { return CSSAutoValue.getInstance(); } final PageSize ps = PageSizeFactory.getInstance().getPageSizeByName( ident ); if ( ps == null ) { return null; } value = value.getNextLexicalUnit(); int pageOrientation = PageFormat.PORTRAIT; if ( value != null ) { if ( value.getLexicalUnitType() != LexicalUnit.SAC_IDENT ) { return null; } if ( value.getStringValue().equalsIgnoreCase( "landscape" ) ) { pageOrientation = PageFormat.LANDSCAPE; } else if ( value.getStringValue().equalsIgnoreCase( "reverse-landscape" ) ) { pageOrientation = PageFormat.REVERSE_LANDSCAPE; } else if ( value.getStringValue().equalsIgnoreCase( "portrait" ) ) { pageOrientation = PageFormat.PORTRAIT; } else { return null; } } if ( pageOrientation == PageFormat.LANDSCAPE || pageOrientation == PageFormat.REVERSE_LANDSCAPE ) { return new CSSValuePair( CSSNumericValue.createPtValue( ps.getHeight() ), CSSNumericValue.createPtValue( ps.getWidth() ) ); } else { return new CSSValuePair( CSSNumericValue.createPtValue( ps.getWidth() ), CSSNumericValue.createPtValue( ps.getHeight() ) ); } } else { final CSSNumericValue horizontalWidth = (CSSNumericValue) parseWidth( value ); if ( horizontalWidth == null ) { return null; } value = value.getNextLexicalUnit(); final CSSNumericValue verticalWidth; if ( value == null ) { verticalWidth = horizontalWidth; } else { verticalWidth = (CSSNumericValue) parseWidth( value ); if ( verticalWidth == null ) { return null; } } return new CSSValuePair( horizontalWidth, verticalWidth ); } }
Example 17
Source File: MarginReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { final CSSValue topWidth = parseWidth( unit ); if ( topWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); final CSSValue rightWidth; if ( unit == null ) { rightWidth = topWidth; } else { rightWidth = parseWidth( unit ); if ( rightWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue bottomWidth; if ( unit == null ) { bottomWidth = topWidth; } else { bottomWidth = parseWidth( unit ); if ( bottomWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue leftWidth; if ( unit == null ) { leftWidth = rightWidth; } else { leftWidth = parseWidth( unit ); if ( leftWidth == null ) { return null; } } final Map map = new HashMap(); map.put( BoxStyleKeys.MARGIN_TOP, topWidth ); map.put( BoxStyleKeys.MARGIN_RIGHT, rightWidth ); map.put( BoxStyleKeys.MARGIN_BOTTOM, bottomWidth ); map.put( BoxStyleKeys.MARGIN_LEFT, leftWidth ); return map; }
Example 18
Source File: PaddingReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { final CSSValue topWidth = parseWidth( unit ); if ( topWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); final CSSValue rightWidth; if ( unit == null ) { rightWidth = topWidth; } else { rightWidth = parseWidth( unit ); if ( rightWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue bottomWidth; if ( unit == null ) { bottomWidth = topWidth; } else { bottomWidth = parseWidth( unit ); if ( bottomWidth == null ) { return null; } unit = unit.getNextLexicalUnit(); } final CSSValue leftWidth; if ( unit == null ) { leftWidth = rightWidth; } else { leftWidth = parseWidth( unit ); if ( leftWidth == null ) { return null; } } final Map map = new HashMap(); map.put( BoxStyleKeys.PADDING_TOP, topWidth ); map.put( BoxStyleKeys.PADDING_RIGHT, rightWidth ); map.put( BoxStyleKeys.PADDING_BOTTOM, bottomWidth ); map.put( BoxStyleKeys.PADDING_LEFT, leftWidth ); return map; }
Example 19
Source File: BorderReadHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
/** * Parses the LexicalUnit and returns a map of (StyleKey, CSSValue) pairs. * * @param unit * @return */ public Map createValues( LexicalUnit unit ) { final CSSValue width = CSSValueFactory.createLengthValue( unit ); if ( width != null ) { unit = unit.getNextLexicalUnit(); } final CSSConstant style; if ( unit != null ) { style = (CSSConstant) lookupValue( unit ); if ( style != null ) { unit = unit.getNextLexicalUnit(); } } else { style = null; } final CSSValue color; if ( unit != null ) { color = ColorReadHandler.createColorValue( unit ); } else { color = null; } final Map map = new HashMap(); if ( width != null ) { map.put( BorderStyleKeys.BORDER_TOP_WIDTH, width ); map.put( BorderStyleKeys.BORDER_LEFT_WIDTH, width ); map.put( BorderStyleKeys.BORDER_BOTTOM_WIDTH, width ); map.put( BorderStyleKeys.BORDER_RIGHT_WIDTH, width ); } if ( style != null ) { map.put( BorderStyleKeys.BORDER_TOP_STYLE, style ); map.put( BorderStyleKeys.BORDER_LEFT_STYLE, style ); map.put( BorderStyleKeys.BORDER_BOTTOM_STYLE, style ); map.put( BorderStyleKeys.BORDER_RIGHT_STYLE, style ); } if ( color != null ) { map.put( BorderStyleKeys.BORDER_TOP_COLOR, color ); map.put( BorderStyleKeys.BORDER_LEFT_COLOR, color ); map.put( BorderStyleKeys.BORDER_BOTTOM_COLOR, color ); map.put( BorderStyleKeys.BORDER_RIGHT_COLOR, color ); } return map; }
Example 20
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(); } } }