diff options
Diffstat (limited to 'examples')
42 files changed, 426 insertions, 426 deletions
diff --git a/examples/embedding/java/embedding/ExampleAWTViewer.java b/examples/embedding/java/embedding/ExampleAWTViewer.java index 716ea1487..9822e47e5 100644 --- a/examples/embedding/java/embedding/ExampleAWTViewer.java +++ b/examples/embedding/java/embedding/ExampleAWTViewer.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; //Java diff --git a/examples/embedding/java/embedding/ExampleDOM2PDF.java b/examples/embedding/java/embedding/ExampleDOM2PDF.java index 9caa5b72a..6bf05827c 100644 --- a/examples/embedding/java/embedding/ExampleDOM2PDF.java +++ b/examples/embedding/java/embedding/ExampleDOM2PDF.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -55,7 +55,7 @@ public class ExampleDOM2PDF { // configure fopFactory as desired private FopFactory fopFactory = FopFactory.newInstance(); - + /** xsl-fo namespace URI */ protected static String foNS = "http://www.w3.org/1999/XSL/Format"; @@ -68,31 +68,31 @@ public class ExampleDOM2PDF { try { FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // configure foUserAgent as desired - + // Setup output OutputStream out = new java.io.FileOutputStream(pdf); out = new java.io.BufferedOutputStream(out); - + try { // Construct fop with desired output format and output stream Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); - + // Setup Identity Transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - + // Setup input for XSLT transformation Source src = new DOMSource(xslfoDoc); - + // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); } finally { out.close(); } - + } catch (Exception e) { e.printStackTrace(System.err); System.exit(-1); @@ -107,24 +107,24 @@ public class ExampleDOM2PDF { public static void main(String[] args) { try { System.out.println("FOP ExampleDOM2PDF\n"); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - + //Setup output file File pdffile = new File(outDir, "ResultDOM2PDF.pdf"); System.out.println("PDF Output File: " + pdffile); System.out.println(); - + Document foDoc = buildDOMDocument(); - + ExampleDOM2PDF app = new ExampleDOM2PDF(); app.convertDOM2PDF(foDoc, pdffile); - + System.out.println("Success!"); - + } catch (Exception e) { e.printStackTrace(System.err); System.exit(-1); @@ -140,15 +140,15 @@ public class ExampleDOM2PDF { // Create a sample XSL-FO DOM document Document foDoc = null; Element root = null, ele1 = null, ele2 = null, ele3 = null; - + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); foDoc = db.newDocument(); - + root = foDoc.createElementNS(foNS, "fo:root"); foDoc.appendChild(root); - + ele1 = foDoc.createElementNS(foNS, "fo:layout-master-set"); root.appendChild(ele1); ele2 = foDoc.createElementNS(foNS, "fo:simple-page-master"); @@ -178,7 +178,7 @@ public class ExampleDOM2PDF { * @param newNodeName name of the new node * @param textVal content of the element */ - protected static void addElement(Node parent, String newNodeName, + protected static void addElement(Node parent, String newNodeName, String textVal) { if (textVal == null) { return; diff --git a/examples/embedding/java/embedding/ExampleFO2JPSPrint.java b/examples/embedding/java/embedding/ExampleFO2JPSPrint.java index a67e2bdad..4f18b71ab 100644 --- a/examples/embedding/java/embedding/ExampleFO2JPSPrint.java +++ b/examples/embedding/java/embedding/ExampleFO2JPSPrint.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -54,12 +54,12 @@ public class ExampleFO2JPSPrint { // configure fopFactory as desired private FopFactory fopFactory = FopFactory.newInstance(); - + private DocPrintJob createDocPrintJob() { PrintService[] services = PrintServiceLookup.lookupPrintServices( DocFlavor.SERVICE_FORMATTED.PAGEABLE, null); PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet(); - PrintService printService = ServiceUI.printDialog(null, 50, 50, + PrintService printService = ServiceUI.printDialog(null, 50, 50, services, services[0], null, attributes); if (printService != null) { return printService.createPrintJob(); @@ -67,7 +67,7 @@ public class ExampleFO2JPSPrint { return null; } } - + /** * Prints an FO file using JPS. * @param fo the FO file @@ -78,7 +78,7 @@ public class ExampleFO2JPSPrint { */ public void printFO(File fo) throws IOException, FOPException, TransformerException, PrintException { - + //Set up DocPrintJob instance DocPrintJob printJob = createDocPrintJob(); @@ -88,20 +88,20 @@ public class ExampleFO2JPSPrint { PageableRenderer renderer = new PageableRenderer(); renderer.setUserAgent(userAgent); userAgent.setRendererOverride(renderer); - + // Construct FOP with desired output format Fop fop = fopFactory.newFop(userAgent); // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - + // Setup input stream Source src = new StreamSource(fo); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); @@ -117,23 +117,23 @@ public class ExampleFO2JPSPrint { try { System.out.println("FOP ExampleFO2JPSPrint\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - //Setup input and output files + //Setup input and output files File fofile = new File(baseDir, "xml/fo/helloworld.fo"); System.out.println("Input: XSL-FO (" + fofile + ")"); System.out.println("Output: JPS (Java Printing System)"); System.out.println(); System.out.println("Transforming..."); - + ExampleFO2JPSPrint app = new ExampleFO2JPSPrint(); app.printFO(fofile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java b/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java index d9bc1d11d..885482dfb 100644 --- a/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java +++ b/examples/embedding/java/embedding/ExampleFO2OldStylePrint.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -44,7 +44,7 @@ public class ExampleFO2OldStylePrint { // configure fopFactory as desired private FopFactory fopFactory = FopFactory.newInstance(); - + /** * Prints an FO file using an old-style PrinterJob. * @param fo the FO file @@ -52,7 +52,7 @@ public class ExampleFO2OldStylePrint { * @throws FOPException In case of a FOP problem */ public void printFO(File fo) throws IOException, FOPException { - + //Set up PrinterJob instance PrinterJob printerJob = PrinterJob.getPrinterJob(); printerJob.setJobName("FOP Printing Example"); @@ -68,13 +68,13 @@ public class ExampleFO2OldStylePrint { // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - + // Setup input stream Source src = new StreamSource(fo); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); @@ -93,23 +93,23 @@ public class ExampleFO2OldStylePrint { try { System.out.println("FOP ExampleFO2OldStylePrint\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - //Setup input and output files + //Setup input and output files File fofile = new File(baseDir, "xml/fo/helloworld.fo"); System.out.println("Input: XSL-FO (" + fofile + ")"); System.out.println("Output: old-style printing using PrinterJob"); System.out.println(); System.out.println("Transforming..."); - + ExampleFO2OldStylePrint app = new ExampleFO2OldStylePrint(); app.printFO(fofile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleFO2PDF.java b/examples/embedding/java/embedding/ExampleFO2PDF.java index 3b239f11b..6ae674908 100644 --- a/examples/embedding/java/embedding/ExampleFO2PDF.java +++ b/examples/embedding/java/embedding/ExampleFO2PDF.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -60,13 +60,13 @@ public class ExampleFO2PDF { * @throws FOPException In case of a FOP problem */ public void convertFO2PDF(File fo, File pdf) throws IOException, FOPException { - + OutputStream out = null; - + try { FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // configure foUserAgent as desired - + // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); @@ -78,24 +78,24 @@ public class ExampleFO2PDF { // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - + // Setup input stream Source src = new StreamSource(fo); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); - + // Result processing FormattingResults foResults = fop.getResults(); java.util.List pageSequences = foResults.getPageSequences(); for (java.util.Iterator it = pageSequences.iterator(); it.hasNext();) { PageSequenceResults pageSequenceResults = (PageSequenceResults)it.next(); - System.out.println("PageSequence " - + (String.valueOf(pageSequenceResults.getID()).length() > 0 - ? pageSequenceResults.getID() : "<no id>") + System.out.println("PageSequence " + + (String.valueOf(pageSequenceResults.getID()).length() > 0 + ? pageSequenceResults.getID() : "<no id>") + " generated " + pageSequenceResults.getPageCount() + " pages."); } System.out.println("Generated " + foResults.getPageCount() + " pages in total."); @@ -117,13 +117,13 @@ public class ExampleFO2PDF { try { System.out.println("FOP ExampleFO2PDF\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - //Setup input and output files + //Setup input and output files File fofile = new File(baseDir, "xml/fo/helloworld.fo"); //File fofile = new File(baseDir, "../fo/pagination/franklin_2pageseqs.fo"); File pdffile = new File(outDir, "ResultFO2PDF.pdf"); @@ -132,10 +132,10 @@ public class ExampleFO2PDF { System.out.println("Output: PDF (" + pdffile + ")"); System.out.println(); System.out.println("Transforming..."); - + ExampleFO2PDF app = new ExampleFO2PDF(); app.convertFO2PDF(fofile, pdffile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java index c9422e1b9..e49eaed24 100644 --- a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java +++ b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -69,13 +69,13 @@ public class ExampleFO2PDFUsingSAXParser { // configure foUserAgent as desired OutputStream out = null; - + try { // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); out = new BufferedOutputStream(out); - + // Construct fop and setup output format Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); @@ -85,7 +85,7 @@ public class ExampleFO2PDFUsingSAXParser { factory.setNamespaceAware(true); // throws ParserConfigurationException SAXParser parser = factory.newSAXParser(); - + // Obtain FOP's DefaultHandler // throws FOPException DefaultHandler dh = fop.getDefaultHandler(); @@ -108,13 +108,13 @@ public class ExampleFO2PDFUsingSAXParser { try { System.out.println("FOP ExampleFO2PDFUsingSAXParser\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - //Setup input and output files + //Setup input and output files File fofile = new File(baseDir, "xml/fo/helloworld.fo"); File pdffile = new File(outDir, "ResultFO2PDFUsingSAXParser.pdf"); @@ -122,10 +122,10 @@ public class ExampleFO2PDFUsingSAXParser { System.out.println("Output: PDF (" + pdffile + ")"); System.out.println(); System.out.println("Transforming..."); - + ExampleFO2PDFUsingSAXParser app = new ExampleFO2PDFUsingSAXParser(); app.convertFO2PDF(fofile, pdffile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleFO2RTF.java b/examples/embedding/java/embedding/ExampleFO2RTF.java index b33fb13b8..68d63304f 100644 --- a/examples/embedding/java/embedding/ExampleFO2RTF.java +++ b/examples/embedding/java/embedding/ExampleFO2RTF.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -60,12 +60,12 @@ public class ExampleFO2RTF { * @throws FOPException In case of a FOP problem */ public void convertFO2RTF(File fo, File rtf) throws IOException, FOPException { - + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // configure foUserAgent as desired OutputStream out = null; - + try { // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). @@ -74,25 +74,25 @@ public class ExampleFO2RTF { // Construct fop with desired output format Fop fop = fopFactory.newFop(MimeConstants.MIME_RTF, foUserAgent, out); - + // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - + // Setup input stream Source src = new StreamSource(fo); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); - + // Please note: getResults() won't work for RTF and other flow formats (like MIF) // as the layout engine is not involved in the conversion. The page-breaking // is done by the application opening the generated file (like MS Word). //FormattingResults foResults = fop.getResults(); - + } catch (Exception e) { e.printStackTrace(System.err); System.exit(-1); @@ -110,13 +110,13 @@ public class ExampleFO2RTF { try { System.out.println("FOP ExampleFO2RTF\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - //Setup input and output files + //Setup input and output files File fofile = new File(baseDir, "xml/fo/helloworld.fo"); File rtffile = new File(outDir, "ResultFO2RTF.rtf"); @@ -124,10 +124,10 @@ public class ExampleFO2RTF { System.out.println("Output: PDF (" + rtffile + ")"); System.out.println(); System.out.println("Transforming..."); - + ExampleFO2RTF app = new ExampleFO2RTF(); app.convertFO2RTF(fofile, rtffile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleObj2PDF.java b/examples/embedding/java/embedding/ExampleObj2PDF.java index c3dcbc5d6..666b7e433 100644 --- a/examples/embedding/java/embedding/ExampleObj2PDF.java +++ b/examples/embedding/java/embedding/ExampleObj2PDF.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -43,7 +43,7 @@ import org.apache.fop.apps.MimeConstants; import embedding.model.ProjectTeam; /** - * This class demonstrates the conversion of an arbitrary object file to a + * This class demonstrates the conversion of an arbitrary object file to a * PDF using JAXP (XSLT) and FOP (XSL:FO). */ public class ExampleObj2PDF { @@ -60,9 +60,9 @@ public class ExampleObj2PDF { * @throws FOPException In case of a FOP problem * @throws TransformerException In case of a XSL transformation problem */ - public void convertProjectTeam2PDF(ProjectTeam team, File xslt, File pdf) + public void convertProjectTeam2PDF(ProjectTeam team, File xslt, File pdf) throws IOException, FOPException, TransformerException { - + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // configure foUserAgent as desired @@ -76,10 +76,10 @@ public class ExampleObj2PDF { // Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xslt)); - + // Setup input for XSLT transformation Source src = team.getSourceForProjectTeam(); - + // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); @@ -99,7 +99,7 @@ public class ExampleObj2PDF { try { System.out.println("FOP ExampleObj2PDF\n"); System.out.println("Preparing..."); - + // Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); @@ -117,7 +117,7 @@ public class ExampleObj2PDF { ExampleObj2PDF app = new ExampleObj2PDF(); app.convertProjectTeam2PDF(ExampleObj2XML.createSampleProjectTeam(), xsltfile, pdffile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleObj2XML.java b/examples/embedding/java/embedding/ExampleObj2XML.java index 90f9ba5b0..71a027192 100644 --- a/examples/embedding/java/embedding/ExampleObj2XML.java +++ b/examples/embedding/java/embedding/ExampleObj2XML.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; //Hava @@ -36,7 +36,7 @@ import embedding.model.ProjectTeam; /** - * This class demonstrates the conversion of an arbitrary object file to an + * This class demonstrates the conversion of an arbitrary object file to an * XML file. */ public class ExampleObj2XML { @@ -48,20 +48,20 @@ public class ExampleObj2XML { * @throws IOException In case of an I/O problem * @throws TransformerException In case of a XSL transformation problem */ - public void convertProjectTeam2XML(ProjectTeam team, File xml) + public void convertProjectTeam2XML(ProjectTeam team, File xml) throws IOException, TransformerException { - + //Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); /* Note: We use the identity transformer, no XSL transformation is done. - The transformer is basically just used to serialize the + The transformer is basically just used to serialize the generated document to XML. */ - + //Setup input Source src = team.getSourceForProjectTeam(); - + //Setup output Result res = new StreamResult(xml); @@ -97,7 +97,7 @@ public class ExampleObj2XML { try { System.out.println("FOP ExampleObj2XML\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); @@ -113,7 +113,7 @@ public class ExampleObj2XML { ExampleObj2XML app = new ExampleObj2XML(); app.convertProjectTeam2XML(createSampleProjectTeam(), xmlfile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleSVG2PDF.java b/examples/embedding/java/embedding/ExampleSVG2PDF.java index ca0f46146..d152db7ae 100644 --- a/examples/embedding/java/embedding/ExampleSVG2PDF.java +++ b/examples/embedding/java/embedding/ExampleSVG2PDF.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; //Java @@ -47,22 +47,22 @@ public class ExampleSVG2PDF { * @throws TranscoderException In case of a transcoding problem */ public void convertSVG2PDF(File svg, File pdf) throws IOException, TranscoderException { - + //Create transcoder Transcoder transcoder = new PDFTranscoder(); //Transcoder transcoder = new org.apache.fop.render.ps.PSTranscoder(); - + //Setup input InputStream in = new java.io.FileInputStream(svg); try { TranscoderInput input = new TranscoderInput(in); - + //Setup output OutputStream out = new java.io.FileOutputStream(pdf); out = new java.io.BufferedOutputStream(out); try { TranscoderOutput output = new TranscoderOutput(out); - + //Do the transformation transcoder.transcode(input, output); } finally { @@ -82,13 +82,13 @@ public class ExampleSVG2PDF { try { System.out.println("FOP ExampleSVG2PDF\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - //Setup input and output files + //Setup input and output files File svgfile = new File(baseDir, "xml/svg/helloworld.svg"); File pdffile = new File(outDir, "ResultSVG2PDF.pdf"); @@ -96,10 +96,10 @@ public class ExampleSVG2PDF { System.out.println("Output: PDF (" + pdffile + ")"); System.out.println(); System.out.println("Transforming..."); - + ExampleSVG2PDF app = new ExampleSVG2PDF(); app.convertSVG2PDF(svgfile, pdffile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleXML2FO.java b/examples/embedding/java/embedding/ExampleXML2FO.java index 07b946435..c5638c45b 100644 --- a/examples/embedding/java/embedding/ExampleXML2FO.java +++ b/examples/embedding/java/embedding/ExampleXML2FO.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; //Java @@ -47,19 +47,19 @@ public class ExampleXML2FO { * @throws IOException In case of an I/O problem * @throws TransformerException In case of a XSL transformation problem */ - public void convertXML2FO(File xml, File xslt, File fo) + public void convertXML2FO(File xml, File xslt, File fo) throws IOException, TransformerException { - + //Setup output OutputStream out = new java.io.FileOutputStream(fo); try { //Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xslt)); - + //Setup input for XSLT transformation Source src = new StreamSource(xml); - + //Resulting SAX events (the generated FO) must be piped through to FOP Result res = new StreamResult(out); @@ -85,7 +85,7 @@ public class ExampleXML2FO { File outDir = new File(baseDir, "out"); outDir.mkdirs(); - //Setup input and output files + //Setup input and output files File xmlfile = new File(baseDir, "xml/xml/projectteam.xml"); File xsltfile = new File(baseDir, "xml/xslt/projectteam2fo.xsl"); File fofile = new File(outDir, "ResultXML2FO.fo"); @@ -95,10 +95,10 @@ public class ExampleXML2FO { System.out.println("Output: XSL-FO (" + fofile + ")"); System.out.println(); System.out.println("Transforming..."); - + ExampleXML2FO app = new ExampleXML2FO(); app.convertXML2FO(xmlfile, xsltfile, fofile); - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/ExampleXML2PDF.java b/examples/embedding/java/embedding/ExampleXML2PDF.java index 2769b032a..a7c8e2a41 100644 --- a/examples/embedding/java/embedding/ExampleXML2PDF.java +++ b/examples/embedding/java/embedding/ExampleXML2PDF.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; //Java @@ -38,7 +38,7 @@ import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; /** - * This class demonstrates the conversion of an XML file to PDF using + * This class demonstrates the conversion of an XML file to PDF using * JAXP (XSLT) and FOP (XSL-FO). */ public class ExampleXML2PDF { @@ -57,7 +57,7 @@ public class ExampleXML2PDF { File outDir = new File(baseDir, "out"); outDir.mkdirs(); - // Setup input and output files + // Setup input and output files File xmlfile = new File(baseDir, "xml/xml/projectteam.xml"); File xsltfile = new File(baseDir, "xml/xslt/projectteam2fo.xsl"); File pdffile = new File(outDir, "ResultXML2PDF.pdf"); @@ -67,7 +67,7 @@ public class ExampleXML2PDF { System.out.println("Output: PDF (" + pdffile + ")"); System.out.println(); System.out.println("Transforming..."); - + // configure fopFactory as desired FopFactory fopFactory = FopFactory.newInstance(); @@ -77,30 +77,30 @@ public class ExampleXML2PDF { // Setup output OutputStream out = new java.io.FileOutputStream(pdffile); out = new java.io.BufferedOutputStream(out); - + try { // Construct fop with desired output format Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); - + // Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xsltfile)); - + // Set the value of a <param> in the stylesheet transformer.setParameter("versionParam", "2.0"); - + // Setup input for XSLT transformation Source src = new StreamSource(xmlfile); - + // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); } finally { out.close(); } - + System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(System.err); diff --git a/examples/embedding/java/embedding/MultipleFO2PDF.java b/examples/embedding/java/embedding/MultipleFO2PDF.java index 7a30f0905..a9ace7cf0 100644 --- a/examples/embedding/java/embedding/MultipleFO2PDF.java +++ b/examples/embedding/java/embedding/MultipleFO2PDF.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding; // Java @@ -59,26 +59,26 @@ public class MultipleFO2PDF { // JAXP TransformerFactory can be reused, too private TransformerFactory factory = TransformerFactory.newInstance(); - + /** * Converts an FO file to a PDF file using FOP * @param fo the FO file * @param pdf the target PDF file - * @throws TransformerException in case of a transformation problem + * @throws TransformerException in case of a transformation problem * @throws IOException in case of an I/O problem * @throws FOPException in case of a FOP problem * @return the formatting results of the run */ - public FormattingResults convertFO2PDF(File fo, File pdf) + public FormattingResults convertFO2PDF(File fo, File pdf) throws TransformerException, IOException, FOPException { - + OutputStream out = null; Fop fop; - + try { FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); // configure foUserAgent as desired - + // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); @@ -89,13 +89,13 @@ public class MultipleFO2PDF { // Setup JAXP using identity transformer Transformer transformer = factory.newTransformer(); // identity transformer - + // Setup input stream Source src = new StreamSource(fo); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); } finally { @@ -105,7 +105,7 @@ public class MultipleFO2PDF { return fop.getResults(); } - /** + /** * Listens on standard in for names of fo files to be transformed to pdf. * 'quit' or the null string (for piped input) cause the listener to stop listening. */ @@ -116,10 +116,10 @@ public class MultipleFO2PDF { File outDir = new File(baseDir, "out"); outDir.mkdirs(); BufferedReader in = new BufferedReader(new java.io.InputStreamReader(System.in)); - + while (true) { try { - // Listen for the input file name + // Listen for the input file name System.out.print("Input XSL-FO file ('quit' to stop): "); String foname = in.readLine(); if (foname == null) { @@ -146,9 +146,9 @@ public class MultipleFO2PDF { java.util.List pageSequences = foResults.getPageSequences(); for (java.util.Iterator it = pageSequences.iterator(); it.hasNext();) { PageSequenceResults pageSequenceResults = (PageSequenceResults)it.next(); - System.out.println("PageSequence " - + (String.valueOf(pageSequenceResults.getID()).length() > 0 - ? pageSequenceResults.getID() : "<no id>") + System.out.println("PageSequence " + + (String.valueOf(pageSequenceResults.getID()).length() > 0 + ? pageSequenceResults.getID() : "<no id>") + " generated " + pageSequenceResults.getPageCount() + " pages."); } System.out.println("Generated " + foResults.getPageCount() + " pages in total."); @@ -161,7 +161,7 @@ public class MultipleFO2PDF { } } } - + /** * Main method. Set up the listener. * @param args command-line arguments diff --git a/examples/embedding/java/embedding/events/ExampleEvents.java b/examples/embedding/java/embedding/events/ExampleEvents.java index 9c52e4ba1..4f0b5c0c2 100644 --- a/examples/embedding/java/embedding/events/ExampleEvents.java +++ b/examples/embedding/java/embedding/events/ExampleEvents.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.events; import java.io.BufferedOutputStream; @@ -68,21 +68,21 @@ public class ExampleEvents { */ public void convertFO2PDF(URL fo, File pdf) throws IOException, FOPException, TransformerException { - + OutputStream out = null; - + try { //Create the user agent for this processing run FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); - + //Adding a simple logging listener that writes to stdout and stderr foUserAgent.getEventBroadcaster().addEventListener(new SysOutEventListener()); - + // Add your own event listener foUserAgent.getEventBroadcaster().addEventListener(new MyEventListener()); - + // configure foUserAgent further as desired - + // Setup output stream. Note: Using BufferedOutputStream // for performance reasons (helpful with FileOutputStreams). out = new FileOutputStream(pdf); @@ -94,13 +94,13 @@ public class ExampleEvents { // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); // identity transformer - + // Setup input stream Source src = new StreamSource(fo.toExternalForm()); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); - + // Start XSLT transformation and FOP processing transformer.transform(src, res); @@ -114,7 +114,7 @@ public class ExampleEvents { public void processEvent(Event event) { if ("org.apache.fop.events.ResourceEventProducer.imageNotFound" .equals(event.getEventID())) { - + //Get the FileNotFoundException that's part of the event's parameters FileNotFoundException fnfe = (FileNotFoundException)event.getParam("fnfe"); @@ -122,16 +122,16 @@ public class ExampleEvents { + "!!! ===---"); //Stop processing when an image could not be found. Otherwise, FOP would just //continue without the image! - + System.out.println("Throwing a RuntimeException..."); throw new RuntimeException(EventFormatter.format(event), fnfe); } else { //ignore all other events } } - + } - + /** A simple event listener that writes the events to stdout and sterr. */ private static class SysOutEventListener implements EventListener { @@ -152,7 +152,7 @@ public class ExampleEvents { } } } - + /** * This method extracts the original exception from some exception. The exception @@ -185,7 +185,7 @@ public class ExampleEvents { try { System.out.println("FOP ExampleEvents\n"); System.out.println("Preparing..."); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); @@ -199,9 +199,9 @@ public class ExampleEvents { System.out.println("Output: PDF (" + pdffile + ")"); System.out.println(); System.out.println("Transforming..."); - + ExampleEvents app = new ExampleEvents(); - + try { app.convertFO2PDF(fo, pdffile); } catch (TransformerException te) { @@ -215,7 +215,7 @@ public class ExampleEvents { System.out.println("Aborted!"); System.exit(-1); } - + System.out.println("Success!"); } catch (Exception e) { //Some other error (shouldn't happen in this example) diff --git a/examples/embedding/java/embedding/intermediate/ExampleConcat.java b/examples/embedding/java/embedding/intermediate/ExampleConcat.java index 07790309d..6967ebc8a 100644 --- a/examples/embedding/java/embedding/intermediate/ExampleConcat.java +++ b/examples/embedding/java/embedding/intermediate/ExampleConcat.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.intermediate; import java.io.File; @@ -81,26 +81,26 @@ public class ExampleConcat { * @throws FOPException In case of a FOP problem * @throws TransformerException In case of a XSL transformation problem */ - public void convertToIntermediate(Source src, Source xslt, File intermediate) + public void convertToIntermediate(Source src, Source xslt, File intermediate) throws IOException, FOPException, TransformerException { - + //Create a user agent FOUserAgent userAgent = fopFactory.newFOUserAgent(); - + //Create an instance of the target renderer so the XMLRenderer can use its font setup Renderer targetRenderer = userAgent.getRendererFactory().createRenderer( - userAgent, MimeConstants.MIME_PDF); - + userAgent, MimeConstants.MIME_PDF); + //Create the XMLRenderer to create the intermediate format (area tree XML) XMLRenderer xmlRenderer = new XMLRenderer(); xmlRenderer.setUserAgent(userAgent); - + //Tell the XMLRenderer to mimic the target renderer xmlRenderer.mimicRenderer(targetRenderer); - + //Make sure the prepared XMLRenderer is used userAgent.setRendererOverride(xmlRenderer); - + // Setup output OutputStream out = new java.io.FileOutputStream(intermediate); out = new java.io.BufferedOutputStream(out); @@ -117,7 +117,7 @@ public class ExampleConcat { } else { transformer = factory.newTransformer(); } - + // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); @@ -136,7 +136,7 @@ public class ExampleConcat { * @throws TransformerException In case of a XSL transformation problem * @throws SAXException In case of an XML-related problem */ - public void concatToPDF(File[] files, File pdffile) + public void concatToPDF(File[] files, File pdffile) throws IOException, TransformerException, SAXException { // Setup output OutputStream out = new java.io.FileOutputStream(pdffile); @@ -147,23 +147,23 @@ public class ExampleConcat { FOUserAgent userAgent = fopFactory.newFOUserAgent(); //Construct the AreaTreeModel that will received the individual pages - AreaTreeModel treeModel = new RenderPagesModel(userAgent, + AreaTreeModel treeModel = new RenderPagesModel(userAgent, MimeConstants.MIME_PDF, fontInfo, out); - + //Iterate over all intermediate files AreaTreeParser parser = new AreaTreeParser(); for (int i = 0; i < files.length; i++) { Source src = new StreamSource(files[i]); parser.parse(src, treeModel, userAgent); } - + //Signal the end of the processing. The renderer can finalize the target document. treeModel.endDocument(); } finally { out.close(); } } - + /** * Main method. * @param args command-line arguments @@ -171,12 +171,12 @@ public class ExampleConcat { public static void main(String[] args) { try { System.out.println("FOP ExampleConcat\n"); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - + //Setup output file File xsltfile = new File(baseDir, "xml/xslt/projectteam2fo.xsl"); File[] files = new File[] { @@ -184,31 +184,31 @@ public class ExampleConcat { new File(outDir, "team2.at.xml")}; File pdffile = new File(outDir, "ResultConcat.pdf"); for (int i = 0; i < files.length; i++) { - System.out.println("Intermediate file " + (i + 1) + ": " + System.out.println("Intermediate file " + (i + 1) + ": " + files[i].getCanonicalPath()); } System.out.println("PDF Output File: " + pdffile.getCanonicalPath()); System.out.println(); - + ProjectTeam team1 = ExampleObj2XML.createSampleProjectTeam(); ProjectTeam team2 = createAnotherProjectTeam(); - + ExampleConcat app = new ExampleConcat(); - + //Create intermediate files app.convertToIntermediate( - team1.getSourceForProjectTeam(), + team1.getSourceForProjectTeam(), new StreamSource(xsltfile), files[0]); app.convertToIntermediate( - team2.getSourceForProjectTeam(), + team2.getSourceForProjectTeam(), new StreamSource(xsltfile), files[1]); - + //Concatenate the individual intermediate files to one document app.concatToPDF(files, pdffile); - + System.out.println("Success!"); - + } catch (Exception e) { e.printStackTrace(System.err); System.exit(-1); diff --git a/examples/embedding/java/embedding/intermediate/ExampleStamp.java b/examples/embedding/java/embedding/intermediate/ExampleStamp.java index b1b0b77e7..c6123b718 100644 --- a/examples/embedding/java/embedding/intermediate/ExampleStamp.java +++ b/examples/embedding/java/embedding/intermediate/ExampleStamp.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.intermediate; import java.io.File; @@ -50,7 +50,7 @@ public class ExampleStamp { // configure fopFactory as desired private FopFactory fopFactory = FopFactory.newInstance(); - + /** * Stamps an intermediate file and renders it to a PDF file. * @param atfile the intermediate file (area tree XML) @@ -60,7 +60,7 @@ public class ExampleStamp { * @throws TransformerException In case of a XSL transformation problem * @throws SAXException In case of an XML-related problem */ - public void stampToPDF(File atfile, File stampSheet, File pdffile) + public void stampToPDF(File atfile, File stampSheet, File pdffile) throws IOException, TransformerException, SAXException { // Setup output OutputStream out = new java.io.FileOutputStream(pdffile); @@ -71,31 +71,31 @@ public class ExampleStamp { FOUserAgent userAgent = fopFactory.newFOUserAgent(); //Construct the AreaTreeModel that will received the individual pages - AreaTreeModel treeModel = new RenderPagesModel(userAgent, + AreaTreeModel treeModel = new RenderPagesModel(userAgent, MimeConstants.MIME_PDF, fontInfo, out); - + //Iterate over all intermediate files AreaTreeParser parser = new AreaTreeParser(); Source src = new StreamSource(atfile); Source xslt = new StreamSource(stampSheet); - + //Setup Transformer for XSLT processing TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(xslt); - + //Send XSLT result to AreaTreeParser SAXResult res = new SAXResult(parser.getContentHandler(treeModel, userAgent)); - + //Start XSLT transformation and area tree parsing transformer.transform(src, res); - + //Signal the end of the processing. The renderer can finalize the target document. treeModel.endDocument(); } finally { out.close(); } } - + /** * Main method. * @param args command-line arguments @@ -103,12 +103,12 @@ public class ExampleStamp { public static void main(String[] args) { try { System.out.println("FOP ExampleConcat\n"); - + //Setup directories File baseDir = new File("."); File outDir = new File(baseDir, "out"); outDir.mkdirs(); - + //Setup output file File xsltfile = new File(baseDir, "xml/xslt/projectteam2fo.xsl"); File atfile = new File(outDir, "team.at.xml"); @@ -120,19 +120,19 @@ public class ExampleStamp { System.out.println(); ProjectTeam team1 = ExampleObj2XML.createSampleProjectTeam(); - + //Create intermediate file ExampleConcat concatapp = new ExampleConcat(); concatapp.convertToIntermediate( - team1.getSourceForProjectTeam(), + team1.getSourceForProjectTeam(), new StreamSource(xsltfile), atfile); - + //Stamp document and produce a PDF from the intermediate format ExampleStamp app = new ExampleStamp(); app.stampToPDF(atfile, stampxsltfile, pdffile); - + System.out.println("Success!"); - + } catch (Exception e) { e.printStackTrace(System.err); System.exit(-1); diff --git a/examples/embedding/java/embedding/model/ProjectMember.java b/examples/embedding/java/embedding/model/ProjectMember.java index 0efc6d514..4b602b87f 100644 --- a/examples/embedding/java/embedding/model/ProjectMember.java +++ b/examples/embedding/java/embedding/model/ProjectMember.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.model; /** @@ -34,8 +34,8 @@ public class ProjectMember { */ public ProjectMember() { } - - + + /** * Convenience constructor. * @param name name of the project member diff --git a/examples/embedding/java/embedding/model/ProjectTeam.java b/examples/embedding/java/embedding/model/ProjectTeam.java index 3dfceb3db..47ae2b569 100644 --- a/examples/embedding/java/embedding/model/ProjectTeam.java +++ b/examples/embedding/java/embedding/model/ProjectTeam.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.model; import java.util.List; diff --git a/examples/embedding/java/embedding/model/ProjectTeamInputSource.java b/examples/embedding/java/embedding/model/ProjectTeamInputSource.java index 2953f41d7..dd9d31236 100644 --- a/examples/embedding/java/embedding/model/ProjectTeamInputSource.java +++ b/examples/embedding/java/embedding/model/ProjectTeamInputSource.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.model; import org.xml.sax.InputSource; diff --git a/examples/embedding/java/embedding/model/ProjectTeamXMLReader.java b/examples/embedding/java/embedding/model/ProjectTeamXMLReader.java index c86f94f9a..b08351a86 100644 --- a/examples/embedding/java/embedding/model/ProjectTeamXMLReader.java +++ b/examples/embedding/java/embedding/model/ProjectTeamXMLReader.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.model; //Java @@ -60,18 +60,18 @@ public class ProjectTeamXMLReader extends AbstractObjectReader { if (handler == null) { throw new IllegalStateException("ContentHandler not set"); } - + //Start the document handler.startDocument(); - + //Generate SAX events for the ProjectTeam generateFor(projectTeam); - + //End the document - handler.endDocument(); + handler.endDocument(); } - + /** * Generates SAX events for a ProjectTeam object. * @param projectTeam ProjectTeam object to use @@ -84,7 +84,7 @@ public class ProjectTeamXMLReader extends AbstractObjectReader { if (handler == null) { throw new IllegalStateException("ContentHandler not set"); } - + handler.startElement("projectteam"); handler.element("projectname", projectTeam.getProjectName()); Iterator i = projectTeam.getMembers().iterator(); @@ -107,7 +107,7 @@ public class ProjectTeamXMLReader extends AbstractObjectReader { if (handler == null) { throw new IllegalStateException("ContentHandler not set"); } - + handler.startElement("member"); handler.element("name", projectMember.getName()); handler.element("function", projectMember.getFunction()); diff --git a/examples/embedding/java/embedding/tools/AbstractObjectReader.java b/examples/embedding/java/embedding/tools/AbstractObjectReader.java index 8ec4836bb..641a90ca3 100644 --- a/examples/embedding/java/embedding/tools/AbstractObjectReader.java +++ b/examples/embedding/java/embedding/tools/AbstractObjectReader.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.tools; //Java @@ -33,7 +33,7 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.EntityResolver; /** - * This class can be used as base class for XMLReaders that generate SAX + * This class can be used as base class for XMLReaders that generate SAX * events from Java objects. */ @@ -43,10 +43,10 @@ public abstract class AbstractObjectReader implements XMLReader { "http://xml.org/sax/features/namespaces"; private static final String NS_PREFIXES = "http://xml.org/sax/features/namespace-prefixes"; - + private Map features = new java.util.HashMap(); private ContentHandler orgHandler; - + /** Proxy for easy SAX event generation */ protected EasyGenerationContentHandlerProxy handler; /** Error handler */ @@ -60,7 +60,7 @@ public abstract class AbstractObjectReader implements XMLReader { setFeature(NAMESPACES, false); setFeature(NS_PREFIXES, false); } - + /* ============ XMLReader interface ============ */ /** diff --git a/examples/embedding/java/embedding/tools/EasyGenerationContentHandlerProxy.java b/examples/embedding/java/embedding/tools/EasyGenerationContentHandlerProxy.java index fe35ad426..c9780a1c1 100644 --- a/examples/embedding/java/embedding/tools/EasyGenerationContentHandlerProxy.java +++ b/examples/embedding/java/embedding/tools/EasyGenerationContentHandlerProxy.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package embedding.tools; //SAX @@ -28,10 +28,10 @@ import org.xml.sax.helpers.AttributesImpl; /** * This class is an implementation of ContentHandler which acts as a proxy to - * another ContentHandler and has the purpose to provide a few handy methods + * another ContentHandler and has the purpose to provide a few handy methods * that make life easier when generating SAX events. * <br> - * Note: This class is only useful for simple cases with no namespaces. + * Note: This class is only useful for simple cases with no namespaces. */ public class EasyGenerationContentHandlerProxy implements ContentHandler { @@ -64,8 +64,8 @@ public class EasyGenerationContentHandlerProxy implements ContentHandler { /** * Sends the notification of the beginning of an element. * @param name Name for the element. - * @param atts The attributes attached to the element. If there are no - * attributes, it shall be an empty Attributes object. + * @param atts The attributes attached to the element. If there are no + * attributes, it shall be an empty Attributes object. * @throws SAXException Any SAX exception, possibly wrapping another exception. */ public void startElement(String name, Attributes atts) throws SAXException { @@ -108,8 +108,8 @@ public class EasyGenerationContentHandlerProxy implements ContentHandler { * Sends notifications for a whole element with some String content. * @param name Name for the element. * @param value Content of the element. - * @param atts The attributes attached to the element. If there are no - * attributes, it shall be an empty Attributes object. + * @param atts The attributes attached to the element. If there are no + * attributes, it shall be an empty Attributes object. * @throws SAXException Any SAX exception, possibly wrapping another exception. */ public void element(String name, String value, Attributes atts) throws SAXException { @@ -165,7 +165,7 @@ public class EasyGenerationContentHandlerProxy implements ContentHandler { /** * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) */ - public void startElement(String namespaceURI, String localName, + public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { target.startElement(namespaceURI, localName, qName, atts); } @@ -174,7 +174,7 @@ public class EasyGenerationContentHandlerProxy implements ContentHandler { /** * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ - public void endElement(String namespaceURI, String localName, String qName) + public void endElement(String namespaceURI, String localName, String qName) throws SAXException { target.endElement(namespaceURI, localName, qName); } diff --git a/examples/hyphenation/src/org/apache/fop/hyphenation/HyphenationTreeAnalysis.java b/examples/hyphenation/src/org/apache/fop/hyphenation/HyphenationTreeAnalysis.java index ccd86ab25..dc8e16202 100644 --- a/examples/hyphenation/src/org/apache/fop/hyphenation/HyphenationTreeAnalysis.java +++ b/examples/hyphenation/src/org/apache/fop/hyphenation/HyphenationTreeAnalysis.java @@ -33,15 +33,15 @@ import java.util.zip.ZipFile; import java.util.zip.ZipEntry; /** - * This class provides some useful methods to print the structure of a HyphenationTree object + * This class provides some useful methods to print the structure of a HyphenationTree object */ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { /** - * The HyphenationTree object to analyse + * The HyphenationTree object to analyse */ protected HyphenationTree ht; - + /** * @param ht the HyphenationTree object */ @@ -49,7 +49,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { super(ht); this.ht = ht; } - + /** * Class representing a node of the HyphenationTree object */ @@ -65,7 +65,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { value = readValue().toString(); } } - + private StringBuffer readValue() { StringBuffer s = new StringBuffer(); int i = (int) ht.eq[index]; @@ -100,7 +100,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { return super.toNodeString(); } } - + /* (non-Javadoc) * @see org.apache.fop.hyphenation.TernaryTreeAnalysis.Node#toCompactString() */ @@ -118,7 +118,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { return super.toCompactString(); } } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ @@ -130,7 +130,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { } return s.toString(); } - + } private void addNode(int nodeIndex, List strings, NodeString ns) { @@ -182,7 +182,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { } tree.append(indentString); tree.append(ns.string + "\n"); - + if (i + 1 == strings.size()) { continue; } @@ -199,10 +199,10 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { } tree.append(indentString + "\n"); } - + return tree.toString(); } - + /** * Construct the tree representation of the HyphenationTree object * @return the string representing the tree @@ -214,7 +214,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { addNode(1, strings, ns); return toTree(strings); } - + /** * Construct the compact node representation of the HyphenationTree object * @return the string representing the tree @@ -229,7 +229,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { } return s.toString(); } - + /** * Construct the node representation of the HyphenationTree object * @return the string representing the tree @@ -244,17 +244,17 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { } return s.toString(); } - + /** * Construct the printed representation of the HyphenationTree object * @return the string representing the tree */ public String toString() { StringBuffer s = new StringBuffer(); - + s.append("classes: \n"); s.append((new TernaryTreeAnalysis(ht.classmap)).toString()); - + s.append("\npatterns: \n"); s.append(super.toString()); s.append("vspace: "); @@ -275,12 +275,12 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { } } s.append("\n"); - + return s.toString(); } /** - * Provide interactive access to a HyphenationTree object and its representation methods + * Provide interactive access to a HyphenationTree object and its representation methods * @param args the arguments */ public static void main(String[] args) { @@ -327,7 +327,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { System.out.print("Object file name: "); token = in.readLine().trim(); try { - String[] parts = token.split(":"); + String[] parts = token.split(":"); InputStream is = null; if (parts.length == 1) { is = new FileInputStream(token); @@ -399,7 +399,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { try { BufferedReader reader = new BufferedReader(new FileReader(token)); String line; - + starttime = System.currentTimeMillis(); while ((line = reader.readLine()) != null) { // System.out.print("\nline: "); @@ -422,7 +422,7 @@ public class HyphenationTreeAnalysis extends TernaryTreeAnalysis { long result = endtime - starttime; System.out.println(counter + " words in " + result + " Milliseconds hyphenated"); - + } else if (token.equals("q")) { break; } diff --git a/examples/hyphenation/src/org/apache/fop/hyphenation/TernaryTreeAnalysis.java b/examples/hyphenation/src/org/apache/fop/hyphenation/TernaryTreeAnalysis.java index 9ac6ff804..a783716a5 100644 --- a/examples/hyphenation/src/org/apache/fop/hyphenation/TernaryTreeAnalysis.java +++ b/examples/hyphenation/src/org/apache/fop/hyphenation/TernaryTreeAnalysis.java @@ -23,15 +23,15 @@ import java.util.ArrayList; import java.util.List; /** - * This class provides some useful methods to print the structure of a TernaryTree object + * This class provides some useful methods to print the structure of a TernaryTree object */ public class TernaryTreeAnalysis { /** - * The TernaryTree object to analyse + * The TernaryTree object to analyse */ protected TernaryTree tt; - + /** * @param tt the TernaryTree object */ @@ -43,27 +43,27 @@ public class TernaryTreeAnalysis { * Class representing a string of nodes in the tree representation of a TernaryTree */ public static class NodeString { - + /** - * The node string being constructed + * The node string being constructed */ public StringBuffer string = new StringBuffer(); - + /** - * The indent of the node string + * The indent of the node string */ public int indent; - + /** - * The list of branchpoints into the high direction + * The list of branchpoints into the high direction */ public List high = new ArrayList(); - + /** - * The list of branchpoints into the low direction + * The list of branchpoints into the low direction */ public List low = new ArrayList(); - + /** * @param indent the indent of the nodestring */ @@ -78,34 +78,34 @@ public class TernaryTreeAnalysis { * Class representing a node of the TernaryTree object */ protected class Node { - + /** - * The index of the node + * The index of the node */ protected int index = 0; - + /** - * The index of the high node + * The index of the high node */ protected int high = 0; - + /** - * The index of the high node + * The index of the high node */ protected int low = 0; - + /** - * The index of the equal node + * The index of the equal node */ protected int equal = 0; - + /** - * The key following the node + * The key following the node */ protected String key = null; - + /** - * True if this is a leaf node + * True if this is a leaf node */ protected boolean isLeafNode = false; @@ -132,7 +132,7 @@ public class TernaryTreeAnalysis { equal = tt.eq[index]; } } - + private StringBuffer readKey() { StringBuffer s = new StringBuffer(); int i = (int) tt.lo[index]; @@ -160,7 +160,7 @@ public class TernaryTreeAnalysis { } return s.toString(); } - + /** * Construct the compact string representation of the node * @return the string representing the node @@ -184,7 +184,7 @@ public class TernaryTreeAnalysis { } return s.toString(); } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ @@ -204,9 +204,9 @@ public class TernaryTreeAnalysis { } return s.toString(); } - + } - + /** * Construct the compact node representation of the TernaryTree object * @return the string representing the tree @@ -221,7 +221,7 @@ public class TernaryTreeAnalysis { } return s.toString(); } - + /** * Construct the node representation of the TernaryTree object * @return the string representing the tree @@ -236,7 +236,7 @@ public class TernaryTreeAnalysis { } return s.toString(); } - + private static StringBuffer toString(char[] c) { StringBuffer s = new StringBuffer(); for (int i = 0; i < c.length; ++i) { @@ -244,8 +244,8 @@ public class TernaryTreeAnalysis { s.append(","); } return s; - } - + } + /* (non-Javadoc) * @see java.lang.Object#toString() */ @@ -255,15 +255,15 @@ public class TernaryTreeAnalysis { s.append("hi: "); s.append(toString(tt.hi)); s.append("\n"); - + s.append("eq: "); s.append(toString(tt.eq)); s.append("\n"); - + s.append("lo: "); s.append(toString(tt.lo)); s.append("\n"); - + s.append("sc: "); for (int i = 0; i < tt.sc.length; ++i) { if (tt.sc[i] == 0) { @@ -275,7 +275,7 @@ public class TernaryTreeAnalysis { } } s.append("\n"); - + s.append("kv: "); for (int i = 0; i < tt.kv.length(); ++i) { if (tt.kv.get(i) == 0) { @@ -285,17 +285,17 @@ public class TernaryTreeAnalysis { } } s.append("\n"); - + s.append("freenode: "); s.append((int) tt.freenode); s.append("\n"); - + s.append("root: "); s.append((int) tt.root); s.append("\n"); - + return s.toString(); } - + } diff --git a/examples/mathml/src/org/apache/fop/mathml/ImageLoaderFactoryMathML.java b/examples/mathml/src/org/apache/fop/mathml/ImageLoaderFactoryMathML.java index b0e94222a..cac43c721 100644 --- a/examples/mathml/src/org/apache/fop/mathml/ImageLoaderFactoryMathML.java +++ b/examples/mathml/src/org/apache/fop/mathml/ImageLoaderFactoryMathML.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,28 +30,28 @@ public class ImageLoaderFactoryMathML extends AbstractImageLoaderFactory { /** MathML MIME type */ public static final String MIME_MATHML = "text/mathml"; - + private static final ImageFlavor[] FLAVORS = new ImageFlavor[] { ImageFlavor.GRAPHICS2D}; - + private static final String[] MIMES = new String[] { MIME_MATHML}; - + /** {@inheritDoc} */ public String[] getSupportedMIMETypes() { return MIMES; } - + /** {@inheritDoc} */ public ImageFlavor[] getSupportedFlavors(String mime) { return FLAVORS; } - + /** {@inheritDoc} */ public ImageLoader newImageLoader(ImageFlavor targetFlavor) { return new ImageLoaderMathML(targetFlavor); } - + /** {@inheritDoc} */ public int getUsagePenalty(String mime, ImageFlavor flavor) { return 0; diff --git a/examples/mathml/src/org/apache/fop/mathml/ImageLoaderMathML.java b/examples/mathml/src/org/apache/fop/mathml/ImageLoaderMathML.java index 900b9d614..d110ca3dc 100644 --- a/examples/mathml/src/org/apache/fop/mathml/ImageLoaderMathML.java +++ b/examples/mathml/src/org/apache/fop/mathml/ImageLoaderMathML.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,7 +47,7 @@ public class ImageLoaderMathML extends AbstractImageLoader { } this.targetFlavor = targetFlavor; } - + /** {@inheritDoc} */ public ImageFlavor getTargetFlavor() { return this.targetFlavor; diff --git a/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java b/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java index 82bd85a17..9bd326f2b 100644 --- a/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java +++ b/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.mathml; import java.awt.Color; @@ -59,9 +59,9 @@ public class MathMLElement extends MathMLObj { } /** {@inheritDoc} */ - public void processNode(String elementName, - Locator locator, - Attributes attlist, + public void processNode(String elementName, + Locator locator, + Attributes attlist, PropertyList propertyList) throws FOPException { super.processNode(elementName, locator, attlist, propertyList); createBasicDocument(); diff --git a/examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java b/examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java index fdfa0b5c7..c9854d1c7 100644 --- a/examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java +++ b/examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.mathml; import java.util.HashMap; @@ -32,7 +32,7 @@ import org.apache.fop.fo.FONode; public class MathMLElementMapping extends ElementMapping { /** MathML Namespace */ - public static final String NAMESPACE = "http://www.w3.org/1998/Math/MathML"; + public static final String NAMESPACE = "http://www.w3.org/1998/Math/MathML"; /** Main constructor. */ public MathMLElementMapping() { diff --git a/examples/mathml/src/org/apache/fop/mathml/MathMLObj.java b/examples/mathml/src/org/apache/fop/mathml/MathMLObj.java index 9d2b78047..f2f5317e3 100644 --- a/examples/mathml/src/org/apache/fop/mathml/MathMLObj.java +++ b/examples/mathml/src/org/apache/fop/mathml/MathMLObj.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.mathml; // FOP diff --git a/examples/mathml/src/org/apache/fop/mathml/PreloaderMathML.java b/examples/mathml/src/org/apache/fop/mathml/PreloaderMathML.java index 3015462ce..193ccf6e3 100644 --- a/examples/mathml/src/org/apache/fop/mathml/PreloaderMathML.java +++ b/examples/mathml/src/org/apache/fop/mathml/PreloaderMathML.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.mathml; import java.awt.Dimension; @@ -58,8 +58,8 @@ public class PreloaderMathML extends AbstractImagePreloader { private static Log log = LogFactory.getLog(PreloaderMathML.class); private boolean jeuclidAvailable = true; - - /** {@inheritDoc} */ + + /** {@inheritDoc} */ public ImageInfo preloadImage(String uri, Source src, ImageContext context) throws IOException { if (!ImageUtil.hasInputStream(src)) { @@ -89,21 +89,21 @@ public class PreloaderMathML extends AbstractImagePreloader { * class. */ class Loader { - + private ImageInfo getImage(String uri, Source src, ImageContext context) { InputStream in = new UnclosableInputStream(ImageUtil.needInputStream(src)); try { int length = in.available(); in.mark(length + 1); - + TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); Source source = new StreamSource(in); SAXMathBuilder mathBuilder = new SAXMathBuilder(); SAXResult res = new SAXResult(mathBuilder); transformer.transform(source, res); - + String fontname = "Helvetica"; int fontstyle = 0; int displayfontsize = 12; @@ -122,7 +122,7 @@ public class PreloaderMathML extends AbstractImagePreloader { mathBuilder.getMathRootElement(), fontname, fontstyle, inlinefontsize, displayfontsize); - + ImageInfo info = new ImageInfo(uri, "text/mathml"); final ImageSize size = new ImageSize(); size.setSizeInMillipoints( @@ -142,13 +142,13 @@ public class PreloaderMathML extends AbstractImagePreloader { public void paint(Graphics2D g2d, Rectangle2D area) { base.paint(g2d); } - + }; - + //The whole image had to be loaded for this, so keep it Image image = new ImageGraphics2D(info, painter); info.getCustomObjects().put(ImageInfo.ORIGINAL_IMAGE, image); - + return info; } catch (NoClassDefFoundError ncdfe) { try { diff --git a/examples/plan/src/org/apache/fop/plan/ActionInfo.java b/examples/plan/src/org/apache/fop/plan/ActionInfo.java index 350ccce8f..1535ed5ec 100644 --- a/examples/plan/src/org/apache/fop/plan/ActionInfo.java +++ b/examples/plan/src/org/apache/fop/plan/ActionInfo.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,13 +16,13 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.util.Date; public class ActionInfo { - + public static final int TASK = 1; public static final int MILESTONE = 2; public static final int GROUPING = 3; diff --git a/examples/plan/src/org/apache/fop/plan/EventList.java b/examples/plan/src/org/apache/fop/plan/EventList.java index 188c9975a..53b32f7c0 100644 --- a/examples/plan/src/org/apache/fop/plan/EventList.java +++ b/examples/plan/src/org/apache/fop/plan/EventList.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,13 +16,13 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.util.List; public class EventList { - + private List data = new java.util.ArrayList(); public void addGroupInfo(GroupInfo set) { diff --git a/examples/plan/src/org/apache/fop/plan/GroupInfo.java b/examples/plan/src/org/apache/fop/plan/GroupInfo.java index e94170d76..a83228197 100644 --- a/examples/plan/src/org/apache/fop/plan/GroupInfo.java +++ b/examples/plan/src/org/apache/fop/plan/GroupInfo.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,13 +16,13 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.util.List; public class GroupInfo { - + private String name; private List actions = new java.util.ArrayList(); diff --git a/examples/plan/src/org/apache/fop/plan/Main.java b/examples/plan/src/org/apache/fop/plan/Main.java index c2b1a5ad5..7b6f5a05e 100644 --- a/examples/plan/src/org/apache/fop/plan/Main.java +++ b/examples/plan/src/org/apache/fop/plan/Main.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.io.InputStream; diff --git a/examples/plan/src/org/apache/fop/plan/PlanDrawer.java b/examples/plan/src/org/apache/fop/plan/PlanDrawer.java index 8398659e0..7f79bb737 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanDrawer.java +++ b/examples/plan/src/org/apache/fop/plan/PlanDrawer.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.util.HashMap; @@ -27,7 +27,7 @@ import org.w3c.dom.Document; * This interface defines how a plan drawer is converted. */ public interface PlanDrawer { - + Document createDocument(EventList data, float w, float h, HashMap hints); } diff --git a/examples/plan/src/org/apache/fop/plan/PlanElement.java b/examples/plan/src/org/apache/fop/plan/PlanElement.java index d910076c6..e7fb8a1e7 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanElement.java +++ b/examples/plan/src/org/apache/fop/plan/PlanElement.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.awt.geom.Point2D; @@ -48,7 +48,7 @@ public class PlanElement extends PlanObj { } /** {@inheritDoc} */ - public void processNode(String elementName, Locator locator, + public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList propertyList) throws FOPException { super.processNode(elementName, locator, attlist, propertyList); @@ -67,7 +67,7 @@ public class PlanElement extends PlanObj { svgDoc = pr.createSVGDocument(doc); width = pr.getWidth(); height = pr.getHeight(); - + doc = svgDoc; } } catch (Throwable t) { diff --git a/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java b/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java index c33c25edf..781fd8371 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java +++ b/examples/plan/src/org/apache/fop/plan/PlanElementMapping.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import org.w3c.dom.DOMImplementation; @@ -30,7 +30,7 @@ import org.apache.fop.fo.FONode; public class PlanElementMapping extends ElementMapping { /** Plan Namespace */ - public static final String NAMESPACE = "http://xmlgraphics.apache.org/fop/plan"; + public static final String NAMESPACE = "http://xmlgraphics.apache.org/fop/plan"; /** Main constructor. */ public PlanElementMapping() { diff --git a/examples/plan/src/org/apache/fop/plan/PlanHints.java b/examples/plan/src/org/apache/fop/plan/PlanHints.java index 0411262ab..2a2c1333a 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanHints.java +++ b/examples/plan/src/org/apache/fop/plan/PlanHints.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,14 +16,14 @@ */ /* $Id$ */ - + package org.apache.fop.plan; /** * This interface defines some constants for use in the plan package. */ public interface PlanHints { - + /** Border attribute */ public static final String PLAN_BORDER = "border"; /** Legend attribute */ diff --git a/examples/plan/src/org/apache/fop/plan/PlanObj.java b/examples/plan/src/org/apache/fop/plan/PlanObj.java index 36f3243a6..ca26a8039 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanObj.java +++ b/examples/plan/src/org/apache/fop/plan/PlanObj.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; // FOP diff --git a/examples/plan/src/org/apache/fop/plan/PlanRenderer.java b/examples/plan/src/org/apache/fop/plan/PlanRenderer.java index 0b592adc6..8b7978259 100644 --- a/examples/plan/src/org/apache/fop/plan/PlanRenderer.java +++ b/examples/plan/src/org/apache/fop/plan/PlanRenderer.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; @@ -34,9 +34,9 @@ import org.w3c.dom.NodeList; import org.apache.batik.dom.svg.SVGDOMImplementation; public class PlanRenderer { - + private static final String SVG_NAMESPACE = SVGDOMImplementation.SVG_NAMESPACE_URI; - + private String fontFamily = "sansserif"; private float fontSize = 12; private String type = ""; diff --git a/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java b/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java index 58d5be477..b8a7a612c 100644 --- a/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java +++ b/examples/plan/src/org/apache/fop/plan/PreloaderPlan.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.io.IOException; @@ -52,7 +52,7 @@ public class PreloaderPlan extends AbstractImagePreloader { /** Logger instance */ private static Log log = LogFactory.getLog(PreloaderPlan.class); - /** {@inheritDoc} */ + /** {@inheritDoc} */ public ImageInfo preloadImage(String uri, Source src, ImageContext context) throws IOException { if (!ImageUtil.hasInputStream(src)) { @@ -75,13 +75,13 @@ public class PreloaderPlan extends AbstractImagePreloader { Source source = new StreamSource(in); DOMResult res = new DOMResult(); transformer.transform(source, res); - + //Have to render the plan to know its size PlanRenderer pr = new PlanRenderer(); Document svgDoc = pr.createSVGDocument((Document)res.getNode()); float width = pr.getWidth(); float height = pr.getHeight(); - + //Return converted SVG image ImageInfo info = new ImageInfo(uri, "image/svg+xml"); final ImageSize size = new ImageSize(); @@ -97,7 +97,7 @@ public class PreloaderPlan extends AbstractImagePreloader { Image image = new ImageXMLDOM(info, svgDoc, svgDoc.getDocumentElement().getNamespaceURI()); info.getCustomObjects().put(ImageInfo.ORIGINAL_IMAGE, image); - + return info; } catch (TransformerException e) { try { diff --git a/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java b/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java index 71025f15b..b49256a31 100644 --- a/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java +++ b/examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.plan; import java.text.DateFormat; @@ -35,9 +35,9 @@ import org.apache.fop.svg.SVGUtilities; * Simple plan drawer implementation. */ public class SimplePlanDrawer implements PlanDrawer { - + private static final String SVG_NAMESPACE = SVGDOMImplementation.SVG_NAMESPACE_URI; - + private float fontSize; private HashMap hints; private java.awt.Font font = null; @@ -91,8 +91,8 @@ public class SimplePlanDrawer implements PlanDrawer { svgRoot.setAttributeNS(null, "width", "" + width); svgRoot.setAttributeNS(null, "height", "" + height); svgRoot.setAttributeNS(null, "style", - "font-size:" + 8 - + ";font-family:" + "font-size:" + 8 + + ";font-family:" + hints.get(PlanHints.FONT_FAMILY)); font = new java.awt.Font((String)hints.get(PlanHints.FONT_FAMILY), @@ -249,8 +249,8 @@ public class SimplePlanDrawer implements PlanDrawer { taskGraphic = SVGUtilities.createRect(doc, left + daysToStart * 300 / (totalDays - 2), topEdge + 2, days * 300 / (totalDays - 2), 10); - taskGraphic.setAttributeNS(null, - "style", + taskGraphic.setAttributeNS(null, + "style", "stroke:black;fill:blue;stroke-width:1;clip-path:url(#clip3)"); g.appendChild(taskGraphic); break; @@ -259,8 +259,8 @@ public class SimplePlanDrawer implements PlanDrawer { "m " + (left + daysToStart * 300 / (totalDays - 2) - 6) + " " + (topEdge + 6) + "l6 6l6-6l-6-6z"); - taskGraphic.setAttributeNS(null, - "style", + taskGraphic.setAttributeNS(null, + "style", "stroke:black;fill:black;stroke-width:1;clip-path:url(#clip3)"); g.appendChild(taskGraphic); text = SVGUtilities.createText(doc, @@ -271,7 +271,7 @@ public class SimplePlanDrawer implements PlanDrawer { break; case ActionInfo.GROUPING: taskGraphic = SVGUtilities.createPath(doc, - "m " + (left + "m " + (left + daysToStart * 300 / (totalDays - 2) - 6) + " " + (topEdge + 6) + "l6 -6l" + (days * 300 / (totalDays - 2)) @@ -279,7 +279,7 @@ public class SimplePlanDrawer implements PlanDrawer { + -(days * 300 / (totalDays - 2) - 8) + " 0l-4 4l-6-6z"); taskGraphic.setAttributeNS(null, - "style", + "style", "stroke:black;fill:black;stroke-width:1;clip-path:url(#clip3)"); g.appendChild(taskGraphic); break; |