I attach some files which implement an easy pluggability model to help people who may want to use FOP as a reporting package within Swing apps.
They're still fairly broken, especially the -print method, which does silent printing - it doesn't complain, it just doesn't print either - so help with that would be appreciated. The internationalisation thing's sort of truncated as well Files SwingHandler This is the class you'd call from your application. You shouldn't need to call any other FOP class directly. You construct it with the FO file you want to use. The package makes no contribution to how you generate this file. Other constructors could readily be added for people using xsl, etc. It then has simple methods to save/print/preview that file. Print is currently broken. PrintRenderer is an inner class and extends the AWTRenderer, but I wonder if it could be done by extending the PDFRenderer, as that has better conformance and results - ideas? SwingPreviewDialog This is a bashed about version of org.apache.fop.viewer.PreviewDialog. The changes are 1/ a save button is added, and both the save() and print() methods call back to the SwingHandler rather than being implemented within the PreviewDialog 2/ it extends JPanel, not JFrame, so it can be easily embedded into wherever suits in your application. FileFilter An implementation of FileFilter used in the save() method to ensure pdf's only are shown Constants & images/*.gif I shoved the ugly button images in SwingPreviewDialog into this: I'm not sure what the FOP way is. SwingDemo A simple commented class showing how it can be used. java org.apache.fop.apps.SwingDemo -preview/-print/-save sorry, haven't taught it to exit by itself :-( If there's any interest in rolling this back into FOP, I'll continue working to make it conform: if not, I'll make it part of my application and use all my logging/image/etc services. Just thought I'd get an opinion before spending any more time. If it were to be rolled back in, then the AWTStarter should probably use this rather than having two separate implementations of the PreviewDialog, and the SwingPreviewDialog & FileFilter should go into org.apache.fop.viewer Alistair To be done: Restore full internationalisation Make viewer prettier (buttons, zoom, etc) Center AWT preview in dialog when you can see full width (currently lopsided) Improve message handling in AWTViewer Mend print method: use PDFRenderer instead of AWTRenderer? Constructor for org.xml.sax.InputSource Allow users to set initial directory in JFileChooser in save() Allow choice of multiple file formats in save method [wait until rtf is implemented?]
SwingHandler.zip
Description: Zip compressed data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]