Java Code Examples for org.pentaho.reporting.engine.classic.core.Element#getStyleExpressions()

The following examples show how to use org.pentaho.reporting.engine.classic.core.Element#getStyleExpressions() . 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: AbstractElementWriteHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void writeStyleExpressions( final WriteableDocumentBundle bundle, final BundleWriterState state,
    final Element element, final XmlWriter writer ) throws IOException, BundleWriterException {
  if ( bundle == null ) {
    throw new NullPointerException();
  }
  if ( state == null ) {
    throw new NullPointerException();
  }
  if ( element == null ) {
    throw new NullPointerException();
  }
  if ( writer == null ) {
    throw new NullPointerException();
  }

  // write style expressions.
  final Map<StyleKey, Expression> styleExpressions = element.getStyleExpressions();
  for ( final Map.Entry<StyleKey, Expression> entry : styleExpressions.entrySet() ) {
    final StyleKey key = entry.getKey();
    final Expression ex = entry.getValue();
    ExpressionWriterUtility.writeStyleExpression( bundle, state, ex, writer, key, BundleNamespaces.LAYOUT,
        "style-expression" );
  }
}
 
Example 2
Source File: ReportDescriptionWriter.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void writeStyleInfo( final Element band ) throws IOException, ReportWriterException {
  final XmlWriter writer = getXmlWriter();
  final ElementStyleSheet styleSheet = band.getStyle();
  if ( isStyleSheetEmpty( styleSheet ) == false ) {
    writer.writeTag( ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.STYLE_TAG, XmlWriterSupport.OPEN );

    final StyleWriter styleWriter = new StyleWriter( getReportWriter(), band.getStyle(), writer );
    styleWriter.write();
    writer.writeCloseTag();
  }

  final Map<StyleKey, Expression> styleExpressions = band.getStyleExpressions();
  if ( styleExpressions.isEmpty() == false ) {
    final FunctionsWriter fnWriter = new FunctionsWriter( getReportWriter(), writer );
    for ( final Map.Entry<StyleKey, Expression> entry : styleExpressions.entrySet() ) {
      final StyleKey key = entry.getKey();
      final Expression ex = entry.getValue();
      fnWriter.writeStyleExpression( ex, key );
    }
  }
}