Browse Source

Merge from Trunk revisions 677589 to 679734.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@679781 13f79535-47bb-0310-9956-ffa450edef68
pull/17/head
Jeremias Maerki 16 years ago
parent
commit
ccc9b4e77c
100 changed files with 919 additions and 904 deletions
  1. 3
    3
      examples/embedding/java/embedding/ExampleAWTViewer.java
  2. 21
    21
      examples/embedding/java/embedding/ExampleDOM2PDF.java
  3. 14
    14
      examples/embedding/java/embedding/ExampleFO2JPSPrint.java
  4. 11
    11
      examples/embedding/java/embedding/ExampleFO2OldStylePrint.java
  5. 16
    16
      examples/embedding/java/embedding/ExampleFO2PDF.java
  6. 10
    10
      examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java
  7. 14
    14
      examples/embedding/java/embedding/ExampleFO2RTF.java
  8. 10
    10
      examples/embedding/java/embedding/ExampleObj2PDF.java
  9. 11
    11
      examples/embedding/java/embedding/ExampleObj2XML.java
  10. 11
    11
      examples/embedding/java/embedding/ExampleSVG2PDF.java
  11. 10
    10
      examples/embedding/java/embedding/ExampleXML2FO.java
  12. 13
    13
      examples/embedding/java/embedding/ExampleXML2PDF.java
  13. 18
    18
      examples/embedding/java/embedding/MultipleFO2PDF.java
  14. 20
    20
      examples/embedding/java/embedding/events/ExampleEvents.java
  15. 28
    28
      examples/embedding/java/embedding/intermediate/ExampleConcat.java
  16. 19
    19
      examples/embedding/java/embedding/intermediate/ExampleStamp.java
  17. 5
    5
      examples/embedding/java/embedding/model/ProjectMember.java
  18. 3
    3
      examples/embedding/java/embedding/model/ProjectTeam.java
  19. 3
    3
      examples/embedding/java/embedding/model/ProjectTeamInputSource.java
  20. 10
    10
      examples/embedding/java/embedding/model/ProjectTeamXMLReader.java
  21. 7
    7
      examples/embedding/java/embedding/tools/AbstractObjectReader.java
  22. 11
    11
      examples/embedding/java/embedding/tools/EasyGenerationContentHandlerProxy.java
  23. 21
    21
      examples/hyphenation/src/org/apache/fop/hyphenation/HyphenationTreeAnalysis.java
  24. 41
    41
      examples/hyphenation/src/org/apache/fop/hyphenation/TernaryTreeAnalysis.java
  25. 8
    8
      examples/mathml/src/org/apache/fop/mathml/ImageLoaderFactoryMathML.java
  26. 3
    3
      examples/mathml/src/org/apache/fop/mathml/ImageLoaderMathML.java
  27. 6
    6
      examples/mathml/src/org/apache/fop/mathml/MathMLElement.java
  28. 4
    4
      examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java
  29. 3
    3
      examples/mathml/src/org/apache/fop/mathml/MathMLObj.java
  30. 12
    12
      examples/mathml/src/org/apache/fop/mathml/PreloaderMathML.java
  31. 4
    4
      examples/plan/src/org/apache/fop/plan/ActionInfo.java
  32. 4
    4
      examples/plan/src/org/apache/fop/plan/EventList.java
  33. 4
    4
      examples/plan/src/org/apache/fop/plan/GroupInfo.java
  34. 3
    3
      examples/plan/src/org/apache/fop/plan/Main.java
  35. 4
    4
      examples/plan/src/org/apache/fop/plan/PlanDrawer.java
  36. 5
    5
      examples/plan/src/org/apache/fop/plan/PlanElement.java
  37. 4
    4
      examples/plan/src/org/apache/fop/plan/PlanElementMapping.java
  38. 4
    4
      examples/plan/src/org/apache/fop/plan/PlanHints.java
  39. 3
    3
      examples/plan/src/org/apache/fop/plan/PlanObj.java
  40. 5
    5
      examples/plan/src/org/apache/fop/plan/PlanRenderer.java
  41. 7
    7
      examples/plan/src/org/apache/fop/plan/PreloaderPlan.java
  42. 13
    13
      examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java
  43. 1
    1
      src/codegen/java/org/apache/fop/tools/EventConventionException.java
  44. 11
    7
      src/codegen/java/org/apache/fop/tools/EventProducerCollector.java
  45. 17
    6
      src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
  46. 7
    7
      src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java
  47. 10
    10
      src/documentation/content/xdocs/DnI/BookMaker.java
  48. 1
    1
      src/documentation/content/xdocs/trunk/anttask.xml
  49. 4
    4
      src/java/org/apache/fop/Version.java
  50. 7
    7
      src/java/org/apache/fop/apps/FOPException.java
  51. 13
    13
      src/java/org/apache/fop/apps/FOURIResolver.java
  52. 5
    5
      src/java/org/apache/fop/apps/FOUserAgent.java
  53. 9
    9
      src/java/org/apache/fop/apps/Fop.java
  54. 7
    7
      src/java/org/apache/fop/apps/FopFactory.java
  55. 2
    2
      src/java/org/apache/fop/apps/FopFactoryConfigurator.java
  56. 2
    2
      src/java/org/apache/fop/apps/FormattingResults.java
  57. 10
    10
      src/java/org/apache/fop/apps/MimeConstants.java
  58. 2
    2
      src/java/org/apache/fop/apps/PageSequenceResults.java
  59. 5
    5
      src/java/org/apache/fop/area/AbstractOffDocumentItem.java
  60. 18
    18
      src/java/org/apache/fop/area/Area.java
  61. 6
    6
      src/java/org/apache/fop/area/AreaEventProducer.java
  62. 29
    29
      src/java/org/apache/fop/area/AreaTreeHandler.java
  63. 5
    5
      src/java/org/apache/fop/area/AreaTreeModel.java
  64. 7
    7
      src/java/org/apache/fop/area/AreaTreeObject.java
  65. 39
    39
      src/java/org/apache/fop/area/AreaTreeParser.java
  66. 3
    3
      src/java/org/apache/fop/area/BeforeFloat.java
  67. 5
    5
      src/java/org/apache/fop/area/Block.java
  68. 5
    5
      src/java/org/apache/fop/area/BlockParent.java
  69. 3
    3
      src/java/org/apache/fop/area/BlockViewport.java
  70. 4
    4
      src/java/org/apache/fop/area/BodyRegion.java
  71. 5
    5
      src/java/org/apache/fop/area/BookmarkData.java
  72. 4
    4
      src/java/org/apache/fop/area/CTM.java
  73. 6
    6
      src/java/org/apache/fop/area/CachedRenderPagesModel.java
  74. 3
    3
      src/java/org/apache/fop/area/DestinationData.java
  75. 3
    3
      src/java/org/apache/fop/area/Footnote.java
  76. 18
    18
      src/java/org/apache/fop/area/IDTracker.java
  77. 11
    11
      src/java/org/apache/fop/area/LineArea.java
  78. 3
    3
      src/java/org/apache/fop/area/LinkResolver.java
  79. 4
    4
      src/java/org/apache/fop/area/MainReference.java
  80. 4
    4
      src/java/org/apache/fop/area/NormalFlow.java
  81. 3
    3
      src/java/org/apache/fop/area/OffDocumentExtensionAttachment.java
  82. 5
    5
      src/java/org/apache/fop/area/OffDocumentItem.java
  83. 15
    15
      src/java/org/apache/fop/area/Page.java
  84. 8
    8
      src/java/org/apache/fop/area/PageSequence.java
  85. 55
    55
      src/java/org/apache/fop/area/PageViewport.java
  86. 9
    9
      src/java/org/apache/fop/area/RegionReference.java
  87. 5
    5
      src/java/org/apache/fop/area/RegionViewport.java
  88. 8
    8
      src/java/org/apache/fop/area/RenderPagesModel.java
  89. 4
    4
      src/java/org/apache/fop/area/Resolvable.java
  90. 22
    22
      src/java/org/apache/fop/area/Span.java
  91. 10
    10
      src/java/org/apache/fop/area/Trait.java
  92. 9
    9
      src/java/org/apache/fop/area/inline/AbstractTextArea.java
  93. 3
    3
      src/java/org/apache/fop/area/inline/Anchor.java
  94. 3
    3
      src/java/org/apache/fop/area/inline/Container.java
  95. 6
    6
      src/java/org/apache/fop/area/inline/FilledArea.java
  96. 6
    6
      src/java/org/apache/fop/area/inline/ForeignObject.java
  97. 3
    3
      src/java/org/apache/fop/area/inline/Image.java
  98. 19
    19
      src/java/org/apache/fop/area/inline/InlineArea.java
  99. 2
    2
      src/java/org/apache/fop/area/inline/InlineBlockParent.java
  100. 0
    0
      src/java/org/apache/fop/area/inline/InlineParent.java

+ 3
- 3
examples/embedding/java/embedding/ExampleAWTViewer.java View File

@@ -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

+ 21
- 21
examples/embedding/java/embedding/ExampleDOM2PDF.java View File

@@ -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;

+ 14
- 14
examples/embedding/java/embedding/ExampleFO2JPSPrint.java View File

@@ -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);

+ 11
- 11
examples/embedding/java/embedding/ExampleFO2OldStylePrint.java View File

@@ -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);

+ 16
- 16
examples/embedding/java/embedding/ExampleFO2PDF.java View File

@@ -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);

+ 10
- 10
examples/embedding/java/embedding/ExampleFO2PDFUsingSAXParser.java View File

@@ -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);

+ 14
- 14
examples/embedding/java/embedding/ExampleFO2RTF.java View File

@@ -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);

+ 10
- 10
examples/embedding/java/embedding/ExampleObj2PDF.java View File

@@ -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);

+ 11
- 11
examples/embedding/java/embedding/ExampleObj2XML.java View File

@@ -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);

+ 11
- 11
examples/embedding/java/embedding/ExampleSVG2PDF.java View File

@@ -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);

+ 10
- 10
examples/embedding/java/embedding/ExampleXML2FO.java View File

@@ -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);

+ 13
- 13
examples/embedding/java/embedding/ExampleXML2PDF.java View File

@@ -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);

+ 18
- 18
examples/embedding/java/embedding/MultipleFO2PDF.java View File

@@ -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

+ 20
- 20
examples/embedding/java/embedding/events/ExampleEvents.java View File

@@ -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)

+ 28
- 28
examples/embedding/java/embedding/intermediate/ExampleConcat.java View File

@@ -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);

+ 19
- 19
examples/embedding/java/embedding/intermediate/ExampleStamp.java View File

@@ -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);

+ 5
- 5
examples/embedding/java/embedding/model/ProjectMember.java View File

@@ -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

+ 3
- 3
examples/embedding/java/embedding/model/ProjectTeam.java View File

@@ -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;

+ 3
- 3
examples/embedding/java/embedding/model/ProjectTeamInputSource.java View File

@@ -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;

+ 10
- 10
examples/embedding/java/embedding/model/ProjectTeamXMLReader.java View File

@@ -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());

+ 7
- 7
examples/embedding/java/embedding/tools/AbstractObjectReader.java View File

@@ -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 ============ */

/**

+ 11
- 11
examples/embedding/java/embedding/tools/EasyGenerationContentHandlerProxy.java View File

@@ -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);
}

+ 21
- 21
examples/hyphenation/src/org/apache/fop/hyphenation/HyphenationTreeAnalysis.java View File

@@ -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;
}

+ 41
- 41
examples/hyphenation/src/org/apache/fop/hyphenation/TernaryTreeAnalysis.java View File

@@ -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();
}

}

+ 8
- 8
examples/mathml/src/org/apache/fop/mathml/ImageLoaderFactoryMathML.java View File

@@ -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;

+ 3
- 3
examples/mathml/src/org/apache/fop/mathml/ImageLoaderMathML.java View File

@@ -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;

+ 6
- 6
examples/mathml/src/org/apache/fop/mathml/MathMLElement.java View File

@@ -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();

+ 4
- 4
examples/mathml/src/org/apache/fop/mathml/MathMLElementMapping.java View File

@@ -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() {

+ 3
- 3
examples/mathml/src/org/apache/fop/mathml/MathMLObj.java View File

@@ -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

+ 12
- 12
examples/mathml/src/org/apache/fop/mathml/PreloaderMathML.java View File

@@ -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 {

+ 4
- 4
examples/plan/src/org/apache/fop/plan/ActionInfo.java View File

@@ -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;

+ 4
- 4
examples/plan/src/org/apache/fop/plan/EventList.java View File

@@ -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) {

+ 4
- 4
examples/plan/src/org/apache/fop/plan/GroupInfo.java View File

@@ -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();


+ 3
- 3
examples/plan/src/org/apache/fop/plan/Main.java View File

@@ -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;

+ 4
- 4
examples/plan/src/org/apache/fop/plan/PlanDrawer.java View File

@@ -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);
}

+ 5
- 5
examples/plan/src/org/apache/fop/plan/PlanElement.java View File

@@ -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) {

+ 4
- 4
examples/plan/src/org/apache/fop/plan/PlanElementMapping.java View File

@@ -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() {

+ 4
- 4
examples/plan/src/org/apache/fop/plan/PlanHints.java View File

@@ -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 */

