aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/events
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-07-17 18:14:01 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-07-17 18:14:01 +0000
commit96b06ff833f8c1059c3a5ae5a3bc023812e38a14 (patch)
tree1c333b49039e0c9bd89ee34259929a3b053a8e5d /src/java/org/apache/fop/events
parent74567e49f4caf648926ab2ba7a034ae84c30b2e9 (diff)
downloadxmlgraphics-fop-96b06ff833f8c1059c3a5ae5a3bc023812e38a14.tar.gz
xmlgraphics-fop-96b06ff833f8c1059c3a5ae5a3bc023812e38a14.zip
Merged revisions 676161,676297,676307,676397,676608,677404-677405,677543,677648-677652 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r676161 | jeremias | 2008-07-12 13:19:40 +0100 (Sat, 12 Jul 2008) | 1 line Attempt to fix a potential build problem. ........ r676297 | adelmelle | 2008-07-13 11:26:48 +0100 (Sun, 13 Jul 2008) | 2 lines Replace occurrences of File.toURL() by File.toURI().toURL() (recommended as of Java 6, where File.toURL() is deprecated) ........ r676307 | jeremias | 2008-07-13 13:11:17 +0100 (Sun, 13 Jul 2008) | 1 line null is not correct here, an empty String needs to be used for the default namespace. Saxon 9 fails with a NullPointerException otherwise. Xalan is more tolerant. ........ r676397 | adelmelle | 2008-07-13 19:31:30 +0100 (Sun, 13 Jul 2008) | 1 line Another attempt at avoiding build issues (?) ........ r676608 | cbowditch | 2008-07-14 15:44:53 +0100 (Mon, 14 Jul 2008) | 1 line A nit: clarify message so its more meaningful to end user ........ r677404 | jeremias | 2008-07-16 21:16:51 +0100 (Wed, 16 Jul 2008) | 1 line Worked around a bug in Xalan 2.4.0 (bundled with Sun Java 1.4.2_xx) where file URLs like file:/C:/.... got converted to file:\C:\.... on Windows causing a FileNotFoundException. ........ r677405 | jeremias | 2008-07-16 21:22:17 +0100 (Wed, 16 Jul 2008) | 1 line Removed stray System.out. ........ r677543 | jeremias | 2008-07-17 10:11:09 +0100 (Thu, 17 Jul 2008) | 1 line fonts package must not depend on the render package. Refactored to restore that rule. ........ r677648 | acumiskey | 2008-07-17 18:39:14 +0100 (Thu, 17 Jul 2008) | 2 lines ZapfDingbats and Symbol is not always available on the AFPRenderer so we can't have these as default font family properties unfortunately. ........ r677649 | acumiskey | 2008-07-17 18:40:12 +0100 (Thu, 17 Jul 2008) | 2 lines A minor optimization. ........ r677650 | acumiskey | 2008-07-17 18:41:27 +0100 (Thu, 17 Jul 2008) | 2 lines An optimization and improved readability of fontLookup() call. ........ r677651 | acumiskey | 2008-07-17 18:44:08 +0100 (Thu, 17 Jul 2008) | 2 lines Moved font setup stuff from setupFontInfo() in AFPRenderer and delegated this stuff to an AFPFontCollection class. ........ r677652 | acumiskey | 2008-07-17 18:47:04 +0100 (Thu, 17 Jul 2008) | 2 lines Unused imports. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@677664 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/events')
-rw-r--r--src/java/org/apache/fop/events/EventFormatter.xml2
-rw-r--r--src/java/org/apache/fop/events/model/EventMethodModel.java58
-rw-r--r--src/java/org/apache/fop/events/model/EventModel.java31
-rw-r--r--src/java/org/apache/fop/events/model/EventProducerModel.java24
4 files changed, 63 insertions, 52 deletions
diff --git a/src/java/org/apache/fop/events/EventFormatter.xml b/src/java/org/apache/fop/events/EventFormatter.xml
index dc9321a39..3578dc4e6 100644
--- a/src/java/org/apache/fop/events/EventFormatter.xml
+++ b/src/java/org/apache/fop/events/EventFormatter.xml
@@ -82,7 +82,7 @@ Any reference to it will be considered a reference to the first occurrence in th
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.rowTooTall">The contents of table-row {row} are taller than they should be (there is a block-progression-dimension or height constraint on the indicated row). Due to its contents the row grows to {effCellBPD} millipoints, but the row shouldn't get any taller than {maxCellBPD} millipoints.{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.tableFixedAutoWidthNotSupported">table-layout="fixed" and width="auto", but auto-layout not supported =&gt; assuming width="100%".{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.objectTooWide">The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt &gt; {maxIPD}mpt).{{locator}}</message>
- <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.overconstrainedAdjustEndIndent">Adjusting end-indent based on overconstrained geometry rules for {elementName}.{{locator}}</message>
+ <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.overconstrainedAdjustEndIndent">An {elementName} {{locator}} is wider than the available room in inline-progression-dimension. Adjusting end-indent based on overconstrained geometry rules (XSL 1.1, ch. 5.3.4)</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.viewportOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.regionOverflow">Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
<message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.flowNotMappingToRegionBody">Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}}</message>
diff --git a/src/java/org/apache/fop/events/model/EventMethodModel.java b/src/java/org/apache/fop/events/model/EventMethodModel.java
index 930cda53d..b9c62f8ab 100644
--- a/src/java/org/apache/fop/events/model/EventMethodModel.java
+++ b/src/java/org/apache/fop/events/model/EventMethodModel.java
@@ -37,12 +37,12 @@ import org.apache.xmlgraphics.util.XMLizable;
public class EventMethodModel implements Serializable, XMLizable {
private static final long serialVersionUID = -7548882973341444354L;
-
+
private String methodName;
private EventSeverity severity;
private List params = new java.util.ArrayList();
private String exceptionClass;
-
+
/**
* Creates an new instance.
* @param methodName the event method's name
@@ -52,7 +52,7 @@ public class EventMethodModel implements Serializable, XMLizable {
this.methodName = methodName;
this.severity = severity;
}
-
+
/**
* Adds a method parameter.
* @param param the method parameter
@@ -60,7 +60,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public void addParameter(Parameter param) {
this.params.add(param);
}
-
+
/**
* Adds a method parameter.
* @param type the type of the parameter
@@ -68,11 +68,11 @@ public class EventMethodModel implements Serializable, XMLizable {
* @return the resulting Parameter instance
*/
public Parameter addParameter(Class type, String name) {
- Parameter param = new Parameter(type, name);
+ Parameter param = new Parameter(type, name);
addParameter(param);
return param;
}
-
+
/**
* Sets the event method name.
* @param name the event name
@@ -80,7 +80,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public void setMethodName(String name) {
this.methodName = name;
}
-
+
/**
* Returns the event method name
* @return the event name
@@ -88,7 +88,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public String getMethodName() {
return this.methodName;
}
-
+
/**
* Sets the event's severity level.
* @param severity the severity
@@ -96,7 +96,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public void setSeverity(EventSeverity severity) {
this.severity = severity;
}
-
+
/**
* Returns the event's severity level.
* @return the severity
@@ -104,7 +104,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public EventSeverity getSeverity() {
return this.severity;
}
-
+
/**
* Returns an unmodifiable list of parameters for this event method.
* @return the list of parameters
@@ -112,7 +112,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public List getParameters() {
return Collections.unmodifiableList(this.params);
}
-
+
/**
* Sets the primary exception class for this event method. Note: Not all event methods throw
* exceptions!
@@ -121,7 +121,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public void setExceptionClass(String exceptionClass) {
this.exceptionClass = exceptionClass;
}
-
+
/**
* Returns the primary exception class for this event method. This method returns null if
* the event is only informational or just a warning.
@@ -130,34 +130,34 @@ public class EventMethodModel implements Serializable, XMLizable {
public String getExceptionClass() {
return this.exceptionClass;
}
-
+
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute(null, "name", "name", "CDATA", getMethodName());
- atts.addAttribute(null, "severity", "severity", "CDATA", getSeverity().getName());
+ atts.addAttribute("", "name", "name", "CDATA", getMethodName());
+ atts.addAttribute("", "severity", "severity", "CDATA", getSeverity().getName());
if (getExceptionClass() != null) {
- atts.addAttribute(null, "exception", "exception", "CDATA", getExceptionClass());
+ atts.addAttribute("", "exception", "exception", "CDATA", getExceptionClass());
}
String elName = "method";
- handler.startElement(null, elName, elName, atts);
+ handler.startElement("", elName, elName, atts);
Iterator iter = this.params.iterator();
while (iter.hasNext()) {
((XMLizable)iter.next()).toSAX(handler);
}
- handler.endElement(null, elName, elName);
+ handler.endElement("", elName, elName);
}
-
+
/**
* Represents an event parameter.
*/
public static class Parameter implements Serializable, XMLizable {
-
+
private static final long serialVersionUID = 6062500277953887099L;
-
+
private Class type;
private String name;
-
+
/**
* Creates a new event parameter.
* @param type the parameter type
@@ -167,7 +167,7 @@ public class EventMethodModel implements Serializable, XMLizable {
this.type = type;
this.name = name;
}
-
+
/**
* Returns the parameter type.
* @return the parameter type
@@ -175,7 +175,7 @@ public class EventMethodModel implements Serializable, XMLizable {
public Class getType() {
return this.type;
}
-
+
/**
* Returns the parameter name.
* @return the parameter name
@@ -187,12 +187,12 @@ public class EventMethodModel implements Serializable, XMLizable {
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute(null, "type", "type", "CDATA", getType().getName());
- atts.addAttribute(null, "name", "name", "CDATA", getName());
+ atts.addAttribute("", "type", "type", "CDATA", getType().getName());
+ atts.addAttribute("", "name", "name", "CDATA", getName());
String elName = "parameter";
- handler.startElement(null, elName, elName, atts);
- handler.endElement(null, elName, elName);
+ handler.startElement("", elName, elName, atts);
+ handler.endElement("", elName, elName);
}
-
+
}
}
diff --git a/src/java/org/apache/fop/events/model/EventModel.java b/src/java/org/apache/fop/events/model/EventModel.java
index 61e221b3b..9c11b79a3 100644
--- a/src/java/org/apache/fop/events/model/EventModel.java
+++ b/src/java/org/apache/fop/events/model/EventModel.java
@@ -21,6 +21,7 @@ package org.apache.fop.events.model;
import java.io.File;
import java.io.IOException;
+import java.io.OutputStream;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
@@ -38,6 +39,8 @@ import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
+import org.apache.commons.io.IOUtils;
+
import org.apache.xmlgraphics.util.XMLizable;
/**
@@ -46,15 +49,15 @@ import org.apache.xmlgraphics.util.XMLizable;
public class EventModel implements Serializable, XMLizable {
private static final long serialVersionUID = 7468592614934605082L;
-
+
private Map producers = new java.util.LinkedHashMap();
-
+
/**
* Creates a new, empty event model
*/
public EventModel() {
}
-
+
/**
* Adds the model of an event producer to the event model.
* @param producer the event producer model
@@ -62,7 +65,7 @@ public class EventModel implements Serializable, XMLizable {
public void addProducer(EventProducerModel producer) {
this.producers.put(producer.getInterfaceName(), producer);
}
-
+
/**
* Returns an iterator over the contained event producer models.
* @return an iterator (Iterator&lt;EventProducerModel&gt;)
@@ -79,7 +82,7 @@ public class EventModel implements Serializable, XMLizable {
public EventProducerModel getProducer(String interfaceName) {
return (EventProducerModel)this.producers.get(interfaceName);
}
-
+
/**
* Returns the model of an event producer with the given interface.
* @param clazz the interface of the event producer
@@ -88,22 +91,28 @@ public class EventModel implements Serializable, XMLizable {
public EventProducerModel getProducer(Class clazz) {
return getProducer(clazz.getName());
}
-
+
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
String elName = "event-model";
- handler.startElement(null, elName, elName, atts);
+ handler.startElement("", elName, elName, atts);
Iterator iter = getProducers();
while (iter.hasNext()) {
((XMLizable)iter.next()).toSAX(handler);
}
- handler.endElement(null, elName, elName);
+ handler.endElement("", elName, elName);
}
private void writeXMLizable(XMLizable object, File outputFile) throws IOException {
- Result res = new StreamResult(outputFile);
-
+ //These two approaches do not seem to work in all environments:
+ //Result res = new StreamResult(outputFile);
+ //Result res = new StreamResult(outputFile.toURI().toURL().toExternalForm());
+ //With an old Xalan version: file:/C:/.... --> file:\C:\.....
+ OutputStream out = new java.io.FileOutputStream(outputFile);
+ out = new java.io.BufferedOutputStream(out);
+ Result res = new StreamResult(out);
+
try {
SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
@@ -120,6 +129,8 @@ public class EventModel implements Serializable, XMLizable {
throw new IOException(e.getMessage());
} catch (SAXException e) {
throw new IOException(e.getMessage());
+ } finally {
+ IOUtils.closeQuietly(out);
}
}
diff --git a/src/java/org/apache/fop/events/model/EventProducerModel.java b/src/java/org/apache/fop/events/model/EventProducerModel.java
index 938609cd9..b0d334e99 100644
--- a/src/java/org/apache/fop/events/model/EventProducerModel.java
+++ b/src/java/org/apache/fop/events/model/EventProducerModel.java
@@ -35,18 +35,18 @@ import org.apache.xmlgraphics.util.XMLizable;
public class EventProducerModel implements Serializable, XMLizable {
private static final long serialVersionUID = 122267104123721902L;
-
+
private String interfaceName;
private Map methods = new java.util.LinkedHashMap();
-
+
/**
* Creates a new instance.
- * @param interfaceName the fully qualified interface name of the event producer
+ * @param interfaceName the fully qualified interface name of the event producer
*/
public EventProducerModel(String interfaceName) {
this.interfaceName = interfaceName;
}
-
+
/**
* Returns the fully qualified interface name of the event producer.
* @return the fully qualified interface name
@@ -54,7 +54,7 @@ public class EventProducerModel implements Serializable, XMLizable {
public String getInterfaceName() {
return this.interfaceName;
}
-
+
/**
* Sets the fully qualified interface name of the event producer.
* @param name the fully qualified interface name
@@ -62,7 +62,7 @@ public class EventProducerModel implements Serializable, XMLizable {
public void setInterfaceName(String name) {
this.interfaceName = name;
}
-
+
/**
* Adds a model instance of an event method.
* @param method the event method model
@@ -70,7 +70,7 @@ public class EventProducerModel implements Serializable, XMLizable {
public void addMethod(EventMethodModel method) {
this.methods.put(method.getMethodName(), method);
}
-
+
/**
* Returns the model instance of an event method for the given method name.
* @param methodName the method name
@@ -79,7 +79,7 @@ public class EventProducerModel implements Serializable, XMLizable {
public EventMethodModel getMethod(String methodName) {
return (EventMethodModel)this.methods.get(methodName);
}
-
+
/**
* Returns an iterator over the contained event producer methods.
* @return an iterator (Iterator&lt;EventMethodModel&gt;)
@@ -91,15 +91,15 @@ public class EventProducerModel implements Serializable, XMLizable {
/** {@inheritDoc} */
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
- atts.addAttribute(null, "name", "name", "CDATA", getInterfaceName());
+ atts.addAttribute("", "name", "name", "CDATA", getInterfaceName());
String elName = "producer";
- handler.startElement(null, elName, elName, atts);
+ handler.startElement("", elName, elName, atts);
Iterator iter = getMethods();
while (iter.hasNext()) {
((XMLizable)iter.next()).toSAX(handler);
}
- handler.endElement(null, elName, elName);
+ handler.endElement("", elName, elName);
}
-
+
}