aboutsummaryrefslogtreecommitdiffstats
path: root/src/documentation
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2009-09-03 07:24:43 +0000
committerJeremias Maerki <jeremias@apache.org>2009-09-03 07:24:43 +0000
commit7389ef5a0f0b8f2059110c5c265a925d6e6240fc (patch)
tree8f1746a91c7798b45564fda14a8fe70afebda18b /src/documentation
parent1e062c6c0fe838515a97c1484ca9f5df609662f3 (diff)
downloadxmlgraphics-fop-7389ef5a0f0b8f2059110c5c265a925d6e6240fc.tar.gz
xmlgraphics-fop-7389ef5a0f0b8f2059110c5c265a925d6e6240fc.zip
There an easier way to throw exceptions from certain event otherwise not causing an exception.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@810792 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/documentation')
-rw-r--r--src/documentation/content/xdocs/trunk/events.xml23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/documentation/content/xdocs/trunk/events.xml b/src/documentation/content/xdocs/trunk/events.xml
index 51a1bb6cc..4ba6014c8 100644
--- a/src/documentation/content/xdocs/trunk/events.xml
+++ b/src/documentation/content/xdocs/trunk/events.xml
@@ -152,7 +152,28 @@ foUserAgent.getEventBroadcaster().addEventListener(new SysOutEventListener());]]
<p>
By default, FOP continues processing even if an image wasn't found. If you have
more strict requirements and want FOP to stop if an image is not available, you can
- do something like the following:
+ do something like the following in the simplest case:
+ </p>
+ <source><![CDATA[public class MyEventListener implements EventListener {
+
+ public void processEvent(Event event) {
+ if ("org.apache.fop.events.ResourceEventProducer".equals(
+ event.getEventGroupID())) {
+ event.setSeverity(EventSeverity.FATAL);
+ } else {
+ //ignore all other events (or do something of your choice)
+ }
+ }
+
+}]]></source>
+ <p>
+ Increasing the event severity to FATAL will signal the event broadcaster to throw
+ an exception and stop further processing. In the above case, all resource-related
+ events will cause FOP to stop processing.
+ </p>
+ <p>
+ You can also customize the exception to throw (you can may throw a RuntimeException
+ or subclass yourself) and/or which event to respond to:
</p>
<source><![CDATA[public class MyEventListener implements EventListener {