Java Code Examples for org.w3c.dom.css.CSSValue#getCssText()
The following examples show how to use
org.w3c.dom.css.CSSValue#getCssText() .
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: OdtEmitter.java From birt with Eclipse Public License 1.0 | 6 votes |
protected boolean isNullValue( CSSValue value ) { if ( value == null ) { return true; } if ( value instanceof DataFormatValue ) { return true; } if ( value instanceof FloatValue ) { return false; } String cssText = value.getCssText( ); return "none".equalsIgnoreCase( cssText ) //$NON-NLS-1$ || "transparent".equalsIgnoreCase( cssText ); //$NON-NLS-1$ }
Example 2
Source File: ReportletBodyExecutor.java From birt with Eclipse Public License 1.0 | 6 votes |
private boolean isNullValue( CSSValue value ) { if ( value == null ) { return true; } if ( value instanceof DataFormatValue ) { return true; } String cssText = value.getCssText( ); return "none".equalsIgnoreCase( cssText ) || "transparent".equalsIgnoreCase( cssText ); }
Example 3
Source File: AbstractEmitterImpl.java From birt with Eclipse Public License 1.0 | 6 votes |
protected boolean isNullValue( CSSValue value ) { if ( value == null ) { return true; } if ( value instanceof DataFormatValue ) { return true; } if ( value instanceof FloatValue ) { return false; } String cssText = value.getCssText( ); return "none".equalsIgnoreCase( cssText ) || "transparent".equalsIgnoreCase( cssText ); }
Example 4
Source File: FontManager.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Remove quotes surrounding a string. * @param family * The string that may be surrounded by double quotes. * @return * family, without any surrounding double quotes. */ private static String cleanupQuotes( CSSValue value ) { if( value == null ) { return null; } if( value instanceof ListValue ){ ListValue listValue = (ListValue)value; if( listValue.getLength() > 0 ) { value = listValue.item(0); } } String stringValue = ( value instanceof StringValue ? ((StringValue)value).getStringValue() : value.getCssText() ); if( ( stringValue == null ) || stringValue.isEmpty() ) { return stringValue; } if( stringValue.startsWith( "\"" ) && stringValue.endsWith( "\"" ) ) { String newFamily = stringValue.substring(1, stringValue.length()-1); return newFamily; } return stringValue; }
Example 5
Source File: CSSPaserTest.java From birt with Eclipse Public License 1.0 | 6 votes |
private String parseProperty( String text ) { int at = text.indexOf( ':' ); if ( at != -1 ) { String name = text.substring( 0, at ); String valueText = text.substring( at + 1 ).trim( ); int idx = engine.getPropertyIndex( name ); if ( idx != -1 ) { CSSValue value = engine.parsePropertyValue( idx, valueText ); return name + ": " + value.getCssText( ); } } return ""; }
Example 6
Source File: HTMLVisionOptimize.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Handles the alignment property of the row content. */ public void handleRowAlign( IRowContent row ) { IStyle rowComputedStyle = row.getComputedStyle( ); // Build the Vertical-Align property of the row content CSSValue vAlign = rowComputedStyle.getProperty( IStyle.STYLE_VERTICAL_ALIGN ); if ( null == vAlign || IStyle.BASELINE_VALUE == vAlign ) { // The default vertical-align value of cell is top. And the cell can // inherit the valign from parent row. vAlign = IStyle.TOP_VALUE; } writer.attribute( HTMLTags.ATTR_VALIGN, vAlign.getCssText( ) ); String hAlignText = null; CSSValue hAlign = rowComputedStyle.getProperty( IStyle.STYLE_TEXT_ALIGN ); if ( null != hAlign ) { hAlignText = hAlign.getCssText( ); } if( null == hAlignText ) { if( htmlRtLFlag ) { hAlignText = "right"; } else { hAlignText = "left"; } } writer.attribute( HTMLTags.ATTR_ALIGN, hAlignText ); }
Example 7
Source File: AbstractStyle.java From birt with Eclipse Public License 1.0 | 5 votes |
protected String getCssText( CSSValue value ) { if ( value == null ) { return null; } return value.getCssText( ); }
Example 8
Source File: AbstractStyle.java From birt with Eclipse Public License 1.0 | 5 votes |
public String getCssText( int index ) { CSSValue value = getProperty( index ); if ( value != null ) { return value.getCssText( ); } return null; }
Example 9
Source File: StyleManagerXUtils.java From birt with Eclipse Public License 1.0 | 5 votes |
@Override public void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width) { if( ( colour != null ) || ( borderStyle != null ) || ( width != null ) ) { String colourString = colour == null ? "rgb(0,0,0)" : colour.getCssText(); String borderStyleString = borderStyle == null ? "solid" : borderStyle.getCssText(); String widthString = width == null ? "medium" : width.getCssText(); if( style instanceof XSSFCellStyle ) { XSSFCellStyle xStyle = (XSSFCellStyle)style; BorderStyle xBorderStyle = poiBorderStyleFromBirt(borderStyleString, widthString); XSSFColor xBorderColour = getXColour(colourString); if(xBorderStyle != BorderStyle.NONE) { switch( side ) { case TOP: xStyle.setBorderTop(xBorderStyle); xStyle.setTopBorderColor(xBorderColour); // log.debug( "Top border: " + xStyle.getBorderTop() + " / " + xStyle.getTopBorderXSSFColor().getARGBHex() ); break; case LEFT: xStyle.setBorderLeft(xBorderStyle); xStyle.setLeftBorderColor(xBorderColour); // log.debug( "Left border: " + xStyle.getBorderLeft() + " / " + xStyle.getLeftBorderXSSFColor().getARGBHex() ); break; case RIGHT: xStyle.setBorderRight(xBorderStyle); xStyle.setRightBorderColor(xBorderColour); // log.debug( "Right border: " + xStyle.getBorderRight() + " / " + xStyle.getRightBorderXSSFColor().getARGBHex() ); break; case BOTTOM: xStyle.setBorderBottom(xBorderStyle); xStyle.setBottomBorderColor(xBorderColour); // log.debug( "Bottom border: " + xStyle.getBorderBottom() + " / " + xStyle.getBottomBorderXSSFColor().getARGBHex() ); break; } } } } }
Example 10
Source File: AbstractHandler.java From birt with Eclipse Public License 1.0 | 5 votes |
protected static String getStyleProperty( IStyledElement element, int property, String defaultValue ) { CSSValue value = element.getComputedStyle().getProperty(property); if( value != null ) { return value.getCssText(); } else { return defaultValue; } }
Example 11
Source File: BirtStyle.java From birt with Eclipse Public License 1.0 | 5 votes |
public String getString( int propIndex ) { CSSValue value = getProperty( propIndex ); if( value != null ) { return value.getCssText(); } else { return null; } }
Example 12
Source File: StyleManagerHUtils.java From birt with Eclipse Public License 1.0 | 4 votes |
@Override public void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width) { if( ( colour != null ) || ( borderStyle != null ) || ( width != null ) ) { String colourString = colour == null ? "rgb(0,0,0)" : colour.getCssText(); String borderStyleString = borderStyle == null ? "solid" : borderStyle.getCssText(); String widthString = width == null ? "medium" : width.getCssText(); if( style instanceof HSSFCellStyle ) { HSSFCellStyle hStyle = (HSSFCellStyle)style; short hBorderStyle = poiBorderStyleFromBirt(borderStyleString, widthString); short colourIndex = getHColour((HSSFWorkbook)workbook, colourString); if( colourIndex > 0 ) { if(hBorderStyle != CellStyle.BORDER_NONE) { switch( side ) { case TOP: hStyle.setBorderTop(hBorderStyle); hStyle.setTopBorderColor(colourIndex); // log.debug( "Top border: " + xStyle.getBorderTop() + " / " + xStyle.getTopBorderXSSFColor().getARGBHex() ); break; case LEFT: hStyle.setBorderLeft(hBorderStyle); hStyle.setLeftBorderColor(colourIndex); // log.debug( "Left border: " + xStyle.getBorderLeft() + " / " + xStyle.getLeftBorderXSSFColor().getARGBHex() ); break; case RIGHT: hStyle.setBorderRight(hBorderStyle); hStyle.setRightBorderColor(colourIndex); // log.debug( "Right border: " + xStyle.getBorderRight() + " / " + xStyle.getRightBorderXSSFColor().getARGBHex() ); break; case BOTTOM: hStyle.setBorderBottom(hBorderStyle); hStyle.setBottomBorderColor(colourIndex); // log.debug( "Bottom border: " + xStyle.getBorderBottom() + " / " + xStyle.getBottomBorderXSSFColor().getARGBHex() ); break; } } } } } }