You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FOEventHandler.java 13KB

Merged branch https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ProcessingFeedback into Trunk. Changes on branch: ........ r615153 | jeremias | 2008-01-25 10:07:21 +0100 (Fr, 25 Jan 2008) | 1 line Created temporary branch for processing feedback. ........ r615155 | jeremias | 2008-01-25 10:11:59 +0100 (Fr, 25 Jan 2008) | 1 line Initial commit of what I've built already for those who prefer code to minimalistic design docs. ........ r615278 | jeremias | 2008-01-25 18:25:00 +0100 (Fr, 25 Jan 2008) | 1 line EventProducer interfaces now operational. ........ r615773 | jeremias | 2008-01-28 10:06:16 +0100 (Mo, 28 Jan 2008) | 1 line No casting in client code when creating EventProducer instances. ........ r616242 | vhennebert | 2008-01-29 11:34:45 +0100 (Di, 29 Jan 2008) | 3 lines Trick to avoid hard-coding the class name of EventProducer in the source file. Feel free to revert if it's not ok. ........ r616900 | jeremias | 2008-01-30 21:59:31 +0100 (Mi, 30 Jan 2008) | 1 line Generate event model XMLs in to the build directory: build/gensrc and build/test-gensrc (the latter is new and needs to be setup as source folder in your IDE!) ........ r616907 | jeremias | 2008-01-30 22:12:59 +0100 (Mi, 30 Jan 2008) | 1 line Added an XMLResourceBundle that uses an XML file instead of a properties file to load the translations. The XML format is the same as for Cocoon's XMLResourceBundle. ........ r617097 | vhennebert | 2008-01-31 11:53:21 +0100 (Do, 31 Jan 2008) | 2 lines Minor typo + slight improvement of Javadoc ........ r617176 | jeremias | 2008-01-31 19:14:19 +0100 (Do, 31 Jan 2008) | 5 lines Renamed FopEvent to Event as suggested by Simon. EventProducerCollectorTask.java now reads the EventSeverity from a doclet tag. Added generation of EventProducer translations (including simple merging, no validation, yet) EventFormatter introduced (only basic functionality, yet). Added a simple EventListener implementation that uses EventFormatter to convert the events to human-readable, localized messages that are sent to the log via Commons Logging. ........ r617362 | jeremias | 2008-02-01 08:18:07 +0100 (Fr, 01 Feb 2008) | 1 line Some remaining rename operations based on an earlier discussion. ........ r617413 | jeremias | 2008-02-01 10:46:26 +0100 (Fr, 01 Feb 2008) | 2 lines Extracted formatting functionality into utility class AdvancedMessageFormat.java. AdvancedMessageFormat.java now supports conditional sub-groups (delimited by []). ........ r618682 | jeremias | 2008-02-05 17:07:08 +0100 (Di, 05 Feb 2008) | 1 line Add support for special object formatters (where toString() isn't good enough). ATM, it's hard-coded but could later be hooked into dynamic discovery if we have multiple such formatters. The SAX Locator is the only example for now. ........ r618686 | jeremias | 2008-02-05 17:12:56 +0100 (Di, 05 Feb 2008) | 3 lines Hooked most of FONode into the new event mechanism. The FOUserAgent provides a DefaultEventBroadcaster instance. If a producer method declares throwing an exception, the event is automatically marked FATAL and the dynamic proxy throws an exception right after notifying the listeners. The exceptions are created through the EventExceptionManager. It currently contains only one exception factory for ValidationException. If we need more such factories it's better to register them dynamically. Right now, they're hard-coded. ........ r619313 | jeremias | 2008-02-07 10:14:15 +0100 (Do, 07 Feb 2008) | 1 line Make sure no events are now just silently swallowed because after upgrading a user doesn't know about the event system. ........ r619314 | jeremias | 2008-02-07 10:14:46 +0100 (Do, 07 Feb 2008) | 1 line Log what translation file is being written. ........ r619320 | jeremias | 2008-02-07 10:31:00 +0100 (Do, 07 Feb 2008) | 2 lines FObj hooked into the event system. Code reduction using a protected method on FONode to acquire a FOValidationEventProducer. ........ r619359 | jeremias | 2008-02-07 11:59:19 +0100 (Do, 07 Feb 2008) | 2 lines Fop's QName now extends XGCommons' QName to initiate a transition. Hooked PropertyList into the event mechanism. ........ r631252 | jeremias | 2008-02-26 16:24:33 +0100 (Di, 26 Feb 2008) | 1 line Removed superfluous warning. ........ r631268 | jeremias | 2008-02-26 17:08:11 +0100 (Di, 26 Feb 2008) | 1 line Deprecated two methods which are a problem for localization. Also helps finding additional spots to switch over to the event mechanism. ........ r633852 | jeremias | 2008-03-05 15:20:24 +0100 (Mi, 05 Mrz 2008) | 1 line Add severity to formatting parameters. ........ r633855 | jeremias | 2008-03-05 15:21:57 +0100 (Mi, 05 Mrz 2008) | 4 lines Added support for additional field styles: {<fieldname>,if,<true-text>,<false-text>} {<fieldname>,equals,<test-string>,<true-text>,<false-text>} ........ r633856 | jeremias | 2008-03-05 15:24:04 +0100 (Mi, 05 Mrz 2008) | 2 lines Javadocs and TODOs. EventListeners can change the event severity. ........ r633857 | jeremias | 2008-03-05 15:27:08 +0100 (Mi, 05 Mrz 2008) | 4 lines Javadocs. Moved out event listener registration into a CompositeEventListener. Event broadcaster uses the events effective severity, not the initial value (for the case where listeners override the initial value). Set up a special EventBroadCaster in the FOUserAgent that filters events through a class (FOValidationEventListenerProxy) that adjusts the event severity for relaxed validation. ........ r633858 | jeremias | 2008-03-05 15:32:07 +0100 (Mi, 05 Mrz 2008) | 2 lines Instead of always decentrally checking whether strict validation is enabled or not, this is now done in a special event listener. The event producer method caller simply indicates whether it can recover from the error condition and continue. Started switching to event production in table FOs. ........ r634027 | jeremias | 2008-03-05 21:58:35 +0100 (Mi, 05 Mrz 2008) | 7 lines Moved AdvancedMessageFormat into its own package. AdvancedMessageFormat got the following added functionality: - Alternative conditional regions [ bla {field}] -> [ bla {field1}| even more bla {field2}] - Functions: functions get access to the parameters and they can produce an object that is then formatted ({#gatherContextInfo}) - "if" and "equals" format moved to top-level classes and added by dynamic registration. EventFormatter now supports includes in the form {{includeName}} so you can include other entries from the resource bundle for better reuse. Some more events in table code. ........ r634031 | jeremias | 2008-03-05 22:05:22 +0100 (Mi, 05 Mrz 2008) | 1 line SVN Props ........ r634208 | jeremias | 2008-03-06 11:26:52 +0100 (Do, 06 Mrz 2008) | 2 lines Improved context gathering. Moved GatherContextInfoFunction to an inner class of FONode to reduce visibilities. ........ r634209 | jeremias | 2008-03-06 11:28:14 +0100 (Do, 06 Mrz 2008) | 1 line Made FOPException localizable. ........ r634280 | jeremias | 2008-03-06 15:38:30 +0100 (Do, 06 Mrz 2008) | 2 lines ExceptionFactory is now dynamically registered. More table warnings and errors switch to events. ........ r634326 | jeremias | 2008-03-06 17:08:16 +0100 (Do, 06 Mrz 2008) | 1 line Remaining table FOs switched to events. ........ r634328 | jeremias | 2008-03-06 17:09:21 +0100 (Do, 06 Mrz 2008) | 1 line Deprecated FOP's QName. Mixing with Commons' variant only produces problems. ........ r634381 | jeremias | 2008-03-06 20:12:57 +0100 (Do, 06 Mrz 2008) | 2 lines Made the "invalidChild" event fully localizable by adding a "lookup" field for the optional rule to be displayed. And a few switches to the event system. ........ r634692 | jeremias | 2008-03-07 15:31:43 +0100 (Fr, 07 Mrz 2008) | 1 line More FO tree stuff switched to events. ........ r634712 | jeremias | 2008-03-07 16:19:21 +0100 (Fr, 07 Mrz 2008) | 1 line Avoid an NPE that says nothing (ex. could happen if the message template is wrong). ........ r634738 | jeremias | 2008-03-07 17:38:21 +0100 (Fr, 07 Mrz 2008) | 2 lines Non-FO children were not properly run through validation by FOTreeBuilder. Unified the way that non-FO elements are validated. Some FOs were already fixed. I now fixed the rest, so foreign elements can occur everywhere. ........ r637833 | jeremias | 2008-03-17 12:01:41 +0100 (Mo, 17 Mrz 2008) | 1 line Exception while cloning for RetrieveMarker to be handled by user as suggested by Andreas. ........ r637835 | jeremias | 2008-03-17 12:03:31 +0100 (Mo, 17 Mrz 2008) | 1 line Throw a RuntimeException of no other Exception class is specified for an event as a fallback if someone just sets the event severity to FATAL. ........ r637838 | jeremias | 2008-03-17 12:06:10 +0100 (Mo, 17 Mrz 2008) | 1 line Throw a meaningful exception when the property name is wrong. Otherwise, there will be an ArrayIndexOutOfBoundsException. ........ r637859 | jeremias | 2008-03-17 13:35:26 +0100 (Mo, 17 Mrz 2008) | 1 line Throw a meaningful exception when the property name is wrong. Otherwise, there will be an ArrayIndexOutOfBoundsException. ........ r637938 | jeremias | 2008-03-17 16:19:51 +0100 (Mo, 17 Mrz 2008) | 1 line Switched pagination package to events. ........ r637947 | jeremias | 2008-03-17 16:45:16 +0100 (Mo, 17 Mrz 2008) | 1 line Removed unlocalizable validation helper methods. ........ r637952 | jeremias | 2008-03-17 16:59:02 +0100 (Mo, 17 Mrz 2008) | 1 line Events on FOTreeBuilder. ........ r638299 | jeremias | 2008-03-18 11:09:30 +0100 (Di, 18 Mrz 2008) | 2 lines Added support for java.util.text's ChoiceFormat to AdvancedMessageFormat. Reuse the regexes as constants. ........ r638302 | jeremias | 2008-03-18 11:17:06 +0100 (Di, 18 Mrz 2008) | 1 line Events for inline-level layout managers. ........ r638774 | jeremias | 2008-03-19 11:17:36 +0100 (Mi, 19 Mrz 2008) | 1 line Added DEBUG level. ........ r638777 | jeremias | 2008-03-19 11:23:40 +0100 (Mi, 19 Mrz 2008) | 3 lines Generalized FOValidationEventListenerProxy into FOPEventListenerProxy, the main proxy for FOP's own event manipulation proxy. Done because of support for overflow="hidden" vs. overflow="error-if-overflow". Switched block-level layout managers to events. Some cleanup along the way. ........ r639222 | jeremias | 2008-03-20 10:27:34 +0100 (Do, 20 Mrz 2008) | 2 lines Some initial work for event forwarding from Batik. Missing errors/exceptions converted to events in PageSequenceMaster. ........ r639270 | jeremias | 2008-03-20 13:50:35 +0100 (Do, 20 Mrz 2008) | 1 line Removed DEBUG event severity again. Promoted constrained geometry adjustment event to INFO level as per discussion. ........ r640395 | jeremias | 2008-03-24 13:39:13 +0100 (Mo, 24 Mrz 2008) | 3 lines Moved the creation of the fallback LoggingEventListener to FOUserAgent so event before the startDocument() SAX event arrive in the log. Dynamic discovery of event models. Renderers and extensions can register renderer-specific event models. Switched the most important parts of the renderers to events (maybe not everything is converted). ........ r640397 | jeremias | 2008-03-24 13:43:04 +0100 (Mo, 24 Mrz 2008) | 1 line Remaining fixcrlfs. Xalan likes to mix CRLF and LF on Windows. ........ r640398 | jeremias | 2008-03-24 13:43:54 +0100 (Mo, 24 Mrz 2008) | 1 line Ignore namespace declarations for property handling. ........ r640463 | jeremias | 2008-03-24 17:59:52 +0100 (Mo, 24 Mrz 2008) | 2 lines Event in area package. Exposed getUserAgent() in Renderer interface (was already public in AbstractRenderer). ........ r642972 | jeremias | 2008-03-31 14:18:39 +0200 (Mo, 31 Mrz 2008) | 1 line Code restructured a bit. ........ r642975 | jeremias | 2008-03-31 14:24:07 +0200 (Mo, 31 Mrz 2008) | 2 lines Plugged fonts package into the event subsystem. Note: I did not follow the same pattern as for the rest as the font package is to be considered FOP-external, so I just added a manual adapter for the FontEventListener. This demonstrates how an external library can be integrated with the event system. Missing warning for unknown formatting objects added. Warning is not issued by the ElementMappingRegistry anymore but by FOTreeBuilder which has access to more context information. ........ r642997 | jeremias | 2008-03-31 16:10:08 +0200 (Mo, 31 Mrz 2008) | 1 line Added an example to demonstrate how to write your own event listener and how to deal with the exceptions thrown in the process. ........ r642998 | jeremias | 2008-03-31 16:13:40 +0200 (Mo, 31 Mrz 2008) | 1 line Removed unused method. Event formatting should not be part of the Event class. Use EventFormatter.format(Event) instead. ........ r643066 | jeremias | 2008-03-31 19:18:54 +0200 (Mo, 31 Mrz 2008) | 1 line First part of the event subsystem documentation (DRAFT). ........ r643784 | jeremias | 2008-04-02 10:05:33 +0200 (Mi, 02 Apr 2008) | 1 line More documentation. ........ r643785 | jeremias | 2008-04-02 10:06:38 +0200 (Mi, 02 Apr 2008) | 1 line Some nits. ........ r643787 | jeremias | 2008-04-02 10:24:41 +0200 (Mi, 02 Apr 2008) | 1 line Completed javadocs ........ r643824 | jeremias | 2008-04-02 12:00:30 +0200 (Mi, 02 Apr 2008) | 1 line Javadocs. ........ r645847 | vhennebert | 2008-04-08 12:54:16 +0200 (Di, 08 Apr 2008) | 2 lines Minor typo fixes ........ r645848 | vhennebert | 2008-04-08 12:58:30 +0200 (Di, 08 Apr 2008) | 2 lines Another small typo fix ........ r647678 | jeremias | 2008-04-14 09:20:26 +0200 (Mo, 14 Apr 2008) | 1 line Renamed *EventProducer.Factory.create() to *EventProducer.Provider.get() to better reflect what the method does (instances may be cached and reused). ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@647742 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
Merged branch https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ProcessingFeedback into Trunk. Changes on branch: ........ r615153 | jeremias | 2008-01-25 10:07:21 +0100 (Fr, 25 Jan 2008) | 1 line Created temporary branch for processing feedback. ........ r615155 | jeremias | 2008-01-25 10:11:59 +0100 (Fr, 25 Jan 2008) | 1 line Initial commit of what I've built already for those who prefer code to minimalistic design docs. ........ r615278 | jeremias | 2008-01-25 18:25:00 +0100 (Fr, 25 Jan 2008) | 1 line EventProducer interfaces now operational. ........ r615773 | jeremias | 2008-01-28 10:06:16 +0100 (Mo, 28 Jan 2008) | 1 line No casting in client code when creating EventProducer instances. ........ r616242 | vhennebert | 2008-01-29 11:34:45 +0100 (Di, 29 Jan 2008) | 3 lines Trick to avoid hard-coding the class name of EventProducer in the source file. Feel free to revert if it's not ok. ........ r616900 | jeremias | 2008-01-30 21:59:31 +0100 (Mi, 30 Jan 2008) | 1 line Generate event model XMLs in to the build directory: build/gensrc and build/test-gensrc (the latter is new and needs to be setup as source folder in your IDE!) ........ r616907 | jeremias | 2008-01-30 22:12:59 +0100 (Mi, 30 Jan 2008) | 1 line Added an XMLResourceBundle that uses an XML file instead of a properties file to load the translations. The XML format is the same as for Cocoon's XMLResourceBundle. ........ r617097 | vhennebert | 2008-01-31 11:53:21 +0100 (Do, 31 Jan 2008) | 2 lines Minor typo + slight improvement of Javadoc ........ r617176 | jeremias | 2008-01-31 19:14:19 +0100 (Do, 31 Jan 2008) | 5 lines Renamed FopEvent to Event as suggested by Simon. EventProducerCollectorTask.java now reads the EventSeverity from a doclet tag. Added generation of EventProducer translations (including simple merging, no validation, yet) EventFormatter introduced (only basic functionality, yet). Added a simple EventListener implementation that uses EventFormatter to convert the events to human-readable, localized messages that are sent to the log via Commons Logging. ........ r617362 | jeremias | 2008-02-01 08:18:07 +0100 (Fr, 01 Feb 2008) | 1 line Some remaining rename operations based on an earlier discussion. ........ r617413 | jeremias | 2008-02-01 10:46:26 +0100 (Fr, 01 Feb 2008) | 2 lines Extracted formatting functionality into utility class AdvancedMessageFormat.java. AdvancedMessageFormat.java now supports conditional sub-groups (delimited by []). ........ r618682 | jeremias | 2008-02-05 17:07:08 +0100 (Di, 05 Feb 2008) | 1 line Add support for special object formatters (where toString() isn't good enough). ATM, it's hard-coded but could later be hooked into dynamic discovery if we have multiple such formatters. The SAX Locator is the only example for now. ........ r618686 | jeremias | 2008-02-05 17:12:56 +0100 (Di, 05 Feb 2008) | 3 lines Hooked most of FONode into the new event mechanism. The FOUserAgent provides a DefaultEventBroadcaster instance. If a producer method declares throwing an exception, the event is automatically marked FATAL and the dynamic proxy throws an exception right after notifying the listeners. The exceptions are created through the EventExceptionManager. It currently contains only one exception factory for ValidationException. If we need more such factories it's better to register them dynamically. Right now, they're hard-coded. ........ r619313 | jeremias | 2008-02-07 10:14:15 +0100 (Do, 07 Feb 2008) | 1 line Make sure no events are now just silently swallowed because after upgrading a user doesn't know about the event system. ........ r619314 | jeremias | 2008-02-07 10:14:46 +0100 (Do, 07 Feb 2008) | 1 line Log what translation file is being written. ........ r619320 | jeremias | 2008-02-07 10:31:00 +0100 (Do, 07 Feb 2008) | 2 lines FObj hooked into the event system. Code reduction using a protected method on FONode to acquire a FOValidationEventProducer. ........ r619359 | jeremias | 2008-02-07 11:59:19 +0100 (Do, 07 Feb 2008) | 2 lines Fop's QName now extends XGCommons' QName to initiate a transition. Hooked PropertyList into the event mechanism. ........ r631252 | jeremias | 2008-02-26 16:24:33 +0100 (Di, 26 Feb 2008) | 1 line Removed superfluous warning. ........ r631268 | jeremias | 2008-02-26 17:08:11 +0100 (Di, 26 Feb 2008) | 1 line Deprecated two methods which are a problem for localization. Also helps finding additional spots to switch over to the event mechanism. ........ r633852 | jeremias | 2008-03-05 15:20:24 +0100 (Mi, 05 Mrz 2008) | 1 line Add severity to formatting parameters. ........ r633855 | jeremias | 2008-03-05 15:21:57 +0100 (Mi, 05 Mrz 2008) | 4 lines Added support for additional field styles: {<fieldname>,if,<true-text>,<false-text>} {<fieldname>,equals,<test-string>,<true-text>,<false-text>} ........ r633856 | jeremias | 2008-03-05 15:24:04 +0100 (Mi, 05 Mrz 2008) | 2 lines Javadocs and TODOs. EventListeners can change the event severity. ........ r633857 | jeremias | 2008-03-05 15:27:08 +0100 (Mi, 05 Mrz 2008) | 4 lines Javadocs. Moved out event listener registration into a CompositeEventListener. Event broadcaster uses the events effective severity, not the initial value (for the case where listeners override the initial value). Set up a special EventBroadCaster in the FOUserAgent that filters events through a class (FOValidationEventListenerProxy) that adjusts the event severity for relaxed validation. ........ r633858 | jeremias | 2008-03-05 15:32:07 +0100 (Mi, 05 Mrz 2008) | 2 lines Instead of always decentrally checking whether strict validation is enabled or not, this is now done in a special event listener. The event producer method caller simply indicates whether it can recover from the error condition and continue. Started switching to event production in table FOs. ........ r634027 | jeremias | 2008-03-05 21:58:35 +0100 (Mi, 05 Mrz 2008) | 7 lines Moved AdvancedMessageFormat into its own package. AdvancedMessageFormat got the following added functionality: - Alternative conditional regions [ bla {field}] -> [ bla {field1}| even more bla {field2}] - Functions: functions get access to the parameters and they can produce an object that is then formatted ({#gatherContextInfo}) - "if" and "equals" format moved to top-level classes and added by dynamic registration. EventFormatter now supports includes in the form {{includeName}} so you can include other entries from the resource bundle for better reuse. Some more events in table code. ........ r634031 | jeremias | 2008-03-05 22:05:22 +0100 (Mi, 05 Mrz 2008) | 1 line SVN Props ........ r634208 | jeremias | 2008-03-06 11:26:52 +0100 (Do, 06 Mrz 2008) | 2 lines Improved context gathering. Moved GatherContextInfoFunction to an inner class of FONode to reduce visibilities. ........ r634209 | jeremias | 2008-03-06 11:28:14 +0100 (Do, 06 Mrz 2008) | 1 line Made FOPException localizable. ........ r634280 | jeremias | 2008-03-06 15:38:30 +0100 (Do, 06 Mrz 2008) | 2 lines ExceptionFactory is now dynamically registered. More table warnings and errors switch to events. ........ r634326 | jeremias | 2008-03-06 17:08:16 +0100 (Do, 06 Mrz 2008) | 1 line Remaining table FOs switched to events. ........ r634328 | jeremias | 2008-03-06 17:09:21 +0100 (Do, 06 Mrz 2008) | 1 line Deprecated FOP's QName. Mixing with Commons' variant only produces problems. ........ r634381 | jeremias | 2008-03-06 20:12:57 +0100 (Do, 06 Mrz 2008) | 2 lines Made the "invalidChild" event fully localizable by adding a "lookup" field for the optional rule to be displayed. And a few switches to the event system. ........ r634692 | jeremias | 2008-03-07 15:31:43 +0100 (Fr, 07 Mrz 2008) | 1 line More FO tree stuff switched to events. ........ r634712 | jeremias | 2008-03-07 16:19:21 +0100 (Fr, 07 Mrz 2008) | 1 line Avoid an NPE that says nothing (ex. could happen if the message template is wrong). ........ r634738 | jeremias | 2008-03-07 17:38:21 +0100 (Fr, 07 Mrz 2008) | 2 lines Non-FO children were not properly run through validation by FOTreeBuilder. Unified the way that non-FO elements are validated. Some FOs were already fixed. I now fixed the rest, so foreign elements can occur everywhere. ........ r637833 | jeremias | 2008-03-17 12:01:41 +0100 (Mo, 17 Mrz 2008) | 1 line Exception while cloning for RetrieveMarker to be handled by user as suggested by Andreas. ........ r637835 | jeremias | 2008-03-17 12:03:31 +0100 (Mo, 17 Mrz 2008) | 1 line Throw a RuntimeException of no other Exception class is specified for an event as a fallback if someone just sets the event severity to FATAL. ........ r637838 | jeremias | 2008-03-17 12:06:10 +0100 (Mo, 17 Mrz 2008) | 1 line Throw a meaningful exception when the property name is wrong. Otherwise, there will be an ArrayIndexOutOfBoundsException. ........ r637859 | jeremias | 2008-03-17 13:35:26 +0100 (Mo, 17 Mrz 2008) | 1 line Throw a meaningful exception when the property name is wrong. Otherwise, there will be an ArrayIndexOutOfBoundsException. ........ r637938 | jeremias | 2008-03-17 16:19:51 +0100 (Mo, 17 Mrz 2008) | 1 line Switched pagination package to events. ........ r637947 | jeremias | 2008-03-17 16:45:16 +0100 (Mo, 17 Mrz 2008) | 1 line Removed unlocalizable validation helper methods. ........ r637952 | jeremias | 2008-03-17 16:59:02 +0100 (Mo, 17 Mrz 2008) | 1 line Events on FOTreeBuilder. ........ r638299 | jeremias | 2008-03-18 11:09:30 +0100 (Di, 18 Mrz 2008) | 2 lines Added support for java.util.text's ChoiceFormat to AdvancedMessageFormat. Reuse the regexes as constants. ........ r638302 | jeremias | 2008-03-18 11:17:06 +0100 (Di, 18 Mrz 2008) | 1 line Events for inline-level layout managers. ........ r638774 | jeremias | 2008-03-19 11:17:36 +0100 (Mi, 19 Mrz 2008) | 1 line Added DEBUG level. ........ r638777 | jeremias | 2008-03-19 11:23:40 +0100 (Mi, 19 Mrz 2008) | 3 lines Generalized FOValidationEventListenerProxy into FOPEventListenerProxy, the main proxy for FOP's own event manipulation proxy. Done because of support for overflow="hidden" vs. overflow="error-if-overflow". Switched block-level layout managers to events. Some cleanup along the way. ........ r639222 | jeremias | 2008-03-20 10:27:34 +0100 (Do, 20 Mrz 2008) | 2 lines Some initial work for event forwarding from Batik. Missing errors/exceptions converted to events in PageSequenceMaster. ........ r639270 | jeremias | 2008-03-20 13:50:35 +0100 (Do, 20 Mrz 2008) | 1 line Removed DEBUG event severity again. Promoted constrained geometry adjustment event to INFO level as per discussion. ........ r640395 | jeremias | 2008-03-24 13:39:13 +0100 (Mo, 24 Mrz 2008) | 3 lines Moved the creation of the fallback LoggingEventListener to FOUserAgent so event before the startDocument() SAX event arrive in the log. Dynamic discovery of event models. Renderers and extensions can register renderer-specific event models. Switched the most important parts of the renderers to events (maybe not everything is converted). ........ r640397 | jeremias | 2008-03-24 13:43:04 +0100 (Mo, 24 Mrz 2008) | 1 line Remaining fixcrlfs. Xalan likes to mix CRLF and LF on Windows. ........ r640398 | jeremias | 2008-03-24 13:43:54 +0100 (Mo, 24 Mrz 2008) | 1 line Ignore namespace declarations for property handling. ........ r640463 | jeremias | 2008-03-24 17:59:52 +0100 (Mo, 24 Mrz 2008) | 2 lines Event in area package. Exposed getUserAgent() in Renderer interface (was already public in AbstractRenderer). ........ r642972 | jeremias | 2008-03-31 14:18:39 +0200 (Mo, 31 Mrz 2008) | 1 line Code restructured a bit. ........ r642975 | jeremias | 2008-03-31 14:24:07 +0200 (Mo, 31 Mrz 2008) | 2 lines Plugged fonts package into the event subsystem. Note: I did not follow the same pattern as for the rest as the font package is to be considered FOP-external, so I just added a manual adapter for the FontEventListener. This demonstrates how an external library can be integrated with the event system. Missing warning for unknown formatting objects added. Warning is not issued by the ElementMappingRegistry anymore but by FOTreeBuilder which has access to more context information. ........ r642997 | jeremias | 2008-03-31 16:10:08 +0200 (Mo, 31 Mrz 2008) | 1 line Added an example to demonstrate how to write your own event listener and how to deal with the exceptions thrown in the process. ........ r642998 | jeremias | 2008-03-31 16:13:40 +0200 (Mo, 31 Mrz 2008) | 1 line Removed unused method. Event formatting should not be part of the Event class. Use EventFormatter.format(Event) instead. ........ r643066 | jeremias | 2008-03-31 19:18:54 +0200 (Mo, 31 Mrz 2008) | 1 line First part of the event subsystem documentation (DRAFT). ........ r643784 | jeremias | 2008-04-02 10:05:33 +0200 (Mi, 02 Apr 2008) | 1 line More documentation. ........ r643785 | jeremias | 2008-04-02 10:06:38 +0200 (Mi, 02 Apr 2008) | 1 line Some nits. ........ r643787 | jeremias | 2008-04-02 10:24:41 +0200 (Mi, 02 Apr 2008) | 1 line Completed javadocs ........ r643824 | jeremias | 2008-04-02 12:00:30 +0200 (Mi, 02 Apr 2008) | 1 line Javadocs. ........ r645847 | vhennebert | 2008-04-08 12:54:16 +0200 (Di, 08 Apr 2008) | 2 lines Minor typo fixes ........ r645848 | vhennebert | 2008-04-08 12:58:30 +0200 (Di, 08 Apr 2008) | 2 lines Another small typo fix ........ r647678 | jeremias | 2008-04-14 09:20:26 +0200 (Mo, 14 Apr 2008) | 1 line Renamed *EventProducer.Factory.create() to *EventProducer.Provider.get() to better reflect what the method does (instances may be cached and reused). ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@647742 13f79535-47bb-0310-9956-ffa450edef68
16 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.fo;
  19. import org.xml.sax.SAXException;
  20. import org.apache.fop.apps.FOUserAgent;
  21. import org.apache.fop.fo.extensions.ExternalDocument;
  22. import org.apache.fop.fo.flow.BasicLink;
  23. import org.apache.fop.fo.flow.Block;
  24. import org.apache.fop.fo.flow.BlockContainer;
  25. import org.apache.fop.fo.flow.Character;
  26. import org.apache.fop.fo.flow.ExternalGraphic;
  27. import org.apache.fop.fo.flow.Footnote;
  28. import org.apache.fop.fo.flow.FootnoteBody;
  29. import org.apache.fop.fo.flow.Inline;
  30. import org.apache.fop.fo.flow.InstreamForeignObject;
  31. import org.apache.fop.fo.flow.Leader;
  32. import org.apache.fop.fo.flow.ListBlock;
  33. import org.apache.fop.fo.flow.ListItem;
  34. import org.apache.fop.fo.flow.ListItemBody;
  35. import org.apache.fop.fo.flow.ListItemLabel;
  36. import org.apache.fop.fo.flow.PageNumber;
  37. import org.apache.fop.fo.flow.PageNumberCitation;
  38. import org.apache.fop.fo.flow.PageNumberCitationLast;
  39. import org.apache.fop.fo.flow.Wrapper;
  40. import org.apache.fop.fo.flow.table.Table;
  41. import org.apache.fop.fo.flow.table.TableBody;
  42. import org.apache.fop.fo.flow.table.TableCell;
  43. import org.apache.fop.fo.flow.table.TableColumn;
  44. import org.apache.fop.fo.flow.table.TableFooter;
  45. import org.apache.fop.fo.flow.table.TableHeader;
  46. import org.apache.fop.fo.flow.table.TableRow;
  47. import org.apache.fop.fo.pagination.Flow;
  48. import org.apache.fop.fo.pagination.PageSequence;
  49. import org.apache.fop.fo.pagination.Root;
  50. import org.apache.fop.fo.pagination.StaticContent;
  51. import org.apache.fop.fonts.FontEventAdapter;
  52. import org.apache.fop.fonts.FontInfo;
  53. /**
  54. * Abstract class defining what should be done with SAX events that map to
  55. * XSL-FO input. The events are actually captured by fo/FOTreeBuilder, passed
  56. * to the various fo Objects, which in turn, if needed, pass them to an instance
  57. * of FOEventHandler.
  58. *
  59. * Sub-classes will generally fall into one of two categories:
  60. * 1) a handler that actually builds an FO Tree from the events, or 2) a
  61. * handler that builds a structured (as opposed to formatted) document, such
  62. * as our MIF and RTF output targets.
  63. */
  64. public abstract class FOEventHandler {
  65. /**
  66. * The FOUserAgent for this process
  67. */
  68. protected FOUserAgent foUserAgent;
  69. /**
  70. * The Font information relevant for this document
  71. */
  72. protected FontInfo fontInfo;
  73. /**
  74. * Main constructor
  75. * @param foUserAgent the apps.FOUserAgent instance for this process
  76. */
  77. public FOEventHandler(FOUserAgent foUserAgent) {
  78. this.foUserAgent = foUserAgent;
  79. this.fontInfo = new FontInfo();
  80. this.fontInfo.setEventListener(new FontEventAdapter(foUserAgent.getEventBroadcaster()));
  81. }
  82. /** Constructor for sub-classes that do not need an {@link FOUserAgent} instance. */
  83. protected FOEventHandler() {
  84. }
  85. /**
  86. * Returns the User Agent object associated with this FOEventHandler.
  87. * @return the User Agent object
  88. */
  89. public FOUserAgent getUserAgent() {
  90. return foUserAgent;
  91. }
  92. /**
  93. * Retrieve the font information for this document
  94. * @return the FontInfo instance for this document
  95. */
  96. public FontInfo getFontInfo() {
  97. return this.fontInfo;
  98. }
  99. /**
  100. * This method is called to indicate the start of a new document run.
  101. * @throws SAXException In case of a problem
  102. */
  103. public void startDocument() throws SAXException {
  104. }
  105. /**
  106. * This method is called to indicate the end of a document run.
  107. * @throws SAXException In case of a problem
  108. */
  109. public void endDocument() throws SAXException {
  110. }
  111. /** {@inheritDoc} */
  112. public void startRoot(Root root) {
  113. }
  114. /** {@inheritDoc} */
  115. public void endRoot(Root root) {
  116. }
  117. /**
  118. *
  119. * @param pageSeq PageSequence that is starting.
  120. */
  121. public void startPageSequence(PageSequence pageSeq) {
  122. }
  123. /**
  124. * @param pageSeq PageSequence that is ending.
  125. */
  126. public void endPageSequence(PageSequence pageSeq) {
  127. }
  128. /**
  129. *
  130. * @param pagenum PageNumber that is starting.
  131. */
  132. public void startPageNumber(PageNumber pagenum) {
  133. }
  134. /**
  135. *
  136. * @param pagenum PageNumber that is ending.
  137. */
  138. public void endPageNumber(PageNumber pagenum) {
  139. }
  140. /**
  141. *
  142. * @param pageCite PageNumberCitation that is starting.
  143. */
  144. public void startPageNumberCitation(PageNumberCitation pageCite) {
  145. }
  146. /**
  147. *
  148. * @param pageCite PageNumberCitation that is ending.
  149. */
  150. public void endPageNumberCitation(PageNumberCitation pageCite) {
  151. }
  152. /**
  153. *
  154. * @param pageLast PageNumberCitationLast that is starting.
  155. */
  156. public void startPageNumberCitationLast(PageNumberCitationLast pageLast) {
  157. }
  158. /**
  159. *
  160. * @param pageLast PageNumberCitationLast that is ending.
  161. */
  162. public void endPageNumberCitationLast(PageNumberCitationLast pageLast) {
  163. }
  164. /**
  165. * This method is called to indicate the start of a new fo:flow
  166. * or fo:static-content.
  167. * This method also handles fo:static-content tags, because the
  168. * StaticContent class is derived from the Flow class.
  169. *
  170. * @param fl Flow that is starting.
  171. */
  172. public void startFlow(Flow fl) {
  173. }
  174. /**
  175. *
  176. * @param fl Flow that is ending.
  177. */
  178. public void endFlow(Flow fl) {
  179. }
  180. /**
  181. *
  182. * @param bl Block that is starting.
  183. */
  184. public void startBlock(Block bl) {
  185. }
  186. /**
  187. *
  188. * @param bl Block that is ending.
  189. */
  190. public void endBlock(Block bl) {
  191. }
  192. /**
  193. *
  194. * @param blc BlockContainer that is starting.
  195. */
  196. public void startBlockContainer(BlockContainer blc) {
  197. }
  198. /**
  199. *
  200. * @param blc BlockContainer that is ending.
  201. */
  202. public void endBlockContainer(BlockContainer blc) {
  203. }
  204. /**
  205. *
  206. * @param inl Inline that is starting.
  207. */
  208. public void startInline(Inline inl) {
  209. }
  210. /**
  211. *
  212. * @param inl Inline that is ending.
  213. */
  214. public void endInline(Inline inl) {
  215. }
  216. // Tables
  217. /**
  218. *
  219. * @param tbl Table that is starting.
  220. */
  221. public void startTable(Table tbl) {
  222. }
  223. /**
  224. *
  225. * @param tbl Table that is ending.
  226. */
  227. public void endTable(Table tbl) {
  228. }
  229. /**
  230. *
  231. * @param tc TableColumn that is starting;
  232. */
  233. public void startColumn(TableColumn tc) {
  234. }
  235. /**
  236. *
  237. * @param tc TableColumn that is ending;
  238. */
  239. public void endColumn(TableColumn tc) {
  240. }
  241. /**
  242. *
  243. * @param header TableHeader that is starting;
  244. */
  245. public void startHeader(TableHeader header) {
  246. }
  247. /**
  248. *
  249. * @param header TableHeader that is ending.
  250. */
  251. public void endHeader(TableHeader header) {
  252. }
  253. /**
  254. *
  255. * @param footer TableFooter that is starting.
  256. */
  257. public void startFooter(TableFooter footer) {
  258. }
  259. /**
  260. *
  261. * @param footer TableFooter that is ending.
  262. */
  263. public void endFooter(TableFooter footer) {
  264. }
  265. /**
  266. *
  267. * @param body TableBody that is starting.
  268. */
  269. public void startBody(TableBody body) {
  270. }
  271. /**
  272. *
  273. * @param body TableBody that is ending.
  274. */
  275. public void endBody(TableBody body) {
  276. }
  277. /**
  278. *
  279. * @param tr TableRow that is starting.
  280. */
  281. public void startRow(TableRow tr) {
  282. }
  283. /**
  284. *
  285. * @param tr TableRow that is ending.
  286. */
  287. public void endRow(TableRow tr) {
  288. }
  289. /**
  290. *
  291. * @param tc TableCell that is starting.
  292. */
  293. public void startCell(TableCell tc) {
  294. }
  295. /**
  296. *
  297. * @param tc TableCell that is ending.
  298. */
  299. public void endCell(TableCell tc) {
  300. }
  301. // Lists
  302. /**
  303. *
  304. * @param lb ListBlock that is starting.
  305. */
  306. public void startList(ListBlock lb) {
  307. }
  308. /**
  309. *
  310. * @param lb ListBlock that is ending.
  311. */
  312. public void endList(ListBlock lb) {
  313. }
  314. /**
  315. *
  316. * @param li ListItem that is starting.
  317. */
  318. public void startListItem(ListItem li) {
  319. }
  320. /**
  321. *
  322. * @param li ListItem that is ending.
  323. */
  324. public void endListItem(ListItem li) {
  325. }
  326. /**
  327. * Process start of a ListLabel.
  328. * @param listItemLabel ListItemLabel that is starting
  329. */
  330. public void startListLabel(ListItemLabel listItemLabel) {
  331. }
  332. /**
  333. * Process end of a ListLabel.
  334. * @param listItemLabel ListItemLabel that is ending
  335. */
  336. public void endListLabel(ListItemLabel listItemLabel) {
  337. }
  338. /**
  339. * Process start of a ListBody.
  340. * @param listItemBody ListItemBody that is starting
  341. */
  342. public void startListBody(ListItemBody listItemBody) {
  343. }
  344. /**
  345. * Process end of a ListBody.
  346. * @param listItemBody ListItemBody that is ending
  347. */
  348. public void endListBody(ListItemBody listItemBody) {
  349. }
  350. // Static Regions
  351. /**
  352. * Process start of a Static.
  353. * @param staticContent StaticContent that is starting
  354. */
  355. public void startStatic(StaticContent staticContent) {
  356. }
  357. /**
  358. * Process end of a Static.
  359. * @param statisContent StaticContent that is ending
  360. */
  361. public void endStatic(StaticContent statisContent) {
  362. }
  363. /**
  364. * Process start of a Markup.
  365. */
  366. public void startMarkup() {
  367. }
  368. /**
  369. * Process end of a Markup.
  370. */
  371. public void endMarkup() {
  372. }
  373. /**
  374. * Process start of a Link.
  375. * @param basicLink BasicLink that is starting
  376. */
  377. public void startLink(BasicLink basicLink) {
  378. }
  379. /**
  380. * Process end of a Link.
  381. * @param basicLink BasicLink that is ending
  382. */
  383. public void endLink(BasicLink basicLink) {
  384. }
  385. /**
  386. * Process an ExternalGraphic.
  387. * @param eg ExternalGraphic to process.
  388. */
  389. public void image(ExternalGraphic eg) {
  390. }
  391. /**
  392. * Process a pageRef.
  393. */
  394. public void pageRef() {
  395. }
  396. /**
  397. * Process the start of an InstreamForeignObject.
  398. * @param ifo InstreamForeignObject that is starting
  399. */
  400. public void startInstreamForeignObject(InstreamForeignObject ifo) {
  401. }
  402. /**
  403. * Process the end of an InstreamForeignObject.
  404. * @param ifo InstreamForeignObject that is ending
  405. */
  406. public void endInstreamForeignObject(InstreamForeignObject ifo) {
  407. }
  408. /**
  409. * Process the start of a footnote.
  410. * @param footnote Footnote that is starting
  411. */
  412. public void startFootnote(Footnote footnote) {
  413. }
  414. /**
  415. * Process the ending of a footnote.
  416. * @param footnote Footnote that is ending
  417. */
  418. public void endFootnote(Footnote footnote) {
  419. }
  420. /**
  421. * Process the start of a footnote body.
  422. * @param body FootnoteBody that is starting
  423. */
  424. public void startFootnoteBody(FootnoteBody body) {
  425. }
  426. /**
  427. * Process the ending of a footnote body.
  428. * @param body FootnoteBody that is ending
  429. */
  430. public void endFootnoteBody(FootnoteBody body) {
  431. }
  432. /**
  433. * Process the start of a Leader.
  434. * @param l Leader that is starting
  435. */
  436. public void startLeader(Leader l) {
  437. }
  438. /**
  439. * Process the end of a Leader.
  440. * @param l Leader that is ending
  441. */
  442. public void endLeader(Leader l) {
  443. }
  444. /**
  445. * Process the start of a wrapper.
  446. *
  447. * @param wrapper wrapper that is starting
  448. */
  449. public void startWrapper(Wrapper wrapper) {
  450. }
  451. /**
  452. * Process the ending of a wrapper.
  453. *
  454. * @param wrapper wrapper that is ending
  455. */
  456. public void endWrapper(Wrapper wrapper) {
  457. }
  458. /**
  459. * Process a Character.
  460. * @param c Character to process.
  461. */
  462. public void character(Character c) {
  463. }
  464. /**
  465. * Process character data.
  466. * @param foText text to process
  467. */
  468. public void characters(FOText foText) {
  469. }
  470. /**
  471. * Process the start of the external-document extension.
  472. * @param document the external-document node
  473. */
  474. public void startExternalDocument(ExternalDocument document) {
  475. }
  476. /**
  477. * Process the end of the external-document extension.
  478. * @param document the external-document node
  479. */
  480. public void endExternalDocument(ExternalDocument document) {
  481. }
  482. }