private void writeAnchors( final XmlWriter xmlWriter, final ReportElement realBackground ) throws IOException { if ( realBackground != null ) { final String[] anchors = new String[0]; // realBackground.getAnchors(); for ( int i = 0; i < anchors.length; i++ ) { final String anchor = anchors[i]; xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor, XmlWriterSupport.CLOSE ); } } }
public void writeLocalAnchor( final StyleSheet styleSheet ) throws IOException { final String anchor = (String) styleSheet.getStyleProperty( ElementStyleKeys.ANCHOR_NAME ); if ( anchor != null ) { xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, A_TAG, "name", anchor, XmlWriterSupport.CLOSE ); } }
protected void writeRuntimeInformation( final BundleWriterState state, final XmlWriter writer ) throws IOException { if ( state == null ) { throw new NullPointerException(); } if ( writer == null ) { throw new NullPointerException(); } writer.writeTag( BundleNamespaces.SETTINGS, "runtime", XmlWriterSupport.OPEN ); writer.writeCloseTag(); }
protected void addLinebreak() { try { result = true; xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, BR_TAG, XmlWriterSupport.CLOSE ); } catch ( final IOException e ) { throw new HtmlOutputProcessingException( "Failed to perform IO", e ); } }
public static void writeDefaultDataFactory( final DataFactory dataFactory, final XmlWriter writer ) throws IOException { String dataFactoryClass = null; if ( dataFactory != null ) { if ( hasPublicDefaultConstructor( dataFactory.getClass() ) ) { dataFactoryClass = dataFactory.getClass().getName(); } } if ( dataFactoryClass == null ) { return; } final AttributeList attr = new AttributeList(); attr.setAttribute( ExtParserModule.NAMESPACE, "type", dataFactoryClass ); writer.writeTag( ExtParserModule.NAMESPACE, "data-factory", attr, XmlWriterSupport.CLOSE ); }
protected boolean startOtherBox( final RenderBox box ) { try { xmlWriter.writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "other-box", createBoxAttributeList( box ), XmlWriter.OPEN ); writeElementAttributes( box ); return true; } catch ( IOException e ) { throw new InvalidReportStateException( e.getMessage(), e ); } }
private boolean startBox( final RenderBox box, final String tagName ) { try { xmlWriter.writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, tagName, createBoxAttributeList( box ), XmlWriter.OPEN ); writeElementAttributes( box ); return true; } catch ( IOException e ) { throw new InvalidReportStateException( e.getMessage(), e ); } }
protected boolean startBox( final RenderBox box, final String tagName ) { try { xmlWriter .writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, tagName, createBoxAttributeList( box ), XmlWriter.OPEN ); writeElementAttributes( box ); return true; } catch ( IOException e ) { throw new InvalidReportStateException( e.getMessage(), e ); } }
protected boolean startRowBox( final RenderBox box ) { try { xmlWriter .writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "row", createBoxAttributeList( box ), XmlWriter.OPEN ); writeElementAttributes( box ); return true; } catch ( IOException e ) { throw new InvalidReportStateException( e.getMessage(), e ); } }
private void writeMeta( final XmlWriter writer, final String name, final String value ) throws IOException { if ( value == null ) { return; } final AttributeList attrList = new AttributeList(); attrList.setAttribute( XHTML_NAMESPACE, "name", name ); attrList.setAttribute( XHTML_NAMESPACE, "content", value ); writer.writeTag( XHTML_NAMESPACE, "meta", attrList, XmlWriterSupport.CLOSE ); }
private void writeImageTag( final StyleSheet styleSheet, final long width, final long height, final long contentWidth, final long contentHeight, AttributeList attrList ) throws IOException { final StyleBuilder imgStyle = produceImageStyle( styleSheet, width, height, contentWidth, contentHeight ); if ( imgStyle == null ) { final AttributeList clipAttrList = new AttributeList(); final StyleBuilder divStyle = produceClipStyle( width, height ); tagHelper.getStyleManager().updateStyle( divStyle, clipAttrList ); xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, clipAttrList, XmlWriterSupport.OPEN ); xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, IMG_TAG, attrList, XmlWriterSupport.CLOSE ); xmlWriter.writeCloseTag(); } else { tagHelper.getStyleManager().updateStyle( imgStyle, attrList ); xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, IMG_TAG, attrList, XmlWriterSupport.CLOSE ); } }
protected boolean startTableCellBox( final TableCellRenderBox box ) { try { AttributeList attrs = createBoxAttributeList( box ); attrs.setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "col-span", String.valueOf( box.getColSpan() ) ); attrs.setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "row-span", String.valueOf( box.getRowSpan() ) ); attrs .setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "col-index", String.valueOf( box.getColumnIndex() ) ); xmlWriter.writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "table-cell", attrs, XmlWriter.OPEN ); writeElementAttributes( box ); return true; } catch ( IOException e ) { throw new InvalidReportStateException( e.getMessage(), e ); } }
protected boolean startTableCellBox( final TableCellRenderBox box ) { try { AttributeList attrs = createBoxAttributeList( box ); attrs.setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "col-span", String.valueOf( box.getColSpan() ) ); attrs.setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "row-span", String.valueOf( box.getRowSpan() ) ); attrs .setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "col-index", String.valueOf( box.getColumnIndex() ) ); xmlWriter.writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "table-cell", attrs, XmlWriter.OPEN ); writeElementAttributes( box ); return true; } catch ( IOException e ) { throw new InvalidReportStateException( e.getMessage(), e ); } }
public void open() throws IOException { final DefaultTagDescription td = new DefaultTagDescription(); td.setNamespaceHasCData( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, false ); td.setElementHasCData( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "text", true ); // prepare anything that might needed to be prepared .. final String encoding = metaData.getConfiguration().getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.xml.Encoding", EncodingRegistry.getPlatformDefaultEncoding() ); final Writer writer = new BufferedWriter( new OutputStreamWriter( outputStream, encoding ) ); this.xmlWriter = new XmlWriter( writer, td ); this.xmlWriter.writeXmlDeclaration( encoding ); final AttributeList attrs = new AttributeList(); attrs.addNamespaceDeclaration( "", XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE ); xmlWriter.writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "layout-output", attrs, XmlWriter.OPEN ); }
public void open() throws IOException { final DefaultTagDescription td = new DefaultTagDescription(); td.setNamespaceHasCData( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, false ); td.setElementHasCData( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "text", true ); // prepare anything that might needed to be prepared .. final String encoding = metaData.getConfiguration().getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.xml.Encoding", EncodingRegistry.getPlatformDefaultEncoding() ); final Writer writer = new BufferedWriter( new OutputStreamWriter( outputStream, encoding ) ); this.xmlWriter = new XmlWriter( writer, td ); this.xmlWriter.writeXmlDeclaration( null ); final AttributeList attrs = new AttributeList(); attrs.addNamespaceDeclaration( "", XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE ); xmlWriter.writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "layout-output", attrs, XmlWriter.OPEN ); }
private static void writeStyleRule( final XmlWriter writer, final ElementStyleRule styleRule ) throws IOException { if ( styleRule.getSelectorCount() == 0 && styleRule.getDefinedPropertyNamesArray().length == 0 ) { return; } writer.writeTag( BundleNamespaces.STYLE, "rule", XmlWriter.OPEN ); final NamespaceCollection collection = StyleSheetParserUtil.getInstance().getNamespaceCollection(); for ( int i = 0; i < styleRule.getSelectorCount(); i += 1 ) { writer.writeTag( BundleNamespaces.STYLE, "selector", XmlWriter.OPEN ); writer.writeTextNormalized( styleRule.getSelector( i ).print( collection ), false ); writer.writeCloseTag(); } StyleWriterUtility.writeStyleRule( BundleNamespaces.STYLE, "styles", writer, styleRule ); writer.writeCloseTag(); }
protected void generateHeaderOnOpen( final ReportAttributeMap attributeMap, final String sheetName, final XmlWriter xmlWriter ) throws IOException { if ( isCreateBodyFragment() == false ) { if ( isInlineStylesRequested() ) { writeCompleteHeader( xmlWriter, sheetName, attributeMap, null, null ); } else { if ( isExternalStyleSheetRequested() ) { if ( isForceBufferedWriting() == false ) { writeCompleteHeader( xmlWriter, sheetName, attributeMap, styleFileUrl, null ); } } } xmlWriter.writeTag( HtmlPrinter.XHTML_NAMESPACE, "body", XmlWriterSupport.OPEN ); } }
/** * Writes the functions to XML. * * @throws IOException * if there is an I/O problem. * @throws ReportWriterException * if the report function definition could not be written. */ public void write() throws IOException, ReportWriterException { if ( shouldWriteFunctions() ) { final XmlWriter writer = getXmlWriter(); writer.writeTag( ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.FUNCTIONS_TAG, XmlWriterSupport.OPEN ); writeExpressions( getReport().getExpressions() ); writer.writeCloseTag(); } }
private void writeAttributes( final XmlWriter writer, final DataAttributes attributes ) throws BeanException, IOException { final AttributeList attributeList = new AttributeList(); final String[] domains = attributes.getMetaAttributeDomains(); for ( int i = 0; i < domains.length; i++ ) { final String domain = domains[i]; final String[] names = attributes.getMetaAttributeNames( domain ); for ( int j = 0; j < names.length; j++ ) { final String name = names[j]; final Object value = attributes.getMetaAttribute( domain, name, null, context ); final String stringValue = ConverterRegistry.toAttributeValue( value ); attributeList.setAttribute( domain, name, stringValue ); } } writer .writeTag( ClassicEngineBoot.DATASCHEMA_NAMESPACE, "column-attributes", attributeList, XmlWriterSupport.CLOSE ); }
public void processLogicalPage( final LogicalPageKey key, final LogicalPageBox logicalPage ) throws IOException { final float width = (float) StrictGeomUtility.toExternalValue( logicalPage.getPageWidth() ); final float height = (float) StrictGeomUtility.toExternalValue( logicalPage.getPageHeight() ); final AttributeList pageAttributes = new AttributeList(); pageAttributes.setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "logical-page-number", pointIntConverter .format( key.getPosition() ) ); pageAttributes.setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "width", pointConverter.format( width ) ); pageAttributes.setAttribute( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "height", pointConverter.format( height ) ); xmlWriter.writeTag( XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "logical-page", pageAttributes, XmlWriter.OPEN ); // and now process the box .. drawArea = new StrictBounds( 0, 0, logicalPage.getPageWidth(), logicalPage.getPageHeight() ); processPage( logicalPage ); xmlWriter.writeCloseTag(); }