+ 3
- 3
examples/plan/src/org/apache/fop/plan/PlanObj.java View File

@@ -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

+ 5
- 5
examples/plan/src/org/apache/fop/plan/PlanRenderer.java View File

@@ -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 = "";

+ 7
- 7
examples/plan/src/org/apache/fop/plan/PreloaderPlan.java View File

@@ -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 {

+ 13
- 13
examples/plan/src/org/apache/fop/plan/SimplePlanDrawer.java View File

@@ -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;

+ 1
- 1
src/codegen/java/org/apache/fop/tools/EventConventionException.java View File

@@ -33,5 +33,5 @@ public class EventConventionException extends Exception {
public EventConventionException(String message) {
super(message);
}
}

+ 11
- 7
src/codegen/java/org/apache/fop/tools/EventProducerCollector.java View File

@@ -46,7 +46,7 @@ public class EventProducerCollector {

private static final String CLASSNAME_EVENT_PRODUCER = EventProducer.class.getName();
private static final Map PRIMITIVE_MAP;
static {
Map m = new java.util.HashMap();
m.put("boolean", Boolean.class);
@@ -59,7 +59,7 @@ public class EventProducerCollector {
m.put("double", Double.class);
PRIMITIVE_MAP = Collections.unmodifiableMap(m);
}
private DocletTagFactory tagFactory;
private EventModel model = new EventModel();

@@ -81,21 +81,25 @@ public class EventProducerCollector {
/**
* Scans a file and processes it if it extends the {@link EventProducer} interface.
* @param src the source file (a Java source file)
* @return true if the file contained an EventProducer interface
* @throws IOException if an I/O error occurs
* @throws EventConventionException if the EventProducer conventions are violated
* @throws ClassNotFoundException if a required class cannot be found
*/
public void scanFile(File src)
public boolean scanFile(File src)
throws IOException, EventConventionException, ClassNotFoundException {
JavaDocBuilder builder = new JavaDocBuilder(this.tagFactory);
builder.addSource(src);
JavaClass[] classes = builder.getClasses();
boolean eventProducerFound = false;
for (int i = 0, c = classes.length; i < c; i++) {
JavaClass clazz = classes[i];
if (clazz.isInterface() && implementsInterface(clazz, CLASSNAME_EVENT_PRODUCER)) {
processEventProducerInterface(clazz);
eventProducerFound = true;
}
}
return eventProducerFound;
}

private boolean implementsInterface(JavaClass clazz, String intf) {
@@ -146,13 +150,13 @@ public class EventProducerCollector {
throw new EventConventionException("The first parameter of the method " + methodSig
+ " must be: 'Object source'!");
}
//build method model
DocletTag tag = method.getTagByName("event.severity");
EventSeverity severity;
if (tag != null) {
severity = EventSeverity.valueOf(tag.getValue());
} else {
} else {
severity = EventSeverity.INFO;
}
EventMethodModel methodMeta = new EventMethodModel(
@@ -192,7 +196,7 @@ public class EventProducerCollector {
public EventModel getModel() {
return this.model;
}
/**
* Saves the accumulated event model to an XML file.
* @param modelFile the target model file
@@ -201,5 +205,5 @@ public class EventProducerCollector {
public void saveModelToXML(File modelFile) throws IOException {
getModel().saveToXML(modelFile);
}
}

+ 17
- 6
src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java View File

@@ -63,16 +63,21 @@ public class EventProducerCollectorTask extends Task {
public void execute() throws BuildException {
try {
EventProducerCollector collector = new EventProducerCollector();
processFileSets(collector);
long lastModified = processFileSets(collector);
File parentDir = getModelFile().getParentFile();
if (!parentDir.exists() && !parentDir.mkdirs()) {
throw new BuildException(
"Could not create target directory for event model file: " + parentDir);
}
collector.saveModelToXML(getModelFile());
log("Event model written to " + getModelFile());
if (!getModelFile().exists() || lastModified > getModelFile().lastModified()) {
collector.saveModelToXML(getModelFile());
log("Event model written to " + getModelFile());
}
if (getTranslationFile() != null) {
updateTranslationFile();
if (!getTranslationFile().exists()
|| lastModified > getTranslationFile().lastModified()) {
updateTranslationFile();
}
}
} catch (ClassNotFoundException e) {
throw new BuildException(e);
@@ -164,12 +169,14 @@ public class EventProducerCollectorTask extends Task {
/**
* Processes the file sets defined for the task.
* @param collector the collector to use for collecting the event producers
* @return the time of the latest modification of any of the files inspected
* @throws IOException if an I/O error occurs
* @throws EventConventionException if the EventProducer conventions are violated
* @throws ClassNotFoundException if a required class cannot be found
*/
protected void processFileSets(EventProducerCollector collector)
protected long processFileSets(EventProducerCollector collector)
throws IOException, EventConventionException, ClassNotFoundException {
long lastModified = 0;
Iterator iter = filesets.iterator();
while (iter.hasNext()) {
FileSet fs = (FileSet)iter.next();
@@ -179,9 +186,13 @@ public class EventProducerCollectorTask extends Task {
for (int i = 0, c = srcFiles.length; i < c; i++) {
String filename = srcFiles[i];
File src = new File(directory, filename);
collector.scanFile(src);
boolean eventProducerFound = collector.scanFile(src);
if (eventProducerFound) {
lastModified = Math.max(lastModified, src.lastModified());
}
}
}
return lastModified;
}

/**

+ 7
- 7
src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java View File

@@ -1,13 +1,13 @@
/*
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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.
@@ -67,7 +67,7 @@ public class GenerateLineBreakUtils {
* table for the table driven line breaking algorithm described in
* <a href="http://unicode.org/reports/tr14/#PairBasedImplementation">UTR #14</a>.
* TODO: Code points above the base plane are simply ignored.
*
*
* @param lineBreakFileName Name of line break property file (part of Unicode files).
* @param propertyValueFileName Name of property values alias file (part of Unicode files).
* @param breakPairFileName Name of pair table file (<i>not</i> part of the unicode files).
@@ -109,7 +109,7 @@ public class GenerateLineBreakUtils {
if (line != null) {
lineTokens = line.split("\\s+");
byte columnNumber = 0;
for (int i = 0; i < lineTokens.length; ++i) {
name = lineTokens[i];
if (name.length() > 0) {
@@ -481,7 +481,7 @@ public class GenerateLineBreakUtils {
* Read line break property value names and the actual properties for the Unicode
* characters from the respective Unicode files.
* TODO: Code points above the base plane are simply ignored.
*
*
* @param lineBreakFileName Name of line break property file.
* @param propertyValueFileName Name of property values alias file.
* @throws Exception in case anything goes wrong.
@@ -600,7 +600,7 @@ public class GenerateLineBreakUtils {
* Determine a good block size for the two stage optimized storage of the
* line breaking properties. Note: the memory utilization calculation is a rule of thumb,
* don't take it too serious.
*
*
* @param lineBreakFileName Name of line break property file.
* @param propertyValueFileName Name of property values alias file.
* @throws Exception in case anything goes wrong.

+ 10
- 10
src/documentation/content/xdocs/DnI/BookMaker.java View File

@@ -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.
@@ -75,7 +75,7 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.messaging.MessageHandler;

/**
* This class converts an XML file to PDF using
* This class converts an XML file to PDF using
* JAXP (XSLT) and FOP (XSL:FO).
*/
public class BookMaker implements ErrorHandler {
@@ -113,7 +113,7 @@ public class BookMaker implements ErrorHandler {
throw e;
}

public void makeBook()
public void makeBook()
throws IOException, FOPException, TransformerException,
FactoryConfigurationError,
ParserConfigurationException, SAXException {
@@ -160,7 +160,7 @@ public class BookMaker implements ErrorHandler {
+ " as SAX parser");
xmlReader.setErrorHandler(this);
xmlReader.setEntityResolver(resolver);
// Setup SAX source
fis = new FileInputStream(xmlFile);
is = new InputSource(fis);
@@ -175,7 +175,7 @@ public class BookMaker implements ErrorHandler {
+ " as SAX parser");
xmlReader.setErrorHandler(this);
xmlReader.setEntityResolver(resolver);
// Setup SAX source
fis = new FileInputStream(xsltFile);
is = new InputSource(fis);
@@ -210,7 +210,7 @@ public class BookMaker implements ErrorHandler {
+ " as TrAX transformer");

// Set the value of parameters, if any, defined for stylesheet
if (xsltParams != null) {
if (xsltParams != null) {
for (int i = 0; i < xsltParams.size(); i += 2) {
transformer.setParameter
((String) xsltParams.elementAt(i),
@@ -299,7 +299,7 @@ public class BookMaker implements ErrorHandler {
}
if (cl.hasOption("xsl")) {
app.xsltFile = new File(cl.getOptionValue("xsl"));
}
}
if (cl.hasOption("out")) {
app.outFile = new File(cl.getOptionValue("out"));
}
@@ -323,9 +323,9 @@ public class BookMaker implements ErrorHandler {
}
app.logger.info("");
app.logger.info("Transforming...");
app.makeBook();
app.logger.info("Transforming done");
} catch (Exception e) {
app.logger.error(ExceptionUtil.printStackTrace(e));

+ 1
- 1
src/documentation/content/xdocs/trunk/anttask.xml View File

@@ -150,7 +150,7 @@
</tr>
<tr>
<td>throwexceptions</td>
<td>Controls whether or not an exception is thrown if an error occurs during rendering.</strong></td>
<td>Controls whether or not an exception is thrown if an error occurs during rendering.</td>
<td>Default is <code>true</code></td>
</tr>
</table>

+ 4
- 4
src/java/org/apache/fop/Version.java View File

@@ -25,7 +25,7 @@ package org.apache.fop;
* as this package equals the one specified in the manifest.
*/
public final class Version {
private Version() { }

/**
@@ -40,11 +40,11 @@ public final class Version {
}
if (version == null) {
//Fallback if FOP is used in a development environment
String headURL
String headURL
= "$HeadURL$";
version = headURL;
final String pathPrefix = "/xmlgraphics/fop/";
int pos = version.indexOf(pathPrefix);
int pos = version.indexOf(pathPrefix);
if (pos >= 0) {
version = version.substring(pos + pathPrefix.length() - 1, version.length() - 2);
pos = version.indexOf("/src/");
@@ -57,5 +57,5 @@ public final class Version {
}
return version;
}
}

+ 7
- 7
src/java/org/apache/fop/apps/FOPException.java View File

@@ -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.
@@ -32,7 +32,7 @@ public class FOPException extends SAXException {
private String systemId;
private int line;
private int column;
private String localizedMessage;

/**
@@ -80,7 +80,7 @@ public class FOPException extends SAXException {
/**
* Constructs a new exception with the specified detail message and cause.
* @param message the detail message
* @param cause the cause
* @param cause the cause
*/
public FOPException(String message, Exception cause) {
super(message, cause);
@@ -212,7 +212,7 @@ public class FOPException extends SAXException {
}
}
}
/**
* Sets the localized message for this exception.
* @param msg the localized message
@@ -230,6 +230,6 @@ public class FOPException extends SAXException {
}
}

}

+ 13
- 13
src/java/org/apache/fop/apps/FOURIResolver.java View File

@@ -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.
@@ -42,7 +42,7 @@ import org.apache.fop.util.DataURIResolver;
/**
* Provides FOP specific URI resolution. This is the default URIResolver
* {@link FOUserAgent} will use unless overidden.
*
*
* @see javax.xml.transform.URIResolver
*/
public class FOURIResolver implements javax.xml.transform.URIResolver {
@@ -96,7 +96,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {

/**
* Additional constructor
*
*
* @param throwExceptions
* true if exceptions are to be thrown if the URIs cannot be
* resolved.
@@ -107,7 +107,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {

/**
* Handles resolve exceptions appropriately.
*
*
* @param errorStr
* error string
* @param strict
@@ -133,7 +133,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {
* If the method is successful it will return a Source of type
* {@link javax.xml.transform.stream.StreamSource} with its SystemID set to
* the resolved URL used to open the underlying InputStream.
*
*
* @param href
* An href attribute, which may be relative or absolute.
* @param base
@@ -212,13 +212,13 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {
/*
* This piece of code is based on the following statement in
* RFC2396 section 5.2:
*
*
* 3) If the scheme component is defined, indicating that
* the reference starts with a scheme name, then the
* reference is interpreted as an absolute URI and we are
* done. Otherwise, the reference URI's scheme is inherited
* from the base URI's scheme component.
*
*
* Due to a loophole in prior specifications [RFC1630], some
* parsers allow the scheme name to be present in a relative
* URI if it is the same as the base URI scheme.
@@ -228,7 +228,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {
* removing the scheme if it matches that of the base URI
* and the scheme is known to always use the <hier_part>
* syntax.
*
*
* The URL class does not implement this work around, so we
* do.
*/
@@ -281,7 +281,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {
* before the connect() method is called. Subclass FOURIResolver and
* override this method to do things like adding the user name and password
* for HTTP basic authentication.
*
*
* @param connection
* the URLConnection instance
* @param href
@@ -295,7 +295,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {
* This is a convenience method for users who want to override
* updateURLConnection for HTTP basic authentication. Simply call it using
* the right username and password.
*
*
* @param connection
* the URLConnection to set up for HTTP basic authentication
* @param username
@@ -327,7 +327,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {
* Sets the custom URI Resolver. It is used for resolving factory-level URIs like
* hyphenation patterns and as backup for URI resolution performed during a
* rendering run.
*
*
* @param resolver
* the new URI resolver
*/
@@ -337,7 +337,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver {

/**
* Returns the custom URI Resolver.
*
*
* @return the URI Resolver or null, if none is set
*/
public URIResolver getCustomURIResolver() {

+ 5
- 5
src/java/org/apache/fop/apps/FOUserAgent.java View File

@@ -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.
@@ -468,7 +468,7 @@ public class FOUserAgent {
/**
* Gets the default page-height to use as fallback,
* in case page-height="auto"
*
*
* @return the page-height, as a String
* @see FopFactory#getPageHeight()
*/
@@ -479,7 +479,7 @@ public class FOUserAgent {
/**
* Gets the default page-width to use as fallback,
* in case page-width="auto"
*
*
* @return the page-width, as a String
* @see FopFactory#getPageWidth()
*/
@@ -522,7 +522,7 @@ public class FOUserAgent {
/**
* Controls the use of SAXLocators to provide location information in error
* messages.
*
*
* @param enableLocator <code>false</code> if SAX Locators should be disabled
*/
public void setLocatorEnabled(boolean enableLocator) {

+ 9
- 9
src/java/org/apache/fop/apps/Fop.java View File

@@ -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,13 +30,13 @@ import org.apache.fop.fo.FOTreeBuilder;
* Primary class that activates the FOP process for embedded usage.
* <P>
* JAXP is the standard method of embedding FOP in Java programs.
* Please check our
* Please check our
* <a href="http://xmlgraphics.apache.org/fop/trunk/embedding.html">embedding page</a>
* for samples (these are also available within the distribution in
* for samples (these are also available within the distribution in
* FOP_DIR\examples\embedding)
* <P>
* Methods within FOUserAgent are available to customize portions of the
* process. For example, a specific Renderer object can be specified,
* process. For example, a specific Renderer object can be specified,
* also ElementMappings which determine elements in the FO that can be
* processed) can be added.
* <P>
@@ -58,7 +58,7 @@ public class Fop {
private FOTreeBuilder foTreeBuilder = null;

/**
* Constructor for use with already-created FOUserAgents. It uses MIME types to select the
* Constructor for use with already-created FOUserAgents. It uses MIME types to select the
* output format (ex. "application/pdf" for PDF).
* @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
* @param ua FOUserAgent object
@@ -72,9 +72,9 @@ public class Fop {
if (foUserAgent == null) {
foUserAgent = FopFactory.newInstance().newFOUserAgent();
}
this.stream = stream;
createDefaultHandler();
}

@@ -119,7 +119,7 @@ public class Fop {
* page-sequence. Call this method only after the rendering process is
* finished. Note that the results are only available for output formats
* which make use of FOP's layout engine (PDF, PS, etc.).
* @return the results of the rendering process, or null for flow-oriented
* @return the results of the rendering process, or null for flow-oriented
* output formats like RTF and MIF.
*/
public FormattingResults getResults() {

+ 7
- 7
src/java/org/apache/fop/apps/FopFactory.java View File

@@ -537,7 +537,7 @@ public class FopFactory implements ImageContext {
/**
* Gets the default page-height to use as fallback,
* in case page-height="auto"
*
*
* @return the page-height, as a String
*/
public String getPageHeight() {
@@ -547,7 +547,7 @@ public class FopFactory implements ImageContext {
/**
* Sets the page-height to use as fallback, in case
* page-height="auto"
*
*
* @param pageHeight page-height as a String
*/
public void setPageHeight(String pageHeight) {
@@ -560,7 +560,7 @@ public class FopFactory implements ImageContext {
/**
* Gets the default page-width to use as fallback,
* in case page-width="auto"
*
*
* @return the page-width, as a String
*/
public String getPageWidth() {
@@ -570,7 +570,7 @@ public class FopFactory implements ImageContext {
/**
* Sets the page-width to use as fallback, in case
* page-width="auto"
*
*
* @param pageWidth page-width as a String
*/
public void setPageWidth(String pageWidth) {
@@ -729,13 +729,13 @@ public class FopFactory implements ImageContext {

/**
* Create (if needed) and return an ICC ColorSpace instance.
*
*
* The ICC profile source is taken from the src attribute of the color-profile FO element.
* If the ICC ColorSpace is not yet in the cache a new one is created and stored in the cache.
*
*
* The FOP URI resolver is used to try and locate the ICC file.
* If that fails null is returned.
*
*
* @param baseUri a base URI to resolve relative URIs
* @param iccProfileSrc ICC Profile source to return a ColorSpace for
* @return ICC ColorSpace object or null if ColorSpace could not be created

+ 2
- 2
src/java/org/apache/fop/apps/FopFactoryConfigurator.java View File

@@ -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.

+ 2
- 2
src/java/org/apache/fop/apps/FormattingResults.java View File

@@ -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.

+ 10
- 10
src/java/org/apache/fop/apps/MimeConstants.java View File

@@ -26,38 +26,38 @@ public interface MimeConstants {

/** Portable Document Format */
String MIME_PDF = "application/pdf";
/** PostScript */
String MIME_POSTSCRIPT = "application/postscript";
/** Encapsulated PostScript (same MIME type as PostScript) */
String MIME_EPS = MIME_POSTSCRIPT;
/** HP's PCL */
String MIME_PCL = "application/x-pcl";
/** HP's PCL (alternative MIME type) */
String MIME_PCL_ALT = "application/vnd.hp-PCL";
/** IBM's AFP */
String MIME_AFP = "application/x-afp";
/** IBM's AFP (alternative MIME type) */
String MIME_AFP_ALT = "application/vnd.ibm.modcap";
/** Plain text */
String MIME_PLAIN_TEXT = "text/plain";
/** Rich text format */
String MIME_RTF = "application/rtf";
/** Rich text format (alternative 1) */
String MIME_RTF_ALT1 = "text/richtext";
/** Rich text format (alternative 2) */
String MIME_RTF_ALT2 = "text/rtf";
/** FrameMaker's MIF */
String MIME_MIF = "application/mif";
/** Scalable Vector Graphics */
String MIME_SVG = "image/svg+xml";
/** GIF images */
String MIME_GIF = "image/gif";
/** PNG images */
@@ -66,7 +66,7 @@ public interface MimeConstants {
String MIME_JPEG = "image/jpeg";
/** TIFF images */
String MIME_TIFF = "image/tiff";
/** Apache FOP's AWT preview (non-standard MIME type) */
String MIME_FOP_AWT_PREVIEW = "application/X-fop-awt-preview";
/** Apache FOP's Direct Printing (non-standard MIME type) */
@@ -77,5 +77,5 @@ public interface MimeConstants {
String MIME_FOP_IF = "application/X-fop-intermediate-format";
/** Proposed but non-registered MIME type for XSL-FO */
String MIME_XSL_FO = "text/xsl";
}

+ 2
- 2
src/java/org/apache/fop/apps/PageSequenceResults.java View File

@@ -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.

+ 5
- 5
src/java/org/apache/fop/area/AbstractOffDocumentItem.java View File

@@ -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.area;

/**
@@ -51,10 +51,10 @@ public abstract class AbstractOffDocumentItem implements OffDocumentItem {
*/
public static final int START_OF_DOC = 2;

/** Indicates in what phase the item should be processed. */
protected int whenToProcess = IMMEDIATELY;
/**
* Get an indicator of when this item should be processed
* @return int constant (IMMEDIATELY, AFTER_PAGE, START_OF_DOC, END_OF_DOC)

+ 18
- 18
src/java/org/apache/fop/area/Area.java View File

@@ -165,9 +165,9 @@ public class Area extends AreaTreeObject implements Serializable {
}

/**
* Get the inline progression dimension of the content rectangle
* Get the inline progression dimension of the content rectangle
* for this area.
*
*
* @return the inline progression dimension
* @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">ipd</a>
*/
@@ -216,7 +216,7 @@ public class Area extends AreaTreeObject implements Serializable {
* @return the total BPD allocation for this area
*/
public int getAllocBPD() {
return getSpaceBefore() + getBorderAndPaddingWidthBefore() + getBPD()
return getSpaceBefore() + getBorderAndPaddingWidthBefore() + getBPD()
+ getBorderAndPaddingWidthAfter() + getSpaceAfter();
}

@@ -231,7 +231,7 @@ public class Area extends AreaTreeObject implements Serializable {
if (bps != null) {
margin = bps.width;
}
Integer padWidth = (Integer) getTrait(Trait.PADDING_BEFORE);
if (padWidth != null) {
margin += padWidth.intValue();
@@ -239,7 +239,7 @@ public class Area extends AreaTreeObject implements Serializable {

return margin;
}
/**
* Return the sum of region border- and padding-after
*
@@ -247,12 +247,12 @@ public class Area extends AreaTreeObject implements Serializable {
*/
public int getBorderAndPaddingWidthAfter() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_AFTER);
if (bps != null) {
margin = bps.width;
}
Integer padWidth = (Integer) getTrait(Trait.PADDING_AFTER);
if (padWidth != null) {
margin += padWidth.intValue();
@@ -272,7 +272,7 @@ public class Area extends AreaTreeObject implements Serializable {
if (bps != null) {
margin = bps.width;
}
Integer padWidth = (Integer) getTrait(Trait.PADDING_START);
if (padWidth != null) {
margin += padWidth.intValue();
@@ -292,7 +292,7 @@ public class Area extends AreaTreeObject implements Serializable {
if (bps != null) {
margin = bps.width;
}
Integer padWidth = (Integer) getTrait(Trait.PADDING_END);
if (padWidth != null) {
margin += padWidth.intValue();
@@ -314,7 +314,7 @@ public class Area extends AreaTreeObject implements Serializable {
}
return margin;
}
/**
* Returns the space after
*
@@ -328,7 +328,7 @@ public class Area extends AreaTreeObject implements Serializable {
}
return margin;
}
/**
* Returns the space start
*
@@ -342,7 +342,7 @@ public class Area extends AreaTreeObject implements Serializable {
}
return margin;
}
/**
* Returns the space end
*
@@ -356,7 +356,7 @@ public class Area extends AreaTreeObject implements Serializable {
}
return margin;
}
/**
* Add a child to this area.
* The default is to do nothing. Subclasses must override
@@ -393,7 +393,7 @@ public class Area extends AreaTreeObject implements Serializable {
public boolean hasTraits() {
return (this.props != null);
}
/**
* Get a trait from this area.
*
@@ -403,7 +403,7 @@ public class Area extends AreaTreeObject implements Serializable {
public Object getTrait(Object oTraitCode) {
return (props != null ? props.get(oTraitCode) : null);
}
/**
* Checks whether a certain trait is set on this area.
* @param oTraitCode the trait key
@@ -412,7 +412,7 @@ public class Area extends AreaTreeObject implements Serializable {
public boolean hasTrait(Object oTraitCode) {
return (getTrait(oTraitCode) != null);
}
/**
* Get a boolean trait from this area.
* @param oTraitCode the trait key
@@ -438,10 +438,10 @@ public class Area extends AreaTreeObject implements Serializable {
+ " could not be converted to an integer");
}
}
/**
* {@inheritDoc}
* @return ipd and bpd of area
* @return ipd and bpd of area
* */
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());

+ 6
- 6
src/java/org/apache/fop/area/AreaEventProducer.java View File

@@ -31,7 +31,7 @@ public interface AreaEventProducer extends EventProducer {
* Provider class for the event producer.
*/
class Provider {
/**
* Returns an event producer.
* @param broadcaster the event broadcaster to use
@@ -51,7 +51,7 @@ public interface AreaEventProducer extends EventProducer {
* @event.severity WARN
*/
void unresolvedIDReference(Object source, String type, String id);
/**
* An unresolved ID reference was encountered on a page.
* @param source the event source
@@ -60,7 +60,7 @@ public interface AreaEventProducer extends EventProducer {
* @event.severity WARN
*/
void unresolvedIDReferenceOnPage(Object source, String page, String id);
/**
* A page could not be loaded/deserialized from a file.
* @param source the event source
@@ -69,7 +69,7 @@ public interface AreaEventProducer extends EventProducer {
* @event.severity ERROR
*/
void pageLoadError(Object source, String page, Exception e);
/**
* A page could not be saved/serialized to a file.
* @param source the event source
@@ -78,7 +78,7 @@ public interface AreaEventProducer extends EventProducer {
* @event.severity ERROR
*/
void pageSaveError(Object source, String page, Exception e);
/**
* A page could not be rendered.
* @param source the event source
@@ -87,5 +87,5 @@ public interface AreaEventProducer extends EventProducer {
* @event.severity ERROR
*/
void pageRenderingError(Object source, String page, Exception e);
}

+ 29
- 29
src/java/org/apache/fop/area/AreaTreeHandler.java View File

@@ -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.
@@ -49,7 +49,7 @@ import org.apache.fop.layoutmgr.TopLevelLayoutManager;

/**
* Area tree handler for formatting objects.
*
*
* Concepts: The area tree is to be as small as possible. With minimal classes
* and data to fully represent an area tree for formatting objects. The area
* tree needs to be simple to render and follow the spec closely. This area tree
@@ -61,7 +61,7 @@ import org.apache.fop.layoutmgr.TopLevelLayoutManager;
* type of renderer.
*/
public class AreaTreeHandler extends FOEventHandler {
private static Log log = LogFactory.getLog(AreaTreeHandler.class);

// Recorder of debug statistics
@@ -78,7 +78,7 @@ public class AreaTreeHandler extends FOEventHandler {

// The fo:root node of the document
private Root rootFObj;
// The formatting results to be handed back to the caller.
private FormattingResults results = new FormattingResults();

@@ -88,7 +88,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Constructor.
*
*
* @param userAgent FOUserAgent object for process
* @param outputFormat the MIME type of the output format to use (ex.
* "application/pdf").
@@ -107,7 +107,7 @@ public class AreaTreeHandler extends FOEventHandler {
}

idTracker = new IDTracker();
if (log.isDebugEnabled()) {
statistics = new Statistics();
}
@@ -115,7 +115,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Sets up the AreaTreeModel instance for use by the AreaTreeHandler.
*
*
* @param userAgent FOUserAgent object for process
* @param outputFormat the MIME type of the output format to use (ex.
* "application/pdf").
@@ -129,7 +129,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Get the area tree model for this area tree.
*
*
* @return AreaTreeModel the model being used for this area tree
*/
public AreaTreeModel getAreaTreeModel() {
@@ -138,7 +138,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Get the LayoutManager maker for this area tree.
*
*
* @return LayoutManagerMaker the LayoutManager maker being used for this
* area tree
*/
@@ -148,7 +148,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Get the IDTracker for this area tree.
*
*
* @return IDTracker used to track reference ids for items in this area tree
*/
public IDTracker getIDTracker() {
@@ -157,7 +157,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Get information about the rendered output, like number of pages created.
*
*
* @return the results structure
*/
public FormattingResults getResults() {
@@ -167,7 +167,7 @@ public class AreaTreeHandler extends FOEventHandler {
/**
* Prepare AreaTreeHandler for document processing This is called from
* FOTreeBuilder.startDocument()
*
*
* @throws SAXException
* if there is an error
*/
@@ -193,7 +193,7 @@ public class AreaTreeHandler extends FOEventHandler {
public void startPageSequence(PageSequence pageSequence) {
startAbstractPageSequence(pageSequence);
}
private void startAbstractPageSequence(AbstractPageSequence pageSequence) {
rootFObj = pageSequence.getRoot();
finishPrevPageSequence(pageSequence.getInitialPageNumber());
@@ -217,7 +217,7 @@ public class AreaTreeHandler extends FOEventHandler {
/**
* End the PageSequence. The PageSequence formats Pages and adds them to the
* AreaTree. The area tree then handles what happens with the pages.
*
*
* @param pageSequence the page sequence ending
*/
public void endPageSequence(PageSequence pageSequence) {
@@ -248,20 +248,20 @@ public class AreaTreeHandler extends FOEventHandler {
if (statistics != null) {
statistics.end();
}
ExternalDocumentLayoutManager edLM;
edLM = getLayoutManagerMaker().makeExternalDocumentLayoutManager(this, document);
edLM.activateLayout();
// preserve the current PageSequenceLayoutManger for the
// force-page-count check at the beginning of the next PageSequence
prevPageSeqLM = edLM;
}

/**
* Called by the PageSequenceLayoutManager when it is finished with a
* page-sequence.
*
*
* @param pageSequence the page-sequence just finished
* @param pageCount The number of pages generated for the page-sequence
*/
@@ -275,7 +275,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* End the document.
*
*
* @throws SAXException if there is some error
*/
public void endDocument() throws SAXException {
@@ -313,7 +313,7 @@ public class AreaTreeHandler extends FOEventHandler {
* Add a OffDocumentItem to the area tree model. This checks if the
* OffDocumentItem is resolvable and attempts to resolve or add the
* resolvable ids for later resolution.
*
*
* @param odi the OffDocumentItem to add.
*/
private void addOffDocumentItem(OffDocumentItem odi) {
@@ -342,7 +342,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Generates and returns a unique key for a page viewport.
*
*
* @return the generated key.
*/
public String generatePageViewportKey() {
@@ -354,7 +354,7 @@ public class AreaTreeHandler extends FOEventHandler {
* Tie a PageViewport with an ID found on a child area of the PV. Note that
* an area with a given ID may be on more than one PV, hence an ID may have
* more than one PV associated with it.
*
*
* @param id the property ID of the area
* @param pv a page viewport that contains the area with this ID
* @deprecated use getIdTracker().associateIDWithPageViewport(id, pv) instead
@@ -367,7 +367,7 @@ public class AreaTreeHandler extends FOEventHandler {
* This method tie an ID to the areaTreeHandler until this one is ready to
* be processed. This is used in page-number-citation-last processing so we
* know when an id can be resolved.
*
*
* @param id the id of the object being processed
* @deprecated use getIdTracker().signalPendingID(id) instead
*/
@@ -379,7 +379,7 @@ public class AreaTreeHandler extends FOEventHandler {
* Signals that all areas for the formatting object with the given ID have
* been generated. This is used to determine when page-number-citation-last
* ref-ids can be resolved.
*
*
* @param id the id of the formatting object which was just finished
* @deprecated use getIdTracker().signalIDProcessed(id) instead
*/
@@ -389,7 +389,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Check if an ID has already been resolved
*
*
* @param id the id to check
* @return true if the ID has been resolved
* @deprecated use getIdTracker().alreadyResolvedID(id) instead
@@ -400,7 +400,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Tries to resolve all unresolved ID references on the given page.
*
*
* @param pv page viewport whose ID refs to resolve
* @deprecated use getIdTracker().tryIDResolution(pv) instead
*/
@@ -410,7 +410,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Get the list of page viewports that have an area with a given id.
*
*
* @param id the id to lookup
* @return the list of PageViewports
* @deprecated use getIdTracker().getPageViewportsContainingID(id) instead
@@ -421,7 +421,7 @@ public class AreaTreeHandler extends FOEventHandler {

/**
* Add an Resolvable object with an unresolved idref
*
*
* @param idref the idref whose target id has not yet been located
* @param res the Resolvable object needing the idref to be resolved
* @deprecated use getIdTracker().addUnresolvedIDRef(idref, res) instead
@@ -429,7 +429,7 @@ public class AreaTreeHandler extends FOEventHandler {
public void addUnresolvedIDRef(String idref, Resolvable res) {
idTracker.addUnresolvedIDRef(idref, res);
}
private class Statistics {
// for statistics gathering
private Runtime runtime;

+ 5
- 5
src/java/org/apache/fop/area/AreaTreeModel.java View File

@@ -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.area;

// Java
@@ -80,7 +80,7 @@ public class AreaTreeModel {
}

/**
* Handle an OffDocumentItem
* Handle an OffDocumentItem
* @param ext the extension to handle
*/
public void handleOffDocumentItem(OffDocumentItem ext) {};
@@ -98,7 +98,7 @@ public class AreaTreeModel {
public PageSequence getCurrentPageSequence() {
return this.currentPageSequence;
}
/**
* Get the page sequence count.
* @return the number of page sequences in the document.

+ 7
- 7
src/java/org/apache/fop/area/AreaTreeObject.java View File

@@ -32,7 +32,7 @@ public abstract class AreaTreeObject {

/** Foreign attributes */
protected Map foreignAttributes = null;
/**
* Sets a foreign attribute.
* @param name the qualified name of the attribute
@@ -44,7 +44,7 @@ public abstract class AreaTreeObject {
}
this.foreignAttributes.put(name, value);
}
/**
* Set foreign attributes from a Map.
* @param atts a Map with attributes (keys: QName, values: String)
@@ -57,11 +57,11 @@ public abstract class AreaTreeObject {
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry)iter.next();
String value = (String)entry.getValue();
//The casting is only to ensure type safety (too bad we can't use generics, yet)
//The casting is only to ensure type safety (too bad we can't use generics, yet)
setForeignAttribute((QName)entry.getKey(), value);
}
}
/**
* Returns the value of a foreign attribute on the area.
* @param name the qualified name of the attribute
@@ -74,7 +74,7 @@ public abstract class AreaTreeObject {
return null;
}
}
/** @return the foreign attributes associated with this area */
public Map getForeignAttributes() {
if (this.foreignAttributes != null) {
@@ -83,6 +83,6 @@ public abstract class AreaTreeObject {
return Collections.EMPTY_MAP;
}
}
}

+ 39
- 39
src/java/org/apache/fop/area/AreaTreeParser.java View File

@@ -85,7 +85,7 @@ public class AreaTreeParser {
/** Logger instance */
protected static Log log = LogFactory.getLog(AreaTreeParser.class);

private static SAXTransformerFactory tFactory
private static SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();

/**
@@ -96,11 +96,11 @@ public class AreaTreeParser {
* @param userAgent the user agent
* @throws TransformerException if an error occurs while parsing the area tree XML
*/
public void parse(Source src, AreaTreeModel treeModel, FOUserAgent userAgent)
public void parse(Source src, AreaTreeModel treeModel, FOUserAgent userAgent)
throws TransformerException {
Transformer transformer = tFactory.newTransformer();
transformer.setErrorListener(new DefaultErrorListener(log));
SAXResult res = new SAXResult(getContentHandler(treeModel, userAgent));

transformer.transform(src, res);
@@ -131,7 +131,7 @@ public class AreaTreeParser {

private CharBuffer content = CharBuffer.allocate(64);
private boolean ignoreCharacters = true;
private PageViewport currentPageViewport;
private Map pageViewportsByKey = new java.util.HashMap();
// set of "ID firsts" that have already been assigned to a PV:
@@ -328,7 +328,7 @@ public class AreaTreeParser {
public void endElement() {
//nop
}
public boolean ignoreCharacters() {
return true;
}
@@ -409,7 +409,7 @@ public class AreaTreeParser {
currentPageViewport = null;
}
}
private class RegionViewportMaker extends AbstractMaker {

public void startElement(Attributes attributes) {
@@ -427,10 +427,10 @@ public class AreaTreeParser {
setTraits(attributes, rv, SUBSET_COLOR);
areaStack.push(rv);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), RegionViewport.class);
}
}
}

private class RegionBeforeMaker extends AbstractMaker {
@@ -438,7 +438,7 @@ public class AreaTreeParser {
public void startElement(Attributes attributes) {
pushNewRegionReference(attributes, Constants.FO_REGION_BEFORE);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), RegionReference.class);
}
@@ -465,7 +465,7 @@ public class AreaTreeParser {
assertObjectOfClass(areaStack.pop(), RegionReference.class);
}
}
private class RegionEndMaker extends AbstractMaker {

public void startElement(Attributes attributes) {
@@ -488,7 +488,7 @@ public class AreaTreeParser {
int columnCount = getAttributeAsInteger(attributes, "columnCount", 1);
int columnGap = getAttributeAsInteger(attributes, "columnGap", 0);
RegionViewport rv = getCurrentRegionViewport();
body = new BodyRegion(Constants.FO_REGION_BODY,
body = new BodyRegion(Constants.FO_REGION_BODY,
regionName, rv, columnCount, columnGap);
transferForeignObjects(attributes, body);
body.setCTM(getAttributeAsCTM(attributes, "ctm"));
@@ -498,10 +498,10 @@ public class AreaTreeParser {
Constants.FO_REGION_BODY, rv);
areaStack.push(body);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), BodyRegion.class);
}
}
}

private class FlowMaker extends AbstractMaker {
@@ -518,12 +518,12 @@ public class AreaTreeParser {
setAreaAttributes(attributes, flow);
areaStack.push(flow);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), NormalFlow.class);
}
}
}
private class MainReferenceMaker extends AbstractMaker {

public void startElement(Attributes attributes) {
@@ -540,7 +540,7 @@ public class AreaTreeParser {
int ipd = getAttributeAsInteger(attributes, "ipd", 0);
int columnCount = getAttributeAsInteger(attributes, "columnCount", 1);
BodyRegion body = getCurrentBodyRegion();
Span span = new Span(columnCount,
Span span = new Span(columnCount,
body.getColumnGap(), ipd);
transferForeignObjects(attributes, span);
setAreaAttributes(attributes, span);
@@ -557,20 +557,20 @@ public class AreaTreeParser {
fn.setTop(getAttributeAsInteger(attributes, "top-offset", 0));
areaStack.push(fn);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), Footnote.class);
}
}
}

private class BeforeFloatMaker extends AbstractMaker {

public void startElement(Attributes attributes) {
BeforeFloat bf = getCurrentBodyRegion().getBeforeFloat();
BeforeFloat bf = getCurrentBodyRegion().getBeforeFloat();
transferForeignObjects(attributes, bf);
areaStack.push(bf);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), BeforeFloat.class);
}
@@ -622,7 +622,7 @@ public class AreaTreeParser {
parent.addChildArea(block);
areaStack.push(block);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), Block.class);
}
@@ -702,7 +702,7 @@ public class AreaTreeParser {
parent.addChildArea(ibp);
areaStack.push(ibp);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), InlineBlockParent.class);
}
@@ -724,13 +724,13 @@ public class AreaTreeParser {
text.setOffset(getAttributeAsInteger(attributes, "offset", 0));
text.setTextLetterSpaceAdjust(getAttributeAsInteger(attributes,
"tlsadjust", 0));
text.setTextWordSpaceAdjust(getAttributeAsInteger(attributes,
text.setTextWordSpaceAdjust(getAttributeAsInteger(attributes,
"twsadjust", 0));
Area parent = (Area)areaStack.peek();
parent.addChildArea(text);
areaStack.push(text);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), TextArea.class);
}
@@ -740,7 +740,7 @@ public class AreaTreeParser {

public void endElement() {
int offset = getAttributeAsInteger(lastAttributes, "offset", 0);
int[] letterAdjust
int[] letterAdjust
= ConversionUtils.toIntArray(
lastAttributes.getValue("letter-adjust"), "\\s");
content.flip();
@@ -749,14 +749,14 @@ public class AreaTreeParser {
word.setParentArea(text);
text.addChildArea(word);
}
public boolean ignoreCharacters() {
return false;
}
}

private class SpaceMaker extends AbstractMaker {
public void endElement() {
int offset = getAttributeAsInteger(lastAttributes, "offset", 0);
//TODO the isAdjustable parameter is currently not used/implemented
@@ -778,7 +778,7 @@ public class AreaTreeParser {
parent.addChildArea(space);
}
}
public boolean ignoreCharacters() {
return false;
}
@@ -822,12 +822,12 @@ public class AreaTreeParser {
parent.addChildArea(viewport);
areaStack.push(viewport);
}
public void endElement() {
assertObjectOfClass(areaStack.pop(), Viewport.class);
}
}
private class ImageMaker extends AbstractMaker {

public void startElement(Attributes attributes) {
@@ -839,12 +839,12 @@ public class AreaTreeParser {
getCurrentViewport().setContent(image);
}
}
private class ForeignObjectMaker extends AbstractMaker {

public void startElement(Attributes attributes) throws SAXException {
String ns = attributes.getValue("ns");
domImplementation
domImplementation
= elementMappingRegistry.getDOMImplementationForNamespace(ns);
if (domImplementation == null) {
throw new SAXException("No DOMImplementation could be"
@@ -941,11 +941,11 @@ public class AreaTreeParser {

private void assertObjectOfClass(Object obj, Class clazz) {
if (!clazz.isInstance(obj)) {
throw new IllegalStateException("Object is not an instance of "
throw new IllegalStateException("Object is not an instance of "
+ clazz.getName() + " but of " + obj.getClass().getName());
}
}
/**
* Handles objects created by "sub-parsers" that implement the ObjectSource interface.
* An example of object handled here are ExtensionAttachments.
@@ -969,7 +969,7 @@ public class AreaTreeParser {
area.setIPD(Integer.parseInt(attributes.getValue("ipd")));
area.setBPD(Integer.parseInt(attributes.getValue("bpd")));
}
private static final Object[] SUBSET_COMMON = new Object[] {
Trait.PROD_ID};
private static final Object[] SUBSET_LINK = new Object[] {
@@ -1078,7 +1078,7 @@ public class AreaTreeParser {
}
}

private static int getAttributeAsInteger(Attributes attributes, String name,
private static int getAttributeAsInteger(Attributes attributes, String name,
int defaultValue) {
String s = attributes.getValue(name);
if (s == null) {
@@ -1123,7 +1123,7 @@ public class AreaTreeParser {
}
}
}
/** {@inheritDoc} */
public void characters(char[] ch, int start, int length) throws SAXException {
if (delegate != null) {
@@ -1132,7 +1132,7 @@ public class AreaTreeParser {
int maxLength = this.content.capacity() - this.content.position();
if (maxLength < length) {
// allocate a larger buffer and transfer content
CharBuffer newContent
CharBuffer newContent
= CharBuffer.allocate(this.content.position() + length);
this.content.flip();
newContent.put(this.content);

+ 3
- 3
src/java/org/apache/fop/area/BeforeFloat.java View File

@@ -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.area;

/**

+ 5
- 5
src/java/org/apache/fop/area/Block.java View File

@@ -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.area;


@@ -59,7 +59,7 @@ public class Block extends BlockParent {
private int positioning = STACK;

protected transient boolean allowBPDUpdate = true;
// a block with may contain the dominant styling info in
// terms of most lines or blocks with info

@@ -120,7 +120,7 @@ public class Block extends BlockParent {
public boolean isStacked() {
return (getPositioning() == Block.STACK || getPositioning() == Block.RELATIVE);
}
/**
* @return the start-indent trait
*/

+ 5
- 5
src/java/org/apache/fop/area/BlockParent.java View File

@@ -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.area;

import java.util.ArrayList;
@@ -51,7 +51,7 @@ public class BlockParent extends Area {
protected List children = null;

// orientation if reference area
private int orientation = ORIENT_0;
// private int orientation = ORIENT_0;

/** {@inheritDoc} */
public void addChildArea(Area childArea) {
@@ -60,7 +60,7 @@ public class BlockParent extends Area {
}
children.add(childArea);
}
/**
* Add the block area to this block parent.
*

+ 3
- 3
src/java/org/apache/fop/area/BlockViewport.java View File

@@ -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.area;

/**

+ 4
- 4
src/java/org/apache/fop/area/BodyRegion.java View File

@@ -55,7 +55,7 @@ public class BodyRegion extends RegionReference {
* @param columnCount the number of columns
* @param columnGap the gap between columns
*/
public BodyRegion(int regionClass, String regionName, RegionViewport parent,
public BodyRegion(int regionClass, String regionName, RegionViewport parent,
int columnCount, int columnGap) {
super(regionClass, regionName, parent);
this.columnCount = columnCount;
@@ -76,7 +76,7 @@ public class BodyRegion extends RegionReference {
public int getColumnGap() {
return this.columnGap;
}
/**
* Get the main reference area.
*
@@ -135,14 +135,14 @@ public class BodyRegion extends RegionReference {
}
return getBPD() - usedBPD;
}
/**
* Clone this object.
*
* @return a shallow copy of this object
*/
public Object clone() {
BodyRegion br = new BodyRegion(getRegionClass(), getRegionName(), regionViewport,
BodyRegion br = new BodyRegion(getRegionClass(), getRegionName(), regionViewport,
getColumnCount(), getColumnGap());
br.setCTM(getCTM());
br.setIPD(getIPD());

+ 5
- 5
src/java/org/apache/fop/area/BookmarkData.java View File

@@ -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.area;

import java.util.Collection;
@@ -33,7 +33,7 @@ import org.apache.fop.fo.pagination.bookmarks.BookmarkTree;
* child bookmark-items under it.
*/
public class BookmarkData extends AbstractOffDocumentItem implements Resolvable {
private List subData = new java.util.ArrayList();

// bookmark-title for this fo:bookmark
@@ -92,7 +92,7 @@ public class BookmarkData extends AbstractOffDocumentItem implements Resolvable
}
refs.add(bd);
}
/**
* Create a new bookmark data root object.
* This constructor is called by the AreaTreeParser when the

+ 4
- 4
src/java/org/apache/fop/area/CTM.java View File

@@ -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.
@@ -133,7 +133,7 @@ public class CTM implements Serializable {
switch (wm) {
case Constants.EN_LR_TB:
return new CTM(CTM_LRTB);
case Constants.EN_RL_TB:
case Constants.EN_RL_TB:
wmctm = new CTM(CTM_RLTB);
wmctm.e = ipd;
return wmctm;
@@ -269,7 +269,7 @@ public class CTM implements Serializable {
public AffineTransform toAffineTransform() {
return new AffineTransform(toArray());
}
/**
* Construct a coordinate transformation matrix (CTM).
* @param absRefOrient absolute reference orientation

+ 6
- 6
src/java/org/apache/fop/area/CachedRenderPagesModel.java View File

@@ -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.area;

import java.io.BufferedInputStream;
@@ -52,7 +52,7 @@ public class CachedRenderPagesModel extends RenderPagesModel {

/** Base directory to save temporary file in, typically points to the user's temp dir. */
protected File baseDir;
/**
* Main Constructor
* @param userAgent FOUserAgent object for process
@@ -61,14 +61,14 @@ public class CachedRenderPagesModel extends RenderPagesModel {
* @param stream OutputStream
* @throws FOPException if the renderer cannot be properly initialized
*/
public CachedRenderPagesModel (FOUserAgent userAgent, String outputFormat,
public CachedRenderPagesModel (FOUserAgent userAgent, String outputFormat,
FontInfo fontInfo, OutputStream stream) throws FOPException {
super(userAgent, outputFormat, fontInfo, stream);
this.baseDir = new File(System.getProperty("java.io.tmpdir"));
}

/**
* {@inheritDoc}
* {@inheritDoc}
*/
protected boolean checkPreparedPages(PageViewport newpage, boolean renderUnresolved) {
for (Iterator iter = prepared.iterator(); iter.hasNext();) {

+ 3
- 3
src/java/org/apache/fop/area/DestinationData.java View File

@@ -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.
@@ -56,7 +56,7 @@ public class DestinationData extends AbstractOffDocumentItem implements Resolvab
this.idRef = idRef;
this.idRefs = new String[] {idRef};
}
/**
* Get the idref for this destination
*

+ 3
- 3
src/java/org/apache/fop/area/Footnote.java View File

@@ -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.area;

// may combine with before float into a conditional area

+ 18
- 18
src/java/org/apache/fop/area/IDTracker.java View File

@@ -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.
@@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory;
* on a PageViewport level.
*/
public class IDTracker {
private static Log log = LogFactory.getLog(IDTracker.class);

// HashMap of ID's whose area is located on one or more consecutive
@@ -50,12 +50,12 @@ public class IDTracker {
private Set unfinishedIDs = new HashSet();

private Set alreadyResolvedIDs = new HashSet();
/**
* Tie a PageViewport with an ID found on a child area of the PV. Note that
* an area with a given ID may be on more than one PV, hence an ID may have
* more than one PV associated with it.
*
*
* @param id the property ID of the area
* @param pv a page viewport that contains the area with this ID
*/
@@ -78,7 +78,7 @@ public class IDTracker {
tryIDResolution(id, pv, pvList);
}
} else {
/* TODO: The check is a quick-fix to avoid a waste
/* TODO: The check is a quick-fix to avoid a waste
* when adding inline-ids to the page */
if (!pvList.contains(pv)) {
pvList.add(pv);
@@ -90,7 +90,7 @@ public class IDTracker {
* This method tie an ID to the areaTreeHandler until this one is ready to
* be processed. This is used in page-number-citation-last processing so we
* know when an id can be resolved.
*
*
* @param id the id of the object being processed
*/
public void signalPendingID(String id) {
@@ -104,7 +104,7 @@ public class IDTracker {
* Signals that all areas for the formatting object with the given ID have
* been generated. This is used to determine when page-number-citation-last
* ref-ids can be resolved.
*
*
* @param id the id of the formatting object which was just finished
*/
public void signalIDProcessed(String id) {
@@ -128,20 +128,20 @@ public class IDTracker {
unresolvedIDRefs.remove(id);
}
}
/**
* Check if an ID has already been resolved
*
*
* @param id the id to check
* @return true if the ID has been resolved
*/
public boolean alreadyResolvedID(String id) {
return (alreadyResolvedIDs.contains(id));
}
/**
* Tries to resolve all unresolved ID references on the given page.
*
*
* @param id ID to resolve
* @param pv page viewport whose ID refs to resolve
* @param pvList of PageViewports
@@ -164,7 +164,7 @@ public class IDTracker {

/**
* Tries to resolve all unresolved ID references on the given page.
*
*
* @param pv page viewport whose ID refs to resolve
*/
public void tryIDResolution(PageViewport pv) {
@@ -178,20 +178,20 @@ public class IDTracker {
}
}
}
/**
* Get the list of page viewports that have an area with a given id.
*
*
* @param id the id to lookup
* @return the list of PageViewports
*/
public List getPageViewportsContainingID(String id) {
return (List) idLocations.get(id);
}
/**
* Add an Resolvable object with an unresolved idref
*
*
* @param idref the idref whose target id has not yet been located
* @param res the Resolvable object needing the idref to be resolved
*/
@@ -203,5 +203,5 @@ public class IDTracker {
}
// add Resolvable object to this HashSet
todo.add(res);
}
}
}

+ 11
- 11
src/java/org/apache/fop/area/LineArea.java View File

@@ -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.area;

import org.apache.fop.area.inline.InlineArea;
@@ -44,7 +44,7 @@ public class LineArea extends Area {
private int availableShrink;
private double variationFactor;
private boolean bAddedToAreaTree;
private LineAdjustingInfo(int alignment, int diff,
int stretch, int shrink) {
lineAlignment = alignment;
@@ -55,7 +55,7 @@ public class LineArea extends Area {
bAddedToAreaTree = false;
}
}
private LineAdjustingInfo adjustingInfo = null;

// this class can contain the dominant char styling info
@@ -67,7 +67,7 @@ public class LineArea extends Area {
* default constructor:
* nothing to do
*/
public LineArea() {
public LineArea() {
}

/**
@@ -142,7 +142,7 @@ public class LineArea extends Area {
setIPD(ipd);
setBPD(bpd);
}
/**
* receive notification about the ipd variation of a descendant area
* and perform the needed adjustment, according to the alignment;
@@ -151,12 +151,12 @@ public class LineArea extends Area {
* <li>left-aligned text needs no adjustement;</li>
* <li>right-aligned text and centered text are handled locally,
* adjusting the indent of this LineArea;</li>
* <li>justified text requires a more complex adjustment, as the
* <li>justified text requires a more complex adjustment, as the
* variation factor computed on the basis of the total
* stretch and shrink of the line must be applied in every
* descendant leaf areas (text areas and leader areas).</li>
* descendant leaf areas (text areas and leader areas).</li>
* </ul>
* @param ipdVariation the difference between old and new ipd
* @param ipdVariation the difference between old and new ipd
*/
public void handleIPDVariation(int ipdVariation) {
switch (adjustingInfo.lineAlignment) {
@@ -186,7 +186,7 @@ public class LineArea extends Area {
throw new RuntimeException();
}
}
/**
* apply the variation factor to all descendant areas
* and destroy the AdjustingInfo object if there are

+ 3
- 3
src/java/org/apache/fop/area/LinkResolver.java View File

@@ -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.
@@ -67,7 +67,7 @@ public class LinkResolver implements Resolvable, Serializable {
/**
* Resolve by adding an internal link to the first PageViewport in the list.
*
* {@inheritDoc}
* {@inheritDoc}
*/
public void resolveIDRef(String id, List pages) {
resolveIDRef(id, (PageViewport)pages.get(0));

+ 4
- 4
src/java/org/apache/fop/area/MainReference.java View File

@@ -43,7 +43,7 @@ public class MainReference extends Area {
this.parent = parent;
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
/**
* Add a span area to this area.
*
@@ -58,11 +58,11 @@ public class MainReference extends Area {
RegionViewport rv = parent.getRegionViewport();
int ipdWidth = (int) parent.getIPD()
- rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();
Span newSpan = new Span(((spanAll) ? 1 : getColumnCount()),
Span newSpan = new Span(((spanAll) ? 1 : getColumnCount()),
getColumnGap(), ipdWidth);
spanAreas.add(newSpan);
return getCurrentSpan();
return getCurrentSpan();
}

/**

+ 4
- 4
src/java/org/apache/fop/area/NormalFlow.java View File

@@ -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.area;

/**
@@ -33,7 +33,7 @@ public class NormalFlow extends BlockParent {
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
setIPD(ipd);
}
/** {@inheritDoc} */
public void addBlock(Block block) {
super.addBlock(block);

+ 3
- 3
src/java/org/apache/fop/area/OffDocumentExtensionAttachment.java View File

@@ -29,7 +29,7 @@ import org.apache.fop.fo.extensions.ExtensionAttachment;
public class OffDocumentExtensionAttachment implements OffDocumentItem {

private ExtensionAttachment attachment;
/**
* Main constructor
* @param attachment the extension attachment to wrap.
@@ -37,7 +37,7 @@ public class OffDocumentExtensionAttachment implements OffDocumentItem {
public OffDocumentExtensionAttachment(ExtensionAttachment attachment) {
this.attachment = attachment;
}
/** @return the extension attachment. */
public ExtensionAttachment getAttachment() {
return this.attachment;
@@ -52,5 +52,5 @@ public class OffDocumentExtensionAttachment implements OffDocumentItem {
public String getName() {
return attachment.getCategory();
}
}

+ 5
- 5
src/java/org/apache/fop/area/OffDocumentItem.java View File

@@ -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.area;

/**
@@ -45,7 +45,7 @@ public interface OffDocumentItem {
*/
int END_OF_DOC = 2;

/**
* Get an indicator of when this item should be processed
* @return int constant (IMMEDIATELY, AFTER_PAGE, END_OF_DOC)
@@ -57,5 +57,5 @@ public interface OffDocumentItem {
* @return String name of ODI
*/
String getName();
}

+ 15
- 15
src/java/org/apache/fop/area/Page.java View File

@@ -59,9 +59,9 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {

/** Set to true to make this page behave as if it were not empty. */
private boolean fakeNonEmpty = false;
/**
* Empty constructor, for cloning
* Empty constructor, for cloning
*/
public Page() {
}
@@ -78,7 +78,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {

// Get absolute margin properties (top, left, bottom, right)
CommonMarginBlock mProps = spm.getCommonMarginBlock();
/*
* Create the page reference area rectangle (0,0 is at top left
* of the "page media" and y increases
@@ -92,20 +92,20 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
* That's why we 'cheat' here and setup a context for the height but
* use the LengthBase.BLOCK_WIDTH.
*/
SimplePercentBaseContext pageWidthContext
SimplePercentBaseContext pageWidthContext
= new SimplePercentBaseContext(null, LengthBase.CONTAINING_BLOCK_WIDTH
, pageViewPortDims.ipd);
SimplePercentBaseContext pageHeightContext
= new SimplePercentBaseContext(null, LengthBase.CONTAINING_BLOCK_WIDTH
, pageViewPortDims.bpd);

Rectangle pageRefRect
Rectangle pageRefRect
= new Rectangle(mProps.marginLeft.getValue(pageWidthContext)
, mProps.marginTop.getValue(pageHeightContext)
, pageViewPortDims.ipd
- mProps.marginLeft.getValue(pageWidthContext)
, pageViewPortDims.ipd
- mProps.marginLeft.getValue(pageWidthContext)
- mProps.marginRight.getValue(pageWidthContext)
, pageViewPortDims.bpd
, pageViewPortDims.bpd
- mProps.marginTop.getValue(pageHeightContext)
- mProps.marginBottom.getValue(pageHeightContext));

@@ -142,7 +142,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
public void fakeNonEmpty() {
this.fakeNonEmpty = true;
}
/**
* Creates a RegionViewport Area object for this pagination Region.
* @param r the region the viewport is to be created for
@@ -161,11 +161,11 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
rv.setBPD((int)relRegionRect.getHeight());
rv.setIPD((int)relRegionRect.getWidth());
TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground(), null);
rv.setClip(r.getOverflow() == Constants.EN_HIDDEN
rv.setClip(r.getOverflow() == Constants.EN_HIDDEN
|| r.getOverflow() == Constants.EN_ERROR_IF_OVERFLOW);
return rv;
}
/**
* Set the region reference position within the region viewport.
* This sets the transform that is used to place the contents of
@@ -177,15 +177,15 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
* where x=distance from left, y=distance from bottom, width=right-left
* height=top-bottom
*/
private void setRegionReferencePosition(RegionReference rr, Region r,
private void setRegionReferencePosition(RegionReference rr, Region r,
Rectangle2D absRegVPRect) {
FODimension reldims = new FODimension(0, 0);
rr.setCTM(CTM.getCTMandRelDims(r.getReferenceOrientation(),
r.getWritingMode(), absRegVPRect, reldims));
rr.setIPD(reldims.ipd);
rr.setBPD(reldims.bpd);
}
}
/**
* Set the region on this page.
*
@@ -219,7 +219,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
case Constants.FO_REGION_START:
return regionStart;
case Constants.FO_REGION_BODY:
return regionBody;
return regionBody;
case Constants.FO_REGION_END:
return regionEnd;
case Constants.FO_REGION_AFTER:

+ 8
- 8
src/java/org/apache/fop/area/PageSequence.java View File

@@ -30,7 +30,7 @@ public class PageSequence {
private LineArea title;
private String language;
private String country;
/**
* Main constructor
* @param title the title for the page-sequence, may be null
@@ -38,14 +38,14 @@ public class PageSequence {
public PageSequence(LineArea title) {
setTitle(title);
}
/**
* @return the title of the page sequence in form of a line area, or null if there's no title
*/
public LineArea getTitle() {
return this.title;
}
/**
* Sets the page sequence's title.
* @param title the title
@@ -53,7 +53,7 @@ public class PageSequence {
public void setTitle(LineArea title) {
this.title = title;
}
/**
* Adds a new page to the page sequence
* @param page the page to be added
@@ -61,7 +61,7 @@ public class PageSequence {
public void addPage(PageViewport page) {
this.pages.add(page);
}
/**
* @return the number of pages currently in this page sequence
*/
@@ -77,7 +77,7 @@ public class PageSequence {
public PageViewport getPage(int idx) {
return (PageViewport)this.pages.get(idx);
}
/**
* Indicates whether a page is the first in this page sequence.
* @param page the page to be inspected
@@ -106,7 +106,7 @@ public class PageSequence {
this.language = language;
}
}
/**
* Returns the country of the page-sequence.
* @return the country (the value of the country property, "none" is mapped to null)
@@ -126,5 +126,5 @@ public class PageSequence {
this.country = country;
}
}
}

+ 55
- 55
src/java/org/apache/fop/area/PageViewport.java View File

@@ -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.
@@ -52,18 +52,18 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
private Page page;
private Rectangle2D viewArea;
private String simplePageMasterName;
/**
* Unique key to identify the page. pageNumberString and pageIndex are both no option
* Unique key to identify the page. pageNumberString and pageIndex are both no option
* for this.
*/
private String pageKey;
private int pageNumber = -1;
private String pageNumberString = null;
private int pageIndex = -1; //-1 = undetermined
private boolean blank;
private transient PageSequence pageSequence;

// list of id references and the rectangle on the page
@@ -86,7 +86,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
private Map markerFirstAny = null;
private Map markerLastEnd = null;
private Map markerLastAny = null;
//Arbitrary attachments to the page from extensions that need to pass information
//down to the renderers.
private List extensionAttachments = null;
@@ -117,7 +117,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
}

/**
* Copy constructor.
* Copy constructor.
* @param original the original PageViewport to copy from
*/
public PageViewport(PageViewport original) {
@@ -141,7 +141,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
* @param simplePageMasterName name of the original simple-page-master that generated this page
* @param blank true if this is a blank page
*/
public PageViewport(Rectangle2D viewArea, int pageNumber, String pageStr,
public PageViewport(Rectangle2D viewArea, int pageNumber, String pageStr,
String simplePageMasterName, boolean blank) {
this.viewArea = viewArea;
this.pageNumber = pageNumber;
@@ -149,7 +149,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
this.simplePageMasterName = simplePageMasterName;
this.blank = blank;
}
/**
* Sets the page sequence this page belongs to
* @param seq the page sequence
@@ -157,12 +157,12 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
public void setPageSequence(PageSequence seq) {
this.pageSequence = seq;
}
/** @return the page sequence this page belongs to */
public PageSequence getPageSequence() {
return this.pageSequence;
}
/**
* Get the view area rectangle of this viewport.
* @return the rectangle for this viewport
@@ -178,7 +178,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
public Page getPage() {
return page;
}
/**
* Sets the page object for this PageViewport.
* @param page the page
@@ -211,15 +211,15 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
public void setPageIndex(int index) {
this.pageIndex = index;
}
/**
* @return the overall page index of the page in this rendering run (zero-based,
* @return the overall page index of the page in this rendering run (zero-based,
* -1 if it is undetermined).
*/
public int getPageIndex() {
return this.pageIndex;
}
/**
* Sets the unique key for this PageViewport that will be used to reference this page.
* @param key the unique key.
@@ -227,7 +227,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
public void setKey(String key) {
this.pageKey = key;
}
/**
* Get the key for this page viewport.
* This is used so that a serializable key can be used to
@@ -292,7 +292,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
* @return true if the page is resolved and can be rendered
*/
public boolean isResolved() {
return unresolvedIDRefs == null
return unresolvedIDRefs == null
|| unresolvedIDRefs.size() == 0;
}

@@ -306,7 +306,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
}

/**
* {@inheritDoc}
* {@inheritDoc}
*/
public void resolveIDRef(String id, List pages) {
if (page == null) {
@@ -345,7 +345,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
* are starting, replacing earlier markers.
* For "last-ending-within-page" it adds all markers that
* are ending, replacing earlier markers.
*
*
* Should this logic be placed in the Page layout manager.
*
* @param marks the map of markers to add
@@ -360,12 +360,12 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
return;
}
if (log.isDebugEnabled()) {
log.debug("--" + marks.keySet() + ": "
+ (starting ? "starting" : "ending")
+ (isfirst ? ", first" : "")
log.debug("--" + marks.keySet() + ": "
+ (starting ? "starting" : "ending")
+ (isfirst ? ", first" : "")
+ (islast ? ", last" : ""));
}
// at the start of the area, register is-first and any areas
if (starting) {
if (isfirst) {
@@ -381,14 +381,14 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
if (!markerFirstStart.containsKey(key)) {
markerFirstStart.put(key, marks.get(key));
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": "
log.trace("page " + pageNumberString + ": "
+ "Adding marker " + key + " to FirstStart");
}
}
if (!markerFirstAny.containsKey(key)) {
markerFirstAny.put(key, marks.get(key));
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": "
log.trace("page " + pageNumberString + ": "
+ "Adding marker " + key + " to FirstAny");
}
}
@@ -399,7 +399,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
// last on page: replace all
markerLastStart.putAll(marks);
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": "
log.trace("page " + pageNumberString + ": "
+ "Adding all markers to LastStart");
}
} else {
@@ -412,7 +412,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
if (!markerFirstAny.containsKey(key)) {
markerFirstAny.put(key, marks.get(key));
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": "
log.trace("page " + pageNumberString + ": "
+ "Adding marker " + key + " to FirstAny");
}
}
@@ -427,7 +427,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
// last on page: replace all
markerLastEnd.putAll(marks);
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": "
log.trace("page " + pageNumberString + ": "
+ "Adding all markers to LastEnd");
}
}
@@ -437,7 +437,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
// last on page: replace all
markerLastAny.putAll(marks);
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": "
log.trace("page " + pageNumberString + ": "
+ "Adding all markers to LastAny");
}
}
@@ -448,7 +448,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
* This will retrieve a marker with the class name
* and position.
*
* @param name The class name of the marker to retrieve
* @param name The class name of the marker to retrieve
* @param pos the position to retrieve
* @return Object the marker found or null
*/
@@ -496,10 +496,10 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
throw new RuntimeException();
}
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": " + "Retrieving marker " + name
+ " at position " + posName);
log.trace("page " + pageNumberString + ": " + "Retrieving marker " + name
+ " at position " + posName);
}
return mark;
return mark;
}

/** Dumps the current marker data to the logger. */
@@ -512,7 +512,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
log.trace("LastStart: " + this.markerLastStart);
}
}
/**
* Save the page contents to an object stream.
* The map of unresolved references are set on the page so that
@@ -576,12 +576,12 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
sb.append(getPageNumberString());
return sb.toString();
}
/** @return the name of the simple-page-master that created this page */
public String getSimplePageMasterName() {
return this.simplePageMasterName;
}
/**
* Adds a new ExtensionAttachment instance to this page.
* @param attachment the ExtensionAttachment
@@ -592,7 +592,7 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
}
extensionAttachments.add(attachment);
}
/** @return the list of extension attachments for this page */
public List getExtensionAttachments() {
if (this.extensionAttachments == null) {
@@ -601,12 +601,12 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
return this.extensionAttachments;
}
}
/** @return True if this is a blank page. */
public boolean isBlank() {
return this.blank;
}
/**
* Convenience method to get BodyRegion of this PageViewport
* @return BodyRegion object
@@ -614,62 +614,62 @@ public class PageViewport extends AreaTreeObject implements Resolvable, Cloneabl
public BodyRegion getBodyRegion() {
return (BodyRegion) getPage().getRegionViewport(
Constants.FO_REGION_BODY).getRegionReference();
}
}

/**
* Convenience method to create a new Span for this
* this PageViewport.
*
*
* @param spanAll whether this is a single-column span
* @return Span object created
*/
public Span createSpan(boolean spanAll) {
return getBodyRegion().getMainReference().createSpan(spanAll);
}
}

/**
* Convenience method to get the span-reference-area currently
* being processed
*
*
* @return span currently being processed.
*/
public Span getCurrentSpan() {
return getBodyRegion().getMainReference().getCurrentSpan();
}
/**
* Convenience method to get the normal-flow-reference-area
* Convenience method to get the normal-flow-reference-area
* currently being processed
*
*
* @return span currently being processed.
*/
public NormalFlow getCurrentFlow() {
return getCurrentSpan().getCurrentFlow();
}
/**
* Convenience method to increment the Span to the
* Convenience method to increment the Span to the
* next NormalFlow to be processed, and to return that flow.
*
*
* @return the next NormalFlow in the Span.
*/
public NormalFlow moveToNextFlow() {
return getCurrentSpan().moveToNextFlow();
}
/**
* Convenience method to return a given region-reference-area,
* Convenience method to return a given region-reference-area,
* keyed by the Constants class identifier for the corresponding
* formatting object (ie. Constants.FO_REGION_BODY, FO_REGION_START,
* formatting object (ie. Constants.FO_REGION_BODY, FO_REGION_START,
* etc.)
*
*
* @param id the Constants class identifier for the region.
* @return the corresponding region-reference-area for this page.
*/
public RegionReference getRegionReference(int id) {
return getPage().getRegionViewport(id).getRegionReference();
}
/** @return whether this page viewport has any extension attachments */
public boolean hasExtensionAttachments() {
return this.extensionAttachments != null && !this.extensionAttachments.isEmpty();

+ 9
- 9
src/java/org/apache/fop/area/RegionReference.java View File

@@ -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,17 +30,17 @@ import org.apache.fop.fo.pagination.Region;
* so the page master can make copies from the original page and regions.
*/
public class RegionReference extends Area implements Cloneable {
/** Reference to the region FO. */
//protected Region regionFO;
private int regionClass;
private String regionName;
private CTM ctm;

// the list of block areas from the static flow
private ArrayList blocks = new ArrayList();
/** the parent RegionViewport for this object */
protected RegionViewport regionViewport;

@@ -78,7 +78,7 @@ public class RegionReference extends Area implements Cloneable {
// subtract bpd of borders and padding before / after
return super.getBPD() - getBorderAndPaddingWidthBefore() - getBorderAndPaddingWidthAfter();
}
/** {@inheritDoc} */
public int getIPD() {
// subtract ipd of borders and padding start / end
@@ -97,7 +97,7 @@ public class RegionReference extends Area implements Cloneable {
public void setCTM(CTM ctm) {
this.ctm = ctm;
}
/**
* @return Returns the parent RegionViewport.
*/
@@ -136,7 +136,7 @@ public class RegionReference extends Area implements Cloneable {
public String getRegionName() {
return this.regionName;
}
/**
* Add a block area to this region reference area.
*
@@ -145,7 +145,7 @@ public class RegionReference extends Area implements Cloneable {
public void addBlock(Block block) {
addChildArea(block);
}
/**
* Clone this region.
* This is used when cloning the page by the page master.

+ 5
- 5
src/java/org/apache/fop/area/RegionViewport.java View File

@@ -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.area;

import java.awt.geom.Rectangle2D;
@@ -25,7 +25,7 @@ import java.util.HashMap;

/**
* Region Viewport area.
* This object represents the region-viewport-area. It has a
* This object represents the region-viewport-area. It has a
* region-reference-area as its child. These areas are described
* in the fo:region-body description in the XSL Recommendation.
*/
@@ -76,7 +76,7 @@ public class RegionViewport extends Area implements Cloneable {
public boolean isClip() {
return this.clip;
}
/**
* Get the view area of this viewport.
*

+ 8
- 8
src/java/org/apache/fop/area/RenderPagesModel.java View File

@@ -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.area;

// Java
@@ -46,7 +46,7 @@ public class RenderPagesModel extends AreaTreeModel {
* The renderer that will render the pages.
*/
protected Renderer renderer;
/**
* Pages that have been prepared but not rendered yet.
*/
@@ -62,7 +62,7 @@ public class RenderPagesModel extends AreaTreeModel {
* @param stream OutputStream
* @throws FOPException if the renderer cannot be properly initialized
*/
public RenderPagesModel (FOUserAgent userAgent, String outputFormat,
public RenderPagesModel (FOUserAgent userAgent, String outputFormat,
FontInfo fontInfo, OutputStream stream) throws FOPException {

super();
@@ -113,7 +113,7 @@ public class RenderPagesModel extends AreaTreeModel {
try {
renderer.renderPage(page);
} catch (RuntimeException re) {
String err = "Error while rendering page " + page.getPageNumberString();
String err = "Error while rendering page " + page.getPageNumberString();
log.error(err, re);
throw re;
} catch (IOException ioe) {
@@ -122,9 +122,9 @@ public class RenderPagesModel extends AreaTreeModel {
eventProducer.ioError(this, ioe);
} catch (FOPException e) {
//TODO use error handler to handle this FOPException or propagate exception
String err = "Error while rendering page " + page.getPageNumberString();
String err = "Error while rendering page " + page.getPageNumberString();
log.error(err, e);
throw new IllegalStateException("Fatal error occurred. Cannot continue. "
throw new IllegalStateException("Fatal error occurred. Cannot continue. "
+ e.getClass().getName() + ": " + err);
}
page.clear();

+ 4
- 4
src/java/org/apache/fop/area/Resolvable.java View File

@@ -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.area;

import java.util.List;
@@ -52,7 +52,7 @@ public interface Resolvable {
* identifies to the AreaTreeHandler which idrefs it needs
* resolved. After the idrefs are resolved, the ATH calls this
* method to allow the Resolvable object to update itself with
* the PageViewport information.
* the PageViewport information.
*
* @param id an ID matching one of the Resolvable object's
* unresolved idref's.

+ 22
- 22
src/java/org/apache/fop/area/Span.java View File

@@ -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.area;

import java.util.List;
@@ -27,7 +27,7 @@ import java.util.List;
* within the main-reference-area
* This object holds one or more normal-flow-reference-area children
* based on the column-count trait in effect for this span.
* See fo:region-body definition in the XSL Rec for more information.
* See fo:region-body definition in the XSL Rec for more information.
*/
public class Span extends Area {
// the list of flow reference areas in this span area
@@ -36,13 +36,13 @@ public class Span extends Area {
private int colGap;
private int colWidth; // width for each normal flow, calculated value
private int curFlowIdx; // n-f-r-a currently being processed, zero-based
/**
* Create a span area with the number of columns for this span area.
*
* @param colCount the number of columns in the span
* @param colGap the column gap between each column
* @param ipd the total ipd of the span
* @param colGap the column gap between each column
* @param ipd the total ipd of the span
*/
public Span(int colCount, int colGap, int ipd) {
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
@@ -57,7 +57,7 @@ public class Span extends Area {
* Create the normal flows for this Span
*/
private void createNormalFlows() {
flowAreas = new java.util.ArrayList(colCount);
flowAreas = new java.util.ArrayList(colCount);
colWidth = (ipd - ((colCount - 1) * colGap)) / colCount;

for (int i = 0; i < colCount; i++) {
@@ -104,28 +104,28 @@ public class Span extends Area {
if (colRequested >= 0 && colRequested < colCount) {
return (NormalFlow) flowAreas.get(colRequested);
} else { // internal error
throw new IllegalArgumentException("Invalid column number "
+ colRequested + " requested; only 0-" + (colCount - 1)
throw new IllegalArgumentException("Invalid column number "
+ colRequested + " requested; only 0-" + (colCount - 1)
+ " available.");
}
}
/**
* Get the NormalFlow area currently being processed
*
* @return the current NormalFlow
*/
public NormalFlow getCurrentFlow() {
return getNormalFlow(curFlowIdx);
return getNormalFlow(curFlowIdx);
}
/** @return the index of the current normal flow */
public int getCurrentFlowIndex() {
return curFlowIdx;
}
/**
* Indicate to the Span that the next column is being
* Indicate to the Span that the next column is being
* processed.
*
* @return the new NormalFlow (in the next column)
@@ -138,17 +138,17 @@ public class Span extends Area {
throw new IllegalStateException("(Internal error.) No more flows left in span.");
}
}
/**
* Indicates if the Span has unprocessed flows.
* Indicates if the Span has unprocessed flows.
*
* @return true if Span can increment to the next flow,
* @return true if Span can increment to the next flow,
* false otherwise.
*/
public boolean hasMoreFlows() {
return (curFlowIdx < colCount - 1);
return (curFlowIdx < colCount - 1);
}
/**
* Called to notify the span that all its flows have been fully generated so it can update
* its own BPD extent.
@@ -160,7 +160,7 @@ public class Span extends Area {
}
bpd = maxFlowBPD;
}
/**
* Indicates whether any child areas have been added to this span area.
*
@@ -179,7 +179,7 @@ public class Span extends Area {
}
return (areaCount == 0);
}
/** {@inheritDoc} */
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());

+ 10
- 10
src/java/org/apache/fop/area/Trait.java View File

@@ -175,19 +175,19 @@ public class Trait implements Serializable {

/** The space-before trait. */
public static final Integer SPACE_BEFORE = new Integer(29);
/** The space-after trait. */
public static final Integer SPACE_AFTER = new Integer(30);
/** The is-reference-area trait. */
public static final Integer IS_REFERENCE_AREA = new Integer(31);
/** The is-viewport-area trait. */
public static final Integer IS_VIEWPORT_AREA = new Integer(32);
/** Blinking trait used when rendering inline parent. */
public static final Integer BLINK = new Integer(33);
/** Trait for color of underline decorations when rendering inline parent. */
public static final Integer UNDERLINE_COLOR = new Integer(34);
/** Trait for color of overline decorations when rendering inline parent. */
@@ -197,9 +197,9 @@ public class Trait implements Serializable {

/** Maximum value used by trait keys */
public static final int MAX_TRAIT_KEY = 36;
private static final TraitInfo[] TRAIT_INFO = new TraitInfo[MAX_TRAIT_KEY + 1];
private static class TraitInfo {
private String name;
private Class clazz; // Class of trait data
@@ -221,7 +221,7 @@ public class Trait implements Serializable {
private static void put(Integer key, TraitInfo info) {
TRAIT_INFO[key.intValue()] = info;
}
static {
// Create a hashmap mapping trait code to name for external representation
//put(ID_LINK, new TraitInfo("id-link", String.class));
@@ -518,7 +518,7 @@ public class Trait implements Serializable {

/** The background image url if any. */
private String url = null;
/** The background image if any. */
private ImageInfo imageInfo = null;

@@ -658,7 +658,7 @@ public class Trait implements Serializable {
throw new IllegalStateException("Illegal repeat style: " + repeat);
}
}
/**
* Return the string for debugging.
* {@inheritDoc}

+ 9
- 9
src/java/org/apache/fop/area/inline/AbstractTextArea.java View File

@@ -36,7 +36,7 @@ public abstract class AbstractTextArea extends InlineParent {
* (this is equivalent to the property word-spacing.optimum)
*/
protected int spaceDifference = 0;
/**
* Constructor
*
@@ -70,7 +70,7 @@ public abstract class AbstractTextArea extends InlineParent {
public AbstractTextArea(int stretch, int shrink, int adj) {
textAdjustingInfo = new TextAdjustingInfo(stretch, shrink, adj);
}
/**
* Get text word space adjust.
*
@@ -108,9 +108,9 @@ public abstract class AbstractTextArea extends InlineParent {
}

/**
* Set the difference between optimal width of a space and
* Set the difference between optimal width of a space and
* default width of a space according to the font; this part
* of the space adjustment is fixed and must not be
* of the space adjustment is fixed and must not be
* multiplied by the variation factor.
* @param spaceDiff the space difference
*/
@@ -129,22 +129,22 @@ public abstract class AbstractTextArea extends InlineParent {
int lineStretch, int lineShrink) {
if (textAdjustingInfo != null) {
// compute the new adjustments:
// if the variation factor is negative, it means that before
// if the variation factor is negative, it means that before
// the ipd variation the line had to stretch and now it has
// to shrink (or vice versa);
// in this case, if the stretch and shrink are not equally
// divided among the inline areas, we must compute a
// in this case, if the stretch and shrink are not equally
// divided among the inline areas, we must compute a
// balancing factor
double balancingFactor = 1.0;
if (variationFactor < 0) {
if (textWordSpaceAdjust < 0) {
// from a negative adjustment to a positive one
balancingFactor
balancingFactor
= ((double) textAdjustingInfo.availableStretch / textAdjustingInfo.availableShrink)
* ((double) lineShrink / lineStretch);
} else {
// from a positive adjustment to a negative one
balancingFactor
balancingFactor
= ((double) textAdjustingInfo.availableShrink / textAdjustingInfo.availableStretch)
* ((double) lineStretch / lineShrink);
}

+ 3
- 3
src/java/org/apache/fop/area/inline/Anchor.java View File

@@ -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.area.inline;

/**

+ 3
- 3
src/java/org/apache/fop/area/inline/Container.java View File

@@ -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.area.inline;

import org.apache.fop.area.Area;

+ 6
- 6
src/java/org/apache/fop/area/inline/FilledArea.java View File

@@ -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.area.inline;

import java.util.List;
@@ -35,7 +35,7 @@ import java.util.Iterator;
*/
public class FilledArea extends InlineParent {
private int unitWidth;
/**
* Create a new filled area.
*/
@@ -98,7 +98,7 @@ public class FilledArea extends InlineParent {
}
return bpd;
}
/**
* Get the child areas for this filled area.
* This copies the references of the inline areas so that
@@ -115,7 +115,7 @@ public class FilledArea extends InlineParent {
}
return newList;
}
/**
* recursively apply the variation factor to all descendant areas
* @param variationFactor the variation factor that must be applied to adjustments

+ 6
- 6
src/java/org/apache/fop/area/inline/ForeignObject.java View File

@@ -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.area.inline;

import org.apache.fop.area.Area;
@@ -30,9 +30,9 @@ import org.w3c.dom.Document;
* This holds an xml document and the associated namespace.
*/
public class ForeignObject extends Area {
private static final long serialVersionUID = -214947698798577885L;
private Document doc;
private String namespace;

@@ -63,7 +63,7 @@ public class ForeignObject extends Area {
public void setDocument(Document document) {
this.doc = document;
}
/**
* Get the document for this foreign object.
*

+ 3
- 3
src/java/org/apache/fop/area/inline/Image.java View File

@@ -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.area.inline;

import org.apache.fop.area.Area;

+ 19
- 19
src/java/org/apache/fop/area/inline/InlineArea.java View File

@@ -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.
@@ -29,7 +29,7 @@ import org.apache.fop.area.Trait;
* in a line area.
*/
public class InlineArea extends Area {
/**
* this class stores information about potential adjustments
* that can be used in order to re-compute adjustments when a
@@ -42,7 +42,7 @@ public class InlineArea extends Area {
protected int availableShrink;
/** total adjustment (= ipd - width of fixed elements) */
protected int adjustment;
/**
* Constructor
*
@@ -55,10 +55,10 @@ public class InlineArea extends Area {
availableShrink = shrink;
adjustment = adj;
}
/**
* Apply the variation factor
*
*
* @param variationFactor the factor by which the adjustment is to be changed
* @return the IPD increase
*/
@@ -68,19 +68,19 @@ public class InlineArea extends Area {
return adjustment - oldAdjustment;
}
}
/**
* offset position from before edge of parent area
*/
protected int offset = 0;
/**
* parent area
* it is needed in order to recompute adjust ratio and indents
* when a page-number or a page-number-citation is resolved
*/
private Area parentArea = null;
/**
* ipd variation of child areas: if this area has not already
* been added and cannot notify its parent area, store the variation
@@ -92,7 +92,7 @@ public class InlineArea extends Area {
* The adjustment information object
*/
protected InlineAdjustingInfo adjustingInfo = null;
/**
* @return the adjustment information object
*/
@@ -109,7 +109,7 @@ public class InlineArea extends Area {
public void setAdjustingInfo(int stretch, int shrink, int adjustment) {
adjustingInfo = new InlineAdjustingInfo(stretch, shrink, adjustment);
}
/**
* Modify the adjustment value in the adjustment information object
* @param adjustment the new adjustment value
@@ -119,7 +119,7 @@ public class InlineArea extends Area {
adjustingInfo.adjustment = adjustment;
}
}
/**
* Increase the inline progression dimensions of this area.
* This is used for inline parent areas that contain mulitple child areas.
@@ -165,7 +165,7 @@ public class InlineArea extends Area {
public Area getParentArea() {
return parentArea;
}
/**
* Set the parent for the child area.
*
@@ -177,7 +177,7 @@ public class InlineArea extends Area {
((InlineArea) childArea).setParentArea(this);
}
}
/**
*@return true if the inline area is underlined.
*/
@@ -189,17 +189,17 @@ public class InlineArea extends Area {
public boolean hasOverline() {
return getTraitAsBoolean(Trait.OVERLINE);
}
/** @return true if the inline area has a line through. */
public boolean hasLineThrough() {
return getTraitAsBoolean(Trait.LINETHROUGH);
}
/** @return true if the inline area is blinking. */
public boolean isBlinking() {
return getTraitAsBoolean(Trait.BLINK);
}
/**
* recursively apply the variation factor to all descendant areas
* @param variationFactor the variation factor that must be applied to adjustments
@@ -215,12 +215,12 @@ public class InlineArea extends Area {
}
return false;
}
public void handleIPDVariation(int ipdVariation) {
increaseIPD(ipdVariation);
notifyIPDVariation(ipdVariation);
}
/**
* notify the parent area about the ipd variation of this area
* or of a descendant area

+ 2
- 2
src/java/org/apache/fop/area/inline/InlineBlockParent.java View File

@@ -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.

+ 0
- 0
src/java/org/apache/fop/area/inline/InlineParent.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save