vmote 2003/08/12 22:32:54 Modified: src/java/org/apache/fop/apps Driver.java src/java/org/apache/fop/fo FOTreeEvent.java FOTreeListener.java Log: clean up documentation of new code and some checkstyle problems Revision Changes Path 1.23 +29 -4 xml-fop/src/java/org/apache/fop/apps/Driver.java Index: Driver.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Driver.java 12 Aug 2003 21:17:44 -0000 1.22 +++ Driver.java 13 Aug 2003 05:32:54 -0000 1.23 @@ -594,6 +594,19 @@ //this.atModel = new CachedRenderPagesModel(renderer); areaTree.setTreeModel(atModel); } + /** + The following statement triggers virtually all of the processing + for this document. The SAX parser fires events that are handled by + the appropriate InputHandler object, which means that you will need + to look in those objects to see where FOP picks up control of + processing again. For Structure Renderers (e.g. MIF & RTF), the SAX + events are handled directly. For Layout Renderers (e.g. PDF & + PostScript), an FO Tree is built by the FOTreeHandler, which in + turn fires events when a PageSequence object is complete. This + allows higher-level control objects (such as this class) to work + directly with PageSequence objects. See foPageSequenceComplete() + where this level of control is implemented. + */ parser.parse(source); if (foInputHandler instanceof FOTreeHandler) { FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler; @@ -659,7 +672,13 @@ } } - public void foPageSequenceComplete (FOTreeEvent event) throws FOPException{ + /** + * Required by the FOTreeListener interface. It handles an + * FOTreeEvent that is fired when a PageSequence object has been completed. + * @param event the FOTreeEvent that was fired + * @throws FOPException for errors in building the PageSequence + */ + public void foPageSequenceComplete (FOTreeEvent event) throws FOPException { PageSequence pageSeq = event.getPageSequence(); Title title = null; if (pageSeq.getTitleFO() != null) { @@ -669,13 +688,19 @@ pageSeq.format(areaTree); } - public void foDocumentComplete (FOTreeEvent event) throws SAXException{ + /** + * Required by the FOTreeListener interface. It handles an FOTreeEvent that + * is fired when the Document has been completely parsed. + * @param event the FOTreeEvent that was fired + * @throws SAXException for parsing errors + */ + public void foDocumentComplete (FOTreeEvent event) throws SAXException { //processAreaTree(atModel); try { areaTree.endDocument(); renderer.stopRenderer(); - } - catch (IOException ex) { + } catch (IOException ex) { + throw new SAXException(ex); } } 1.2 +13 -1 xml-fop/src/java/org/apache/fop/fo/FOTreeEvent.java Index: FOTreeEvent.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeEvent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FOTreeEvent.java 12 Aug 2003 06:30:04 -0000 1.1 +++ FOTreeEvent.java 13 Aug 2003 05:32:54 -0000 1.2 @@ -66,13 +66,25 @@ private PageSequence pageSeq; + /** + * Constructor captures the object that fired the event. + * @param source the Object that fired the event. + */ public FOTreeEvent (Object source) { super(source); } + /** + * Sets the PageSequence object for this event. + * @param pageSeq the PageSequence object attached to this event. + */ public void setPageSequence(PageSequence pageSeq) { this.pageSeq = pageSeq; } + + /** + * @return the PageSequence object attached to this event. + */ public PageSequence getPageSequence () { return pageSeq; } 1.2 +20 -6 xml-fop/src/java/org/apache/fop/fo/FOTreeListener.java Index: FOTreeListener.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FOTreeListener.java 12 Aug 2003 06:30:04 -0000 1.1 +++ FOTreeListener.java 13 Aug 2003 05:32:54 -0000 1.2 @@ -60,15 +60,29 @@ import org.apache.fop.apps.FOPException; /** - * An Event used for notification that various stages of the building of an - * FO tree have been completed. Specifically, these are currently used to - * notify Driver when a PageSequence has been completed. + * An interface for classes that need to handle FOTreeEvent objects as they + * are fired. + * The key benefit to using this interface is that the implementation can handle + * PageSequence objects at a higher level, rather than dealing directly with + * a lower-level SAX event. + * @see FOTreeEvent */ public interface FOTreeListener extends EventListener { - abstract void foPageSequenceComplete (FOTreeEvent e) throws FOPException; - abstract void foDocumentComplete (FOTreeEvent e) throws SAXException; + /** + * Method for handling a completed PageSequence object. + * @param e the FOTreeEvent that has been fired + * @throws FOPException for invalid input + */ + void foPageSequenceComplete (FOTreeEvent e) throws FOPException; + + /** + * Method for handling the end of the document. + * @param e the FOTreeEvent that has been fired + * @throws SAXException for parsing error + */ + void foDocumentComplete (FOTreeEvent e) throws SAXException; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]