Author: jeremias
Date: Thu Sep 3 07:24:43 2009
New Revision: 810792
URL: http://svn.apache.org/viewvc?rev=810792&view=rev
Log:
There an easier way to throw exceptions from certain event otherwise not
causing an exception.
Modified:
xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/events.xml
Modified: xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/events.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/events.xml?rev=810792&r1=810791&r2=810792&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/events.xml
(original)
+++ xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/events.xml Thu
Sep 3 07:24:43 2009
@@ -152,7 +152,28 @@
<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
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]