[pentaho-reporting-flow-engine] 02/06: Import Upstream version 0.9.4

Tony Mancill tmancill at moszumanska.debian.org
Mon Apr 10 04:43:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

tmancill pushed a commit to branch master
in repository pentaho-reporting-flow-engine.

commit d5ddd02baa8b52d2abf80db9a05920d8c57c0645
Author: tony mancill <tmancill at debian.org>
Date:   Sun Apr 9 21:40:46 2017 -0700

    Import Upstream version 0.9.4
---
 ChangeLog.txt                                      | 2530 ++++++++++++++++++++
 README.txt                                         |   67 +
 build.xml                                          |   95 +
 debian/changelog                                   |  102 -
 debian/compat                                      |    1 -
 debian/control                                     |   53 -
 debian/copyright                                   |   25 -
 .../libpentaho-reporting-flow-engine-java-doc.docs |    3 -
 debian/libpentaho-reporting-flow-engine-java.dirs  |    1 -
 debian/libpentaho-reporting-flow-engine-java.links |    1 -
 debian/patches/00list                              |    5 -
 debian/patches/01_libdir.dpatch                    |   19 -
 debian/patches/02_jarnames.dpatch                  |   55 -
 debian/patches/03_source-target-1.3.dpatch         |   21 -
 debian/patches/04_local_dtd.dpatch                 |   29 -
 debian/patches/05_no_gnujaxp.dpatch                |   59 -
 debian/rules                                       |   75 -
 debian/watch                                       |    2 -
 devresource/META-INF/MANIFEST.MF                   |    5 +
 licence-LGPL.txt                                   |  525 ++++
 source/loader.properties                           |    7 +
 source/org/jfree/report/DataFlags.java             |   50 +
 source/org/jfree/report/DataRow.java               |  117 +
 source/org/jfree/report/DataSet.java               |   44 +
 source/org/jfree/report/DataSourceException.java   |   68 +
 source/org/jfree/report/EmptyReportData.java       |  100 +
 .../org/jfree/report/EmptyReportDataFactory.java   |   87 +
 source/org/jfree/report/EmptyReportException.java  |   61 +
 source/org/jfree/report/JFreeReport.java           |  253 ++
 source/org/jfree/report/JFreeReportBoot.java       |  391 +++
 source/org/jfree/report/JFreeReportCoreModule.java |  111 +
 source/org/jfree/report/JFreeReportInfo.java       |  185 ++
 .../jfree/report/ReportConfigurationException.java |   68 +
 source/org/jfree/report/ReportData.java            |  103 +
 source/org/jfree/report/ReportDataFactory.java     |   70 +
 .../jfree/report/ReportDataFactoryException.java   |   65 +
 source/org/jfree/report/ReportException.java       |   71 +
 .../jfree/report/ReportInterruptedException.java   |   62 +
 .../jfree/report/ReportProcessingException.java    |   61 +
 source/org/jfree/report/TableReportData.java       |  132 +
 .../org/jfree/report/TableReportDataFactory.java   |  123 +
 source/org/jfree/report/compat.css                 |   15 +
 source/org/jfree/report/coremodule.properties      |   15 +
 .../report/data/CachingReportDataFactory.java      |  257 ++
 source/org/jfree/report/data/DefaultDataFlags.java |  129 +
 .../org/jfree/report/data/ExpressionDataRow.java   |  354 +++
 source/org/jfree/report/data/ExpressionSlot.java   |   57 +
 source/org/jfree/report/data/FastGlobalView.java   |  455 ++++
 source/org/jfree/report/data/GlobalMasterRow.java  |  375 +++
 source/org/jfree/report/data/GlobalView.java       |  314 +++
 .../report/data/ImportedVariablesDataRow.java      |  111 +
 .../report/data/MasterDataRowChangeEvent.java      |   71 +
 source/org/jfree/report/data/ParameterDataRow.java |   75 +
 source/org/jfree/report/data/PrecomputeNode.java   |   48 +
 .../org/jfree/report/data/PrecomputeNodeImpl.java  |  180 ++
 .../org/jfree/report/data/PrecomputeNodeKey.java   |   42 +
 .../report/data/PrecomputedExpressionSlot.java     |   99 +
 .../report/data/PrecomputedValueRegistry.java      |   56 +
 .../data/PrecomputedValueRegistryBuilder.java      |   82 +
 .../org/jfree/report/data/ReportContextImpl.java   |  206 ++
 source/org/jfree/report/data/ReportDataRow.java    |  280 +++
 .../jfree/report/data/RunningExpressionSlot.java   |  174 ++
 source/org/jfree/report/data/StaticDataRow.java    |  225 ++
 .../report/data/StaticExpressionRuntimeData.java   |  111 +
 source/org/jfree/report/engine.css                 |   45 +
 .../jfree/report/event/ReportProgressEvent.java    |   77 +
 .../jfree/report/event/ReportProgressListener.java |   46 +
 .../report/expressions/AbstractExpression.java     |  211 ++
 .../expressions/ColumnAggregationExpression.java   |   58 +
 .../org/jfree/report/expressions/Expression.java   |  164 ++
 .../report/expressions/ExpressionException.java    |   62 +
 .../report/expressions/ExpressionRuntime.java      |   71 +
 .../report/expressions/FormulaExpression.java      |  193 ++
 .../jfree/report/expressions/FormulaFunction.java  |  308 +++
 source/org/jfree/report/expressions/Function.java  |   59 +
 .../report/expressions/ProxyExpressionRuntime.java |  107 +
 .../report/expressions/ReportFormulaContext.java   |  175 ++
 .../formula/sys/Attr-Function.properties           |    7 +
 .../expressions/formula/sys/AttrFunction.java      |  100 +
 .../formula/sys/AttrFunctionDescription.java       |  108 +
 .../report/expressions/sys/GetValueExpression.java |   75 +
 .../report/expressions/sys/GroupByExpression.java  |  130 +
 .../expressions/sys/IsEmptyDataExpression.java     |   82 +
 .../report/expressions/sys/IsEmptyExpression.java  |   91 +
 .../expressions/sys/IsEndOfDataExpression.java     |   66 +
 .../expressions/sys/IsExportTypeExpression.java    |   80 +
 .../report/expressions/sys/IsNullExpression.java   |   73 +
 .../jfree/report/flow/AbstractReportProcessor.java |  110 +
 .../jfree/report/flow/AbstractReportTarget.java    |   94 +
 .../jfree/report/flow/DefaultFlowController.java   |  364 +++
 source/org/jfree/report/flow/DefaultReportJob.java |  157 ++
 .../org/jfree/report/flow/EmptyReportTarget.java   |  112 +
 .../jfree/report/flow/FlowControlOperation.java    |  119 +
 source/org/jfree/report/flow/FlowController.java   |   97 +
 .../jfree/report/flow/LayoutExpressionRuntime.java |  137 ++
 .../jfree/report/flow/LibLayoutReportTarget.java   |  341 +++
 source/org/jfree/report/flow/ParameterMapping.java |   62 +
 source/org/jfree/report/flow/ReportContext.java    |   60 +
 source/org/jfree/report/flow/ReportJob.java        |   67 +
 source/org/jfree/report/flow/ReportProcessor.java  |   49 +
 .../org/jfree/report/flow/ReportStructureRoot.java |   55 +
 source/org/jfree/report/flow/ReportTarget.java     |   71 +
 .../org/jfree/report/flow/ReportTargetState.java   |   47 +
 source/org/jfree/report/flow/ReportTargetUtil.java |   88 +
 .../report/flow/SinglePassReportProcessor.java     |   67 +
 .../jfree/report/flow/StatefullReportTarget.java   |   44 +
 .../report/flow/flowing/FlowReportProcessor.java   |  114 +
 .../layoutprocessor/AbstractLayoutController.java  |  145 ++
 .../flow/layoutprocessor/BufferedReportTarget.java |  231 ++
 .../layoutprocessor/BufferingLayoutController.java |  190 ++
 .../ContentElementLayoutController.java            |  150 ++
 .../DefaultLayoutControllerFactory.java            |  133 +
 .../layoutprocessor/ElementLayoutController.java   |  574 +++++
 .../flow/layoutprocessor/LayoutController.java     |  135 ++
 .../layoutprocessor/LayoutControllerFactory.java   |   50 +
 .../flow/layoutprocessor/LayoutControllerUtil.java |  574 +++++
 .../layoutprocessor/ReportLayoutController.java    |   72 +
 .../layoutprocessor/SectionLayoutController.java   |  256 ++
 .../StaticTextLayoutController.java                |  123 +
 .../layoutprocessor/SubReportLayoutController.java |   68 +
 .../jfree/report/flow/paginating/PageState.java    |   74 +
 .../report/flow/paginating/PageStateList.java      |  344 +++
 .../flow/paginating/PaginatingReportProcessor.java |  308 +++
 .../jfree/report/flow/raw/RawReportProcessor.java  |   54 +
 .../org/jfree/report/flow/raw/RawReportTarget.java |  114 +
 .../report/flow/raw/XmlPrintReportProcessor.java   |   79 +
 .../report/flow/raw/XmlPrintReportTarget.java      |  282 +++
 .../flow/streaming/StreamingReportProcessor.java   |  104 +
 .../report/i18n/DefaultResourceBundleFactory.java  |   74 +
 .../jfree/report/i18n/ResourceBundleFactory.java   |   58 +
 source/org/jfree/report/jfreereport.properties     |  144 ++
 .../jfree/report/modules/data/beans/.placeholder   |    2 +
 .../data/beans/NamedStaticReportDataFactory.java   |  113 +
 .../data/beans/StaticReportDataFactory.java        |  455 ++++
 .../data/beans/StaticReportDataFactoryModule.java  |   70 +
 .../report/modules/data/beans/module.properties    |   20 +
 .../modules/data/sql/ConnectionProvider.java       |   45 +
 .../modules/data/sql/DriverConnectionProvider.java |  110 +
 .../modules/data/sql/SQLParameterLookupParser.java |   64 +
 .../report/modules/data/sql/SQLReportData.java     |  230 ++
 .../modules/data/sql/SQLReportDataFactory.java     |  110 +
 .../modules/data/sql/SQLReportDataModule.java      |   64 +
 .../data/sql/SimpleSQLReportDataFactory.java       |  338 +++
 .../modules/data/sql/StaticConnectionProvider.java |   57 +
 .../modules/data/sql/configuration.properties      |   15 +
 .../report/modules/data/sql/module.properties      |   14 +
 .../jfree/report/modules/data/xpath/.placeholder   |    2 +
 .../modules/factories/common/module.properties     |   14 +
 .../data/base/DataFactoryReadHandler.java          |   45 +
 .../data/base/DataFactoryReadHandlerFactory.java   |   81 +
 .../data/base/ReportDataFactoryBaseModule.java     |   63 +
 .../base/ReportDataFactoryXmlResourceFactory.java  |   58 +
 .../modules/factories/data/base/module.properties  |   14 +
 .../data/beans/StaticDataFactoryModule.java        |   68 +
 .../beans/StaticDataResourceXmlFactoryModule.java  |   80 +
 .../data/beans/StaticDataSourceReadHandler.java    |  121 +
 .../factories/data/beans/configuration.properties  |   16 +
 .../modules/factories/data/beans/module.properties |   14 +
 .../factories/data/beans/staticdatasource.xsd      |   48 +
 .../factories/data/sql/ConfigReadHandler.java      |   83 +
 .../factories/data/sql/ConnectionReadHandler.java  |   45 +
 .../data/sql/ConnectionReadHandlerFactory.java     |   81 +
 .../data/sql/DriverConnectionReadHandler.java      |  142 ++
 .../factories/data/sql/SQLDataFactoryModule.java   |   67 +
 .../data/sql/SQLDataFactoryReadHandler.java        |  160 ++
 .../data/sql/SQLResourceXmlFactoryModule.java      |   79 +
 .../factories/data/sql/configuration.properties    |   19 +
 .../modules/factories/data/sql/module.properties   |   14 +
 .../modules/factories/data/sql/sqldatasource.xsd   |   77 +
 .../report/base/JFreeReportXmlResourceFactory.java |   87 +
 .../factories/report/base/NodeReadHandler.java     |   45 +
 .../report/base/NodeReadHandlerFactory.java        |   81 +
 .../report/base/ReportFactoryBaseModule.java       |   63 +
 .../report/base/SubReportXmlResourceFactory.java   |   58 +
 .../factories/report/base/configuration.properties |    3 +
 .../factories/report/base/module.properties        |   14 +
 .../extended/ExtendedXmlFactoryModule.java         |   62 +
 .../simple/SimpleXmlFactoryModule.java             |   62 +
 .../report/compatibility/simple/jfreereport.xsd    |  891 +++++++
 .../report/compatibility/simple/report-085.dtd     |  874 +++++++
 .../report/compatibility/simple/simple.xsd         | 1008 ++++++++
 .../report/flow/AbstractElementReadHandler.java    |  250 ++
 .../report/flow/AbstractExpressionReadHandler.java |  188 ++
 .../flow/AttributeExpressionReadHandler.java       |  122 +
 .../report/flow/AttributeReadHandler.java          |  161 ++
 .../report/flow/ContentElementReadHandler.java     |  126 +
 .../report/flow/DatasourceFactoryReadHandler.java  |  121 +
 .../report/flow/DetailSectionReadHandler.java      |   62 +
 .../report/flow/DisplayConditionReadHandler.java   |   43 +
 .../factories/report/flow/ElementReadHandler.java  |  225 ++
 .../report/flow/ExpressionReadHandler.java         |   89 +
 .../report/flow/FlowOperationReadHandler.java      |  112 +
 .../report/flow/FlowReportFactoryModule.java       |   68 +
 .../report/flow/FlowXmlFactoryModule.java          |   80 +
 .../factories/report/flow/GroupReadHandler.java    |  106 +
 .../report/flow/GroupingExpressionReadHandler.java |   50 +
 .../report/flow/OutOfOrderSectionReadHandler.java  |  103 +
 .../report/flow/PageFooterReadHandler.java         |   78 +
 .../report/flow/PageHeaderReadHandler.java         |   78 +
 .../report/flow/ParameterMappingReadHandler.java   |   94 +
 .../factories/report/flow/ReportReadHandler.java   |  171 ++
 .../factories/report/flow/SectionReadHandler.java  |  239 ++
 .../report/flow/StyleExpressionReadHandler.java    |   74 +
 .../factories/report/flow/StyleKeyReadHandler.java |   58 +
 .../report/flow/StyleSheetReadHandler.java         |  152 ++
 .../report/flow/SubReportReadHandler.java          |  152 ++
 .../report/flow/TypedPropertyReadHandler.java      |  228 ++
 .../report/flow/ValueExpressionReadHandler.java    |   43 +
 .../factories/report/flow/configuration.properties |   38 +
 .../report/modules/factories/report/flow/flow.css  |   90 +
 .../report/modules/factories/report/flow/flow.xsd  |  599 +++++
 .../factories/report/flow/module.properties        |   15 +
 .../report/simplex/SimplexXmlFactoryModule.java    |   63 +
 .../modules/gui/common/DefaultGuiContext.java      |   72 +
 .../modules/gui/common/DefaultIconTheme.java       |   82 +
 .../report/modules/gui/common/GuiCommonModule.java |   68 +
 .../report/modules/gui/common/GuiContext.java      |   51 +
 .../jfree/report/modules/gui/common/IconTheme.java |   54 +
 .../modules/gui/common/configuration.properties    |    6 +
 .../report/modules/gui/common/module.properties    |   20 +
 .../report/modules/gui/common/resources.properties |    8 +
 .../gui/swing/common/AbstractActionPlugin.java     |  254 ++
 .../swing/common/AbstractExportActionPlugin.java   |  137 ++
 .../gui/swing/common/AbstractExportDialog.java     |  469 ++++
 .../modules/gui/swing/common/ActionFactory.java    |   42 +
 .../modules/gui/swing/common/ActionPlugin.java     |  128 +
 .../swing/common/ActionPluginMenuComparator.java   |   95 +
 .../common/ActionPluginToolbarComparator.java      |   95 +
 .../modules/gui/swing/common/CenterLayout.java     |  191 ++
 .../gui/swing/common/DefaultActionFactory.java     |  126 +
 .../gui/swing/common/EncodingComboBoxModel.java    |  702 ++++++
 .../modules/gui/swing/common/ExceptionDialog.java  |  385 +++
 .../gui/swing/common/ExportActionPlugin.java       |   51 +
 .../modules/gui/swing/common/ExportDialog.java     |   47 +
 .../modules/gui/swing/common/FormValidator.java    |  200 ++
 .../modules/gui/swing/common/JStatusBar.java       |  191 ++
 .../gui/swing/common/KeyedComboBoxModel.java       |  481 ++++
 .../gui/swing/common/ReportProgressBar.java        |  166 ++
 .../gui/swing/common/ReportProgressDialog.java     |  531 ++++
 .../gui/swing/common/SwingCommonModule.java        |   69 +
 .../modules/gui/swing/common/SwingGuiContext.java  |   46 +
 .../report/modules/gui/swing/common/SwingUtil.java |  204 ++
 .../gui/swing/common/WindowSizeLimiter.java        |   91 +
 .../common/action/AbstractActionDowngrade.java     |   65 +
 .../common/action/AbstractFileSelectionAction.java |  136 ++
 .../gui/swing/common/action/ActionButton.java      |  296 +++
 .../gui/swing/common/action/ActionDowngrade.java   |   54 +
 .../gui/swing/common/action/ActionMenuItem.java    |  293 +++
 .../gui/swing/common/action/ActionRadioButton.java |  293 +++
 .../swing/common/action/DowngradeActionMap.java    |  182 ++
 .../gui/swing/common/encoding-names.properties     |  138 ++
 .../swing/common/jfreereport-encodings.properties  |  297 +++
 .../localization/ActionLocaleUpdateHandler.java    |   67 +
 .../localization/JLabelLocaleUpdateHandler.java    |   89 +
 .../common/localization/LocaleUpdateHandler.java   |   70 +
 .../swing/common/localization/LocalizedAction.java |   45 +
 .../common/localization/LocalizedComponent.java    |   44 +
 .../modules/gui/swing/common/module.properties     |   13 +
 .../modules/gui/swing/common/resources.properties  |   97 +
 .../modules/gui/swing/excel/module.properties      |   17 +
 .../gui/swing/html/HtmlFileExportActionPlugin.java |  161 ++
 .../gui/swing/html/HtmlFileExportDialog.java       |  532 ++++
 .../modules/gui/swing/html/HtmlFileExportTask.java |  173 ++
 .../gui/swing/html/HtmlZipExportActionPlugin.java  |  159 ++
 .../gui/swing/html/HtmlZipExportDialog.java        |  498 ++++
 .../modules/gui/swing/html/HtmlZipExportTask.java  |  180 ++
 .../modules/gui/swing/html/SwingHtmlModule.java    |   68 +
 .../gui/swing/html/configuration.properties        |   50 +
 .../modules/gui/swing/html/module.properties       |   17 +
 .../modules/gui/swing/html/resources.properties    |   74 +
 .../gui/swing/pdf/PdfExportActionPlugin.java       |  158 ++
 .../modules/gui/swing/pdf/PdfExportDialog.java     |  946 ++++++++
 .../modules/gui/swing/pdf/PdfExportTask.java       |  117 +
 .../modules/gui/swing/pdf/SwingPdfModule.java      |   69 +
 .../modules/gui/swing/pdf/configuration.properties |  106 +
 .../report/modules/gui/swing/pdf/module.properties |   17 +
 .../modules/gui/swing/pdf/resources.properties     |   46 +
 .../modules/gui/swing/preview/ActionCategory.java  |  204 ++
 .../gui/swing/preview/CategoryTreeItem.java        |  120 +
 .../gui/swing/preview/DefaultReportController.java |   97 +
 .../gui/swing/preview/PageBackgroundDrawable.java  |  193 ++
 .../modules/gui/swing/preview/PreviewApplet.java   |   43 +
 .../modules/gui/swing/preview/PreviewDialog.java   |  318 +++
 .../modules/gui/swing/preview/PreviewFrame.java    |  231 ++
 .../modules/gui/swing/preview/PreviewPane.java     |  960 ++++++++
 .../gui/swing/preview/PreviewPaneUtilities.java    |  546 +++++
 .../gui/swing/preview/ReportController.java        |   92 +
 .../gui/swing/preview/SwingPreviewModule.java      |   68 +
 .../gui/swing/preview/about/AboutDialog.java       |  312 +++
 .../gui/swing/preview/about/LibraryPanel.java      |  139 ++
 .../swing/preview/about/SystemPropertiesPanel.java |  255 ++
 .../swing/preview/actions/AboutActionPlugin.java   |  171 ++
 .../gui/swing/preview/actions/ControlAction.java   |   76 +
 .../swing/preview/actions/ControlActionPlugin.java |   45 +
 .../swing/preview/actions/ExitActionPlugin.java    |  139 ++
 .../gui/swing/preview/actions/ExportAction.java    |   85 +
 .../swing/preview/actions/GoToActionPlugin.java    |  161 ++
 .../preview/actions/GoToFirstPageActionPlugin.java |  139 ++
 .../preview/actions/GoToLastPageActionPlugin.java  |  139 ++
 .../preview/actions/GoToNextPageActionPlugin.java  |  140 ++
 .../actions/GoToPreviousPageActionPlugin.java      |  139 ++
 .../gui/swing/preview/actions/ZoomAction.java      |   77 +
 .../preview/actions/ZoomCustomActionPlugin.java    |  167 ++
 .../swing/preview/actions/ZoomInActionPlugin.java  |  145 ++
 .../preview/actions/ZoomListActionPlugin.java      |  128 +
 .../swing/preview/actions/ZoomOutActionPlugin.java |  146 ++
 .../gui/swing/preview/configuration.properties     |  131 +
 .../modules/gui/swing/preview/module.properties    |   17 +
 .../modules/gui/swing/preview/resources.properties |  107 +
 .../gui/swing/printing/DrawablePrintable.java      |   93 +
 .../gui/swing/printing/PrintActionPlugin.java      |  147 ++
 .../gui/swing/printing/PrintReportProcessor.java   |  333 +++
 .../modules/gui/swing/printing/PrintTask.java      |   74 +
 .../modules/gui/swing/printing/PrinterUtility.java |  128 +
 .../gui/swing/printing/SwingPrintingModule.java    |   67 +
 .../gui/swing/printing/configuration.properties    |   13 +
 .../modules/gui/swing/printing/module.properties   |   17 +
 .../gui/swing/printing/resources.properties        |   10 +
 .../report/modules/gui/swing/rtf/module.properties |   17 +
 .../report/modules/gui/themes/default/About16.gif  |  Bin 0 -> 644 bytes
 .../report/modules/gui/themes/default/About24.gif  |  Bin 0 -> 797 bytes
 .../report/modules/gui/themes/default/Back16.gif   |  Bin 0 -> 414 bytes
 .../report/modules/gui/themes/default/Back24.gif   |  Bin 0 -> 422 bytes
 .../modules/gui/themes/default/BlueCircle.gif      |  Bin 0 -> 942 bytes
 .../modules/gui/themes/default/EmptyIcon.gif       |  Bin 0 -> 43 bytes
 .../modules/gui/themes/default/FirstPage16.gif     |  Bin 0 -> 291 bytes
 .../modules/gui/themes/default/FirstPage24.gif     |  Bin 0 -> 333 bytes
 .../modules/gui/themes/default/Forward16.gif       |  Bin 0 -> 414 bytes
 .../modules/gui/themes/default/Forward24.gif       |  Bin 0 -> 434 bytes
 .../modules/gui/themes/default/GreenCircle.gif     |  Bin 0 -> 933 bytes
 .../modules/gui/themes/default/Information16.gif   |  Bin 0 -> 457 bytes
 .../modules/gui/themes/default/Information24.gif   |  Bin 0 -> 1328 bytes
 .../modules/gui/themes/default/LastPage16.gif      |  Bin 0 -> 289 bytes
 .../modules/gui/themes/default/LastPage24.gif      |  Bin 0 -> 341 bytes
 .../modules/gui/themes/default/PageSetup16.gif     |  Bin 0 -> 298 bytes
 .../modules/gui/themes/default/PageSetup24.gif     |  Bin 0 -> 499 bytes
 .../report/modules/gui/themes/default/Print16.gif  |  Bin 0 -> 293 bytes
 .../report/modules/gui/themes/default/Print24.gif  |  Bin 0 -> 491 bytes
 .../modules/gui/themes/default/PrintPreview16.gif  |  Bin 0 -> 425 bytes
 .../modules/gui/themes/default/PrintPreview24.gif  |  Bin 0 -> 786 bytes
 .../report/modules/gui/themes/default/Quit16.gif   |  Bin 0 -> 1022 bytes
 .../report/modules/gui/themes/default/Quit24.gif   |  Bin 0 -> 1291 bytes
 .../modules/gui/themes/default/RedCircle.gif       |  Bin 0 -> 928 bytes
 .../report/modules/gui/themes/default/SaveAs16.gif |  Bin 0 -> 255 bytes
 .../report/modules/gui/themes/default/SaveAs24.gif |  Bin 0 -> 348 bytes
 .../modules/gui/themes/default/YellowCircle.gif    |  Bin 0 -> 923 bytes
 .../report/modules/gui/themes/default/ZoomIn16.gif |  Bin 0 -> 540 bytes
 .../report/modules/gui/themes/default/ZoomIn24.gif |  Bin 0 -> 484 bytes
 .../modules/gui/themes/default/ZoomOut16.gif       |  Bin 0 -> 540 bytes
 .../modules/gui/themes/default/ZoomOut24.gif       |  Bin 0 -> 477 bytes
 .../modules/gui/themes/default/theme.properties    |   68 +
 .../misc/autotable/AutoTableCellContent.java       |   57 +
 .../modules/misc/autotable/AutoTableElement.java   |  104 +
 .../modules/misc/autotable/AutoTableModule.java    |   66 +
 .../report/modules/misc/autotable/autotable.css    |   35 +
 .../report/modules/misc/autotable/autotable.xsd    |   86 +
 .../misc/autotable/configuration.properties        |   25 +
 .../flow/AutoTableItemLayoutController.java        |  125 +
 .../autotable/flow/AutoTableLayoutController.java  |  265 ++
 .../modules/misc/autotable/module.properties       |   20 +
 .../xml/AutoTableCellContentReadHandler.java       |   84 +
 .../autotable/xml/AutoTableElementReadHandler.java |  144 ++
 .../referencedoc/DataSourceReferenceReport.xml     |  262 ++
 .../misc/referencedoc/ObjectReferenceReport.xml    |  266 ++
 .../misc/referencedoc/StyleKeyReferenceReport.xml  |  317 +++
 .../report/modules/misc/survey/SurveyModule.java   |   59 +
 .../report/modules/misc/survey/SurveyScale.java    |  959 ++++++++
 .../modules/misc/survey/SurveyScaleExpression.java |  200 ++
 .../modules/misc/survey/SurveyScaleLegendItem.java |  193 ++
 .../report/modules/misc/survey/module.properties   |   20 +
 .../modules/misc/tablemodel/CSVTableModel.java     |  162 ++
 .../misc/tablemodel/CSVTableModelProducer.java     |  199 ++
 .../misc/tablemodel/CloseableTableModel.java       |   43 +
 .../modules/misc/tablemodel/JoiningTableModel.java |  330 +++
 .../misc/tablemodel/PrintableTableModel.java       |  119 +
 .../tablemodel/ResultSetTableModelFactory.java     |  294 +++
 .../tablemodel/ScrollableResultSetTableModel.java  |  360 +++
 .../modules/misc/tablemodel/SubSetTableModel.java  |  339 +++
 .../modules/misc/tablemodel/TableModelInfo.java    |  118 +
 .../modules/misc/tablemodel/TableModelModule.java  |   71 +
 .../report/modules/misc/tablemodel/TypeMapper.java |  163 ++
 .../misc/tablemodel/configuration.properties       |   23 +
 .../modules/misc/tablemodel/module.properties      |   19 +
 .../report/modules/misc/tablemodel/package.html    |    4 +
 .../modules/preferences/base/ConfigFactory.java    |  194 ++
 .../modules/preferences/base/ConfigStorage.java    |   77 +
 .../preferences/base/ConfigStoreBaseModule.java    |   71 +
 .../preferences/base/ConfigStoreException.java     |   72 +
 .../preferences/base/NullConfigStorage.java        |   96 +
 .../modules/preferences/base/module.properties     |   24 +
 .../report/modules/preferences/base/package.html   |    7 +
 .../preferences/filesystem/FileConfigStorage.java  |  190 ++
 .../filesystem/FileConfigStoreModule.java          |   79 +
 .../FileConfigStoreModuleInitializer.java          |  157 ++
 .../filesystem/configuration.properties            |   15 +
 .../preferences/filesystem/module.properties       |   32 +
 .../modules/preferences/filesystem/package.html    |    6 +
 source/org/jfree/report/package.html               |   81 +
 .../org/jfree/report/structure/ContentElement.java |   72 +
 .../org/jfree/report/structure/DetailSection.java  |   48 +
 source/org/jfree/report/structure/Element.java     |  573 +++++
 source/org/jfree/report/structure/Group.java       |  104 +
 source/org/jfree/report/structure/Node.java        |  142 ++
 .../jfree/report/structure/ReportDefinition.java   |   65 +
 source/org/jfree/report/structure/Section.java     |  518 ++++
 source/org/jfree/report/structure/StaticText.java  |   61 +
 source/org/jfree/report/structure/SubReport.java   |  162 ++
 .../jfree/report/util/AttributeNameGenerator.java  |   78 +
 source/org/jfree/report/util/CSVQuoter.java        |  217 ++
 source/org/jfree/report/util/CSVTokenizer.java     |  365 +++
 .../jfree/report/util/CharacterEntityParser.java   |  245 ++
 .../org/jfree/report/util/ComponentDrawable.java   |  591 +++++
 source/org/jfree/report/util/DataSetUtility.java   |   85 +
 source/org/jfree/report/util/ImageUtils.java       |   80 +
 source/org/jfree/report/util/InstanceID.java       |   61 +
 source/org/jfree/report/util/IntegerCache.java     |   61 +
 source/org/jfree/report/util/LazyNameMap.java      |  139 ++
 .../report/util/MemoryByteArrayOutputStream.java   |  192 ++
 .../org/jfree/report/util/MemoryStringWriter.java  |  140 ++
 .../jfree/report/util/MessageFormatSupport.java    |  336 +++
 .../org/jfree/report/util/NoCloseOutputStream.java |   77 +
 .../report/util/ObjectStreamResolveException.java  |   59 +
 .../jfree/report/util/PropertyLookupParser.java    |  264 ++
 source/org/jfree/report/util/ReportParameters.java |  188 ++
 source/org/jfree/report/util/ScalingDrawable.java  |  128 +
 .../jfree/report/util/ScalingExtendedDrawable.java |  128 +
 source/org/jfree/report/util/TextUtilities.java    |   69 +
 .../org/jfree/report/util/WeakReferenceList.java   |  344 +++
 source/org/jfree/report/util/Worker.java           |  202 ++
 source/org/jfree/report/util/WorkerHandle.java     |   64 +
 source/org/jfree/report/util/WorkerPool.java       |  247 ++
 .../report/util/beans/ArrayValueConverter.java     |  119 +
 .../org/jfree/report/util/beans/BeanException.java |   71 +
 .../util/beans/BeanPropertyLookupParser.java       |   97 +
 .../org/jfree/report/util/beans/BeanUtility.java   |  548 +++++
 .../util/beans/BigDecimalValueConverter.java       |   77 +
 .../util/beans/BigIntegerValueConverter.java       |   77 +
 .../report/util/beans/BooleanValueConverter.java   |   75 +
 .../report/util/beans/ByteValueConverter.java      |   75 +
 .../report/util/beans/CharacterValueConverter.java |   79 +
 .../report/util/beans/ClassValueConverter.java     |   70 +
 .../report/util/beans/ColorValueConverter.java     |  144 ++
 .../jfree/report/util/beans/ConverterRegistry.java |  142 ++
 .../report/util/beans/DoubleValueConverter.java    |   75 +
 .../report/util/beans/FloatValueConverter.java     |   75 +
 .../report/util/beans/GenericValueConverter.java   |  110 +
 .../report/util/beans/IntegerValueConverter.java   |   75 +
 .../report/util/beans/LocaleValueConverter.java    |   98 +
 .../report/util/beans/LongValueConverter.java      |   75 +
 .../report/util/beans/ShortValueConverter.java     |   75 +
 .../report/util/beans/StringValueConverter.java    |   75 +
 .../report/util/beans/TimeZoneValueConverter.java  |   70 +
 .../jfree/report/util/beans/ValueConverter.java    |   58 +
 source/org/jfree/report/util/beans/package.html    |    8 +
 source/org/jfree/report/util/package.html          |    7 +
 source/overview.html                               |   12 +
 test/org/jfree/report/Pre397Test.java              |   41 +
 test/org/jfree/report/TableReportDataTest.java     |   77 +
 .../data/beans/StaticReportDataFactoryTest.java    |  110 +
 .../beans/StaticReportDataFactoryTestSupport.java  |   75 +
 test/org/jfree/report/testcore/SimpleDataSet.java  |  136 ++
 461 files changed, 61474 insertions(+), 451 deletions(-)

diff --git a/ChangeLog.txt b/ChangeLog.txt
new file mode 100644
index 0000000..2ccf93d
--- /dev/null
+++ b/ChangeLog.txt
@@ -0,0 +1,2530 @@
+---------------
+1.  WHAT's NEW
+---------------
+A list of changes in recent versions:
+
+0.9.2:    (30-Jul-2007)
+        * [BUG] Precomputing variables did not work and resulted always in an
+          IllegalStateException.
+          
+        * SectionLayoutController#isNodeVisible is now protected and can be
+          overrided in subclasses. This allows subclasses to filter out certain
+          nodes.
+
+        * Libraries updated.
+
+0.9.1:    (24-Jun-2007)
+        * [BUG] Empty data-sources were not handled correctly and the system
+          tried to query the first (but non-existent) row anyway. To fix this
+          is a sane way, all datasources now start counting their rows at 1,
+          and row zero is reserved for the special state 'BEFORE_FIRST_ROW'.
+
+        * [BUG] Skipping invisible elements using a display-condition caused
+          state-bugs. The system forwarded to the end of the report, while it
+          should only skip to the end of the hidden element itself.
+
+0.9.0-05: (27-Apr-2007)
+        * SectionLayoutController has been changed to be more extensible when
+          subclasses try to implement different iteration patterns.
+
+0.9.0-04: (02-Apr-2007) 
+        * Simplified the layout controller API. It should be easier now to
+          derive own layout controller without having to reimplement everything
+          from scratch.
+
+        * FormulaExpression and FormulaFunction now allow some introspection of
+          the contained formula without having to recompile it every time.
+
+0.9.0-03: (07-Mar-2007)
+        * Libraries updated.
+
+0.9.0-02: (25-Jan-2007)
+        * [BUG] Thousands of bugs fixed, which caused weird crashes everywhere.
+
+        * Bean-DataSources and SQL-DataSources aligned with the 0.8 codeline.
+
+0.9.0-01  (11-Dec-2006)
+        * [BUG] The ZIP-HTML-Dialog crashed due to an invalid resource reference.
+
+        * [BUG] A couple of strange layout issues has been fixed.
+
+        * [BUG] Sub-Reporting was barely working due to some bugs in the
+          data processing.
+
+        * ReportData-objects no longer misbehave if the underlying table is
+          empty. Any query to an empty data-source returns null. Positioning
+          the cursor to the row 'zero' is always valid.
+
+        * The default structural modell contained in 'org.jfree.report.structure'
+          is no longer mandatory. There are no dependencies to that package
+          on the expression handling or layout- and data-controllers anymore.
+
+        * A new auto-table module allows to create generic reports without
+          listing all columns of the table.
+
+0.9.0:    (3-Dec-2006)
+        * What's new: Everything!
+
+          - SubReports, FormulaSupport, Complex Layouts, Elements that can
+            span more than one page - we got 'em all.
+
+          JFreeReport 0.9 is a complete rewrite of the good old JFreeReport
+          engine. One of the ugly consequences of that rewrite is the total
+          loss of backward compatiblity.
+
+          With JFreeReport 0.9 we dropped the absolute-positioned banded
+          report paradigm and entered the world of Document centric reports.
+
+          For more details on what has changed and what is still on the ToDo
+          list, have a look at the JFreeReport site and forum.
+
+0.8.7-10: (2-Nov-2006)
+        * [BUG] Updated the DTD to contain the stroke-style definitions.
+
+        * Added support to concat PDFs to PDFExportUtil. (Mimil)
+
+        * Updated the parser to spit out a explicit warning if JFreeReport
+          has not yet been booted. Parsing will fail afterwards, but now it
+          should be clear why and how to prevent it.
+
+0.8.7-9: (26-Sep-2006)
+        * [BUG] The report converter was not working, due to a missing
+          call to boot the report engine.
+
+        * [BUG] Follow-up to the inaccurate printing bug in 0.8.7-7:
+          Changed the normalization transformation. It seems that this
+          bug is related to an bug in the JDK that messes up the scaling
+          (Java-Bug #4992456). The fix from 0.8.7-7 made things worse than
+          better, so that patch was undone.
+
+          Until there is a final solution, we cannot guarantee printout
+          sizes in all cases. If the JDK behaves correctly, all measurements
+          are given in point (assuming a resolution of 72dpi).
+
+        * [BUG] Printing caused rendering errors in the report preview. This
+          was caused by reusing the preview's report pane for the printing
+          (to possibly avoid the repagination). Now a separate report pane is
+          used on all printing operations.
+
+        * [BUG] As long as we have to stick with iText, abstracting and
+          caching the font creation is not possible. iText's font handler
+          insists of either using *filenames* (not even URLs, that would be to
+          simple) or byte-arrays to feed the font-data into the library. Using
+          byte-arrays is out of question if you have to deal with 'Arial Unicode
+          MS' (a 28MB font file), so we are effectively restricted to files.
+
+          That means: LibLoader is not used for font loading anymore, we are
+          back using the old an inefficient file-name passing.
+
+        * [PERFORMANCE] Resolved some scalability issues when running several
+          reports concurrently. The StyleKey-implementation caused some severe
+          congestion due to some synchronization code, that - if written
+          slightly different - could have been easily avoided.
+
+          The original report was posted in the blog referenced below, and
+          later also posted in the Pentaho-Forum.
+
+          http://jroller.com/page/galina?entry=pentaho_jfreereport_reporting_framework_performance
+
+        * Direct printing now supports to define the number-of-copies using
+          the report configuration property
+          'org.jfree.report.modules.output.pageable.graphics.print.NumberOfCopies'
+
+        * The Excel-Export is now able to append the generated report content
+          to an exsiting workbook file. Radek Maciaszek wrote the patch for that.
+
+        * ImageContent and drawable content can now also be loaded from an BLOB
+          or byte-array. The 'image-url-field' and 'drawable-url-field' types
+          now handles these source-types along with the URL loading.
+
+0.8.7-8: (03-Sep-2006)
+          This release contains bugfixes for the next stable version of
+          Pentaho. Its always better to have an extra release than to have
+          extra complaints, isn't it?
+
+        * [BUG] The extwriter produced extra whitespaces for 'property-ref'
+          tags with content inside.
+
+        * [BUG] Images on page-spanning reports where misplaced if they crossed
+          the inner page boundary.
+
+0.8.7-7: (31-Aug-2006)
+        * [BUG] Martin Schmidt reported, that the results of the ColumnMultiply,
+          ColumnDifference and ColumnDivisionExpression were invalid, due to
+          some stupid initialization bugs.
+
+        * [BUG] Martin Schmidt fixed a ClassCastException in the
+          ElementTrafficLightFunction.
+
+        * [BUG] Repeating GroupHeaders of the outer-most group behaved invalidly
+          and repeating group-footers did not reserve enough space to be printed
+          correctly all the time.
+
+        * [BUG] CSV separator was hardcoded.
+
+        * [BUG] Printing was sometimes inaccurate, as some printer spoolers
+          added some extra scaling to the process. We now try to prevent that
+          by applying the normalization scale to the PrinterGraphics.
+
+        * [BUG] The HTML-Viewer called Internet Explorer ignores vertical
+          alignments on table-cells. Therefore, we now also add 'valign'
+          attributes to the generated table cells in the HTML export.
+
+        * [BUG] Exceptions when accessing encodings do no longer stop the
+          GUI. There are still JDK bugs pending on that issue (particulary
+          IBM-CP970).
+
+        * [BUG] The HTML-Export GUI did not allow to place the data directory
+          of the Directory-Export outside the directory containing the main
+          HTML file.
+
+        * Added 'org.jfree.report.modules.gui.*.DefaultFileName' property key
+          that could be used to give a default file name in export GUIs. Use
+          '~/' to reference the user's home directory.
+
+        * Added a caching parser frontend. Parsing is slow, so caching that
+          (using libloader's cache) saves a lot of time. To use the cache,
+          use the CachingReportGenerator instead of the ReportGenerator class.
+
+        * The CreateHyperlinksFunction now has a new parameter called 'target'
+          to specify the target-window of the generated links directly. This
+          only affects the HTML export.
+
+0.8.7-6: (27-Jul-2006)
+        * [BUG] The PDFAction for generating links was invalid.
+
+        * [BUG] The ColumnAggregationExpressions used double-variables for
+          their computation. This caused accuracy issues. Now all computation
+          expressions use BigDecimals for their computation.
+
+        * [BUG] The DateCutExpression did not work at all.
+
+        * [BUG] Setting a solid white background in Excel was funny, but
+          stupid. Now cells have no background, unless specified explicitly.
+
+        * [BUG] Graphics2D operations in the PDF export did not share the
+          default font encoding and embedding settings of the PDFOutputTarget.
+
+        * [BUG] A duplicate mnemonic for the english locale has been reported
+          and fixed.
+
+        * The StaticDataSourceFactory now accepts some more variations on the
+          factory method syntax.
+
+        * The ItemHideFunction accepts two new parameters (ignorePageBreaks,
+          ignoreGroupBreaks) which allow to override the reset-behaviour.
+
+        * The DateSpanExpression now also accepts Numbers.
+
+0.8.7-5: (29-Jun-2006)
+        * [BUG] Both the HTML-Export GUI and HtmlProcessor class did not handle
+          the report configuration correctly, and therefore caused errors when
+          trying to export to XHTML.
+
+        * [BUG] Serialization issues caused by a stupidly placed 'transient'
+          flag caused NullPointerExceptions after serialzing/deserializing
+          of Number- and Date- fields.
+
+        * [BUG] The I18N-Demo was not well-defined and thus one of the to-be-
+          translated strings was totally buggy.
+
+        * [BUG] The MessageFormatSupport crashed when the format string was
+          buggy. Now it does no longer crash - it fails silently now (but
+          drops a Log-message).
+
+        * [BUG] The number-field and date-field did not use the locale
+          defined by the ResourceBundleFactory of the report.
+
+        * [BUG] Booting was not synchronized. (This has been fixed in jcommon).
+
+        * [BUG] A bug in LibFonts caused some italics and oblique fonts to not
+          be recognized correctly.
+
+        * A primitive version of the Query-Interfaces of JFreeReport 0.9 have
+          been downported into this version. The new DataFactory and Query
+          properties of the JFreeReport object can be used to let the engine
+          perform the query. These properties can also be defined in the
+          XML definitions (using the <datafactory> tag).
+
+        * The ReportDrawable interface offers an easy way for drawables to gain
+          knowledge about their environment. Drawables get access to the report
+          configuration, the current LayoutSupport and the element's stylesheet.
+
+        * The Graphics2D that is passed to Drawable-instances for rendering is
+          now preinitialized with the current font, stroke and paint.
+
+        * The Internationalization-Demo now uses a ReportControler to allow to
+          select the locale for the report at runtime.
+
+        * The reset behaviour on new pages and group starts of the
+          ElementVisibilitySwitchFunction can now be controled using the
+          boolean flags 'resetOnPageStart' and 'resetOnGroupStart'.
+
+0.8.7-4: (30-May-2006)
+        * [BUG] The XML-Writer declared an obsolete system location of the DTD
+          for the generated report definitions.
+
+        * [BUG] The XML-Writer included the system properties (like "name" and
+          "dependencyLevel" into the function's properties list.
+
+        * [BUG] The Extended Report Definition DTD did not include the class
+          attribute for properties.
+
+        * [BUG] The BigDecimals were used with the 'double' constructor instead
+          of using the 'string' constructor. Evil me.
+
+        * [BUG] The Simple-XML's line reading was invalid for lines with X2 < X1
+          or Y2 < Y1. The resulting element behaved funny, but definitly not
+          correctly.
+
+        * [BUG] An invalid cast limited the number of generatable Excel-rows to
+          32768 instead of the physical limit of 65535 rows.
+
+        * [BUG] A bug in the StaticBandLayouter caused elements with an x2, that
+          is greater than the parent's usable space, to violate the parent's
+          containing rule. This caused funny effects in the Excel export.
+
+        * The Export-Dialog's habbit of storing the last user input for a report
+          can now be configured using a set of new configuration properties.
+
+        * The HTML exports 'copy-external-images' property is now configurable
+          using the report configuration. It is enabled by default, so that
+          all referenced images get copied into the specified data directory
+          (or into the ZIP-File for the ZIP-Export).
+
+        * The Stroke-Dashes are now based on the pen-width by default. The
+          global configuration property 'org.jfree.report.DynamicStrokeDashes'
+          can revert this change to the old static version.
+
+        * The stroke width for Excel-Exports now generates more suitable
+          definitions by modifying a few range tests.
+
+0.8.7-3: (26-Apr-2006)
+        * [BUG] Previewing expressions did not work properly, as the preview
+          expressions still referenced to the old row.
+
+        * [BUG] The message-field and the MessageFieldElementFactory did not
+          set the 'nullString' property, even if it was set in the
+          ElementFactory.
+
+        * [BUG] Missing or invalid encoding implementations do no longer
+          interrupt the font registration process.
+
+        * TextFormatExpression has been enhanced to optionally URLEncode the
+          complete content or single elements.
+
+        * A new URLEncodeExpression encodes Strings for URL-computations.
+
+        * A new demo shows how to group against values computed from expressions.
+
+        * A complete set of Greek translations has been written by George
+          Hatzisymeon.
+
+0.8.7-2: (28-Mar-2006)
+        * [BUG] The page setup plugin was not initialized properly. In
+          conjunction with other bugs (related to the export plugin handling)
+          this made the page setup option totally unavailable.
+
+0.8.7-1: (23-Mar-2006)
+        * [BUG] The ExportDialogs did not allow the closing of the window using
+          the normal operating system operations.
+
+        * [BUG] Synchronization was awkward within the JDK1.4 printing
+          (ext-project)
+
+        * [BUG] The first pageheader of a report did not have access to a
+          validly initialized datarow. This caused exceptions, troubles and
+          weird behaviour.
+
+        * [BUG] The Czech resources of PDF gui module were invalid. This
+          has been reported and fixed by Ivo Panacek.
+
+        * [BUG] The ToLowerCaseFunction did call 'toUppercase' which is
+          outspoken stupid.
+
+        * [BUG] Image sizing was wrong. There was an ugly mixup between the
+          'point' and 'pixel' unit types, which caused images to appear
+          smaller than they should be (or to be scaled where they should not
+          be scaled). This primarily affected the HTML and Excel output.
+
+        * [BUG] The stroke recognition was not correctly implemented and did
+          not match the stroke factory. This affected the Excel and HTML table
+          targets.
+
+        * [BUG] The font mapper did ignore fully qualified font names. Fonts
+          specified by their full name (Name Type '4') get now mapped to their
+          font families.
+
+        * Added flush() calls to all export targets, as unclosed and non-flushed
+          streams seem to be a common source of errors.
+
+        * New XML Elements exist for creating RoundRectangles and Ellipses.
+
+        * The Logging to JDK 1.4 and Log4J has been removed from JFreeReport.
+          These classes now form an library on its own and therefore are only
+          dependend on JCommon.
+
+        * Note: There is an unresolved bug in the RTF-Writer, which causes
+          IndexOutOfBoundsExceptions.
+
+0.8.7: (10-Feb-2006)
+        * [BUG] Performing a pagebreak-before-print on a group header and
+          printing values from the datarow in the pagefooter of the previous
+          page already showed the contents of the to-be-printed group.
+
+        * [BUG] Type1 Fonts can be embedded, if there is a 'pfb' file for that
+          font. The old code simply declared all of these fonts to be
+          non-embeddable, which is definitly not true.
+
+        * [BUG] The excel export used the localized pattern to define the cell-
+          format for number and date cells. This caused trouble in most non-
+          english environments.
+
+        * [BUG] The excel cell width factor was invalid and caused trouble on
+          some systems. The new default scale factor has been increased to work
+          around these problems. It can be adjusted using the report
+          configuration for cases where the default is not appropriate.
+
+        * [BUG] The excel color mapping was still buggy. The bug caused gray
+          areas to be rendered in red shades.
+
+        * [BUG] The line height of text elements was computed incorrectly and
+          therefore clipped large glyphs. Now, the maximum height defined for the
+          current font is used to define the line height.
+
+          This bugfix is not enabled by default, as it has the side effect,
+          that the effective lineheight is now greater than the font's declared
+          height most of the time. Therefore an element with Arial 10 needs a
+          defined element height of 11pt or 12pt to display a single line.
+
+          Please read the corresponding section in 'migration.txt' on how to
+          activate the bugfix.
+
+          Setting a custom line height in conjunction with multiline elements
+          caused exceptions due to another bug in that code.
+
+        * [BUG] The TrueType support did not register the available fonts. Thus
+          no truetype font information was used. Additionally, the PDF target
+          did not apply bold strokes to the fonts.
+
+        * [BUG] Component-Drawing was causing an infinite loop because of stupid
+          coding.
+
+        * [BUG] The preview components did not shutdown the repagination thread
+          properly. The thread eventually lived forever, eating valuable resources.
+
+        * [BUG] Groups declaring their headers to have a 'pagebreak-before-print'
+          behaved differently than groups having a 'pagebreak-after-print'
+          on their footers. This was caused by an incomplete roll-back of the
+          layout-states.
+
+        * [BUG] The About-dialog was a frame, which caused trouble on modal
+          settings. Additionally, the export dialogs did not search the
+          PreviewProxyBase's window when building the modal export dialogs,
+          which also caused trouble in some (rather unusual) setups.
+
+        * As a workaround for a bug in the JDK 1.5, DecimalFormats with
+          an empty format string get initialized manually using a hardcoded
+          format string as generated by JDK 1.4.
+
+        * The Message-Format handling has been improved. The Message-field
+          now recognizes the 'nullstring' attribute and replaces invalid or
+          missing content with that string.
+
+        * A huge set of new functions has been added to ease the handling of
+          dates and strings, whithout having to fall back to BeanShell-Scripts.
+
+          - a set of column aggregate expressions makes it easier to compute
+            results from columns of the same row.
+
+          - The DateExpression and VariableDateExpression allow the construction
+            of Date objects by encapsulating the functionality of
+            java.util.Calendar.
+
+          - String functions allow to truncate, replace or transform strings.
+
+          - Various compare functions allow to compare fields with static or
+            other field values.
+
+        * Expressions and functions now both have access to the current report
+          configuration and the ResourceBundleFactory holding all the
+          localization information.
+
+          Warning: This changed the interface of the Expression class.
+          Expressions and functions derived from AbstractExpression should not
+          notice a difference in most cases and should work as usual.
+
+        * The new field type 'resource-message' provides an internationalizable
+          counterpart of the message-field. The field's format string is read
+          from an resourcebundle and must have the same format as the
+          message-field.
+
+        * Shape-elements have a new property to define the stroke-type of the
+          shapes contained in them. In the Simple-XML definition, a set of
+          predefined strokes is available.
+
+        * The ExpressionRuntime interface now allows expressions to safely
+          detect the current export type.
+
+        * A new band type is available to display special content if the table
+          model of the report does not contain any data. The 'no-data-band'
+          replaces the 'itemband' in such cases and is printed exactly one time.
+
+          The new functions HideElementIfDataAvailableExpression and
+          ShowElementIfDataAvailableExpression can be used to customize the
+          report layout even further, if needed.
+
+0.8.6-6: (27-Dec-2005)
+        * [BUG] The demo did not initialize JFreeReport through the
+          JFreeReportBoot class and thus ran into an ugly NullPointer.
+
+        * The CSV-Data export is more configurable now. It does no longer
+          add extra state columns by default and which bands should be exported
+          can be controled using report properties. I also added some convienience
+          methods to the CSVDataReportUtil so that exporting to CSV files
+          is now a single line of code.
+
+0.8.6-5: (21-Dec-2005)
+        * [BUG] The colors used in the HTML export stylesheets were not
+          conforming to CSS2.1. Users working with the internet explorer using
+          one of the named colors in their reports did not see these colors at
+          all, as invalid style definitions got ignored by the browser.
+
+        * [BUG] The sheet-name function and the page headers in the table
+          exports now always use the data from the next report state. This
+          prevents some ugly misbehaviour when using 'pagebreak-after-print'
+          flags on group footers.
+
+        * [BUG] Duplicate values returned by the sheetName-function do no longer
+          interrupt the report process in the Excel-Exporter. Invalid sheetnames
+          do no longer cause trouble - they will be ignored.
+
+        * [BUG] The cell-width and height computations in previous versions of
+          JFreeReport have been some kind of voodoo. This has been fixed and
+          now the width and height are always correct.
+
+        * The Excel export target does now support images. Drawables get
+          converted to images before they get added to the sheets.
+
+        * The build process did not include the demo documentation files in
+          the demo-jar.
+
+        * Replacing the Exit and About-Action in the Preview-Dialogs works
+          again. Replacing the navigation or zoom actions is no longer allowed
+          (as it makes no sense to replace them).
+
+        * The GUI-icons have been factored out into an own package. The
+          skinning facility makes it easier to replace the icons and/or the
+          resource bundles of the GUI components.
+
+        * The PDF-Output target now interprets the '_blank' window name as
+          command to open the link target document in a new window.
+
+0.8.6-4: (20-Nov-2005)
+        * (As the public CVS is not available, this release is used to make
+          the current changes available to the public.)
+
+        * [BUG] In the PDF output target printing scaled images did not work
+          propertly, as the clipping code used the unscaled coordinates.
+
+        * Removed most of the 'strictfp' modifiers. They were no longer
+          neccessary and a bug in the IBM JDK tries to apply the class-wide
+          modifier to all abstract methods as well, which renders JFreeReport
+          useless on that JDK version.
+
+0.8.6-3: (14-Nov-2005)
+        * [BUG] Distributing text content over multiple pages caused exceptions
+          if the string got split and continued on a later page.
+
+        * [BUG] The ComponentDrawable was not able to handle java.awt.Window
+          instances.
+
+        * [BUG] The Excel-Color computation was totally messed up. The new
+          algorithm uses science instead of magic (and HSB instead of RGB)
+
+        * [BUG] The ImageContentFactory was not able to handle invalid inputs,
+          which caused ClassCastExceptions.
+
+        * [BUG] The image handling for the HTML export was invalid and caused
+          ugly scaled images.
+
+        * [BUG] The CSV and Excel export dialogs did not update the report
+          configuration properly.
+
+        * [BUG] The PDF export did not create italic or bold fonts. A new library
+          was introduced to solve the problem. 'libFonts' allows to map fonts
+          into Font-Families and to select the most appropriate font file for
+          a given style.
+
+        * JCommon has reached 1.0.0. JFreeChart users should switch to the
+          latest CVS version of JFreeChart til the next release.
+
+        * SurveyScale-Drawable is now serializable.
+
+        * A 'PrintableTableModel' has been added, which allows to override the
+          column names specified in the tablemodel. This is a contribution by
+          'LordOfCode'.
+
+        * Repeating Group-Footers have been implemented to support the printing
+          of running totals in large lists, without having to use the pagefooter.
+
+0.8.6-2: (17-Oct-2005)
+        * [BUG] Having a pagebreak-after-print on a group-footer without
+          having an report footer caused the table-type reporting to fail.
+
+        * [BUG] Printing repeated group-headers used the wrong table row index
+          if the printing occured if the group-header for the next group instance
+          has been printed just before the pagebreak occured.
+
+        * [BUG] An invalid computation of the maximum size of dynamic elements
+          caused all content to disapear, if the absolute position of the
+          dynamic element was greater than the horizontal space left for
+          the element content.
+
+        * It is now possible to add HTML link-targets to the elements. This way,
+          the link can be opened in a named or new frame or window.
+
+0.8.6-1: (12-Oct-2005)
+        * [BUG] There was inconsistent behaviour when exporting single table
+          reports using PageHeaders with 'print-on-lastpage' set to false.
+
+        * [BUG] Exporting multipage-wide reports to the plain-text export
+          did not work correctly.
+
+        * [BUG] The TableExport behaved unpredictable, including raising
+          errors when using the "StackedLayoutmanager". The real cause was
+          hidden in the LayoutManager API which did not compute band sizes
+          correctly. Combining relative y-positions and dynamic elements
+          creates undefined behaviour and must be avoided at all price.
+
+        * [BUG] The BaseFontSupport did not accept font files other than
+         'ttf' due to an overly paranoid check. (Bug #1299056)
+
+        * [BUG] The FunctionUtilities.findElement and findAllElements methods
+          did not take the given root band into account and therefore only worked
+          on subbands.
+
+        * [BUG] The CSVTokenizer did not handle trailing commas correctly.
+          Rob (redgeler), reported the bug and provided a test case to track
+          it down.
+
+        * [BUG] The PreviewDialog did not pass a 'parent' reference to its
+          repagination dialog, thus making that dialog inaccessible.
+
+        * Added a new Drawable-Element type to allow high-quality printing of
+          AWT and Swing components. The component-element is available from within
+          the SimpleXML, the ExtendedXML and the API. The new 'ComponentDrawing'-
+          demo shows how to use it.
+
+        * Modified the Simple DTD to make most of the style properties optional.
+          Styles can be inherited using stylesheets, as shown in the new
+          StyleSheet demo.
+
+        * New Functions: PageItemSumFunction, PageItemCountFunction,
+          HideNullValuesFunction and ShowElementByNameFunction added.
+
+        * Minor performance improvements when handling singlelined text, which
+          gives roughly a 25% bonus on the report processing time.
+
+        * Modified the ANT-Scripts to make custom builds easier. All compilation
+          tasks have been factored out and can be called directly using the
+          'antcall' task.
+
+0.8.6: (21-Sep-2005)
+        * [BUG] The XML Parser handler for function properties did not handle
+          specified classes correctly.
+
+        * [BUG] Michael Tennes fixed a show-stopping bug in the text width
+          calculation in the PlainTextOutputTarget.
+
+        * [BUG] Changed the API of StaticImageElementFactory to fix some unclean
+          method names. Also added a convinience property of type 'java.awt.Image'
+          to the class.
+
+        * [BUG] NumberFieldElementFactory and DateFieldElementFactory did not set
+          the Null-String correctly. This affects the 'simple-xml' parser as well
+          as the API report definition method. This fixes BugReport #1215492.
+
+        * [BUG] The table exports did not handle the bottom and right most borders
+          of a report correctly. These borders simply disapeared. This fixes
+          Bug #1277214 and #1270744.
+
+        * [BUG] Vertical alignment did not work in the HTML exports. This fixes
+          Bug #1276626
+
+        * [BUG] XHTML styles were not fully applied to the generated content.
+          This fixes Bug #1280328.
+
+        * [BUG] Removed the 'table-layout: fixed' style attribute, as it does
+          have a negative effect with the MSIE and all other browsers seem to
+          ignore it. (Bug #1276654)
+
+        * [BUG] The HTML exports need to add no-break-spaces to empty cells,
+          if not using CSS, messed up the export. The fix alters the font size
+          to one point, and therefore minimizes the effect. (Bug #1277122).
+
+        * [BUG] Ilkka fixed the Anchor support in JFreeReport. The Anchor element
+          is now fully functional. (Bug #1293615 and #1290405)
+
+        * [BUG] The XML-Parsers replaced the content for marked report properties,
+          even if the report definition document did not specify any value for
+          them. This bug prevented to mark the 'report.name' property.
+
+        * [BUG] A bug in the TotalGroupSumQuotient-function family caused the
+          functions to return invalid results.
+
+        * [BUG] The XML parsers and writers used 'reverselandscape' as attribute
+          value for the page orientation, but the DTDs declared it as
+          'reverse_landscape'. (Bug #1297258)
+
+        * The HTML renderer now has an option to switch to proportional column
+          widths. The resulting table will consume the complete page width.
+          (Patch #1282043)
+
+        * The HTML and ExcelExports can now be used to export multiple reports
+          in a single file using the new Appending*Processor classes.
+          (Patch #1281142 and partial fix for feature request #1204087)
+
+        * BSHExpression's createInterpreter is now protected to allow subclasses
+          to modify the created instance.
+
+        * Changed the PageEvent order. PageEvents are now fired before any other
+          events are fired (but after the reportInitialized event). On pagebreaks
+          the page header and the repeated group headers will contain the same
+          computed values as the last page footer. This fixes Bug #1263817.
+
+        * More work at the JavaDoc and DocBook texts.
+
+        * It is now possible to span a report over multiple pages. For best
+          results, the elements should not cross pagebreaks. JFreeReport handles
+          that case, but the resulting output is not perfect.
+
+        * Added the StackedLayoutManager, which behaves like a Swing-Box-Layout.
+          Use this within a band to allow dynamic elements to push other elements
+          below the used space of the dynamic element. See the StackedLayoutDemo
+          for an example.
+
+        * The SimpleXML-Parser is now able to assign a global stylesheet to
+          the generated elements. The new attribute 'styleClass' must contain
+          the name of the stylesheet. If the stylesheet does not exist, it will
+          be created and can be modified after the parsing is complete.
+
+        * The demos have been restructured. Every demo now has a longer text
+          describing the purpose and structure of the demo.
+
+        * All deprecated classes have been removed.
+
+        * The Report configuration is no longer responsible for providing a
+          global configuration. The JFreeReportBoot class holds the global
+          config, which can be retrieved using
+          'JFreeReportBoot.getInstance().getGlobalConfig()'.
+
+          Initializing the log system should be done using the properties
+          file or by querying 'JFreeReportBoot.getInstance().getEditableConfig()'
+          and updating the properties there.
+
+        * Booting JFreeReport before it can be used is now mandatory. Booting
+          is done using 'JFreeReportBoot.getInstance.start()'. Without this
+          initialization, you *will* experience trouble.
+
+        * Added a switch to use either the MasterSelect command or a series of
+          single commands to define the font properties on Epson 9-pin printers.
+
+        * It is now possible to access the raw datasource (the TableModel) using
+          the system maintained report property 'report.datasource'. If the
+          property is marked, even expressions will be able to access the
+          datasource.
+
+        * The layout manager is now able to apply limited caching to dynamic
+          elements. Although still slower than static elements, this caching
+          prevents unneccessary recomputations between layouting and printing.
+
+        * Changed the Key-Binding for the Preview-Component's Next- and Previous
+          Page action to plain keystrokes. From now on, a simple PageDown or
+          PageUp is sufficient to navigate through the pages.
+
+0.8.5-5: (1-Jun-2005)
+        * [BUG] The ItemHideFunction did not reset the visible state to visible
+          after a pagebreak.
+
+        * [BUG] The include parser did not setup the EntityResolver correctly.
+          This caused trouble when working without an internet connection.
+
+        * [BUG] The Excel cell style provider created too many styles due
+          to an invalid key used for checking whether a style already exists.
+
+        * [BUG] Discovered and fixed some bugs using the 'FindBugs' tool.
+
+        * [BUG] Fixed an error condition, where an non-absolute path could cause
+          a NullPointer if the parent directory could not be resolved.
+
+        * [BUG] The XML-Parser's support for indexed function properties has
+          been fixed.
+
+        * The classloader handling is now configurable via JCommon. By default
+          the ThreadContext-classloader is used now.
+
+        * The one-to-many demo got an API-only counterpart. Noone is forced to
+          use the XML definition.
+
+        * There were some ugly bugs in the I18N report support. The I18N demo
+          is now working as expected.
+
+        * Excel reports with more than 4000 different styles to no longer break
+          the file format. JFreeReport will not create more than 4000 styles in
+          a single report (all extra styles are discarded and the cells left
+          unstyled).
+
+        * The HTML export now allows border definition in the <tr> elements.
+          This is a workaround for bugs in the Mozilla table renderer. The
+          setting is configurable using the report configuration with the
+          key 'org.jfree.report.modules.output.table.html.TableRowBorderDefinition'.
+
+0.8.5-4: (15-Apr-2005)
+        * The location of the ReportControler can now be defined from
+          within the ReportControler.
+
+        * [BUG] The TableLayouter does no longer use heuristics to compute
+          the layout. Now every layouted cell has its own TableCellBackground
+          instance - this makes computing more accurate but also more resource
+          intensive.
+
+        * [BUG] Excel-CellStyles are now applied to all cells of a region.
+          (Bug #1172423)
+
+        * [BUG] CSVContentCreator used an invalid offset and therefore did not
+          generate valid content.
+
+        * [BUG] The demo-jar classpath did not include the misc-survey module.
+
+        * [BUG] FunctionUtilties.findElement(..) and
+          FunctionUtilities.findAllElements (..) did not check the names of bands
+          and therefore did never return band references.
+
+        * [BUG] Some bugs were fixed in the include-functionality of the
+          JFreeReport XML-parsers.
+
+        * [BUG] Fixed some bugs in the SurveyScaleDemo (missing resources) and
+          SurveyScaleExpression (adding 'field' property failed).
+
+        * [BUG] DemoFrontend did not give error messages, when the start of the
+          demo failed.
+
+        * The org.jfree.report.modules.output.table.html.EmptyCellsUseCSS
+          configuration property controls how empty cells are handled. By
+          default no CSS is used (as the InternetExplorer gets confused by
+          standards). This is a follow up to Bug #1165992.
+
+        * The DEFAULT_GROUP_NAME constant of GroupList is now public. This
+          constant defines the name of the automaticly created default group.
+          That group is created to prevent an empty GroupList, if other groups
+          exist for the report, the default group might not exist.
+
+        * To help Mozilla/Firefox render generated HTML pages correctly, the
+          HtmlContentCreator now also adds border and background definitions to
+          the table row element style.
+
+        * All tables now have a ColGroup tag to define the table's column widths.
+          This way even large tables get rendered correctly even if not all data
+          is received.
+
+        * A new demo shows how to join several reports into a single report. A
+          new JoiningTableModel has been added to simplify the task of creating
+          a suitable tablemodel for that report.
+
+0.8.5-3: (25-Mar-2005)
+        * [BUG] The GUI-ExportTasks now create missing directories, if
+          necessary. The HTML-Directory Export's data directory is now
+          relative to the specified HTML file and no longer to the current
+          working directory.
+
+        * [BUG] Merging lines and backgrounds in the TableExports was invalid.
+
+        * [BUG] StaticLayoutManager's caching worked to hard and stored
+          intermediate values, which caused elements with a fixed width and
+          relative height to be way to large.
+
+        * [BUG] The 'pagebreak-before-print' and 'pagebreak-after-print' of
+           the SimpleXML DTD were inconsistent. Now all pagebreak attributes
+           use the names given above, as these attribute names have been
+           used for the group header/footer for some time. (closes #1165942)
+
+        * [BUG] TableBackground-borders with a width of '0' should not be
+          activated. Such borders must have their color set to 'null'.
+          (closes #1166296)
+
+        * [BUG] Duplicate logging of the project info can be confusing.
+          Removed the log statement from JFreeReportBoot. (closes #1166415)
+
+        * [BUG] The PDF default encoding of the module configuration was set to
+          Cp1251 (which is cyrillic) but should have been set to Cp1252 (WinAnsi)
+          (closes #1165907)
+
+        * [BUG] The output-pageable-base module did not jave the output-meta
+          jar file included in the classpath. This seems to kill the demo on
+          some systems. (closes #1168342)
+
+        * [BUG] The HTML-Export now uses the fixed table-layout alogorithm as
+          specified in the CSS-standard. Additionally, the total width of
+          the table is now specified in the table tag to help the HTML renderer.
+          Column widths are now specified using the '<col>' tag. (closes #1165992)
+
+        * [BUG] The HTML-Export does no longer generate   for empty cells.
+          The CSS-property "empty-cells: show" is used instead. (closes #1168156)
+
+        * [BUG] In the Excel-Export row heights and cell widths were unreliable.
+          The row height are now set according to the POI documentation (1/1440th
+          of an inch as unit).
+
+          For the cell heights Arial 10 is set as default font and all cell
+          heights are computed with an assumed character width of 5 points.
+          The way how cell widths are computed is way to weird, you wouldn't
+          believe it (I still have problems to believe it).
+
+        * The Demo-Jar now uses the DemoFrontend class as Main class. This way,
+          all demos are accessible when running that jar.
+
+        * The SimpleXML format now defines a new attribute for Number and Date
+          fields to supply an explicit cell format for the Excel export. Excel
+          does not really like the Java-Formats and as there is no reliable
+          specification  for the excel format strings on the net, this is a
+          workaround to get good looking excel exports.
+
+        * Added support for report constomizations from within the Preview
+          components. A "ReportControler" can now be assigned to the preview base
+          to supply additional menus and/or a custom property editor panel.
+
+          The ReportControlerDemo demonstrates how this could be used.
+          (closes request #1162404)
+
+        * The SwingIcons demo has been changed to search for the 'jlgr-1_0.jar'
+          on the classpath, the directories containing classpath-jars or the
+          local working directory. If that fails, the user now can specify a
+          custom location for the icons.
+
+        * The PDFExportDialog now maps the UTF-8 and UTF-16 encodings to the
+          PDF Unicode encoding "Identity-H". Using the UTF-encodings directly
+          was a great way to produce reports without a single character of
+          text inside.
+
+0.8.5-2: (18-Mar-2005)
+        * [BUG] FontPath caching did not validate the cache integrity. This way,
+          some fonts might be left unregistered.
+
+        * [BUG] The image content class did not refuse bounds with a
+          width or height of zero. Such content would never be displayable
+          and should therefore be removed as early as possible.
+
+          In the same class, the image scaling code tried to use an integer
+          division to compute the scale factor. That resulted in a scale factor
+          of zero in all down-scale operations.
+
+        * [BUG] Drawing scaled image content was wrong in PDF and Graphics2D
+          targets. The HTML target did use the unscaled image size instead of
+          the computed (scaled) bounds for the <img> tag.
+
+        * [BUG] PageHeader/Footer handler of the SimpleXML parser did not
+          parse the onfirst/lastpage attribute. The ReportHeader/Footer handler
+          did not parse the (deprecated) ownpage attribute.
+
+        * Added verbose warning messages if image loading failed.
+
+        * Added deprecation warnings for the old report DTDs.
+
+        * All Export Dialogs use lazy initializations now, wherever possible.
+          This way, the preview dialogs show up a lot faster than before.
+
+0.8.5-1: (10-Mar-2005)
+        * [BUG] The PDF did not setup the first page correctly.
+
+        * [BUG] Images were not exported to PDF due to a bug in the
+          clipping setup.
+
+        * [BUG] filling shapes seemed to put the output target into an
+          invalid state; therefore an alternative way to draw and fill
+          shapes and process Drawables has been implemented.
+
+0.8.5: (4-Mar-2005)
+        * The modules are now named after their java package names and
+          correspond now with the jar file name.
+
+        * The naming schema for the jar files changed to fit the common
+          naming schema used in Maven and other OpenSource projects.
+
+        * All output target generate 'output-complete' events whenever
+          a root level band has been successfully printed.
+
+        * Most of the deprecated code has been removed. Due to the heavy
+          nature of the other changes, also many non deprecated methods
+          have changed.
+
+        * All ResourceBundles used by JFreeReport have been converted to
+          property files for better maintainability.
+
+        * The Boot process of JFreeReport now integrates into the jcommon
+          boot system; a new boot loader implementation (JFreeReportBoot)
+          provides the boot loader for this library.
+
+        * Images are no longer required to be loadable. The ImageReference
+          interface is used to define the image sizes and URLs. There is
+          no need to load the image anymore. This allows references to
+          image sources, which are not reachable for the report generator.
+
+        * Images and Drawables are now loaded using a separate factory,
+          so that Pixie is no longer a hardcoded requirement. If during
+          the boot process the Pixie library is detected, support for WMF
+          images and drawable will be available.
+
+        * All output targets use 'MetaBands' to produce their spool
+          content. This makes implementing other target less error prone.
+
+        * In the pageable output targets, the report state list is no
+          longer public. All state information is now handled by the
+          pageable report processor so that there is no way to tamper
+          with internal states.
+
+        * The PlainTextOutput targets have been completly rewritten.
+          (thanks Michael Tennes for all the debugging, patience and
+          tips and tricks).
+
+        * This implementation has now a complete ESC/P printer driver
+          and makes sure that your epson compatible matrix printers will
+          have some happy days in the Java world.
+
+        * The table targets have been completly rewritten. The old
+          implementation produced invalid results and was impossible to
+          debug.
+
+        * HTML targets now support body fragment generation. This makes
+          it possible to use the output from JFreeReport in JSP-Include
+          files.
+
+        * The RTF target is now fixed and considered stable enough to be
+          fully supported. Images are still unsupported, as this consumes
+          to much memory to be handled safely for now.
+
+        * The Excel target now allows alternate cell-format definitions.
+          This resolves issues, where Excel's internal format definitions
+          are incompatible with the Java definitions.
+
+        * The numeric and date data cells now use the original raw data
+          instead of parsing the formatted content string. This preserves
+          the full precision of the contained data.
+
+        * Functions and Expressions now use the bean-interface for their
+          configuration; the explicit use of setProperties (..) has been
+          removed in favor of the get/set methods of the Bean-API.
+
+          The parsers currently support parameters of the following types:
+          - java.math.BigDecimal
+          - java.math.BigInteger
+          - java.lang.Boolean
+          - java.lang.Byte
+          - java.lang.Character
+          - java.lang.Class
+          - java.awt.Color
+          - java.lang.Double
+          - java.lang.Float
+          - java.lang.Integer
+          - java.lang.Long
+          - java.lang.Short
+          - java.lang.String
+          as well as all primitive values and all values that define a
+          java.beans.PropertyEditor that supports the configuration using
+          PropertyEditor.getAsText() and PropertyEditor.setAsText().
+
+        * A PageDefinition object is now used instead of the
+          java.awt.print.PageFormat object. This will allow the definition of
+          printing areas that consist of multiple physical pages.
+
+          The support for larger than 1x1 page-set is untested and should be
+          considered experimental for now.
+
+        * ReportStates allow access to the current page definition object from
+          within functions. The ReportProperty "report.pageformat" should not
+          be used anymore. That property will contain the first page format.
+          Obviously, this is invalid, if more than one pageformat is defined.
+
+        * The page definition is now the only source for the page format;
+          all constructors accepting page formats have been removed from
+          the report processors.
+
+        * The ReportConnectable interface replaces the DataRowConnectable
+          to allow access to the complete report definition during the data
+          preprocessing.
+
+        * Resourcebundles for the ResourceFields are no longer loaded directly.
+          The ResourceBundleFactory from the ReportDefinition object is now
+          used as source for the ResourceBundle.
+
+        * Function and expression handling is now unified. The distinction
+          between the various function types is now classified as an internal
+          secret. For the users, functions should be not more than a special
+          kind of expressions.
+
+        * Root-Level bands can now have a fixed start position on the page.
+          This solves the various requests for the report or group footers
+          printed at the bottom of the page. Be aware that the Layout-Engine
+          will abort the report generation, if the fixed footer does not fit
+          completly on the current page. Using dynamic elements in such bands
+          can cause trouble.
+
+        * TextElements bind the encoding of their content; multiple encodings
+          can be used within a single PDF document (that feature has been
+          silently implemented in the later 0.8.4 versions, and is now ready
+          to be used officially)
+
+        * Horizontal lines no longer use the x1==x2; y1==y2 form of definition.
+          Now lines use the relative coordinates like all other elements
+          (width="100%") Special factory methods have been added to the
+          StaticShapeElementFactory so that vertical and horizontal lines can
+          be generated more easily.
+
+        * LayoutManagerCache now uses the Element's InstanceID as key for the
+          cache. This increases the performance a lot (HugeReport6: from 84 sec
+          to 35 secs). Elements that will have their sizes or position be modified
+          by the user must be marked uncachable by using the stylekey
+          ELEMENT_LAYOUT_CACHABLE set to 'false', or the layout might be invalid.
+          Dynamic elements are never cachable.
+
+        * The PDF target caches the used images. It also does no longer try to
+          encode all images as PNG files - this was completly unnecessay and
+          just stupid.
+
+        * Some minor performance improvements have been made in the stylekey handling.
+
+        * An userdefined configuration can be added to the ReportConfiguration.
+          This way JFreeReport can use other frameworks as configuration source.
+          (Based on a suggestion by 'bitstorm').
+
+          Use the 'setUserConfig' method of the ReportConfiguration class to
+          include the configuration implementation.
+
+        * The XML-parsers can be used to configure an predefined JFreeReport
+          instance. This makes it possible to supply an own JFreeReport
+          implementation to the parser..
+
+        * The PageFinished event is now handled correctly. This catches all
+          pagebreak related bugs.
+
+        * MessageFormatElements (contributed by Joerg Schaible) have been added.
+          These elements allow to join and format text in a similiar way as it
+          is possible with the TextFormatExpression.
+
+          DataRow-columns get referenced by using $(columnname) instead of
+          the parameter index of the MessageFormat format string.
+
+        * A PageOfPagesFunction (contributed by Joerg Schaible) greatly
+          reduces the complexity when defining the common 'Page x of y'
+          fields.
+
+        * All Preview components now use a factory method "protected
+          PreviewProxyBase createPreviewProxyBase ()" to create the
+          ProxyBaseImplementation. This should make it easier to replace
+          the PreviewProxyBase with a custom implementation.
+
+        * PDF- and HTML-Targets now support Anchors and Hyperlinks.
+
+        * The ElementStyleSheets have a cleaner semantic now. There are
+          two classes of stylesheets, the ones assigned directly to the
+          elements and bands and the global ones, which are created and
+          managed by the StyleSheetCollection.
+
+          Only on default parent can exist, and one cascading parent,
+          which links the elements to its parent bands. Bands do no longer
+          have two unrelated stylesheets, now they inherit their primary
+          stylesheet to their parents. This way, the inheritance change
+          can go from the root level band to the last child, allowing the
+          same inheritance chain as found in the cascading stylesheets.
+
+          The BandDefaults have been removed.
+
+        * Simple XML parser has been completly rewritten and uses now a
+          framework initially created by Peter Becker. Support for the new
+          features has been added.
+
+        * Support for Include-files added to allow to reuse common parts
+          of the report definitions (like report header/footer,
+          page header/footer, or everything else)
+
+          There is no limitation in how many reports get included or in
+          which XML-format was used as definition format.
+
+        * Support for the ImageIO API of JDK1.4 has been added to JFreeReport-Ext.
+          As soon as JFreeReport-Ext is on the classpath, the resource factory
+          will start to use these new image loaders.
+
+        * BarCode support has been added by Mimil (JFreeReport-ext).
+
+        * The servlet demos have been updated to demonstrate the use of
+          custom URLImageContainer implementations to include images in
+          StreamHtmlReports (JFreeReport-ext).
+
+        * The ExportDialogs have been redesigned to behave a little bit better.
+          All the annoying popup windows have been replaced by a less annyoing
+          status bar.
+
+        * BugFix: The layout manager did not align elements according to the
+          output target's properties. This made plain text output almost impossible.
+
+0.8.4-11: (13-Oct-2004)
+
+        * BugFix: Watermark-Band elements were not connected to the
+          datarow, causing all non-static elements to fail.
+
+        * BugFix: Selecting fonts in the PlainText-OutputTarget was not
+          supported.
+
+        * BugFix: JFreeReport now uses the latest JCommon to fix that
+          nasty recompile problem when used together with JFreeChart.
+
+        * BugFix: Changing PageFormats was buggy and caused the margins
+          of the page to be swapped.
+
+        * BugFix: The ItemMin- and ItemMaxFunction where inizialized in
+          an invalid way and therefore not working as expected.
+
+        * BugFix: The PDF-OutputTarget always created PDFs with embedded
+          fonts, defining the embedded value in the configuration had no
+          effect. To fix that, a new constructor was added which does no
+          longer set the embedded property.
+
+        * BugFix: PDF-Font creation caused OutOfMemoryErrors in case the
+          font creation failed several times before. Support for truetype
+          collections was not correctly implemented.
+
+        * A new function was added to support pagefooter printing on only
+          the last page.
+
+        * David Gilbert created a new module to support survey reports.
+          The SurveyScaleDemo shows how to use that new feature. The survey
+          module is not yet configurable with the XML report definitions,
+          this will be included in later versions of JFreeReport.
+
+        * Two new demos show, how it is possible to misuse the page-footer to
+          print a report-footer at the bottom of the last page.
+
+        * The used libraries were updated to the latest stable versions
+          available.
+
+0.8.4-10: (27-Apr-2004)
+
+        * BugFix: Excel export threw exceptions if an background
+          spanned more than one row or column
+
+        * BugFix: PDF and RTF export failed on non-embedded fonts.
+
+        * BugFix: The Simple XML parser threw exceptions if a
+          number or date-field definition did not specify a format
+          string.
+
+        * BugFix: Replacing the report object in the preview dialogs
+          could cause the next reporting to fail with an
+          "ReportInterruptedException". This was caused by not waiting
+          for the repagination worker to shutdown properly.
+
+        * BugFix: The ReportWriter caused trouble when trying to write
+          DecimalFormat objects. Fixed is contained in jcommon-0.9.3a.
+
+        * A new demo shows how to use conditional groups.
+
+        * The swedish translations were updated by Ulf Ekstr?m.
+
+        * The PlainText target now offers the option to specify an
+          initialization string, which is sent to the printer before
+          any other content is printed.
+
+        * JFreeReport now compiles on JDK 1.5 without warnings.
+
+0.8.4-9: (6-Apr-2004)
+        * BugFix: The BaseFontSupport and the PDF output target
+          did not handle iText fonts correctly resulting in a
+          memory leak.
+
+        * BugFix: An exception occured whenever a band flagged with
+          "pagebreak-after" did not fit on the previous page and was
+          printed during the page-open process
+
+        * BugFix: The TableTargets did not format row/colspanned cells
+          correctly. Credits for detecting this bug goes to mechiland.
+
+        * BugFix: The HTML Target did not close all table data elements.
+          Credits for detecting this bug goes to mechiland.
+
+        * BugFix: The paint component function did not layout given the components
+          correctly. Using non-opaque components did not produce valid results.
+
+        * BugFix: The PageFormatFactory did not correctly convert millimeters
+          into points. (2nd Try)
+
+        * BugFix: The font path detection of the itext-support was not
+          case insensitive causing wrong results on some systems.
+          Thanks mechiland for your reports.
+
+        * BugFix: Fixed some typos
+
+        * BugFix: Fixed several synchronization issues with singleton implementations
+
+        * Whether a repeating group header should be printed for a lonely
+          group footer can now be configured using the report configuration.
+
+        * ResultSetTableModel classes now try to recover from errors when
+          examining column types. Thanks, Roger Hayes for your great code.
+
+        * Introduced better support for form printing by adding a "fixed-position"
+          stylekey. Group- and report header and -footer and the itemband can now
+          be printed at a fixed position on the page.
+
+        * New Demo: Invoice demo shows a complexer invoice example.
+
+        * New Demo: Form demo shows a simple patient form and demonstrates the usage
+          of the new fixed-position key.
+
+0.8.4-8: (04-Feb-2004)
+        * BugFix: The ConfigStore module was totally messed up.
+
+        * BugFix: The PlainTextExport contained a really strange
+          implementation to handle borders. That thing did not work
+          as expected and was removed.
+
+        * BugFix: Many, many synchronization issues resolved. Most
+          of the old stuff was incomplete or just stupid. Hopefully
+          it is better now :)
+
+        * BugFix: The report footer's ownpage attribute was not handled
+          correctly in the simple xml parser.
+
+        * Dialogs now store the last user input for a certain report.
+          The input is keyed by the report's name, so it is important
+          to give every report a unique name.
+
+        * Group exception messages and SizeCalculator exceptions are
+          more chatty now.
+
+        * The BOUNDS style is no longer written when serializing reports.
+
+        * The baseURL of the ImageURL* Templates will no longer be written.
+          The baseURL points to the URL of the report definition and is
+          set by the parser.
+
+        * The PreviewComponent's toolbar has now the option to add a
+          close button to the toolbar.
+
+        * The PreviewComponent's toolbar now allows to add custom actions
+          to the toolbar. The actions must be supplied in the "customActions"
+          action map.
+
+        * The Drawable renderer of the PDF output now uses the BaseFontFactory
+          to resolve font requests.
+
+        * Whether a ProgressDialog or the progressBar is shown is configurable
+          now. The progressdialog can be configured for every export plugin;
+          the progress bar is only available in the preview frame and cannot
+          be used to monitor the export progress.
+
+0.8.4-7:
+        * BugFix: The simple parser did not handle the font encoding
+          attribute of bands correctly.
+
+        * BugFix: Hidden root level bands should not consume any space.
+
+        * BugFix: Javac 1.2 complained a lot about coding errors. The
+          errors it noticed weren't there, but the code changed to make
+          that stupid thing shut up.
+
+        * BugFix: The PageFormatFactory did not correctly convert millimeters
+          into points.
+
+        * BugFix: The HTML export created buggy code; The head-tag was not
+          closed properly and the <td> tags contained invalid widths if
+          the columns defined a colspan.
+
+        * BugFix: PageHeader and -footer now obey to both the "display-on-first-page"
+          and "display-on-last-page" flag.
+
+        * All supplied jars are now built with JDK1.2 to get rid of the
+          AbstractMethodExceptions caused by the JDK1.4 class files.
+
+        * Support for watermark-bands was added.
+
+0.8.4-6 (25-Nov-2003):
+        * BugFix: In some cases the band layout manager "lost" the
+          reference to the local LayoutSupport. This part was ugly
+          and was completly rewritten.
+
+        * BugFix: Repeating group headers were lost if the printing
+          of the group footer of that group was delayed until a new
+          page was started. The inner most group header was not printed
+          in such cases.
+
+        * BugFix: Exceptions in the SimplePageLayouter may be lost when
+          the clearCurrentEvent() method throws an other exception. This
+          was stupid coding and this method does no longer throw that
+          unnecessary exception causing all the trouble.
+
+        * The preview components are now fully configurable. The creation
+          and contents of the toolbar and menubar can now be controlled
+          using the report configuration.
+
+        * The preview base is reuseable now. The report can be redefined
+          using the setReport(..) method.
+
+        * The Total* Function now support a global computation, if no
+          group is defined. They do no longer depend on the existence
+          of the default group.
+
+        * JFreeReport now prints the current version of the Core-Module
+          during the boot process.
+
+0.8.4-5 (07-Nov-2003):
+        * BugFix: The report footer was not printed, if an automatic
+          pagebreak was done right before the printing of the footer.
+
+        * BugFix: Minor fixes in the simple parser to improve
+          the quality of the generated report definition.
+
+        * BugFix: DrawableTemplate did not implement DataRowConnectable
+          and was not available in the ext-parser.
+
+        * The export plugins of the GUI are better configurable now.
+          The report configuration can be used to define, whether a
+          plugin will appear separated from previous menu entries or
+          whether the export will be selectable from the toolbar.
+
+        * The ResultSetTableModelFactory can now be configured to map
+          either ColumnNames or ColumnLabels to the column indices.
+
+        * The PreviewBase has been reworked to be more extensible.
+
+0.8.4-4 (01-Nov-2003):
+        * BugFix: TotalItemCountFunction is now serializable and handles
+          nested groups correctly.
+
+        * BugFix: ExportPlugins had a weird way of registering themself on
+          the ReportProgressDialogs
+
+        * BugFix: SimplePageLayouter did not implement getInstance() correctly.
+
+        * BugFix: TextElement.setLineHeight tried to use Integer where Float
+          was expected causing ClassCastExceptions.
+
+        * BugFix: The PackageManager did not accept some of the version strings
+          correctly causing all export plugins to fail. Additionally all
+          warnings were surpressed.
+
+        * TextElements can now trim the textlines to make the aligned content
+          look properly.
+
+        * The simple xml parser now allows to define the reserved-literal, the
+          string which is appended when a text does not fully fit into the
+          elements bounds. Additionally, the simple parser now can define the
+          trim-text property for all text elements.
+
+        * A new demo shows the usage of ReportProperties.
+
+0.8.4-3 (22-Oct-2003):
+        * BugFix: PlainText output fixed. It was funnily messed up when
+          handling borders and was fed in the wrong way by some of the demos.
+
+        * BugFix: TotalItemCountFunction fixed; another stupid Copy&Paste
+          bug :(
+
+0.8.4-2 (19-Oct-2003):
+        * BugFix: Exceptions in the repagination did not close the progress
+          monitor.
+
+        * BugFix: InternalFrames did not repaint due to a weird use of the
+          RepaintManager in the PreviewProxyBase and some other stupid bugs.
+
+        * BugFix: Non-Embeddable fonts cause no longer fatal errors. If such
+          an font is encountered, it will be included as non-embedded font.
+
+        * BugFix: The table targets were completly broken, they have been reworked
+          and all direct and indirect causes (aka bad code) was fixed.
+
+        * BugFix: SimpleParser's subbands did not work as expected.
+
+        * BugFix: The export did not show the correct result in the dialogs status
+          bar. The synchronisation/locking schema was invalid for all exports.
+
+        * BugFix: Serialization issues fixed for various functions.
+
+        * BugFix: The line-height definition of the TextElementFactory used
+          the wrong type causing ClassCastExceptions to be thrown by the
+          stylesheet implementation.
+
+        * The preview components can now perform multiple exports at the
+          same time. Currently 10 parallel exports are possible, this will
+          be configurable later.
+
+        * The element color function does now work with all bands of an report.
+
+        * The TotalItemSumFunction can be used to precompute group results.
+
+        * Warning: (ElementVisiblitySwitch function does not work correctly;
+          this will be fixed with version 0.8.5)
+
+
+0.8.4-1:
+        * BugFix: InternalFrame was not closed properly and caused NullPointers
+          in Swing.
+
+        * BugFix: PaintComponentFunctions did draw on a black image. It is now
+          transparent instead.
+
+        * BugFix: Band.remove caused exceptions when the band was connected
+          with the report.
+
+        * BugFix: Printing values in the GroupFooter caused invalid values to
+          be printed, if an PageBreak occured between initializing and printing
+          the band.
+
+        * Added Accessor methods for common style properties as suggested
+          by 'joecole'. Band and Elements have now various getter/setter
+          methods to make the style definition easier.
+
+        * InternalFrameDemo shows how to use the PreviewInternalFrame properly.
+
+0.8.4:
+        * Table targets use some kind of repagination to prepare the layouting.
+          This makes it possible to compute the columns and styles before they
+          are written into the stream, so that we can create streaming content.
+
+        * The BaseFont-Support is now able to cache the collected fonts. This
+          reduces the startup time.
+
+        * We have modules to configure the functionality of JFreeReport ...
+
+        * HTML output can strip the file headers to make it easier to include
+          the generated content into other files.
+
+        * All code moved to org.jfree.report; all deprecated methods and classes
+          were removed. Major structural changes ... (write docs about that issue!)
+
+        * Simple ReportParser creates cleaner objects (undefined attributes are
+          no longer filled with unnecessary default values).
+
+        * The SheetName function property is more usable now.
+
+        * The GUI base module contains the option to translate the standard GUI
+          dialogs of Swing.
+
+        * The elementfactory package replaces the old ItemFactory. These factory
+          classes contain a bean like interface as well as the static methods of
+          the old ItemFactory.
+
+        * We now have templates for Rectangles and Horizontal- and Vertical line
+          shapes. This reduces the definition code size when creating the common
+          shape use-cases.
+
+        * ReportWriter creates slightly cleaner code by removing unnecessary
+          class specifications.
+
+	      * SimpleReportParser is now able to create sub bands.
+
+        * The writer supports comments and templates now. Comments are only
+          preserved in extended report formats for now.
+
+        * The excel export defines the printer setup according to the report
+          configuration or the defined page format of the report.
+
+        * The reserved-literal (the string that is appended if the text would
+          not fit into the element) can now be customized using stylessheets.
+
+        * Initializing JFreeReport is now done in a controled way using the
+          Boot class.
+
+        * Minor performance improvements to reduce the number of generated
+          objects during the report generation.
+
+        * A graphical configuration editor assists in the process of creating
+          JFreeReport configuration files.
+
+        * The XML Parser reports validation errors when a DTD is available.
+
+        * The ReportConverter got a facelifting and can now also be used to
+          import the extended reports from older versions. Changed class
+          attributes will be translated to the new namespace.
+
+        * The PDF target can now control what PDF document version will be
+          generated.
+
+0.8.3g:
+        * BugFix: XML encoding for entity 'apos' was invalid.
+
+        * BugFix: The call to the AWT print dialog is now completly
+          removed from the event-handler thread to work around a
+          Java-Bug.
+
+        * BugFix: Exceptions were not logged and caused no valid error
+          message when exporting a report with the GUI dialogs.
+
+        * BugFix: ExcelFiles were not visible from the ExcelExportDialog.
+
+        * BugFix: Image- and Shape content was not aligned in the pageable
+          output targets.
+
+        * BugFix: Another fix for the image references of the HTML target.
+          Images contained in a separate data directory were not visible.
+
+        * BugFix: The multithreading caused problems due to an missing
+          sychronize block in the worker class. This caused the worker to
+          dead-lock in some cases.
+
+        * BugFix: The preview components did not kill the worker threads
+          when being finalized. The repagination worker was not interrupted
+          if the pagination was aborted.
+
+        * The Report templates for the reference documentation were not
+          included in the JFreeReport jar file.
+
+        * The LayoutManagers now synchronizes on the Element-Tree instead of
+          the "this" reference.
+
+        * The PDF layouting bug, which appeared in some VMs has been resolved.
+          The bug was caused by an non-strict floating point implementation
+          as allowed since Java 1.2; this feature seems to have influence
+          on all layouting operations and the PDF generation. The readme file
+          contains more details.
+
+0.8.3f: (24-Aug-2003)
+        * BugFix: SwingIcons demo definition was invalid.
+
+        * BugFix: The PDF export dialog did not read the predefined
+          security settings from the report configuration.
+
+        * BugFix: Table targets did not use the properties to get
+          configured.
+
+        * BugFix: The Html Output produced garbage when writing image
+          references.
+
+        * BugFix: Expressions were not able to see the next datarow
+          and therefore useless as group arguments
+
+        * BugFix: The tabletargets do no longer have a default sheet
+          name defined. The html target will no print an automatic
+          page header anymore.
+
+        * BugFix: The preview dialog now disables all actions when
+          a long running operation is done. The tool bar floating and
+          the large icons setting can now be configured from within
+          the report properties.
+
+        * The export and pagination progress is now visible in the
+          ReportProgressDialog.
+
+0.8.3e: (16-Jul-2003)
+        * BugFix: JFreeReportResources didn't work in a Headless environment.
+          This caused weird behaviour in Tomcat. Thanks to jxmoshe for your
+          valueable hints.
+
+        * BugFix: The Pageable targets created empty pages on
+          PageableProcessor.processReport();
+
+        * BugFix: The string encoding 1251 (Windows Cyrillic) was not defined in
+          the EncodingComboBox and therefore not visible.
+
+0.8.3d: (29-Jun-2003)
+        * BugFix: All table report processors had problems with reports, that
+          had a PageFormat with a imagable size > 1000 points. This issue was
+          pure stupidity and is fixed now...
+
+        * BugFix: The ItemPercentageFunction did not initialize its private sum
+          function properly causing IndexOutOfBounds exceptions.
+
+        * BugFix: The PlainTextOutputTarget did not handle the encodings of the
+          generated text, it did encode all texts with "Cp437".
+
+        * BugFix: The PlainTextDialog and the EncodingComboBoxModel had errors
+          which prevent them from selecting encodings correctly.
+
+        * BugFix: The StyleSheetCollection now handles stylesheets with the
+          same name correctly.
+
+        * All OutputTargets use String properties now for their configuration.
+          The object interface was no great idea and caused confusion so it
+          was narrowed down to a String-only interface.
+
+          The Strings "true" and "false" are used to express boolean values.
+
+        * The iText library was updated to version 1.00; this version is now
+          able to handle the PNG-Alpha channel.
+
+0.8.3c: (19-Jun-2003)
+        * BugFix: The Area class is not able to clip lines, any attemp results
+          in an empty area. Clipping for lines is now disabled, if the output
+          target does not support clipping, the results may look weird if the
+          shape exceeds the element bounds.
+
+        * BugFix: The RTF writer does no longer support images. Using images
+          seems to cause a memory leak, so this function is disabled until a
+          fix is found.
+
+        * BugFix: The ExportDialogs now disables all plugins during the repagination.
+          PageSetup works again.
+
+        * BugFix: The demos now report all errors in a proper way.
+
+        * BugFix: The AbstractBandLayoutManager is now able to handle null content
+          without crashes.
+
+        * BugFix: The StyleSheet collection now clones all substylesheets correctly
+          and gets updated when stylesheets are added or removed from already
+          registered stylesheets.
+
+        * The RTF target now supports all fonts by using the PDF base font support
+          classes.
+
+        * The StyleSheet collection is available from all Bands and Elements, as
+          soon as the element is connected with the report. Independent elements
+          have no stylesheet collection.
+
+        * A new PreviewApplet was created to enable the direct preview of
+          Reports within a webpage. The OpenSourceDemoApplet demonstrates the
+          new component.
+
+0.8.3b:  (16-Jun-2003)
+        * BugFix: StyleSheets were not deeply cloned, so inherited stylesheets
+          were shared among all reports. This is fixed now.
+
+          Stylesheets can now be accessed directly using StyleSheetCollection,
+          which is maintained by the report definition object.
+
+        * BugFix: Printing in the PreviewFrame was no plugin and could not be
+          disabled.
+
+        * BugFix: On MacOS X the font path was not detected properly. MacOS
+          does not use the standard unix font path.
+
+        * BugFix: Menu accelerators were not defined in a platform independent way.
+          Systems without an CTRL key (like MacOS) were not able to use the
+          shortcuts).
+
+        * BugFix: Empty pages were not detected correctly, causing empty pages
+          to be printed at the end of the report under some circumstances.
+
+          The group footers pagebreak-after-print now works as expected.
+
+        * BugFix: Not all errors which may have occured during the function
+          processing were detected or even printed in the log.
+
+        * BugFix: The PlainTextOutputTarget computed wrong page sizes, which
+          caused errors when elements were printed at the bottom or the right
+          border of a page.
+
+        * BugFix: The TextContent removed leading whitespaces from the text.
+
+        * BugFix: The HTML-TableProcessor did not encode the generated content
+          properly. The content was completly invalid and did not conform to any
+          standard. The same bug was hidden in the ReportWriter.
+
+          Both classes are working now as expected.
+
+          Warning: UTF-16 encoded content is not readable by Mozilla or IE, both
+          browsers are not able to handle standard conforming UTF-16 correctly.
+
+        * BugFix: The report writer is now able to handle inherited stylesheets
+          correctly.
+
+        * BugFix: Null values in the element content do no longer cause the layouting
+          to fail. NullContent and empty content are handled correctly now.
+
+        * An EmptyReportException is now thrown when the report generation produced
+          no pages for the report.
+
+        * The StyleSheet interface is removed now, it was not used.
+
+        * The reference document generator now also generates documentation for the
+          DataSource factories.
+
+        * The XML parser now prints the location of the parse error on all exceptions.l
+
+0.8.3a : (04-Jun-2003)
+        * BugFix: Serialization works again. All functions are serializable
+          now.
+
+        * BugFix: The report writer handles subclasses correctly
+
+        * BugFix: The parser's extended report definition is working again.
+
+        * BugFix: Unclean definitions in the ReportState, Band, Element and
+          DataRow classes.
+
+        * BugFix: The excel and PDF target work again.
+
+        * BugFix: Unclean definition in Group and GroupList methods removed.
+          Groups can no longer be composed in an invalid way.
+
+        * BugFix: ReportWriter was unclean and did not handle complex stylesheet
+          definitions.
+
+        * BugFix: The parser/writer object factories did not handle inherited objects
+          correctly in some cases.
+
+        * BugFix: Generating URLs in the ReportParser was unclean.
+
+        * BugFix: ItemColumnQuotientFunction did not implement the function interface
+          causing classcast exceptions when used as function.
+
+        * We got a new Swedish translation. All fame goes to Thomas Dilts.
+
+0.8.3    : (26-May-2003)
+        * BugFix: The report states where unclean when a pagebreak was issued,
+          causing the printing and several computation functions to fail or to
+          return invalid values.
+
+          The event oder was redefined to resolve that issue. Please read
+          "migration.txt" for details on the new event order.
+
+        * BugFix: URL handling was buggy, the base URL was never set in the
+          templates.
+
+        * BugFix: NewLine characters were not handled correctly in the last
+          version. After the linebreak was done, an undisplayable newline character
+          remained in the text-line instances.
+
+        * BugFix: The repeating group header feature now repeats all marked group
+          headers, and not just the last one.
+
+        * BugFix: Wordbreaking was buggy.
+
+        * Most of the parser code moved into JCommon. We are using JCommon version
+          0.8.1; all classes of JCommon moved into the package tree under
+          org.jfree.*
+
+        * Upgraded to pixie-0.8.0. All pixie classes moved into the package tree
+          under org.jfree.*
+
+        * DTD bugs fixed.
+
+        * Modified the BuggyFontRenderer messages as these messages seemed to
+          cause confusion.
+
+        * All table output targets (CSV, HTML, Excel, RTF) have now a generic
+          configuration interface; the targets can be configured using the
+          ReportConfiguration.
+
+        * Drawable elements are officially supported now. There are no
+          drawable implementations yet (except JFreeChart :)), more support
+          is included in later versions ...
+
+        * ItemColumnQuotientFunction changed into ItemColumnQuotientExpression.
+
+        * New Translations: Slovenian, Russian, Hungarian and Dutch. Adjusted
+          the mnemonics of some translations to fit the displayed text.
+
+        * The Excel export now uses the extended data cell style capabilities
+          of POI 1.10. Numeric and Date/Time cells are no longer formatted as
+          texts, the cells contain numeric values so that you can use them in
+          formulas. In case this causes trouble, the cell format strings can
+          be redefined or this feature can be completly disabled. Please see
+          migration.txt for details.
+
+        * The licence now has an exception for using function and expression
+          implementations in non-free programms.
+
+        * Due to several iText improvements, the PDF target is now able to use
+          transparent PNG pictures and iText is now able to use all GIF files.
+
+        * The extended XML-Parser and the writer are now able to write and
+          parse generic shapes.
+
+        * The report converter GUI now displays exceptions to the user.
+
+0.8.2 : (12-Apr-2003):
+        * Important: There were fixes in the shape handling and the order of the
+          function events, please read the file migration.txt for detailed
+          information about API changes of this release.
+
+        * BugFix: Layouting was broken for band in band stacking and complex layouts.
+
+        * BugFix: SimplePageLayouter layouting was broken.
+
+        * BugFix: The event handling and pagebreaking within the SimplePageLayouter
+          was unclean and under some circumstances the row of a last page which
+          triggered a pagebreak could got lost.
+
+          The event handling is now in a better defined state: It is guaranteed, that
+          page-start events are invoked before any other report event for the page.
+          When starting a new report, the page-start event will be the first event that
+          is received. When the itemAdvanced event is triggered all previous bands are
+          printed completly and no other event is issued between the itemAdvanced and
+          the print event (unless the printing would trigger a new pagebreak).
+
+        * BugFix: Images were not printed correctly, when an image was not loaded
+          completly using an ImageObserver. The return value of Graphics2D.drawImage
+          is now used to determine whether the image must be loaded and reprinted.
+          If the image was not yet loaded, the printing process waits until the image
+          is completly loaded by the AWT.
+
+        * BugFix: When no content was generated for given bounds, the resulting null
+          content was not checked and caused NullPointerExceptions.
+
+        * BugFix: The PlainTextDialog had no CloseListener, so an attemp to close the
+          window had no effect.
+
+        * BugFix: TextLayout was buggy, if the minimum size was greater than the
+          element's maximum size.
+
+        * BugFix: The template writer was buggy.
+
+        * BugFix: Extended report definition parser had a bug in the handling of
+          the extends-tag of stylesheets.
+
+        * BugFix: Several MemoryLeaks have been fixed. The leaks were non-fatal for
+          smaller reports but killed report with more than 300 pages. The reference
+          to the JFreeReport object within the ReportStates was replaced by a smallscale
+          ReportDefinition object.
+
+          The report definition object is readonly and limits access to the bands and
+          group definitions and the report configuration. The function/expression
+          collections and the tablemodel are no longer directly available within the
+          report definition and can only be accessed indirectly by using the DataRow.
+
+        * BugFix: The excel export generated too many CellStyle-definitions. The generated
+          excel file could not be read if more than 4000 CellStyles were generated. The
+          fixed implementation fixes the caching of previously generated styles.
+          The 4000 CellStyles limitation is a hard limit imposed by MS Excel.
+
+        * "shape-element" added for the simple report definition format. The shape
+          element can be used to draw shapes retrieved from the dataRow.
+
+        * ShapeFieldTemplate added to create a easy to use "shape-element" for the
+          extended report definition profile.
+
+        * The report processing performance is heavily increased.
+
+        * LineShapes were now created correctly when using the ItemFactory.
+
+        * We have an complete french translation of the core libraries now. Thanks
+          mimil :)
+
+        * Bands now bind their own BandLayoutManagers.
+
+        * New demo: The card demo has been added to show a complexer use and the power
+          of the extended report definition format. The demo uses templates and
+          stylesheets to coordinate the appearance of several fields.
+
+          The demo can be found in the package com.jrefinery.report.demo.cards
+
+        * New demo: The PercentageDemo shows the use of NumberFields and the format
+          decimal format string of the number field.
+
+        * A new ElementColorFunction defines the color of an element depending on
+          a boolean expression.
+
+        * JFreeReport now uses iText 0.98. This iText version is incompatible with
+          the previously used iText version 0.96.
+
+        * The available encodings for the various export dialogs can now be defined
+          using a properties file. The properties file is referenced in the report
+          configuration in the Key "com.jrefinery.report.encodings.available" and
+          the key "com.jrefinery.report.encodings.file". The available key
+          can be set to "all", "none" or "file".
+
+          A sample encodings property file can be found in the file
+          "/com/jrefinery/report/jfreereport-encodings.properties". Disabling
+          unnessary encodings will speed up the initial loading of the preview dialogs.
+
+0.8.1_02 : (09-Mar-2003):
+        * BugFix: Shape handling was invalid. All Shapes were painted at position
+          (0,0) within the element, regardless what was defined for the shape.
+
+        * BugFix: The ReportWriters validity checks were buggy and caused exceptions
+          when writting Object-Descriptions.
+
+0.8.1_01 : (04-Mar-2003):
+        * BugFix: The PlainTextOutputDialog was not modal and caused trouble.
+
+        * BugFix: Adding element to a band, which already contains that element
+          caused IndexOutofBoundsExceptions.
+
+        * BugFix: The extended parser had a bug in the band handler, so that
+          elements got added twice.
+
+        * Added stricter error handling to the report processing. This can be
+          activated by setting the com.jrefinery.report.StrictErrorHandling
+          property to true. If activated, all exceptions that occur during the
+          report processing cause the report generation to fail.
+
+        * Removed the "/jfreereport.properties not found" debug message. It caused
+          confusion without supplying anything valuable.
+
+        * Updated the HTML OutputTarget so that the default Page text is printed
+          properly and Author and Title work as expected. The Html dialog is now
+          more resistent against invalid or unexpected inputs.
+
+        * Updated the README file, so that the layout restrictions are mentioned.
+          Thanks for the idea, JM Delsaux.
+
+0.8.1 : (28-Feb-2003):
+        * BugFix: Corrected many bugs in the SimplePageLayouter.
+
+        * BugFix: empty ReportProperties were not marked correctly.
+
+        * BugFix: TextLine layout was inaccurate, used java.awt.Dimension instead
+          of Dimension2D.
+
+        * BugFix: Band containing other bands were not laid out correctly.
+
+        * BugFix: PreviewPane was unusable when used directly. The report was not
+          repaginated automaticly and there was no way to trigger the repagination.
+
+        * BugFix: Generated PNG files in the PDFOutputTarget no longer use the
+          Alpha-Channel as iText doesn't seem to like it.
+
+        * BugFix: The generated PDF files did not work with GhostScript.
+
+        * BugFix: The ReportFooter handling was unclean and caused trouble.
+
+        * BugFix: The PageBreak was not handled correctly, so that sometimes bands
+          got lost after a pagebreak was done.
+
+        * BugFix: Corrected layouting calculations; using double values seem to cause
+          incorrect calculations. Switched to float values everywhere.
+
+        * BugFix: BandLayoutManager illegaly modified the values from the
+          ElementStyleSheet. This caused invalid states when a band was hidden and restored.
+
+        * BugFix: The PDFOutputTarget did not handle state restoration correctly when a
+          new page was started.
+
+        * Refactoring: All tablemodel related classes moved into a spearate package.
+          The package is expected to grow heavily during the next releases.
+
+        * Refactoring: The iText font support moved into a separate package. The
+          PDFFontFactory is now known as BaseFontFactory.
+
+        * Refactoring: The BandLayout stuff moved into a separate package as these
+          classes are used by allmost all output targets.
+
+        * Info: The First demo has been renamed to SwingIconsDemo.
+
+        * Added a main method in the JFreeReport info, so that everybody is able to
+          read the library specifications without having to install or start the
+          demo package.
+
+        * The order of fields in the group definition does no longer matter. Anyway,
+          all fields of the parent group must also be defined in the child group.
+
+        * Added a new event type: The LayoutEvent can be used to adjust INTERNAL values
+          after the layouting is completed. Do not use this event to modify the layout,
+          this can have funny results, but won't produce what you may expect.
+
+        * Added separate thread for the repagination process and the printing. The
+          PageableOutputTarget now check the Thread-state for interrupt events. If
+          the current thread gets interrupted, the report processing or repagination
+          is canceled.
+
+        * Added resource compare tool lists differences between the base
+          resource class and the localized resources to help with the translation
+          process.
+
+        * Added a line height property for text elements. This property can be used
+          to increase the space between 2 lines.
+
+        * Bands now handle the object composition correctly and check for component
+          loops.
+
+        * The ANT script can be used to checkout the latest sources from the anonymous
+          CVS repository on sourceforge.
+
+        * Added a generic DummyImplementation for the output targets. This should help
+          to reduce the repagination time.
+
+        * We now have a polish translation. Thanks Pjotr (pbzdyl).
+
+        * Font encoding and embedding can now defined separatly for all text elements.
+
+        * The ABSOLUTE_DIM stylekey was removed. This is now handled by specifying
+          a minimum size (and a maximum size if needed).
+
+        * Added dynamic element support for all content types. Image and shape elements
+          can be defined as dynamic elements to have their sizes adjusted according to
+          the contained content.
+
+        * New element template types: ResourceLabel and ResourceField use a string from
+          the data source to lookup a value in an assigned ResourceBundle.
+
+        * Added support for Scaling for Shape and Image elements. Scaling can be
+          configured to keep the original aspect ratio.
+
+        * The XML parser now uses local copies of the DTD to validate the document,
+          if an document type is specified in the XML definitions.
+
+        * Added support for Underlined and StrikeThrough font style.
+
+        * Several new report functions added by Heiko Evermann.
+
+        * A PaintComponentFunction can be used to create Images from AWT-Components.
+
+        * Added PaintComponentFunction to create images from AWT or Swing components.
+          The generated images can be used in ImageElements.
+
+        * Added a new Demo: OpenSourceDemo2.java
+
+        * The maximum band height is now limited by the page height. A band will never
+          grow over the available page size when using dynamic elements. To make a band
+          greater than the available page height, the user has to force it by defining
+          such an invalid minimum band size. This fix reduces the accidentaly generated
+          "Report-Does-Not-Proceed" Exceptions.
+
+        * Added a new Demo: LGPLDemo.java shows the automatic height limitation for oversized
+          "dynamic" elements.
+
+        * Heiko Evermann wrote an Excel-OutputTarget, which provided the base implementation
+          for several table style output targets:
+
+          Added several new OutputTargets:
+
+          - Simple XML Output
+              an educational output target to have a simple output target
+          - CSV Data-Output
+              to write the raw data from the DataRow into a CSV file
+          - CSV TableLayout Output
+              writes layouted bands and elements into a CSV file.
+          - Excel Output
+              writes Excel files using the Apache POI library.
+          - HTML Output
+              writes HTML4 and XHTML content.
+          - RTF Output
+              generates simple RTF documents
+              (implementation limited to standard fonts)
+          - PlainTextOutput
+              generates text files
+
+        * Added a new XML-parser to support extended report definitions.
+          Also implemented a writer to create XML-Definitions from JFreeReport objects.
+          The new parser can be used transparent replacement of the old implementation,
+          without any special treatment of the client application. The report definition
+          type is detected during the parsing process.
+
+        * Added a report converter to convert reports from the simple profile into
+          the extensible report definition format.
+          (com.jrefinery.report.io.ext.writer.ReportConverterGUI)
+
+        * Added a ReferenceDoc generator for the extensible report definition format:
+          (com.jrefinery.report.io.ext.ReferenceDocGenerator)
+
+        * Added support for templates to simplify the usage of DataSources and DataFilters.
+
+        * Redesigned the PreviewDialogs: All dialog implementations now share a common
+          backend. All Export-Targets are included using a PlugIn-Strucure and can
+          be activated and deactivated separatly using the ReportConfiguration.
+
+        * BugFix: Cloning was insufficient to separate functions and expression from their
+          anchestors. Added the method getInstance() to enforce a strict separation of
+          the original expression instance and the generated copy.
+
+        * Added a second properties file ("/jfreereport.properties") which overlays the
+          main property file "com/jrefinery/report/jfreereport.properties". Use this file
+          to create a global configuration without having to repack the jfreereport.jar file.
+
+        * The FileEncodings are now selectable from the PDF- and HTML dialogs.
+
+        * Patrice Rolland contributed a french translation
+
+0.8.0-3 : (07-Jan-2003):
+        * BugFix: Fixed the ReportStateList. Element were added at the wrong position, causing
+          NullPointerExceptions. Also fixed the dynamic element, if the element contained too much
+          data which would not fit on a single page, the report generation failed. Now the data
+          is cut down to the size of a single page. The LGPL-Demo shows the new behaviour.
+
+0.8.0-2 : (19-Dec-2002):
+        * BugFix: fix for a ReportFooter bug in the layoutmanagement. Printing the ReportFooter on
+          its own page caused the report generation to fail.
+
+0.8.0-1 : (16-Dec-2002):
+        * BugFix: fix for a PageHeader bug in the layoutmanagement. The bug
+          caused the pageheader to drive crazy and print strange values in the elements.
+
+0.8.0 : (13-Dec-2002):
+        * Many, many ... (repeat it several times: many) ... many lines of JavaDoc documentation.
+
+        * Added a new Demo: StraightToPDF.java: Demo for saving PDF directly - no preview
+
+        * Added a new Demo: HelloWorld.java: New (simple) demo.
+
+        * Added a new Demo: OpenSourceProjects.java
+
+        * BugFix: FontRendering is not correct when not using AntiAliasing on some JDKs.
+          A configuration setting exists to switch to an alterate font size calculation
+
+        * BugFix: PDFFontFactory did not prevent iText from caching the created fonts -> OutOfMemoryException
+
+        * BugFix: PDFDocument metadata was never added to the document (Author and Title)
+
+        * BugFix: original LineBreaking was buggy and got fixed by Aleksandr Gekht
+
+        * BugFix: DefaultTableModel creation was buggy, ReportGenerator had a NullPointer
+          on parseReport(File). Thanks to Robert Fuller for the report and the fix.
+
+        * FunctionLeveling: functions can be executed in a controled order. Functions of the same
+          depencylevel are considered independent, functions with a higher level depended.
+
+        * Dynamic TextElements are now fully supported.
+
+        * A full featured configuration interface with support for external property file
+          and system-properties added. Reports can supply local configuration settings
+          (as PDFEncoding or advanced PDF-Settings (security, author, title)
+
+        * ReportProperties can be defined in the report definition. <property-ref> tag
+          is used to mark and possibly define the property. Marked properties are treated
+          as DataRow-columns and can be queried as every other function or tablemodel column.
+
+        * PageCounting can now be customized. Start-page can be set, page counting is now
+          a Function.
+
+        * Preview frame can have a maximum-size and a preferred-size defined. The maximum
+          size is enforced.
+
+        * Logging now uses Object-parameters instead of strings for performance reasons.
+
+        * A PreviewDialog was added, as frames are not accessible from within modal
+          dialogs.
+
+        * PreviewDialog/Frame menus changed to allow the selection of Zoom-levels by
+          using the JMenu.
+
+        * Some possible memory leaks have been resolved. Most leaks occur in certain
+          Swing/AWT environments when PreviewFrames and ReportPanes are not garbage collected.
+          If you think you found another leak, report it to us (and don't forget to
+          tell us the JDK version you use).
+
+        * We have a polish translation. And there is a spanish translation as well.
+
+        * Elements can have a vertical alignment.
+
+        * LineShapeElement changed. A line is no longer extended to the full width
+          if the X values are equal and the Y values are equal. A line must be  a
+          valid shape and can then be extended to the full element dimension by
+          setting the scale-property to true.
+
+        * All Bands are able to pagebreak before or after printing. Pagebreaks on
+          empty pages are ignored. A page is empty if no content or just the pageheader
+          is printed.
+
+        * All text is now printed to the font's base line. The base line is calculated
+          manually and does not depend on the AWT anymore. Now the results are almost
+          as accurate as the iText calculations.
+
+        * The report now uses a new layouting/printing subsystem. Printing is done by
+          using a report function and is no longer bound to a specific output method.
+
+        * The dynamic feature finally works in all imaginable configurations.
+
+        * Elements are now configured using StyleSheets. There is no direct StyleSheet
+          support in the parser yet. StyleSheet can inherit settings from other
+          style sheets. Not all stylesheet settings are configurable using the classical
+          get/set methods and not all style-settings need to be used by the outputtargets.
+          StyleSheet-settings should be seen as a general constraints collection, and
+          like AWT does, not every constraint is used everywhere.
+
+        * The PDF-Dialog is now able to save the PDF without showing the dialog to the
+          user.
+
+        * Bands are able to use LayoutManager for their internal component layout.
+          Bands can be stacked into each other, the same rules as in the AWT apply.
+
+        * The report state list uses a smarter storage model. The first states are
+          now always stored as strong-references.
+
+        * JCommon-0.7.1 is used.
+
+        * removed deprecated classes and most of the deprecated functions. <*-function>
+          tags are no longer defined in the DTD, use the corresponding <*-field> elements.
+          DataElement and DataFunctionElement and their sub classes do no longer exist.
+          Use text fields and filters instead or create similiar fields using the ItemFactory.
+
+        * PageCountFunction and PageTotalFunction is now more flexible and can count
+          the pages of a certain group or can start counting at an arbitary page number.
+
+        * Functions and Expressions have dependency levels.  Higher dependency functions
+          are executed before lower dependency functions.
+
+        * There is a JPEG-Servlet in the extension package. This servlet generates
+          JPEG-Files for every page of an report.
+
+0.7.6 : (07-Sep-2002):
+
+        --- A new Library is needed: bsh.jar from www.beanshell.org ---
+
+        * Downport to JDK 1.2.2, requires a Pixie-Update from the CVS; JFreeReport should
+          now work in Visual Age for Java 3.5 without any patching.
+
+        * PDF supports security and encryption (40bit & 128bit keys). The password for the example
+          is "user" and "owner" for the user- and the ownerpassword.
+
+        * An extended and more comportable Save-Dialog for PDF-Files exists
+
+        * Expressions exist as a way to implement stateless lightweight
+          functions. Expressions do not maintain a state and refer only
+          the current datarow.
+
+        * The BSHExpression can be used to include the expressions sourcecode
+          in the report definition. This enables a
+
+        * DataRows are used to unify the access to the different datasources
+          as functions, expressions and the tablemodel.
+
+        * Bands can be set invisible, invisible bands are not printed and
+          consume no space.
+
+        * Band height of "-100" is now interpreted as "full page height available".
+          In the XML-definitions this can be expressed by setting the pageheight to "100%"
+
+        * Rectangle-Elements support drawing, so that an unfilled border can
+          be drawn
+
+        * After Parsing the report the source filename and the contentbase
+          are stored as report properties.
+
+        * The DefaultPageFormat can be defined in the report definitions <report>-tag
+
+        * All Strings are cut down to the length of the element. If a string is too
+          long to fit into the field, the string is cut down on word boundry.
+
+        * Bug: PreviewFrame was not being GarbageCollected, if dispose() or removeNotify() was
+          not called. Added call to dispose when the frame is hidden.
+
+        * Bug: Drawing on G2OutputTarget was buggy, aligment was inaccurate
+
+        * Bug: FontSize for G2OutputTarget was not calculated correctly
+
+        * Bug: ReportPane.setError was buggy
+
+        * Bug: ReportState.isProceeding was useless
+
+        * Bug: Fonthandling for default fonts fixed in PDF-Target
+
+        * Bug: Unicode support was not working in PDF-mode
+
+        * Bug: some GIF Images not recognized
+
+        * Bug: ClassLoader changed for use in servlet environment
+
+        * Bug: Mutiline-Text fixed
+
+        * Bug: Cloning fixed
+
+        * Bug: An Empty (0 rows) tablemodel caused a single all-elements-null row to be printed. Fixed,
+          now the headers and then the footers are printed without an ItemBand between headers and footers
+          in that case.
+
+        * Bug: WMF-Support in Pixie-Lib: The WmfImageProducer needed a huge amount of RAM to work on
+          complex images, now the image production process uses multiple scanlines to create the image
+          resulting in lower resource usage.
+
+0.7.5 : (21-Jul-2002):
+        * DTD updated to contain the latest elements
+
+        * Bug: ReportFunctions are now evaluated before the result is printed
+
+        * Bug: WaitingImageObserver deadlock fixed
+
+        * Bug: Nullpointers on empty graphic fixed
+
+        * Bug: Corrected function behaviour when the tablemodel contains no data
+
+        * Bug: Reportproperties set in the JFreeReport object got lost when a report is started
+
+        * A new example (first.xml) which is used in the documentation
+
+        * Most classes now implement the serializable and clonable interfaces
+
+        * TextElement simplified
+
+        * ImageElement/ImageFunctionElement updated
+
+        * Removed JUNIT tests from base package. The tests can be found in
+          the extension project.
+
+        * A new mode exists on report processing, called a prepare run. During this run,
+          the report is repaginated and the reentry points for the ReportStateList are
+          created. Function-results computed in this state can be reused during the real
+          report processing. This leads to 2 new functions to demonstrate the posibilities:
+
+        * 2 new functions ItemPercent and TotalSum
+          TotalSum summarizes a group in the prepare run so that the total sum
+          for that group is available in the group header.
+
+0.7.4 : (10-Jun-2002):
+        * A bug in PDFFontFactory crashed the programm in linux
+
+        * jcommon-0.6.2.jar is now included in the package. JCommon
+          changed the name of an used class, so you have to use jcommon-0.6.2
+          instead of one of the previous versions.
+
+0.7.3 : (09-Jun-2002):
+        * PreviewPane has a property to enable/disable the painting of the
+          border
+
+        * PreviewFrame's toolbar floating is controled by a property
+
+        * PDFTarget uses the truetype fonts of the system. These fonts have
+          to be registered to the FontFactory in order to be used.
+          Registration can be done by feeding Directories or files into the
+          PDFOutoutTarget.FontFactory or by letting the factory search the
+          fonts by ifself by setting the SystemProperty
+          "com.jrefinery.report.targets.PDFOutputTarget.AUTOINIT" to "true"
+
+        * PDFTarget is able to do unicode. The encoding is controled by the
+          system property
+          "com.jrefinery.report.targets.PDFOutputTarget.ENCODING"
+          and defaults to windows "Cp1252" (WinANSI). Set this property to
+          "Identity-H" to enable HorizontalUnicode writing (see
+          PDFOutputTarget.setEncoding() and the iText documentation for more
+          information on that)
+
+        * PreviewFrame has improved navigation (Goto first, last, or Page#)
+
+        * A statusbar for the PreviewPane displays total and current pages
+
+        * A demo with 200.000 rows is added to show what JFR is able to do
+
+        * Truetype-Fonts are now embedded in PDF
+
+        * Support for generic shapes is included
+
+        * a new Element (RectangleShapeElement) for filled colored boxes
+
+        * all TextElement-Inheritants have been replaced by the filtering
+          interface in com.jrefinery.report.filter. The deprecated classes in
+          the main package should no longer be used. Use the ItemFactory to
+          create the TextElement with correct filters attached.
+
+        * A new function (ElementVisibilitySwitch) shows how to control the
+          visiblity of elements at runtime.
+
+        * The parser has a better structure and can be easier customized
+          using inheritance.
+
+        * All TextElements are now able to perform a linebreak if the text
+          is too long to fit on the line and if there is space for more than
+          one line.
+
+        * Reports are repaginated before printing, Repagination moved into
+          JFreeReport. A new ReportState property (isPrepareRun()) can be
+          used to query whether this is a repagination run.
+
+        * The total number of pages is stored in the report properties
+          (using key "report.pagecount")
+
+        * An exception dialog informs the user when errors occur. A stacktrace
+          can be viewed in this dialog if wanted.
+
+        * ReportProperties are now bound to the ReportStates, not the report,
+          and shared among all ReportStates derived from the StartState.
+          A repagination run for printing/saving will no longer affect other
+          prepared reports.
+
+        * UI improvements
+
+        * removed ReportStateConstants interface and the constants for the
+          action commands in JFreeReportConstants.
+
+        * All classes have at least basic documentation.
+
+        * All UserInterface strings are localized. Localisations for
+          english and german exist.
+
+
+        Bugs fixed:
+        * ReportState did not initialize the ReportProperties correctly
+
+        * ReportState caused a OutOfMemoryError on huge reports
+
+        * the default PageFormat is passed from the JFreeReport-object into the
+          PreviewFrame.
+
+        Still to do:
+
+        * JUnitTests
+
+0.7.2a: (15-May-2002) Just a small fix as long as the code is fresh.
+        * No more NullPointer if the DataModel contains null
+        * values. Functions can no longer disrupt the report processing by
+          throwing Exceptions.
+        * All text elements have a property "nullstring" to define a String
+          which will replace all Null-Values for this element's or function's
+          value. Thanks go to Thomas Rynne for this inspiration.
+        * Fixed Bug: The ImageReference did not fill its sourceURL, so printing
+          images to pdf targets always failed.
+
+0.7.2 : (14_May-2002) This release is the result of a code review. Most
+        classes have been simplified and hardened. Unnessecary import
+        statements have been removed, so every class has changed. Please
+        look at the classes ChangeLog to see real changes.
+
+        * Important: Please make sure you have the Pixie-Library included,
+          or ImageReference/ImageElement will not work. The Pixie-Library
+          is included in JFreeReport's repositiory and release directory.
+
+        * All complex constructors have been removed. For every element
+          exists a defaultConstructor. All properties can be accessed by
+          accessor functions.
+
+        * From now on a report is always completly initialized. Such a
+          report has no null-value bands or groups. A report is guaranteed
+          to have at least one group.
+
+        * Groups have to be fully qualified. A sub-group has to include all
+          fields from its parent. So if you define group "Continents" and
+          a subgroup of "Countries" you have to declare
+
+          <groups>
+            <group name="Continents">
+              <fields>
+                <field>Continient</field>
+              </fields>
+            </group>
+            <group name="Countries">
+              <fields>
+                <field>Continient</field>
+                <field>Countries</field>
+              </field>
+            </group>
+          </groups>
+
+         for the report to work correctly. See example2.xml for a complete
+         report definition.
+
+       * ReportHeader, ReportFooter and GroupHeaders may trigger a pageBreak
+         before they are printed.
+         See example3.xml for details.
+
+       * Line-Elements now recognize the colors-attribute.
+
+       * PreviewPane has been moved to its own package. The actions
+         now are abstract to ease up integration of the preview pane in
+         other programms.
+
+       * ReportState is much smarter now. Transition from a state to another
+         is now done by returning a instance of ReportState, which handles
+         all state specific actions.
+
+       * The function interface has been improved. All function get references
+         to the report definition and the current report state.
+
+       * Bugfixes:
+
+         - LastRowMissingBug reported by Steven Feinstein is fixed
+         - Multiple data elements can now be added to a band refering to
+           the same table model column
+         - no more NullPointer if no ItemBand or no group defined.
+
+0.7.1 : (24-Apr-2002) A DTD exists for the default report parser, support
+        for images, multilined text, and some updates to the PreviewFrame.
+        JFreeReport includes a modified version of Pixie to support the
+        wmf-file format.
+
+0.7.0 : (8-Mar-2002) Reports can now be saved to PDF format using the
+        iText PDF generator (http://www.lowagie.com/itext/).
+        Integrated code contributed by Thomas Morgner including report
+        functions, XML report definitions and various bug fixes.
+        JFreeReport no longer user ANTLR-parsed report definitions.
+
+0.6.0 : (8-Feb-2002) A minor update to ensure compatibility with the
+        JCommon Class Library.
+
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..ed1397d
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,67 @@
+Pentaho Reporting Flow Engine 0.9.2                               30 Jul 2007
+   .. the reporting engine formerly known as 'JFreeReport' ..
+=============================================================================
+
+
+1. INTRODUCTION
+---------------
+Pentaho Reporting Flow Engine is a free Java report library, distributed
+under the terms of the GNU Lesser General Public License (see license-LGPL.txt
+for details). Pentaho Reporting Flow Engine is developed by Thomas Morgner,
+David Gilbert and others.
+
+Pentaho Reporting Flow Engine requires JDK 1.2.2.
+
+For the latest news and information about Pentaho Reporting Flow Engine,
+please refer to:
+
+    http://reporting.pentaho.org/
+
+
+2. SUPPORT
+----------
+Free support is available via the Pentaho Reporting forum, follow the link
+from the Pentaho Reporting home page.  Please note that questions are
+answered by volunteers, so there is no guaranteed response time or
+level of service.
+
+Please avoid e-mailing the developers directly for support questions.
+If you post a message in the forum, then everyone can see the
+question, and everyone can see the answer.
+
+
+3. REPORTING BUGS
+-----------------
+If you find bugs in Pentaho Reporting Flow Engine, we'd like to hear about
+it so that we can improve future releases of Pentaho Reporting Flow Engine.
+Please post bug reports to the JIRA bug-tracker at Pentaho.org:
+
+    http://jira.pentaho.org/
+
+Please be sure to provide as much information as you can.  We need to
+know the version of Pentaho Reporting Flow Engine that you are using,
+the JDK version, and the steps required to replicate the bug.  Include any other
+information that you think is relevant.
+
+
+4. ANT
+------
+We use an open source build tool called Ant to build Pentaho Reporting Flow Engine.
+An Ant script (tested using Ant 1.6) is included in the distribution:
+
+    <jfreereport-directory>/build.xml
+
+You can find out more about Ant at:
+
+    http://ant.apache.org/
+
+Ant is licensed under the terms of the Apache Software License (a
+popular open source software license).
+
+
+5. OTHER FEEDBACK
+-----------------
+For other feedback and comments, please post a message on the
+Pentaho Reporting forum. The Forum is available at
+
+  http://forums.pentaho.org/
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..bdf3800
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,95 @@
+<project name="flow-engine" default="all" basedir=".">
+
+   <!-- Properties -->
+   <property name="name" value="flow-engine"/>
+   <property name="build" value="build"/>
+   <property name="build.classes" value="${build}/classes"/>
+   <property name="build.doc" value="${build}/api"/>
+   <property name="build.lib" value="${build}/lib"/>
+   <property name="lib" value="lib"/>
+   <property name="build.dist" value="${build}/dist"/>
+
+   <!-- Targets -->
+   <!-- Prepare build directories -->
+   <target name="prepare">
+     <property file="devresource/META-INF/MANIFEST.MF"/>
+     <property name="version" value="${Release-Major-Number}.${Release-Minor-Number}.${Release-Milestone-Number}"/>
+
+     <mkdir dir="${build}"/>
+     <mkdir dir="${build.classes}"/>
+     <mkdir dir="${build.lib}"/>
+     <mkdir dir="${build.doc}"/>
+   </target>
+
+  <!-- Setup the compile classpath -->
+  <path id="classpath">
+    <fileset dir="lib">
+      <include name="*.jar" />
+    </fileset>
+  </path>
+
+   <!-- Kill all the created directories -->
+   <target name="clean">
+     <delete dir="${build}"/>
+   </target>
+
+   <!-- Build classes -->
+   <target name="classes" depends="prepare">
+     <javac srcdir="source" destdir="${build.classes}" debug="off" optimize="on">
+       <classpath refid="classpath"/>
+       <exclude name="org/jfree/report/modules/gui/swing/**"/>
+     </javac>
+
+     <copy todir="${build.classes}">
+       <fileset dir="source">
+         <include name="**/*.properties"/>
+         <exclude name="org/jfree/report/modules/gui/swing/**"/>
+       </fileset>
+     </copy>
+   </target>
+
+   <!-- Build jar archives -->
+   <target name="jar" depends="classes">
+     <copy file="devresource/META-INF/MANIFEST.MF" tofile="${build}/manifest.tmp" failonerror="false"/>
+     <manifest file="${build}/manifest.tmp" mode="update"/>
+     <jar jarfile="${build.lib}/${name}.jar" basedir="${build.classes}" manifest="${build}/manifest.tmp"/>
+   </target>
+
+   <!-- Build the full JavaDocs -->
+   <target name="javadoc" depends="prepare">
+     <javadoc sourcepath="source"
+             destdir="${build.doc}"
+             doctitle="${name} JavaDoc"
+             windowtitle="${name} JavaDoc"
+             package="true"
+             author="true"
+             version="true">
+       <classpath refid="classpath"/>
+       <packageset dir="source">
+         <exclude name="org/jfree/report/modules/gui/swing/**"/>
+       </packageset>
+     </javadoc>
+  </target>
+
+  <target name="zip" depends="prepare">
+    <mkdir dir="${build.dist}"/>
+    <copy todir="${build.dist}/source">
+      <fileset dir="source"/>
+    </copy>
+    <copy todir="${build.dist}/devresource">
+      <fileset dir="devresource"/>
+    </copy>
+    <copy todir="${build.dist}/test">
+      <fileset dir="test"/>
+    </copy>
+    <copy file="build.xml" todir="${build.dist}"/>
+    <copy file="licence-LGPL.txt" todir="${build.dist}"/>
+    <copy file="README.txt" todir="${build.dist}"/>
+    <copy file="ChangeLog.txt" todir="${build.dist}"/>
+    <zip destfile="${build}/${name}-${version}.zip" basedir="${build.dist}"/>
+  </target>
+
+  <!-- Build everything -->
+  <target name="all" depends="jar,javadoc"/>
+
+</project>
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index 36cad7e..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,102 +0,0 @@
-pentaho-reporting-flow-engine (0.9.2-4) unstable; urgency=low
-
-  * Team upload
-
-  [ Matthias Klose ]
-  * (Build-)depend on default-jre/-jdk.
-
-  [ Torsten Werner ]
-  * Orphaning package.
-
- -- Torsten Werner <twerner at debian.org>  Sat, 06 Aug 2011 09:44:09 +0200
-
-pentaho-reporting-flow-engine (0.9.2-3) unstable; urgency=low
-
-  * add missing symlink for jfreereport.jar
-  * upload to unstable
-
- -- Rene Engelhard <rene at debian.org>  Thu, 14 Feb 2008 23:37:51 +0100
-
-pentaho-reporting-flow-engine (0.9.2-2) experimental; urgency=low
-
-  [ Rene Engelhard ]
-  * conflict/provide/replace libjfreereport-java[-doc]
-
-  [ Michael Koch ]
-  * Added watch file.
-  * Fixed debian/copyright.
-  * Added Homepage, Vcs-Svn and Vcs-Browser fields.
-  * Updated Standards-Version to 3.7.3.
-  * Added myself to Uploaders.
-
- -- Michael Koch <konqueror at gmx.de>  Thu, 14 Feb 2008 21:35:51 +0100
-
-pentaho-reporting-flow-engine (0.9.2-1) experimental; urgency=low
-
-  * New upstream release
-  * update debian/ for JFreeReport -> Pentaho Reporting Flow Engine 
-
- -- Rene Engelhard <rene at debian.org>  Mon, 28 Jan 2008 13:43:59 +0100
-
-jfreereport (0.9.0-05-4) unstable; urgency=low
-
-  * fix dpatch creation oversight... 
-
- -- Rene Engelhard <rene at debian.org>  Wed, 28 Nov 2007 15:21:26 +0100
-
-jfreereport (0.9.0-05-3) unstable; urgency=low
-
-  * fix manual to refer to the local DTDs - thanks Kumar Appaiah
-    (closes: #453205)
-
- -- Rene Engelhard <rene at debian.org>  Wed, 28 Nov 2007 14:44:43 +0100
-
-jfreereport (0.9.0-05-2) unstable; urgency=low
-
-  * upload to unstable 
-
- -- Rene Engelhard <rene at debian.org>  Mon, 05 Nov 2007 01:16:02 +0100
-
-jfreereport (0.9.0-05-1) experimental; urgency=low
-
-  * reintroduce
-  * add Debian Java Maintainers as Maintainer: and me as Uploader
-  * new upstream release
-
- -- Rene Engelhard <rene at debian.org>  Mon, 27 Aug 2007 21:30:40 +0200
-
-libjfreereport-java (0.8.3c-5) unstable; urgency=high
-
-  * Recognize the JAVA_HOME directories for ibm-j2sdk1.4 and
-    blackdown-j2sdk1.4 (Closes: #306923)
-
- -- Christian Bayle <bayle at debian.org>  Fri, 29 Apr 2005 20:33:22 +0200
-
-libjfreereport-java (0.8.3c-4) unstable; urgency=high
-
-  * Transition to liblog4j1.2-java (Closes: #306754) 
-
- -- Christian Bayle <bayle at debian.org>  Thu, 28 Apr 2005 22:50:59 +0200
-
-libjfreereport-java (0.8.3c-3) unstable; urgency=low
-
-  * Applied Andreas Jochens patch 'debian_patch' not executable and
-    missing Build-Depends on 'bsh' (Closes: bug#294043)
-
- -- Christian Bayle <bayle at debian.org>  Tue,  8 Feb 2005 20:16:05 +0100
-
-libjfreereport-java (0.8.3c-2) unstable; urgency=low
-
-  * Added dependancy to libpixie-java
-  * Changed dependancy from liblog4j to liblog4j-java (Closes: bug#266073)
-  * libjfreereport-java only works with liblog4j 1.1.3 as suggested in 
-  * bug #191175
-
- -- Christian Bayle <bayle at debian.org>  Sun,  2 Jan 2005 23:56:17 +0100
-
-libjfreereport-java (0.8.3c-1) unstable; urgency=low
-
-  * Initial Release, closes ITP (Closes: bug#199757).
-
- -- Christian Bayle <bayle at debian.org>  Thu, 10 Jul 2003 02:04:27 +0200
-
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index 7ed6ff8..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/debian/control b/debian/control
deleted file mode 100644
index a66559b..0000000
--- a/debian/control
+++ /dev/null
@@ -1,53 +0,0 @@
-Source: pentaho-reporting-flow-engine
-Section: libs
-Priority: optional
-Maintainer: Debian QA Group <packages at qa.debian.org>
-Build-Depends: debhelper (>> 5.0.0), default-jdk, ant, bsh, libjcommon-java (>= 1.0.10), libitext-java, libjakarta-poi-java, libpixie-java (>= 0.8.6), liblog4j1.2-java, dpatch, libjcommon-serializer-java, libformula-java, libflute-1.3-jfree-java, libfonts-java (>= 0.3.2), liblayout-java, libloader-java, librepository-java, libxml-java (>= 0.8.9), libsac-java, docbook-utils, docbook-xml
-Standards-Version: 3.7.3
-Vcs-Git: https://anonscm.debian.org/git/pkg-java/pentaho-reporting-flow-engine.git
-Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/pentaho-reporting-flow-engine.git
-Homepage: http://www.pentaho.com/
-
-Package: libpentaho-reporting-flow-engine-java
-Section: libs
-Architecture: all
-Depends: default-jre | java2-runtime, libjcommon-java (>= 1.0.10), libitext-java, libjakarta-poi-java, liblog4j1.2-java, libjcommon-serializer-java, libformula-java, libflute-1.3-jfree-java, libfonts-java (>= 0.3.2), liblayout-java, libloader-java, librepository-java, libxml-java (>= 0.8.9), libsac-java
-Conflicts: libjfreereport-java
-Provides: libjfreereport-java
-Replaces: libjfreereport-java
-Suggests: libjfreereport-java-doc
-Description: report library for java
- Pentaho Reporting Flow Engine is a free Java report library.
- .
- It has the following features:
-    * full on-screen print preview;
-    * data obtained via Swing's TableModel interface
-    (making it easy to print data directly from your application);
-    * XML-based report definitions;
-    * output to the screen, printer or various export formats
-    (PDF, HTML, CSV, Excel, plain text);
-    * support for servlets (uses the JFreeReport extensions)
-    * extensive documentation in Acrobat PDF format, plus full Javadocs;
-
-Package: libpentaho-reporting-flow-engine-java-doc
-Section: doc
-Architecture: all
-Conflicts: libjfreereport-java-doc
-Provides: libjfreereport-java-doc
-Replaces: libjfreereport-java-doc
-Description: report library for java documentation
- Pentaho Reporting Flow Engine is a free Java report library.
- .
- It has the following features:
-    * full on-screen print preview;
-    * data obtained via Swing's TableModel interface
-    (making it easy to print data directly from your application);
-    * XML-based report definitions;
-    * output to the screen, printer or various export formats
-    (PDF, HTML, CSV, Excel, plain text);
-    * support for servlets (uses the JFreeReport extensions)
-    * extensive documentation in Acrobat PDF format, plus full Javadocs;
-  .
- This package contains the Javadoc, the Manual and the Developers Guide of
- the Pentaho Reporting Flow Engine.
-
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index 9a00eee..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,25 +0,0 @@
-This package was debianized by Christian Bayle <bayle at debian.org>, Sun,  6 Jul 2003 14:02:45 +0200
-
-It was downloaded from http://www.jfree.org/jfreereport/index.html
-
-Upstream Authors: Thomas Morgner, David Gilbert and others.
-
-Copyright: (C) 2003-2008 Thomas Morgner, David Gilbert and others.
-
-License:
-
-    This package is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This package is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-On Debian systems, the complete text of the GNU Lesser General
-Public License can be found in `/usr/share/common-licenses/LGPL'.
diff --git a/debian/libpentaho-reporting-flow-engine-java-doc.docs b/debian/libpentaho-reporting-flow-engine-java-doc.docs
deleted file mode 100644
index 8e0afb3..0000000
--- a/debian/libpentaho-reporting-flow-engine-java-doc.docs
+++ /dev/null
@@ -1,3 +0,0 @@
-javadoc
-docs/manual
-docs/devguide/developers-guide
diff --git a/debian/libpentaho-reporting-flow-engine-java.dirs b/debian/libpentaho-reporting-flow-engine-java.dirs
deleted file mode 100644
index b67bc01..0000000
--- a/debian/libpentaho-reporting-flow-engine-java.dirs
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/java
diff --git a/debian/libpentaho-reporting-flow-engine-java.links b/debian/libpentaho-reporting-flow-engine-java.links
deleted file mode 100644
index 40cbb2e..0000000
--- a/debian/libpentaho-reporting-flow-engine-java.links
+++ /dev/null
@@ -1 +0,0 @@
-usr/share/java/pentaho-reporting-flow-engine.jar usr/share/java/jfreereport.jar
diff --git a/debian/patches/00list b/debian/patches/00list
deleted file mode 100644
index 3735074..0000000
--- a/debian/patches/00list
+++ /dev/null
@@ -1,5 +0,0 @@
-01_libdir
-02_jarnames
-03_source-target-1.3
-04_local_dtd
-05_no_gnujaxp
diff --git a/debian/patches/01_libdir.dpatch b/debian/patches/01_libdir.dpatch
deleted file mode 100755
index 46696ea..0000000
--- a/debian/patches/01_libdir.dpatch
+++ /dev/null
@@ -1,19 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 01_libdir.dpatch by Rene Engelhard <rene at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
-
- at DPATCH@
-diff -urNad jfreereport-0.9.0-05~/ant/build.properties jfreereport-0.9.0-05/ant/build.properties
---- jfreereport-0.9.0-05~/build.properties	2007-06-13 14:30:51.000000000 +0200
-+++ jfreereport-0.9.0-05/build.properties	2007-08-27 22:04:54.000000000 +0200
-@@ -24,7 +24,7 @@
- # All path settings are relative to the project root directory
- # (..)
- #
--libdir=lib
-+libdir=/usr/share/java
- 
- #
- # If you specify a non-emty string, then dont forget the
diff --git a/debian/patches/02_jarnames.dpatch b/debian/patches/02_jarnames.dpatch
deleted file mode 100755
index 1d00f21..0000000
--- a/debian/patches/02_jarnames.dpatch
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 02_jarnames.dpatch by Rene Engelhard <rene at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
-
- at DPATCH@
-diff -urNad pentaho-reporting-flow-engine-0.9.2~/build.properties pentaho-reporting-flow-engine-0.9.2/build.properties
---- pentaho-reporting-flow-engine-0.9.2~/build.properties	2007-12-27 20:34:43.000000000 +0100
-+++ pentaho-reporting-flow-engine-0.9.2/build.properties	2007-12-27 20:34:48.000000000 +0100
-@@ -39,22 +39,22 @@
- #  Used libraries ...
- 
- # Used by: core libraries
--jcommon-jar-file=jcommon-1.0.10.jar
--jcommon-serializer-jar-file=jcommon-serializer-0.1.0.jar
--libfonts-jar-file=libfonts-0.3.2.jar
--libfonts-core-jar-file=libfonts-0.3.2.jar
--libfonts-itext-jar-file=libfonts-0.3.2.jar
--liblayout-jar-file=liblayout-0.2.8.jar
--libloader-jar-file=libloader-0.3.5.jar
--libxml-jar-file=libxml-0.9.8.jar
--libformula-jar-file=libformula-0.1.13.jar
--librepository-jar-file=librepository-0.1.3.jar
--flute-jar-file=flute-1.3-jfree-20061107.jar
-+jcommon-jar-file=jcommon.jar
-+jcommon-serializer-jar-file=jcommon-serializer.jar
-+libfonts-jar-file=libfonts.jar
-+libfonts-core-jar-file=libfonts.jar
-+libfonts-itext-jar-file=libfonts.jar
-+liblayout-jar-file=liblayout.jar
-+libloader-jar-file=libloader.jar
-+libxml-jar-file=libxml.jar
-+libformula-jar-file=libformula.jar
-+librepository-jar-file=librepository.jar
-+flute-jar-file=flute-1.3-jfree.jar
- 
- #
- # Optional libraries
--pixie-jar-file=optional/pixie-0.8.8.jar
--commons-logging-jar-file=optional/commons-logging-1.0.4.jar
-+pixie-jar-file=optional/pixie.jar
-+commons-logging-jar-file=optional/commons-logging.jar
- oscache-jar-file=optional/oscache-2.3-compat.jar
- 
- # Used by: module-parser
-@@ -62,7 +62,7 @@
- sac-jar-file=sac.jar
- 
- # Used by: output-pdf
--itext-jar-file=itext-1.4.jar
-+itext-jar-file=itext.jar
- 
- ##############################################################
- #
diff --git a/debian/patches/03_source-target-1.3.dpatch b/debian/patches/03_source-target-1.3.dpatch
deleted file mode 100755
index b4846c7..0000000
--- a/debian/patches/03_source-target-1.3.dpatch
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 02_source-target-1.3.dpatch by Rene Engelhard <rene at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
-
- at DPATCH@
-diff -urNad pentaho-reporting-flow-engine-0.9.2~/build.properties pentaho-reporting-flow-engine-0.9.2/build.properties
---- pentaho-reporting-flow-engine-0.9.2~/build.properties	2007-12-27 20:36:01.000000000 +0100
-+++ pentaho-reporting-flow-engine-0.9.2/build.properties	2007-12-27 20:36:10.000000000 +0100
-@@ -17,8 +17,8 @@
- 
- #
- # Make sure that JDK 1.2 compatible class files are generated
--build.target=1.2
--build.source=1.2
-+build.target=1.3
-+build.source=1.3
- build.retro.jdk=/opt/jdk1.2.2
- 
- #
diff --git a/debian/patches/04_local_dtd.dpatch b/debian/patches/04_local_dtd.dpatch
deleted file mode 100755
index 6e2079d..0000000
--- a/debian/patches/04_local_dtd.dpatch
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 04_local_dtd.dpatch by Rene Engelhard <rene at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
-
- at DPATCH@
-diff -urNad jfreereport-0.9.0-05~/docs/devguide/developers-guide.xml jfreereport-0.9.0-05/docs/devguide/developers-guide.xml
---- jfreereport-0.9.0-05~/docs/devguide/developers-guide.xml	2005-03-08 18:42:01.000000000 +0100
-+++ jfreereport-0.9.0-05/docs/devguide/developers-guide.xml	2007-11-28 14:17:37.000000000 +0100
-@@ -1,6 +1,6 @@
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
--"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-+"/usr/share/xml/docbook/schema/dtd/4.3/docbookx.dtd" [
- <!ENTITY chap1 SYSTEM "chapter1-styleguide.xml">
- ]>
- <book>
-diff -urNad jfreereport-0.9.0-05~/docs/manual.xml jfreereport-0.9.0-05/docs/manual.xml
---- jfreereport-0.9.0-05~/docs/manual.xml	2007-11-28 13:51:28.000000000 +0100
-+++ jfreereport-0.9.0-05/docs/manual.xml	2007-11-28 14:16:42.000000000 +0100
-@@ -1,6 +1,6 @@
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
--"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-+"docbook42.flat.dtd">
- <book>
-   <bookinfo>
-     <title>JFreeReport Manual</title>
diff --git a/debian/patches/05_no_gnujaxp.dpatch b/debian/patches/05_no_gnujaxp.dpatch
deleted file mode 100755
index e3ba69f..0000000
--- a/debian/patches/05_no_gnujaxp.dpatch
+++ /dev/null
@@ -1,59 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 05_no_gnujaxp.dpatch by Rene Engelhard <rene at debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
-
- at DPATCH@
-diff -urNad pentaho-reporting-flow-engine-0.9.2~/build.properties pentaho-reporting-flow-engine-0.9.2/build.properties
---- pentaho-reporting-flow-engine-0.9.2~/build.properties	2007-12-27 23:30:35.000000000 +0100
-+++ pentaho-reporting-flow-engine-0.9.2/build.properties	2007-12-27 23:30:43.000000000 +0100
-@@ -58,7 +58,6 @@
- oscache-jar-file=optional/oscache-2.3-compat.jar
- 
- # Used by: module-parser
--jaxp-jar-file=gnujaxp.jar
- sac-jar-file=sac.jar
- 
- # Used by: output-pdf
-diff -urNad pentaho-reporting-flow-engine-0.9.2~/build.xml pentaho-reporting-flow-engine-0.9.2/build.xml
---- pentaho-reporting-flow-engine-0.9.2~/build.xml	2007-10-18 08:20:01.000000000 +0200
-+++ pentaho-reporting-flow-engine-0.9.2/build.xml	2007-12-27 23:30:56.000000000 +0100
-@@ -54,13 +54,11 @@
-     <isClassAvailableEx class-name="org.jfree.xmlns.LibXmlInfo"
-                       property-name="lib.xmlns.present">
-       <test-classpath>
--        <pathelement location="${libdir}/${jaxp-jar-file}"/>
-         <pathelement location="${libdir}/${libxml-jar-file}"/>
-         <pathelement location="${libdir}/${jcommon-jar-file}"/>
-         <pathelement location="${libdir}/${libloader-jar-file}"/>
-       </test-classpath>
-       <additional-tests>
--        <available file="${libdir}/${jaxp-jar-file}"/>
-         <available file="${libdir}/${libxml-jar-file}"/>
-         <available file="${libdir}/${jcommon-jar-file}"/>
-       </additional-tests>
-@@ -145,7 +143,6 @@
-         <pathelement location="${libdir}/${liblayout-jar-file}"/>
-         <pathelement location="${libdir}/${libformula-jar-file}"/>
-         <pathelement location="${libdir}/${libxml-jar-file}"/>
--        <pathelement location="${libdir}/${jaxp-jar-file}"/>
-         <pathelement location="${libdir}/${librepository-jar-file}"/>
-         <pathelement location="${libdir}/${flute-jar-file}"/>
-         <pathelement location="${libdir}/${libfonts-core-jar-file}"/>
-@@ -188,7 +185,6 @@
-         <pathelement location="${libdir}/${liblayout-jar-file}"/>
-         <pathelement location="${libdir}/${libformula-jar-file}"/>
-         <pathelement location="${libdir}/${libxml-jar-file}"/>
--        <pathelement location="${libdir}/${jaxp-jar-file}"/>
-         <pathelement location="${libdir}/${librepository-jar-file}"/>
-         <pathelement location="${libdir}/${flute-jar-file}"/>
-         <pathelement location="${libdir}/${libfonts-core-jar-file}"/>
-@@ -230,7 +226,6 @@
-         <pathelement location="${libdir}/${liblayout-jar-file}"/>
-         <pathelement location="${libdir}/${libformula-jar-file}"/>
-         <pathelement location="${libdir}/${libxml-jar-file}"/>
--        <pathelement location="${libdir}/${jaxp-jar-file}"/>
-         <pathelement location="${libdir}/${librepository-jar-file}"/>
-         <pathelement location="${libdir}/${flute-jar-file}"/>
-         <pathelement location="${libdir}/${libfonts-core-jar-file}"/>
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index 542e8d6..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/make -f
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# Build 
-# Choose the VM
-export JAVA_HOME ?= /usr/lib/jvm/default-java
-export JAVA=$(JAVA_HOME)/bin/java
-export JAVAC=$(JAVA_HOME)/bin/javac
-export CLASSPATH=$(JAVA_HOME)/jre/lib/rt.jar:.
-
-export CURDIR=$(shell pwd)
-export SRCDIR=$(CURDIR)
-export LIBRARY=pentaho-reporting-flow-engine
-export VERSION=0.9.2
-
-include /usr/share/dpatch/dpatch.make
-
-configure: configure-stamp
-configure-stamp: patch-stamp
-	dh_testdir
-	touch configure-stamp
-
-
-build: configure build-stamp
-build-stamp:
-	dh_testdir
-	
-	ant compile
-	ant javadoc
-	cd docs && db2html manual.xml
-	cd docs/devguide && db2html developers-guide.xml
-	
-	touch build-stamp
-
-clean: unpatch
-	dh_testdir
-	dh_testroot
-	-rm -f build-stamp
-	-rm -f configure-stamp
-	rm -f $(LIBRARY)-$(VERSION).jar
-	rm -rf docs/manual
-	rm -rf docs/devguide/developers-guide
-	rm -rf javadoc
-	dh_clean
-
-install: build javadoc
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	dh_installdirs
-	
-	install -m 644 $(SRCDIR)/$(LIBRARY)-$(VERSION).jar \
-	debian/lib$(LIBRARY)-java/usr/share/java/
-	ln -s $(LIBRARY)-$(VERSION).jar debian/lib$(LIBRARY)-java/usr/share/java/$(LIBRARY).jar
-
-binary-indep: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs
-	dh_installexamples
-	dh_installchangelogs
-	dh_link
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-
-binary: binary-indep 
-
-.PHONY: binary binary-indep clean
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index 828c609..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,2 +0,0 @@
-version=3
-http://sf.net/jfreereport/ pentaho-reporting-flow-engine-([\d\.]*).zip
diff --git a/devresource/META-INF/MANIFEST.MF b/devresource/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ba49101
--- /dev/null
+++ b/devresource/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Implementation-Title: flow-engine
+Implementation-Vendor: Pentaho Corporation
+Release-Major-Number: 0
+Release-Minor-Number: 9
+Release-Milestone-Number: 4
diff --git a/licence-LGPL.txt b/licence-LGPL.txt
new file mode 100644
index 0000000..84b5f5a
--- /dev/null
+++ b/licence-LGPL.txt
@@ -0,0 +1,525 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+

+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+

+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+

+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+

+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+

+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+

+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+

+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+

+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+

+As a special exception, the copyright holders of JFreeReport give you
+permission to extend JFreeReport with independent modules that communicate with
+JFreeReport solely through the "Expression" or the "Function" interface, regardless
+of the license terms of these independent modules, and to copy and distribute the
+resulting combined work under terms of your choice, provided that
+every copy of the combined work is accompanied by a complete copy of
+the source code of JFreeReport (the version of JFreeReport used to produce the
+combined work), being distributed under the terms of the GNU Lesser
+General Public License plus this exception.  An independent module is a module
+which is not derived from or based on JFreeReport.
+
+This exception applies to the Java interfaces "Expression" and "Function"
+and the classes "AbstractExpression" and "AbstractFunction".
+
+Note that people who make modified versions of JFreeReport are not obligated
+to grant this special exception for their modified versions; it is
+their choice whether to do so.  The GNU Lesser General Public License gives
+permission to release a modified version without this exception; this
+exception also makes it possible to release a modified version which
+carries forward this exception.
+

+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/source/loader.properties b/source/loader.properties
new file mode 100644
index 0000000..c6dac59
--- /dev/null
+++ b/source/loader.properties
@@ -0,0 +1,7 @@
+#
+# This file registers the loader-factories defined in JFreeReport. Do not
+# modify it, unless you really want to *remove* support for one of the created
+# types.
+org.pentaho.reporting.libraries.resourceloader.factory.type.org.jfree.report.ReportDataFactory=org.jfree.report.modules.factories.data.base.ReportDataFactoryXmlResourceFactory
+org.pentaho.reporting.libraries.resourceloader.factory.type.org.jfree.report.JFreeReport=org.jfree.report.modules.factories.report.base.JFreeReportXmlResourceFactory
+org.pentaho.reporting.libraries.resourceloader.factory.type.org.jfree.report.structure.SubReport=org.jfree.report.modules.factories.report.base.SubReportXmlResourceFactory
diff --git a/source/org/jfree/report/DataFlags.java b/source/org/jfree/report/DataFlags.java
new file mode 100644
index 0000000..918c698
--- /dev/null
+++ b/source/org/jfree/report/DataFlags.java
@@ -0,0 +1,50 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DataFlags.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * A DataFlags object is an immutable wrapper around a value read from the
+ * datarow.
+ *
+ * @author Thomas Morgner
+ */
+public interface DataFlags
+{
+  public boolean isNumeric();
+  public boolean isDate();
+  public boolean isNull();
+  public boolean isZero();
+  public boolean isNegative();
+  public boolean isPositive();
+  public boolean isChanged();
+  public Object getValue() throws DataSourceException;
+  public String getName();
+}
diff --git a/source/org/jfree/report/DataRow.java b/source/org/jfree/report/DataRow.java
new file mode 100644
index 0000000..f14712f
--- /dev/null
+++ b/source/org/jfree/report/DataRow.java
@@ -0,0 +1,117 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DataRow.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * This is the base interface for all data access collectors. A data-row adds a
+ * certain order to the elements in the dataset. It also allows statefull
+ * comparisions and data attributes using DataFlags.
+ * <p/>
+ * The data-row is an internal concept of JFreeReport. The report engine will be
+ * responsible for creating and maintaining these implementations. Authors of
+ * functions and expressions usually dont have to care where a datarow comes
+ * from or at which particular instance they are looking right now.
+ * <p/>
+ * Note: Do not attempt to cache the datarow outside the core engine. This can
+ * have funny sideeffects and might trigger the end of the world.
+ *
+ * @author Thomas Morgner
+ */
+public interface DataRow extends DataSet
+{
+  /**
+   * Returns the value of the expression or column in the tablemodel using the
+   * given column number as index. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   * @throws DataSourceException   if an error occured.
+   */
+  public Object get(int col) throws DataSourceException;
+
+  /**
+   * Returns the value of the function, expression or column using its specific
+   * name. The given name is translated into a valid column number and the the
+   * column is queried. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   * @throws DataSourceException   if an error occured.
+   */
+  public Object get(String col) throws DataSourceException;
+
+  /**
+   * Returns the name of the column, expression or function. For columns from
+   * the tablemodel, the tablemodels <code>getColumnName</code> method is
+   * called. For functions, expressions and report properties the assigned name
+   * is returned.
+   *
+   * @param col the item index.
+   * @return the name.
+   * @throws DataSourceException if an error occured.
+   */
+  public String getColumnName(int col) throws DataSourceException;
+
+  /**
+   * Returns the number of columns, expressions and functions and marked
+   * ReportProperties in the report.
+   *
+   * @return the item count.
+   * @throws DataSourceException if an error occured.
+   */
+  public int getColumnCount() throws DataSourceException;
+
+  /**
+   * Queries lowlevel meta-data for the current value of the specified column.
+   *
+   * @param col the colum for which to query the meta-data flags
+   * @return the dataflag collection for the value in the named column
+   * @throws DataSourceException if an error occured.
+   */
+  public DataFlags getFlags(String col) throws DataSourceException;
+
+  /**
+   * Queries lowlevel meta-data for the current value of the specified column.
+   *
+   * @param col the colum for which to query the meta-data flags
+   * @return the dataflag collection for the value in the specified column
+   * @throws DataSourceException if an error occured.
+   */
+  public DataFlags getFlags(int col) throws DataSourceException;
+}
diff --git a/source/org/jfree/report/DataSet.java b/source/org/jfree/report/DataSet.java
new file mode 100644
index 0000000..f024afc
--- /dev/null
+++ b/source/org/jfree/report/DataSet.java
@@ -0,0 +1,44 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DataSet.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * A dataset is a one-dimensional collection of data items. Its main purpose is
+ * to describe parameter sets.
+ *
+ * @author Thomas Morgner
+ */
+public interface DataSet
+{
+  public int getColumnCount() throws DataSourceException;
+  public String getColumnName(int column) throws DataSourceException;
+  public Object get (int column) throws DataSourceException;
+}
diff --git a/source/org/jfree/report/DataSourceException.java b/source/org/jfree/report/DataSourceException.java
new file mode 100644
index 0000000..3758d97
--- /dev/null
+++ b/source/org/jfree/report/DataSourceException.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DataSourceException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+import org.pentaho.reporting.libraries.base.util.StackableException;
+
+
+/**
+ * Creation-Date: 19.02.2006, 16:58:35
+ *
+ * @author Thomas Morgner
+ */
+public class DataSourceException extends StackableException
+{
+  /** Creates a StackableRuntimeException with no message and no parent. */
+  public DataSourceException()
+  {
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public DataSourceException(final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   */
+  public DataSourceException(final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/EmptyReportData.java b/source/org/jfree/report/EmptyReportData.java
new file mode 100644
index 0000000..5e8ccdd
--- /dev/null
+++ b/source/org/jfree/report/EmptyReportData.java
@@ -0,0 +1,100 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: EmptyReportData.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * Creation-Date: 22.04.2006, 14:25:04
+ *
+ * @author Thomas Morgner
+ */
+public class EmptyReportData implements ReportData
+{
+  public EmptyReportData()
+  {
+  }
+
+  public int getCursorPosition() throws DataSourceException
+  {
+    return 0;
+  }
+
+  public boolean isReadable() throws DataSourceException
+  {
+    return false;
+  }
+
+  public boolean setCursorPosition(final int cursor) throws DataSourceException
+  {
+    if (cursor == ReportData.BEFORE_FIRST_ROW)
+    {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * This operation checks, whether a call to next will be likely to succeed. If there is a next data row, this should
+   * return true.
+   *
+   * @return
+   * @throws DataSourceException
+   *
+   */
+  public boolean isAdvanceable() throws DataSourceException
+  {
+    return false;
+  }
+
+  public boolean next() throws DataSourceException
+  {
+    return false;
+  }
+
+  public void close() throws DataSourceException
+  {
+
+  }
+
+  public int getColumnCount() throws DataSourceException
+  {
+    return 0;
+  }
+
+  public String getColumnName(final int column) throws DataSourceException
+  {
+    return null;
+  }
+
+  public Object get(final int column) throws DataSourceException
+  {
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/EmptyReportDataFactory.java b/source/org/jfree/report/EmptyReportDataFactory.java
new file mode 100644
index 0000000..deb64fa
--- /dev/null
+++ b/source/org/jfree/report/EmptyReportDataFactory.java
@@ -0,0 +1,87 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: EmptyReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+/**
+ * Creation-Date: 17.11.2006, 16:51:01
+ *
+ * @author Thomas Morgner
+ */
+public class EmptyReportDataFactory implements ReportDataFactory
+{
+  public EmptyReportDataFactory()
+  {
+  }
+
+  public void open()
+  {
+
+  }
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query. The
+   * Parameterset given here may contain more data than actually needed.
+   * <p/>
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query
+   * @param parameters
+   * @return
+   */
+  public ReportData queryData(final String query, final DataSet parameters)
+      throws ReportDataFactoryException
+  {
+    return new EmptyReportData();
+  }
+
+  /**
+   * Closes the report data factory and all report data instances that have been
+   * returned by this instance.
+   */
+  public void close()
+  {
+
+  }
+
+
+  /**
+   * Derives a freshly initialized report data factory, which is independend of
+   * the original data factory. Opening or Closing one data factory must not
+   * affect the other factories.
+   *
+   * @return
+   */
+  public ReportDataFactory derive()
+  {
+    return this;
+  }
+}
diff --git a/source/org/jfree/report/EmptyReportException.java b/source/org/jfree/report/EmptyReportException.java
new file mode 100644
index 0000000..3217833
--- /dev/null
+++ b/source/org/jfree/report/EmptyReportException.java
@@ -0,0 +1,61 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: EmptyReportException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+/**
+ * The EmptyReportException is thrown, it the report processing generated no content.
+ *
+ * @author Thomas Morgner.
+ */
+public class EmptyReportException extends ReportProcessingException
+{
+  /**
+   * Creates an EmptyReportException.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public EmptyReportException (final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates an EmptyReportException.
+   *
+   * @param message the exception message.
+   */
+  public EmptyReportException (final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/JFreeReport.java b/source/org/jfree/report/JFreeReport.java
new file mode 100644
index 0000000..8bd7303
--- /dev/null
+++ b/source/org/jfree/report/JFreeReport.java
@@ -0,0 +1,253 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JFreeReport.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+import java.awt.print.PageFormat;
+import java.util.ArrayList;
+import java.util.Locale;
+import javax.swing.table.TableModel;
+
+import org.jfree.layouting.input.style.CSSPageRule;
+import org.jfree.layouting.input.style.StyleSheet;
+import org.jfree.layouting.input.style.StyleSheetUtility;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.structure.ReportDefinition;
+import org.jfree.report.util.ReportParameters;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.config.HierarchicalConfiguration;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+
+/**
+ * A JFreeReport instance is used as report template to define the visual layout
+ * of a report and to collect all data sources for the reporting. Possible data
+ * sources are the {@link TableModel}, {@link org.jfree.report.expressions.Expression}s
+ * or {@link ReportParameters}.
+ * <p/>
+ * New since 0.9: Report properties contain data. They do not contain processing
+ * objects (like the outputtarget) or attribute values. Report properties should
+ * only contains things, which are intended for printing.
+ * <p/>
+ * The report data source is no longer part of the report definition. It is an
+ * extra object passed over to the report processor or generated using a report
+ * data factory.
+ *
+ * @author David Gilbert
+ * @author Thomas Morgner
+ */
+public class JFreeReport extends ReportDefinition
+    implements ReportStructureRoot
+{
+  /**
+   * The report configuration.
+   */
+  private ModifiableConfiguration reportConfiguration;
+
+  private ArrayList styleSheets;
+  private StyleSheet pageFormatStyleSheet;
+  private CSSPageRule pageRule;
+
+  private ReportParameters parameters;
+
+  private ReportDataFactory dataFactory;
+
+  private ResourceManager resourceManager;
+  private ResourceKey baseResource;
+
+  /**
+   * The default constructor. Creates an empty but fully initialized report.
+   */
+  public JFreeReport()
+  {
+    setType("report");
+    this.reportConfiguration = new HierarchicalConfiguration
+        (JFreeReportBoot.getInstance().getGlobalConfig());
+
+    this.styleSheets = new ArrayList();
+    this.parameters = new ReportParameters();
+    this.dataFactory = new EmptyReportDataFactory();
+
+    this.pageFormatStyleSheet = new StyleSheet();
+    this.pageRule = new CSSPageRule(pageFormatStyleSheet, null, null, null);
+    this.pageFormatStyleSheet.addRule(pageRule);
+
+    setQuery("default");
+  }
+
+  /**
+   * Returns the report configuration.
+   * <p/>
+   * The report configuration is automatically set up when the report is first
+   * created, and uses the global JFreeReport configuration as its parent.
+   *
+   * @return the report configuration.
+   */
+  public Configuration getConfiguration()
+  {
+    return reportConfiguration;
+  }
+
+  public void addStyleSheet(StyleSheet s)
+  {
+    if (s == null)
+    {
+      throw new NullPointerException();
+    }
+    styleSheets.add(s);
+  }
+
+  public void removeStyleSheet(StyleSheet s)
+  {
+    styleSheets.remove(s);
+  }
+
+  public StyleSheet getStyleSheet(int i)
+  {
+    if (i == 0)
+    {
+      return pageFormatStyleSheet;
+    }
+    return (StyleSheet) styleSheets.get(i - 1);
+  }
+
+  public int getStyleSheetCount()
+  {
+    return styleSheets.size() + 1;
+  }
+
+  public JFreeReport getRootReport()
+  {
+    return this;
+  }
+
+  public ReportParameters getInputParameters()
+  {
+    return parameters;
+  }
+
+  public ReportDataFactory getDataFactory()
+  {
+    return dataFactory;
+  }
+
+  public void setDataFactory(final ReportDataFactory dataFactory)
+  {
+    if (dataFactory == null)
+    {
+      throw new NullPointerException();
+    }
+
+    this.dataFactory = dataFactory;
+  }
+
+  public ResourceManager getResourceManager()
+  {
+    if (resourceManager == null)
+    {
+      resourceManager = new ResourceManager();
+      resourceManager.registerDefaults();
+    }
+    return resourceManager;
+  }
+
+  public void setResourceManager(final ResourceManager resourceManager)
+  {
+    this.resourceManager = resourceManager;
+  }
+
+  public ResourceKey getBaseResource()
+  {
+    return baseResource;
+  }
+
+  public void setBaseResource(final ResourceKey baseResource)
+  {
+    this.baseResource = baseResource;
+  }
+
+  public void setPageFormat(final PageFormat format)
+  {
+    pageRule.clear();
+    StyleSheetUtility.updateRuleForPage(pageRule, format);
+  }
+
+  public PageFormat getPageFormat()
+  {
+    return StyleSheetUtility.getPageFormat(pageRule);
+  }
+
+  public ModifiableConfiguration getEditableConfiguration()
+  {
+    return reportConfiguration;
+  }
+
+  public Locale getLocale()
+  {
+    final Locale locale = super.getLocale();
+    if (locale == null)
+    {
+      return Locale.getDefault();
+    }
+    return locale;
+  }
+
+
+  /**
+   private ModifiableConfiguration reportConfiguration;
+
+   private ArrayList styleSheets;
+   private StyleSheet pageFormatStyleSheet;
+   private CSSPageRule pageRule;
+
+   private ReportParameters parameters;
+
+   private ReportDataFactory dataFactory;
+
+   private ResourceManager resourceManager;
+   private ResourceKey baseResource;
+   *
+   * @return
+   * @throws CloneNotSupportedException
+   */
+  public Object clone()
+      throws CloneNotSupportedException
+  {
+    final JFreeReport report = (JFreeReport) super.clone();
+    report.dataFactory = dataFactory.derive();
+    report.parameters = (ReportParameters) parameters.clone();
+    report.pageRule = (CSSPageRule) pageRule.clone();
+    report.styleSheets = (ArrayList) styleSheets.clone();
+    report.pageFormatStyleSheet = pageFormatStyleSheet;
+    return report;
+  }
+}
diff --git a/source/org/jfree/report/JFreeReportBoot.java b/source/org/jfree/report/JFreeReportBoot.java
new file mode 100644
index 0000000..ceb0700
--- /dev/null
+++ b/source/org/jfree/report/JFreeReportBoot.java
@@ -0,0 +1,391 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JFreeReportBoot.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+import java.util.Enumeration;
+
+import org.jfree.report.util.CSVTokenizer;
+import org.pentaho.reporting.libraries.base.config.HierarchicalConfiguration;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.config.PropertyFileConfiguration;
+import org.pentaho.reporting.libraries.base.config.SystemPropertyConfiguration;
+import org.pentaho.reporting.libraries.base.boot.AbstractBoot;
+import org.pentaho.reporting.libraries.base.boot.PackageManager;
+import org.pentaho.reporting.libraries.base.versioning.ProjectInformation;
+import org.pentaho.reporting.libraries.base.LibBaseBoot;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+/**
+ * An utility class to safely boot and initialize the JFreeReport library. This class
+ * should be called before using the JFreeReport classes, to make sure that all subsystems
+ * are initialized correctly and in the correct order.
+ * <p/>
+ * Application developers should make sure, that the booting is done, before JFreeReport
+ * objects are used. Although the boot process will be started automaticly if needed, this
+ * automated start may no longer guarantee the module initialization order.
+ * <p/>
+ * Additional modules can be specified by defining the system property
+ * <code>"org.jfree.report.boot.Modules"</code>. The property expects a comma-separated
+ * list of {@link org.jfree.base.modules.Module} implementations.
+ * <p/>
+ * Booting should be done by aquirering a new boot instance using {@link
+ * JFreeReportBoot#getInstance()} and then starting the boot process with {@link
+ * JFreeReportBoot#start()}.
+ *
+ * @author Thomas Morgner
+ */
+public class JFreeReportBoot extends AbstractBoot
+{
+  private static final Log logger = LogFactory.getLog(JFreeReportBoot.class);
+
+  /**
+   * A wrappper around the user supplied global configuration.
+   */
+  private static class UserConfigWrapper extends HierarchicalConfiguration
+          implements Configuration
+  {
+    /** The wrapped configuration. */
+    private Configuration wrappedConfiguration;
+
+    /**
+     * Default constructor.
+     */
+    public UserConfigWrapper ()
+    {
+      this (null);
+    }
+
+    public UserConfigWrapper (Configuration config)
+    {
+      this.wrappedConfiguration = config;
+    }
+    /**
+     * Sets a new configuration. This configuration will be inserted into the
+     * report configuration hierarchy. Set this property to null to disable
+     * the user defined configuration.
+     *
+     * @param wrappedConfiguration the wrapped configuration.
+     */
+    public void setWrappedConfiguration (final Configuration wrappedConfiguration)
+    {
+      this.wrappedConfiguration = wrappedConfiguration;
+    }
+
+    /**
+     * Returns the user supplied global configuration, if exists.
+     *
+     * @return the user configuration.
+     */
+    public Configuration getWrappedConfiguration ()
+    {
+      return wrappedConfiguration;
+    }
+
+    /**
+     * Returns the configuration property with the specified key.
+     *
+     * @param key the property key.
+     * @return the property value.
+     */
+    public String getConfigProperty (final String key)
+    {
+      if (wrappedConfiguration == null)
+      {
+        return getParentConfig().getConfigProperty(key);
+      }
+
+      final String retval = wrappedConfiguration.getConfigProperty(key);
+      if (retval != null)
+      {
+        return retval;
+      }
+      return getParentConfig().getConfigProperty(key);
+    }
+
+    /**
+     * Returns the configuration property with the specified key
+     * (or the specified default value if there is no such property).
+     * <p/>
+     * If the property is not defined in this configuration, the code
+     * will lookup the property in the parent configuration.
+     *
+     * @param key          the property key.
+     * @param defaultValue the default value.
+     * @return the property value.
+     */
+    public String getConfigProperty (final String key, final String defaultValue)
+    {
+      if (wrappedConfiguration == null)
+      {
+        return getParentConfig().getConfigProperty(key, defaultValue);
+      }
+
+      final String retval = wrappedConfiguration.getConfigProperty(key, null);
+      if (retval != null)
+      {
+        return retval;
+      }
+      return getParentConfig().getConfigProperty(key, defaultValue);
+    }
+
+    /**
+     * Sets a configuration property.
+     *
+     * @param key   the property key.
+     * @param value the property value.
+     */
+    public void setConfigProperty (final String key, final String value)
+    {
+      if (wrappedConfiguration instanceof ModifiableConfiguration)
+      {
+        final ModifiableConfiguration modConfiguration =
+                (ModifiableConfiguration) wrappedConfiguration;
+        modConfiguration.setConfigProperty(key, value);
+      }
+    }
+
+    /**
+     * Returns all defined configuration properties for the report. The enumeration
+     * contains all keys of the changed properties, properties set from files or
+     * the system properties are not included.
+     *
+     * @return all defined configuration properties for the report.
+     */
+    public Enumeration getConfigProperties ()
+    {
+      if (wrappedConfiguration instanceof ModifiableConfiguration)
+      {
+        final ModifiableConfiguration modConfiguration =
+                (ModifiableConfiguration) wrappedConfiguration;
+        return modConfiguration.getConfigProperties();
+      }
+      return super.getConfigProperties();
+    }
+  }
+
+  /**
+   * The singleton instance of the Boot class.
+   */
+  private static JFreeReportBoot instance;
+  /**
+   * The project info contains all meta data about the project.
+   */
+  private ProjectInformation projectInfo;
+
+  /**
+   * Holds a possibly empty reference to a user-supplied Configuration
+   * implementation.
+   */
+  private static transient UserConfigWrapper configWrapper =
+          new UserConfigWrapper();
+
+  /**
+   * Creates a new instance.
+   */
+  private JFreeReportBoot ()
+  {
+    projectInfo = JFreeReportInfo.getInstance();
+  }
+
+  /**
+   * Returns the singleton instance of the boot utility class.
+   *
+   * @return the boot instance.
+   */
+  public static synchronized JFreeReportBoot getInstance ()
+  {
+    if (instance == null)
+    {
+      // make sure that I am able to debug the package manager ..
+      instance = new JFreeReportBoot();
+    }
+    return instance;
+  }
+
+  /**
+   * Returns the current global configuration as modifiable instance. This
+   * is exactly the same as casting the global configuration into a
+   * ModifableConfiguration instance.
+   * <p/>
+   * This is a convinience function, as all programmers are lazy.
+   *
+   * @return the global config as modifiable configuration.
+   */
+  public ModifiableConfiguration getEditableConfig()
+  {
+    return (ModifiableConfiguration) getGlobalConfig();
+  }
+
+  /**
+   * Returns the project info.
+   *
+   * @return The project info.
+   */
+  protected ProjectInformation getProjectInfo ()
+  {
+    return projectInfo;
+  }
+
+  /**
+   * Loads the configuration. This will be called exactly once.
+   *
+   * @return The configuration.
+   */
+  protected Configuration loadConfiguration ()
+  {
+    HierarchicalConfiguration globalConfig = new HierarchicalConfiguration();
+
+    final PropertyFileConfiguration rootProperty = new PropertyFileConfiguration();
+    rootProperty.load("/org/jfree/report/jfreereport.properties");
+    rootProperty.load("/org/jfree/report/ext/jfreereport-ext.properties");
+    globalConfig.insertConfiguration(rootProperty);
+    globalConfig.insertConfiguration(JFreeReportBoot.getInstance().getPackageManager()
+            .getPackageConfiguration());
+
+    final PropertyFileConfiguration baseProperty = new PropertyFileConfiguration();
+    baseProperty.load("/jfreereport.properties");
+    globalConfig.insertConfiguration(baseProperty);
+
+    globalConfig.insertConfiguration(configWrapper);
+
+    final SystemPropertyConfiguration systemConfig = new SystemPropertyConfiguration();
+    globalConfig.insertConfiguration(systemConfig);
+    return globalConfig;
+  }
+
+  /**
+   * Performs the actual boot process.
+   */
+  protected void performBoot ()
+  {
+    // Inject JFreeReport's configuration into jcommon.
+    // make sure logging is re-initialized after we injected our configuration.
+    if (isStrictFP() == false)
+    {
+      logger.warn("The used VM seems to use a non-strict floating point arithmetics");
+      logger.warn("Layouts computed with this Java Virtual Maschine may be invalid.");
+      logger.warn("JFreeReport and the library 'iText' depend on the strict floating point rules");
+      logger.warn("of Java1.1 as implemented by the Sun Virtual Maschines.");
+      logger.warn("If you are using the BEA JRockit VM, start the Java VM with the option");
+      logger.warn("'-Xstrictfp' to restore the default behaviour.");
+    }
+
+    final PackageManager mgr = getPackageManager();
+
+    mgr.addModule(JFreeReportCoreModule.class.getName());
+    mgr.load("org.jfree.report.modules.");
+    mgr.load("org.jfree.report.ext.modules.");
+    mgr.load("org.jfree.report.userdefined.modules.");
+
+    bootAdditionalModules();
+    mgr.initializeModules();
+  }
+
+  /**
+   * Boots modules, which have been spcified in the "org.jfree.report.boot.Modules"
+   * configuration parameter.
+   */
+  private void bootAdditionalModules ()
+  {
+    try
+    {
+      final String bootModules =
+              getGlobalConfig().getConfigProperty
+              ("org.jfree.report.boot.Modules");
+      if (bootModules != null)
+      {
+        final CSVTokenizer csvToken = new CSVTokenizer(bootModules, ",");
+        while (csvToken.hasMoreTokens())
+        {
+          final String token = csvToken.nextToken();
+          getPackageManager().load(token);
+        }
+      }
+    }
+    catch (SecurityException se)
+    {
+      logger.info("Security settings forbid to check the system properties for extension modules.");
+    }
+    catch (Exception se)
+    {
+      logger.error
+              ("An error occured while checking the system properties for extension modules.", se);
+    }
+  }
+
+
+  /**
+   * This method returns true on non-strict floating point systems.
+   * <p/>
+   * Since Java 1.2 Virtual Maschines may implement the floating point arithmetics in a
+   * more performant way, which does not put the old strict constraints on the floating
+   * point types <code>float</code> and <code>double</code>.
+   * <p/>
+   * As iText and this library requires strict (in the sense of Java1.1) floating point
+   * operations, we have to test for that feature here.
+   * <p/>
+   * The only known VM that seems to implement that feature is the JRockit VM. The strict
+   * mode can be restored on that VM by adding the "-Xstrictfp" VM parameter.
+   *
+   * @return true, if the VM uses strict floating points by default, false otherwise.
+   */
+  private static boolean isStrictFP ()
+  {
+    final double d = 8e+307;
+    final double result1 = 4.0 * d * 0.5;
+    final double result2 = 2.0 * d;
+    return (result1 != result2 && (result1 == Double.POSITIVE_INFINITY));
+  }
+
+
+  /**
+   * Returns the user supplied global configuration.
+   *
+   * @return the user configuration, if any.
+   */
+  public static Configuration getUserConfig ()
+  {
+    return configWrapper.getWrappedConfiguration();
+  }
+
+  /**
+   * Defines the global user configuration.
+   *
+   * @param config the user configuration.
+   */
+  public static void setUserConfig (final Configuration config)
+  {
+    configWrapper.setWrappedConfiguration(config);
+  }
+
+}
diff --git a/source/org/jfree/report/JFreeReportCoreModule.java b/source/org/jfree/report/JFreeReportCoreModule.java
new file mode 100644
index 0000000..f586c95
--- /dev/null
+++ b/source/org/jfree/report/JFreeReportCoreModule.java
@@ -0,0 +1,111 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JFreeReportCoreModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+import java.io.InputStream;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+
+/**
+ * The CoreModule is used to represent the base classes of JFreeReport in a
+ * PackageManager-compatible way. Modules may request a certain core-version to be present
+ * by referencing to this module.
+ * <p>
+ * This module is used to initialize the image and drawable factories. If the
+ * Pixie library is available, support for WMF-files is added to the factories.
+ *
+ * @author Thomas Morgner
+ */
+public class JFreeReportCoreModule extends AbstractModule
+{
+  /**
+   * The 'no-printer-available' property key.
+   */
+  public static final String NO_PRINTER_AVAILABLE_KEY
+          = "org.jfree.report.NoPrinterAvailable";
+
+  /**
+   * The G2 fontrenderer bug override configuration key.
+   */
+  public static final String FONTRENDERER_ISBUGGY_FRC_KEY
+          = "org.jfree.report.layout.fontrenderer.IsBuggyFRC";
+
+  /**
+   * The text aliasing configuration key.
+   */
+  public static final String FONTRENDERER_USEALIASING_KEY
+          = "org.jfree.report.layout.fontrenderer.UseAliasing";
+
+  /**
+   * A configuration key that defines, whether errors will abort the report
+   * processing. This defaults to true.
+   */
+  public static final String STRICT_ERROR_HANDLING_KEY
+          = "org.jfree.report.StrictErrorHandling";
+  /**
+   * Creates a new module definition based on the 'coremodule.properties' file of this
+   * package.
+   *
+   * @throws ModuleInitializeException if the file could not be loaded.
+   */
+  public JFreeReportCoreModule ()
+          throws ModuleInitializeException
+  {
+    final InputStream in = ObjectUtilities.getResourceRelativeAsStream
+            ("coremodule.properties", JFreeReportCoreModule.class);
+    if (in == null)
+    {
+      throw new ModuleInitializeException
+              ("File 'coremodule.properties' not found in JFreeReport package.");
+    }
+    loadModuleInfo(in);
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup operations. This
+   * method is called only once in a modules lifetime. If the initializing cannot be
+   * completed, throw a ModuleInitializeException to indicate the error,. The module will
+   * not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize (final SubSystem subSystem)
+          throws ModuleInitializeException
+  {
+  }
+}
diff --git a/source/org/jfree/report/JFreeReportInfo.java b/source/org/jfree/report/JFreeReportInfo.java
new file mode 100644
index 0000000..3bf19ff
--- /dev/null
+++ b/source/org/jfree/report/JFreeReportInfo.java
@@ -0,0 +1,185 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JFreeReportInfo.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+import org.jfree.layouting.LibLayoutInfo;
+import org.pentaho.reporting.libraries.base.versioning.ProjectInformation;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+import org.pentaho.reporting.libraries.serializer.LibSerializerInfo;
+import org.pentaho.reporting.libraries.resourceloader.LibLoaderInfo;
+import org.pentaho.reporting.libraries.formula.LibFormulaInfo;
+import org.pentaho.reporting.libraries.xmlns.LibXmlInfo;
+
+/**
+ * Details about the JFreeReport project.
+ *
+ * @author David Gilbert
+ */
+public class JFreeReportInfo extends ProjectInformation
+{
+  /**
+   * This namespace covers all current reporting structures. These structures
+   * are not being forwarded to libLayout and should be treated to be generally
+   * invisible for all non-liblayout output targets.
+   *
+   * This is not an XML namespace, so dont expect to see documents using that
+   * namespace. It is purely internal.
+   */
+  public static final String REPORT_NAMESPACE =
+          "http://jfreereport.sourceforge.net/namespaces/engine";
+
+  /**
+   * This namespace contains the compatibility layer for the old JFreeReport
+   * structures.
+   *
+   * This is not an XML namespace, so dont expect to see documents using that
+   * namespace. It is purely internal.
+   */
+  public static final String COMPATIBILITY_NAMESPACE =
+          "http://jfreereport.sourceforge.net/namespaces/engine/compatibility";
+
+  private static JFreeReportInfo instance;
+
+  public static synchronized JFreeReportInfo getInstance()
+  {
+    if (instance == null)
+    {
+      instance = new JFreeReportInfo();
+    }
+    return instance;
+  }
+
+  /**
+   * Constructs an object containing information about the JFreeReport project.
+   * <p/>
+   * Uses a resource bundle to localise some of the information.
+   */
+  private JFreeReportInfo ()
+  {
+    super("flow-engine", "Pentaho Reporting Flow-Engine");
+    setVersion("0.9.2");
+    setInfo("http://reporting.pentaho.org/");
+    setCopyright
+            ("(C)opyright 2000-2007, by Pentaho Corporation, Object Refinery Limited and Contributors");
+
+    addLibrary(LibSerializerInfo.getInstance());
+    addLibrary(LibLoaderInfo.getInstance());
+    addLibrary(LibLayoutInfo.getInstance());
+    addLibrary(LibFormulaInfo.getInstance());
+    addLibrary(LibXmlInfo.getInstance());
+
+    final ProjectInformation pixieLibraryInfo = tryLoadPixieInfo();
+    if (pixieLibraryInfo != null)
+    {
+      addLibrary(pixieLibraryInfo);
+    }
+    final ProjectInformation libfontsLibraryInfo = tryLoadLibFontInfo();
+    if (libfontsLibraryInfo != null)
+    {
+      addLibrary(libfontsLibraryInfo);
+    }
+
+    setBootClass(JFreeReportBoot.class.getName());
+  }
+
+  /**
+   * Tries to load the Pixie boot classes. If the loading fails,
+   * this method returns null.
+   *
+   * @return the Pixie boot info, if Pixie is available.
+   */
+  private static ProjectInformation tryLoadPixieInfo ()
+  {
+    try
+    {
+      return (ProjectInformation) ObjectUtilities.loadAndInstantiate
+              ("org.jfree.pixie.PixieInfo", JFreeReportInfo.class,
+                  ProjectInformation.class);
+    }
+    catch (Exception e)
+    {
+      return null;
+    }
+  }
+
+  /**
+   * Tries to load the libFonts boot classes. If the loading fails,
+   * this method returns null.
+   *
+   * @return the Pixie boot info, if Pixie is available.
+   */
+  private static ProjectInformation tryLoadLibFontInfo ()
+  {
+    try
+    {
+      return (ProjectInformation) ObjectUtilities.loadAndInstantiate
+              ("org.jfree.fonts.LibFontInfo",
+                  JFreeReportInfo.class, ProjectInformation.class);
+    }
+    catch (Exception e)
+    {
+      return null;
+    }
+  }
+
+  /**
+   * Checks, whether the Pixie-library is available and in a working condition.
+   *
+   * @return true, if Pixie is available, false otherwise.
+   */
+  public static boolean isPixieAvailable ()
+  {
+    return tryLoadPixieInfo() != null;
+  }
+
+  /**
+   * Print the library version and information about the library.
+   * <p/>
+   * After there seems to be confusion about which version is currently used by the user,
+   * this method will print the project information to clarify this issue.
+   *
+   * @param args ignored
+   */
+  public static void main (final String[] args)
+  {
+    final JFreeReportInfo info = new JFreeReportInfo();
+    System.out.println(info.getName() + " " + info.getVersion());
+    System.out.println("----------------------------------------------------------------");
+    System.out.println(info.getCopyright());
+    System.out.println(info.getInfo());
+    System.out.println("----------------------------------------------------------------");
+    System.out.println("This project is licenced under the terms of the "
+            + info.getLicenseName() + ".");
+    System.exit(0);
+  }
+}
+
diff --git a/source/org/jfree/report/ReportConfigurationException.java b/source/org/jfree/report/ReportConfigurationException.java
new file mode 100644
index 0000000..5e97a29
--- /dev/null
+++ b/source/org/jfree/report/ReportConfigurationException.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportConfigurationException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+/**
+ * Creation-Date: 02.12.2006, 14:51:42
+ *
+ * @author Thomas Morgner
+ */
+public class ReportConfigurationException extends ReportException
+{
+  /**
+   * Creates a StackableRuntimeException with no message and no parent.
+   */
+  public ReportConfigurationException()
+  {
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public ReportConfigurationException(final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   */
+  public ReportConfigurationException(final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/ReportData.java b/source/org/jfree/report/ReportData.java
new file mode 100644
index 0000000..8184497
--- /dev/null
+++ b/source/org/jfree/report/ReportData.java
@@ -0,0 +1,103 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportData.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * A report data source is a ordered set of rows. For a report, we assume that
+ * the report dataset does not change while the report is processed. Concurrent
+ * updates will invalidate the whole precomputed layout.
+ *
+ * A report dataset will be accessed in a linear fashion. On certain points, the
+ * cursor will be reset to the a previously read position, and processing the
+ * data will restart from there. It is guaranteed, that the cursor will never
+ * be set to a row that is beyond the last row that has been read with 'next()'.
+ *
+ * If the cursor is out of range, any call to get must return 'null'. 
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportData extends DataSet
+{
+  public static final int BEFORE_FIRST_ROW = 0;
+
+  public int getCursorPosition() throws DataSourceException;
+
+  /**
+   * Moves the cursor back to an already visited position. Calling this method
+   * for an row number that has not yet been read using 'next' is undefined,
+   * whether that call succeeds is implementation dependent.
+   *
+   * Calls to position zero (aka BEFORE_FIRST_ROW) will always succeeed (unless there is a physical
+   * error, which invalidated the whole report-data object).
+   *
+   * @param cursor
+   * @return true, if moving the cursor succeeded, false otherwise.
+   * @throws DataSourceException
+   */
+  public boolean setCursorPosition(int cursor) throws DataSourceException;
+
+  /**
+   * This operation checks, whether a call to next will be likely to succeed.
+   * If there is a next data row, this should return true.
+   *
+   * @return
+   * @throws DataSourceException
+   */
+  public boolean isAdvanceable () throws DataSourceException;
+
+  /**
+   * This method produces the same result as 'setCursorPosition(getCursorPosition() + 1);'
+   *
+   * @return
+   * @throws DataSourceException
+   */
+  public boolean next() throws DataSourceException;
+
+  /**
+   * Closes the datasource. This should be called at the end of each report
+   * processing run. Whether this closes the underlying data-source backend
+   * depends on the ReportDataFactory. Calling 'close()' on the ReportDataFactory
+   * *must* close all report data objects.
+   *
+   * @throws DataSourceException
+   */
+  public void close() throws DataSourceException;
+
+  /**
+   * Checks, whether this report-data instance is currently readable. A report-data instance cannot be
+   * readable if it is positioned before the first row. (The look-ahead system of 'isAdvanceable()' will
+   * prevent that the datasource is positioned behind the last row.)
+   *
+   * @return true, if the datarow is valid, false otherwise.
+   * @throws DataSourceException
+   */
+  public boolean isReadable() throws DataSourceException;
+}
diff --git a/source/org/jfree/report/ReportDataFactory.java b/source/org/jfree/report/ReportDataFactory.java
new file mode 100644
index 0000000..aeda81d
--- /dev/null
+++ b/source/org/jfree/report/ReportDataFactory.java
@@ -0,0 +1,70 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * The report data-factory is responsible for querying the data from arbitary
+ * datasources.
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportDataFactory
+{
+  public void open();
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query.
+   * The Parameterset given here may contain more data than actually needed.
+   *
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query
+   * @param parameters
+   * @return
+   */
+  public ReportData queryData (final String query, final DataSet parameters)
+          throws ReportDataFactoryException;
+
+  /**
+   * Closes the report data factory and all report data instances that have
+   * been returned by this instance.
+   */
+  public void close();
+
+  /**
+   * Derives a freshly initialized report data factory, which is independend
+   * of the original data factory. Opening or Closing one data factory must not
+   * affect the other factories.
+   *
+   * @return
+   */
+  public ReportDataFactory derive ();
+}
diff --git a/source/org/jfree/report/ReportDataFactoryException.java b/source/org/jfree/report/ReportDataFactoryException.java
new file mode 100644
index 0000000..c710ffc
--- /dev/null
+++ b/source/org/jfree/report/ReportDataFactoryException.java
@@ -0,0 +1,65 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportDataFactoryException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * Creation-Date: 19.02.2006, 17:45:38
+ *
+ * @author Thomas Morgner
+ */
+public class ReportDataFactoryException extends ReportException
+{
+  /** Creates a StackableRuntimeException with no message and no parent. */
+  public ReportDataFactoryException()
+  {
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public ReportDataFactoryException(final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   */
+  public ReportDataFactoryException(final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/ReportException.java b/source/org/jfree/report/ReportException.java
new file mode 100644
index 0000000..1715db8
--- /dev/null
+++ b/source/org/jfree/report/ReportException.java
@@ -0,0 +1,71 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+import org.pentaho.reporting.libraries.base.util.StackableException;
+
+
+/**
+ * Creation-Date: 02.12.2006, 14:52:08
+ *
+ * @author Thomas Morgner
+ */
+public class ReportException extends StackableException
+{
+  /**
+   * Creates a StackableRuntimeException with no message and no parent.
+   */
+  public ReportException()
+  {
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public ReportException(final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   */
+  public ReportException(final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/ReportInterruptedException.java b/source/org/jfree/report/ReportInterruptedException.java
new file mode 100644
index 0000000..869a2b8
--- /dev/null
+++ b/source/org/jfree/report/ReportInterruptedException.java
@@ -0,0 +1,62 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportInterruptedException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+/**
+ * This exception is thrown when the current thread received the Interrupt-signal while
+ * the report is beeing processed. Depending on the ReportProcessor implementation such an
+ * signal would abort the report generation.
+ *
+ * @author Thomas Morgner
+ */
+public class ReportInterruptedException extends ReportProcessingException
+{
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public ReportInterruptedException (final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   */
+  public ReportInterruptedException (final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/ReportProcessingException.java b/source/org/jfree/report/ReportProcessingException.java
new file mode 100644
index 0000000..14a46ea
--- /dev/null
+++ b/source/org/jfree/report/ReportProcessingException.java
@@ -0,0 +1,61 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportProcessingException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report;
+
+/**
+ * An exception that can be thrown during report processing, if an error occurs.
+ *
+ * @author Thomas Morgner
+ */
+public class ReportProcessingException extends ReportException
+{
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public ReportProcessingException (final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   */
+  public ReportProcessingException (final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/TableReportData.java b/source/org/jfree/report/TableReportData.java
new file mode 100644
index 0000000..64909b0
--- /dev/null
+++ b/source/org/jfree/report/TableReportData.java
@@ -0,0 +1,132 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TableReportData.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+import javax.swing.table.TableModel;
+
+/**
+ * Creation-Date: 19.02.2006, 17:00:10
+ *
+ * @author Thomas Morgner
+ */
+public class TableReportData implements ReportData
+{
+  private TableModel tableModel;
+  private int cursor;
+  private int rowMax;
+  private int rowMin;
+  private int cursorMaxPosition;
+
+  public TableReportData(final TableModel tableModel)
+  {
+    this(tableModel, 0, tableModel.getRowCount());
+  }
+
+  public TableReportData(final TableModel tableModel, final int start, final int length)
+  {
+    this.tableModel = tableModel;
+    this.rowMax = start + length;
+    this.rowMin = start;
+    this.cursorMaxPosition = length;
+  }
+
+  public int getColumnCount() throws DataSourceException
+  {
+    return tableModel.getColumnCount();
+  }
+
+  public boolean isReadable() throws DataSourceException
+  {
+    return cursor > 0 && cursor <= cursorMaxPosition ;
+  }
+
+  public boolean setCursorPosition(final int row) throws DataSourceException
+  {
+    if (row > cursorMaxPosition)
+    {
+      return false;
+    }
+    else if (row < 0)
+    {
+      return false;
+    }
+    cursor = row;
+    return true;
+  }
+
+  /**
+   * This operation checks, whether a call to next will be likely to succeed. If
+   * there is a next data row, this should return true.
+   *
+   * @return
+   * @throws org.jfree.report.DataSourceException
+   *
+   */
+  public boolean isAdvanceable() throws DataSourceException
+  {
+    return cursor < cursorMaxPosition;
+  }
+
+  public String getColumnName(final int column) throws DataSourceException
+  {
+    return tableModel.getColumnName(column);
+  }
+
+  public Object get(final int column) throws DataSourceException
+  {
+    if (isReadable() == false)
+    {
+      throw new DataSourceException("Unable to read from datasource");
+    }
+    return tableModel.getValueAt(cursor - 1, column);
+  }
+
+  public boolean next() throws DataSourceException
+  {
+    if (cursor >= cursorMaxPosition)
+    {
+      return false;
+    }
+
+    cursor += 1;
+    return true;
+  }
+
+  public void close() throws DataSourceException
+  {
+    // does nothing ...
+  }
+
+  public int getCursorPosition() throws DataSourceException
+  {
+    return cursor;
+  }
+}
diff --git a/source/org/jfree/report/TableReportDataFactory.java b/source/org/jfree/report/TableReportDataFactory.java
new file mode 100644
index 0000000..287fca4
--- /dev/null
+++ b/source/org/jfree/report/TableReportDataFactory.java
@@ -0,0 +1,123 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TableReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report;
+
+import java.util.HashMap;
+import javax.swing.table.TableModel;
+
+/**
+ * Creation-Date: 21.02.2006, 17:59:32
+ *
+ * @author Thomas Morgner
+ */
+public class TableReportDataFactory implements ReportDataFactory, Cloneable
+{
+  private HashMap tables;
+
+  public TableReportDataFactory()
+  {
+    this.tables = new HashMap();
+  }
+
+  public TableReportDataFactory(String name, TableModel tableModel)
+  {
+    this();
+    addTable(name, tableModel);
+  }
+
+  public void addTable(String name, TableModel tableModel)
+  {
+    tables.put(name, tableModel);
+  }
+
+  public void removeTable(String name)
+  {
+    tables.remove(name);
+  }
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query. The
+   * Parameterset given here may contain more data than actually needed.
+   * <p/>
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query the name of the table.
+   * @param parameters are ignored for this factory.
+   * @return the report data or null.
+   */
+  public ReportData queryData(final String query, final DataSet parameters)
+          throws ReportDataFactoryException
+  {
+    TableModel model = (TableModel) tables.get(query);
+    if (model == null)
+    {
+      return null;
+    }
+
+    return new TableReportData(model);
+  }
+
+  public void open()
+  {
+
+  }
+
+  public void close()
+  {
+
+  }
+
+  /**
+   * Derives a freshly initialized report data factory, which is independend of
+   * the original data factory. Opening or Closing one data factory must not
+   * affect the other factories.
+   *
+   * @return
+   */
+  public ReportDataFactory derive()
+  {
+    try
+    {
+      return (ReportDataFactory) clone();
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new IllegalStateException("Clone should not fail.");
+    }
+  }
+
+  public Object clone () throws CloneNotSupportedException
+  {
+    TableReportDataFactory dataFactory = (TableReportDataFactory) super.clone();
+    dataFactory.tables = (HashMap) tables.clone();
+    return dataFactory;
+  }
+}
diff --git a/source/org/jfree/report/compat.css b/source/org/jfree/report/compat.css
new file mode 100644
index 0000000..01888dc
--- /dev/null
+++ b/source/org/jfree/report/compat.css
@@ -0,0 +1,15 @@
+/**
+ * The StyleSheet mapping for the compatibility-layer.
+ *
+ * During the report processing, the LibLayoutReportTarget adds some control
+ * attributes to help the layouter. These attributes are always added to the
+ * namespace '../namespaces/engine/flow', regardless what namespace the element
+ * itself is in.
+ */
+ at namespace url(http://jfreereport.sourceforge.net/namespaces/engine/compat); /* set default namespace to HTML */
+ at namespace xml url(http://www.w3.org/XML/1998/namespace);
+
+
+/**
+ * This is empty, so luckily we did not have to tweak anything yet.
+ */
\ No newline at end of file
diff --git a/source/org/jfree/report/coremodule.properties b/source/org/jfree/report/coremodule.properties
new file mode 100644
index 0000000..dc4a464
--- /dev/null
+++ b/source/org/jfree/report/coremodule.properties
@@ -0,0 +1,15 @@
+#
+# The core module
+#
+#
+
+module-info:
+  name: core-module
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: The core files of JFreeReport. The module collects all
+               classes needed to provide the basic reporting capabilities
+               of JFreeReport.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/data/CachingReportDataFactory.java b/source/org/jfree/report/data/CachingReportDataFactory.java
new file mode 100644
index 0000000..b7c0172
--- /dev/null
+++ b/source/org/jfree/report/data/CachingReportDataFactory.java
@@ -0,0 +1,257 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CachingReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.jfree.report.DataSet;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportData;
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.ReportDataFactoryException;
+
+/**
+ * Creation-Date: 19.11.2006, 13:35:45
+ *
+ * @author Thomas Morgner
+ */
+public class CachingReportDataFactory implements ReportDataFactory
+{
+  private static class Parameters implements DataSet
+  {
+    private Object[] dataStore;
+    private String[] nameStore;
+    private Integer hashCode;
+
+    protected Parameters(final DataSet dataSet) throws DataSourceException
+    {
+      final int columnCount = dataSet.getColumnCount();
+      dataStore = new Object[columnCount];
+      nameStore = new String[columnCount];
+
+      for (int i = 0; i < columnCount; i++)
+      {
+        nameStore[i] = dataSet.getColumnName(i);
+        dataStore[i] = dataSet.get(i);
+      }
+    }
+
+    public int getColumnCount() throws DataSourceException
+    {
+      return dataStore.length;
+    }
+
+    public String getColumnName(final int column) throws DataSourceException
+    {
+      return nameStore[column];
+    }
+
+    public Object get(final int column) throws DataSourceException
+    {
+      return dataStore[column];
+    }
+
+    public boolean equals(final Object o)
+    {
+      if (this == o)
+      {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass())
+      {
+        return false;
+      }
+
+      final Parameters that = (Parameters) o;
+
+      if (!Arrays.equals(dataStore, that.dataStore))
+      {
+        return false;
+      }
+      if (!Arrays.equals(nameStore, that.nameStore))
+      {
+        return false;
+      }
+
+      return true;
+    }
+
+    public synchronized int hashCode()
+    {
+      if (hashCode != null)
+      {
+        return hashCode.intValue();
+      }
+      int hashCode = 0;
+      for (int i = 0; i < dataStore.length; i++)
+      {
+        final Object o = dataStore[i];
+        if (o != null)
+        {
+          hashCode = hashCode * 23 + o.hashCode();
+        }
+        else
+        {
+          hashCode = hashCode * 23;
+        }
+      }
+      for (int i = 0; i < nameStore.length; i++)
+      {
+        final Object o = nameStore[i];
+        if (o != null)
+        {
+          hashCode = hashCode * 23 + o.hashCode();
+        }
+        else
+        {
+          hashCode = hashCode * 23;
+        }
+      }
+      this.hashCode = new Integer(hashCode);
+      return hashCode;
+    }
+  }
+
+  private HashMap queryCache;
+
+  private ReportDataFactory backend;
+
+  public CachingReportDataFactory(final ReportDataFactory backend)
+  {
+    if (backend == null)
+    {
+      throw new NullPointerException();
+    }
+    this.backend = backend;
+    this.queryCache = new HashMap();
+  }
+
+  public void open()
+  {
+    backend.open();
+  }
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query. The Parameterset given here may contain
+   * more data than actually needed.
+   * <p/>
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query
+   * @param parameters
+   * @return
+   */
+  public ReportData queryData(final String query, final DataSet parameters)
+      throws ReportDataFactoryException
+  {
+    try
+    {
+      final HashMap parameterCache = (HashMap) queryCache.get(query);
+      if (parameterCache == null)
+      {
+        // totally new query here.
+        final HashMap newParams = new HashMap();
+        queryCache.put(query, newParams);
+
+        final Parameters params = new Parameters(parameters);
+        final ReportData newData = backend.queryData(query, params);
+        newParams.put(params, newData);
+        newData.setCursorPosition(ReportData.BEFORE_FIRST_ROW);
+        return newData;
+      }
+      else
+      {
+        // Lookup the parameters ...
+        final Parameters params = new Parameters(parameters);
+        final ReportData data = (ReportData) parameterCache.get(params);
+        if (data != null)
+        {
+          data.setCursorPosition(ReportData.BEFORE_FIRST_ROW);
+          return data;
+        }
+
+        final ReportData newData = backend.queryData(query, params);
+        parameterCache.put(params, newData);
+        newData.setCursorPosition(ReportData.BEFORE_FIRST_ROW);
+        return newData;
+      }
+    }
+    catch (DataSourceException e)
+    {
+      e.printStackTrace();
+      throw new ReportDataFactoryException("Failed to query data", e);
+    }
+  }
+
+  /**
+   * Closes the report data factory and all report data instances that have been returned by this instance.
+   */
+  public void close()
+  {
+    final Iterator queries = queryCache.values().iterator();
+    while (queries.hasNext())
+    {
+      final HashMap map = (HashMap) queries.next();
+      final Iterator dataSets = map.values().iterator();
+      while (dataSets.hasNext())
+      {
+        final ReportData data = (ReportData) dataSets.next();
+        try
+        {
+          data.close();
+        }
+        catch (DataSourceException e)
+        {
+          // ignore, we'll finish up anyway ..
+        }
+      }
+    }
+    backend.close();
+  }
+
+  /**
+   * Derives a freshly initialized report data factory, which is independend of the original data factory. Opening or
+   * Closing one data factory must not affect the other factories.
+   *
+   * @return
+   */
+  public ReportDataFactory derive()
+  {
+    // If you see that exception, then you've probably tried to use that
+    // datafactory from outside of the report processing. You deserve the
+    // exception in that case ..
+    throw new UnsupportedOperationException
+        ("The CachingReportDataFactory cannot be derived.");
+  }
+}
diff --git a/source/org/jfree/report/data/DefaultDataFlags.java b/source/org/jfree/report/data/DefaultDataFlags.java
new file mode 100644
index 0000000..3b657fd
--- /dev/null
+++ b/source/org/jfree/report/data/DefaultDataFlags.java
@@ -0,0 +1,129 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultDataFlags.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import java.util.Date;
+
+import org.jfree.report.DataFlags;
+
+/**
+ * Creation-Date: 20.02.2006, 16:00:34
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultDataFlags implements DataFlags
+{
+  private Object value;
+  private boolean changed;
+  private String name;
+
+  public DefaultDataFlags(final String name,
+                          final Object value,
+                          final boolean changed)
+  {
+    this.value = value;
+    this.changed = changed;
+    this.name = name;
+  }
+
+  public boolean isNumeric()
+  {
+    return value instanceof Number;
+  }
+
+  public boolean isDate()
+  {
+    return value instanceof Date;
+  }
+
+  public boolean isNull()
+  {
+    return value == null;
+  }
+
+  public boolean isZero()
+  {
+    if (isNumeric() == false)
+    {
+      return false;
+    }
+    Number n = (Number) value;
+    return (n.floatValue() == 0);
+  }
+
+  public boolean isNegative()
+  {
+    if (isNumeric() == false)
+    {
+      return false;
+    }
+    Number n = (Number) value;
+    return (n.floatValue() < 0);
+  }
+
+  public boolean isPositive()
+  {
+    if (isNumeric() == false)
+    {
+      return false;
+    }
+    Number n = (Number) value;
+    return (n.floatValue() > 0);
+  }
+
+  public boolean isChanged()
+  {
+    return changed;
+  }
+
+  public Object getValue()
+  {
+    return value;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public String toString ()
+  {
+    StringBuffer b = new StringBuffer();
+    b.append("DefaultDataFlags={name=");
+    b.append(name);
+    b.append(", value=");
+    b.append(value);
+    b.append(", changed=");
+    b.append(changed);
+    b.append("}");
+    return b.toString();
+  }
+}
diff --git a/source/org/jfree/report/data/ExpressionDataRow.java b/source/org/jfree/report/data/ExpressionDataRow.java
new file mode 100644
index 0000000..f6170ae
--- /dev/null
+++ b/source/org/jfree/report/data/ExpressionDataRow.java
@@ -0,0 +1,354 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExpressionDataRow.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import java.util.HashMap;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.flow.ReportContext;
+
+/**
+ * A datarow for all expressions encountered in the report. This datarow is a
+ * stack-like structure, which allows easy adding and removing of expressions,
+ * even if these expressions have been cloned and or otherwisely modified.
+ *
+ * @author Thomas Morgner
+ */
+public final class ExpressionDataRow implements DataRow
+{
+  private ExpressionSlot[] expressions;
+  private int length;
+  private HashMap nameCache;
+  private GlobalMasterRow masterRow;
+  private ReportContext reportContext;
+
+  public ExpressionDataRow(final GlobalMasterRow masterRow,
+                           final ReportContext reportContext,
+                           int capacity)
+  {
+    this.masterRow = masterRow;
+    this.nameCache = new HashMap(capacity);
+    this.expressions = new ExpressionSlot[capacity];
+    this.reportContext = reportContext;
+  }
+
+  private ExpressionDataRow(final GlobalMasterRow masterRow,
+                            final ExpressionDataRow previousRow)
+      throws CloneNotSupportedException
+  {
+    this.reportContext = previousRow.reportContext;
+    this.masterRow = masterRow;
+    this.nameCache = (HashMap) previousRow.nameCache.clone();
+    this.expressions = new ExpressionSlot[previousRow.expressions.length];
+    this.length = previousRow.length;
+    for (int i = 0; i < length; i++)
+    {
+      final ExpressionSlot expression = previousRow.expressions[i];
+      if (expression == null)
+      {
+//        Log.debug("Error: Expression is null...");
+      }
+      else
+      {
+        expressions[i] = (ExpressionSlot) expression.clone();
+      }
+    }
+  }
+
+  private void ensureCapacity(int requestedSize)
+  {
+    final int capacity = this.expressions.length;
+    if (capacity > requestedSize)
+    {
+      return;
+    }
+    final int newSize = Math.max(capacity * 2, requestedSize + 10);
+
+    final ExpressionSlot[] newExpressions = new ExpressionSlot[newSize];
+
+    System.arraycopy(expressions, 0, newExpressions, 0, length);
+
+    this.expressions = newExpressions;
+  }
+
+  /**
+   * This adds the expression to the data-row and queries the expression for the
+   * first time.
+   *
+   * @param ex
+   * @param rd
+   * @throws DataSourceException
+   */
+  public synchronized void pushExpression(final ExpressionSlot expressionSlot)
+      throws DataSourceException
+  {
+    if (expressionSlot == null)
+    {
+      throw new NullPointerException();
+    }
+
+    ensureCapacity(length + 1);
+
+    this.expressions[length] = expressionSlot;
+    final String name = expressionSlot.getName();
+    if (name != null)
+    {
+      nameCache.put(name, expressionSlot);
+    }
+    length += 1;
+
+    expressionSlot.updateDataRow(masterRow.getGlobalView());
+    // A manual advance to initialize the function.
+    expressionSlot.advance();
+    if (name != null)
+    {
+      final Object value = expressionSlot.getValue();
+      final MasterDataRowChangeEvent chEvent = new MasterDataRowChangeEvent
+          (MasterDataRowChangeEvent.COLUMN_ADDED, name, value);
+      masterRow.dataRowChanged(chEvent);
+    }
+  }
+
+  public synchronized void pushExpressions(final ExpressionSlot[] expressionSlots)
+      throws DataSourceException
+  {
+    if (expressionSlots == null)
+    {
+      throw new NullPointerException();
+    }
+
+    ensureCapacity(length + expressionSlots.length);
+    for (int i = 0; i < expressionSlots.length; i++)
+    {
+      ExpressionSlot expression = expressionSlots[i];
+      if (expression == null)
+      {
+        continue;
+      }
+      pushExpression(expression);
+    }
+  }
+
+  public synchronized void popExpressions(final int counter) throws
+      DataSourceException
+  {
+    for (int i = 0; i < counter; i++)
+    {
+      popExpression();
+    }
+  }
+
+  public synchronized void popExpression() throws DataSourceException
+  {
+    if (length == 0)
+    {
+      return;
+    }
+    String originalName = expressions[length - 1].getName();
+    boolean preserve = expressions[length - 1].isPreserve();
+    this.expressions[length - 1] = null;
+    this.length -= 1;
+    if (originalName != null)
+    {
+      int otherIndex = -1;
+      for (int i = length - 1; i >= 0; i -= 1)
+      {
+        ExpressionSlot expression = expressions[i];
+        if (originalName.equals(expression.getName()))
+        {
+          otherIndex = i;
+          break;
+        }
+      }
+      if (otherIndex == -1)
+      {
+        nameCache.remove(originalName);
+      }
+      else
+      {
+        nameCache.put(originalName, expressions[otherIndex]);
+      }
+
+      if (preserve == false)
+      {
+        final MasterDataRowChangeEvent chEvent = new MasterDataRowChangeEvent
+            (MasterDataRowChangeEvent.COLUMN_REMOVED, originalName, null);
+        masterRow.dataRowChanged(chEvent);
+      }
+      // for preserved elements we do not send an remove-event.
+    }
+
+  }
+
+  /**
+   * Returns the value of the expressions or column in the tablemodel using the
+   * given column number as index. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(int col) throws DataSourceException
+  {
+    return expressions[col].getValue();
+  }
+
+  /**
+   * Returns the value of the function, expressions or column using its specific
+   * name. The given name is translated into a valid column number and the the
+   * column is queried. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(String col) throws DataSourceException
+  {
+    final ExpressionSlot es = (ExpressionSlot) nameCache.get(col);
+    if (es == null)
+    {
+      return null;
+    }
+
+    return es.getValue();
+  }
+
+  /**
+   * Returns the name of the column, expressions or function. For columns from
+   * the tablemodel, the tablemodels <code>getColumnName</code> method is
+   * called. For functions, expressions and report properties the assigned name
+   * is returned.
+   *
+   * @param col the item index.
+   * @return the name.
+   */
+  public String getColumnName(int col)
+  {
+    return expressions[col].getName();
+  }
+
+  /**
+   * Returns the number of columns, expressions and functions and marked
+   * ReportProperties in the report.
+   *
+   * @return the item count.
+   */
+  public int getColumnCount()
+  {
+    return length;
+  }
+
+  public DataFlags getFlags(String col)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  public DataFlags getFlags(int col)
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  /**
+   * Advances to the next row and attaches the given master row to the objects
+   * contained in that client data row.
+   *
+   * @param master
+   * @param deepTraversing only advance expressions that have been marked as
+   *                       deeply traversing
+   * @return
+   */
+  public ExpressionDataRow advance(final GlobalMasterRow master,
+                                   final boolean deepTraversing)
+      throws DataSourceException
+  {
+    try
+    {
+      final ExpressionDataRow edr = new ExpressionDataRow(master, this);
+
+      // It is defined, that new expressions get evaluated before any older
+      // expression.
+      for (int i = edr.length - 1; i >= 0; i--)
+      {
+        ExpressionSlot expressionSlot = edr.expressions[i];
+        expressionSlot.updateDataRow(master.getGlobalView());
+        if (deepTraversing == false ||
+            (deepTraversing && expressionSlot.isDeepTraversing()))
+        {
+          expressionSlot.advance();
+        }
+        // Query the value (once per advance) ..
+        final Object value = expressionSlot.getValue();
+        final String name = expressionSlot.getName();
+        if (name != null)
+        {
+          final MasterDataRowChangeEvent chEvent = new MasterDataRowChangeEvent
+              (MasterDataRowChangeEvent.COLUMN_UPDATED, name, value);
+          master.dataRowChanged(chEvent);
+        }
+      }
+      return edr;
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new DataSourceException("Cloning failed", e);
+    }
+  }
+
+  public ExpressionDataRow derive(final GlobalMasterRow master)
+      throws DataSourceException
+  {
+    try
+    {
+      return new ExpressionDataRow(master, this);
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new DataSourceException("Cloning failed", e);
+    }
+  }
+
+  public ExpressionSlot[] getSlots()
+  {
+    // to be totally safe from any tampering, we would have to do some sort of
+    // deep-copy here.
+    ExpressionSlot[] slots = new ExpressionSlot[length];
+    System.arraycopy(expressions, 0, slots, 0, length);
+    return slots;
+  }
+}
diff --git a/source/org/jfree/report/data/ExpressionSlot.java b/source/org/jfree/report/data/ExpressionSlot.java
new file mode 100644
index 0000000..01a00f5
--- /dev/null
+++ b/source/org/jfree/report/data/ExpressionSlot.java
@@ -0,0 +1,57 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExpressionSlot.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+
+/**
+ * Creation-Date: 25.11.2006, 15:18:42
+ *
+ * @author Thomas Morgner
+ */
+public interface ExpressionSlot extends Cloneable
+{
+  public Object getValue() throws DataSourceException;
+
+  public void advance() throws DataSourceException;
+
+  public void updateDataRow (DataRow dataRow);
+
+  public String getName();
+
+  public boolean isDeepTraversing();
+
+  public boolean isPreserve();
+
+  public Object clone() throws CloneNotSupportedException;
+}
diff --git a/source/org/jfree/report/data/FastGlobalView.java b/source/org/jfree/report/data/FastGlobalView.java
new file mode 100644
index 0000000..a123171
--- /dev/null
+++ b/source/org/jfree/report/data/FastGlobalView.java
@@ -0,0 +1,455 @@
+/**
+ * ===========================================
+ * JFreeReport : a free Java reporting library
+ * ===========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * FastGlobalView.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+package org.jfree.report.data;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Arrays;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.JFreeReportBoot;
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.util.IntegerCache;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * Creation-Date: 10.08.2007, 14:07:32
+ *
+ * @author Thomas Morgner
+ */
+public final class FastGlobalView implements DataRow
+{
+
+    private static final boolean DEBUG = false;
+    private HashSet duplicateColumns;
+    private HashSet invalidColumns;
+    private boolean modifiableNameCache;
+    private HashMap nameCache;
+    private String[] columnNames;
+    private DataFlags[] columnValue;
+    private DataFlags[] columnOldValue;
+    private boolean[] columnChanged;
+    private int[] columnPrev;
+    private int length;
+    private boolean warnInvalidColumns;
+
+    public FastGlobalView(final FastGlobalView parent)
+    {
+        if (parent.modifiableNameCache)
+        {
+            this.duplicateColumns = (HashSet) parent.duplicateColumns.clone();
+            this.nameCache = (HashMap) parent.nameCache.clone();
+            this.modifiableNameCache = false;
+            this.columnNames = (String[]) parent.columnNames.clone();
+        }
+        else
+        {
+            this.duplicateColumns = parent.duplicateColumns;
+            this.nameCache = parent.nameCache;
+            this.columnNames = parent.columnNames;
+            this.modifiableNameCache = false;
+        }
+        this.columnChanged = parent.columnChanged.clone();
+        this.columnValue = parent.columnValue.clone();
+        this.columnOldValue = parent.columnOldValue.clone();
+        this.columnPrev = parent.columnPrev.clone();
+        this.length = parent.length;
+        this.warnInvalidColumns = parent.warnInvalidColumns;
+        this.invalidColumns = parent.invalidColumns;
+    }
+
+    public FastGlobalView()
+    {
+        this.warnInvalidColumns = "true".equals(JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty("org.jfree.report.WarnInvalidColumns"));
+        if (warnInvalidColumns)
+        {
+            this.invalidColumns = new HashSet();
+        }
+
+        this.duplicateColumns = new HashSet();
+        this.nameCache = new HashMap();
+        this.modifiableNameCache = true;
+        this.columnChanged = new boolean[20];
+        this.columnNames = new String[20];
+        this.columnValue = new DataFlags[20];
+        this.columnOldValue = new DataFlags[20];
+        this.columnPrev = new int[20];
+    }
+
+    public Object get(final int col) throws DataSourceException
+    {
+        final DataFlags flag = getFlags(col);
+        if (flag == null)
+        {
+            return null;
+        }
+        return flag.getValue();
+    }
+
+    public Object get(final String col) throws DataSourceException
+    {
+        final DataFlags flag = getFlags(col);
+        if (flag == null)
+        {
+            return null;
+        }
+        return flag.getValue();
+    }
+
+    public String getColumnName(final int col)
+    {
+        if (col < 0 || col >= length)
+        {
+            throw new IndexOutOfBoundsException("Column-Index " + col + " is invalid.");
+        }
+        return columnNames[col];
+    }
+
+    public int findColumn(final String name)
+    {
+        final Integer o = (Integer) nameCache.get(name);
+        if (o == null)
+        {
+            return -1;
+        }
+        return o.intValue();
+    }
+
+    public int getColumnCount()
+    {
+        return length;
+    }
+
+    public FastGlobalView derive()
+    {
+        return new FastGlobalView(this);
+    }
+
+    public FastGlobalView advance()
+    {
+        final FastGlobalView advanced = new FastGlobalView(this);
+        System.arraycopy(advanced.columnValue, 0, advanced.columnOldValue, 0, length);
+        Arrays.fill(advanced.columnChanged, false);
+        return advanced;
+    }
+
+    public void removeColumn(final String name)
+    {
+        final boolean needToRebuildCache;
+        int idx = -1;
+        if (duplicateColumns.contains(name))
+        {
+            needToRebuildCache = true;
+            // linear index search from the end ..
+            for (int i = length - 1; i >= 0; i -= 1)
+            {
+                if (ObjectUtilities.equal(name, columnNames[i]))
+                {
+                    idx = i;
+                    break;
+                }
+            }
+            if (idx < 0)
+            {
+                return;
+            }
+        }
+        else
+        {
+            needToRebuildCache = false;
+            final Integer o = (Integer) nameCache.get(name);
+            if (o == null)
+            {
+                return;
+            }
+            idx = o.intValue();
+        }
+
+        if (DEBUG)
+        {
+            DebugLog.log("Removing column " + name + " (Length: " + length + " NameCache: " +
+                    nameCache.size() + ", Idx: " + idx);
+        }
+
+        if (modifiableNameCache == false)
+        {
+            this.duplicateColumns = (HashSet) duplicateColumns.clone();
+            this.columnNames = (String[]) columnNames.clone();
+            this.nameCache = (HashMap) nameCache.clone();
+            this.modifiableNameCache = true;
+        }
+
+        if (idx == (length - 1))
+        {
+            columnChanged[idx] = false;
+            columnNames[idx] = null;
+            columnValue[idx] = null;
+            if (columnPrev[idx] == -1)
+            {
+                nameCache.remove(name);
+            }
+            else
+            {
+                nameCache.put(name, IntegerCache.getInteger(columnPrev[idx]));
+            }
+            // thats the easy case ..
+            length -= 1;
+            if (needToRebuildCache)
+            {
+                if (columnPrev[idx] == -1)
+                {
+                    DebugLog.log("Column marked as duplicate but no duplicate index recorded: " + name);
+                }
+                else
+                {
+                    if (columnPrev[columnPrev[idx]] == -1)
+                    {
+                        duplicateColumns.remove(name);
+                    }
+                }
+            }
+            return;
+        }
+
+        if (DEBUG)
+        {
+            DebugLog.log("Out of order removeal of a column: " + name);
+        }
+
+        if (columnPrev[idx] == -1)
+        {
+            nameCache.remove(name);
+        }
+        else
+        {
+            nameCache.put(name, IntegerCache.getInteger(columnPrev[idx]));
+        }
+
+        final int moveStartIdx = idx + 1;
+        final int moveLength = length - moveStartIdx;
+        System.arraycopy(columnNames, moveStartIdx, columnNames, idx, moveLength);
+        System.arraycopy(columnChanged, moveStartIdx, columnChanged, idx, moveLength);
+        System.arraycopy(columnOldValue, moveStartIdx, columnOldValue, idx, moveLength);
+        System.arraycopy(columnValue, moveStartIdx, columnValue, idx, moveLength);
+        System.arraycopy(columnPrev, moveStartIdx, columnPrev, idx, moveLength);
+        columnNames[length - 1] = null;
+        columnChanged[length - 1] = false;
+        columnOldValue[length - 1] = null;
+        columnPrev[length - 1] = 0;
+
+        // Now it gets expensive: Rebuild the namecache ..
+        final int newLength = moveLength + idx;
+        nameCache.clear();
+        duplicateColumns.clear();
+        for (int i = 0; i < newLength; i++)
+        {
+            final String columnName = columnNames[i];
+            final Integer oldVal = (Integer) nameCache.get(columnName);
+            if (nameCache.containsKey(columnName))
+            {
+                duplicateColumns.add(columnName);
+            }
+
+            nameCache.put(columnName, IntegerCache.getInteger(i));
+            if (oldVal != null)
+            {
+                columnPrev[i] = oldVal.intValue();
+            }
+            else
+            {
+                columnPrev[i] = -1;
+            }
+        }
+        length -= 1;
+        if (DEBUG)
+        {
+            DebugLog.log("New Namecache: " + nameCache);
+        }
+    }
+
+    public void putField(final String name,
+            final Object value,
+            final boolean update)
+    {
+        if (DEBUG)
+        {
+            if (update)
+            {
+                DebugLog.log("  +   : " + name);
+            }
+            else
+            {
+                DebugLog.log("Adding: " + name);
+            }
+        }
+
+        if (update == false)
+        {
+            if (modifiableNameCache == false)
+            {
+                this.columnNames = (String[]) columnNames.clone();
+                this.nameCache = (HashMap) nameCache.clone();
+                this.modifiableNameCache = true;
+            }
+
+            final DefaultDataFlags flagedValue = new DefaultDataFlags(name, value, true);
+
+            // A new column ...
+            ensureCapacity(length + 1);
+            columnNames[length] = name;
+            columnValue[length] = flagedValue;
+            final Integer o = (Integer) nameCache.get(name);
+            if (o == null)
+            {
+                columnPrev[length] = -1;
+            }
+            else
+            {
+                columnPrev[length] = o.intValue();
+                duplicateColumns.add(name);
+            }
+            columnChanged[length] = true;
+            columnOldValue[length] = null;
+            nameCache.put(name, IntegerCache.getInteger(length));
+            length += 1;
+        }
+        else
+        {
+            try
+            {
+                // Updating an existing column ...
+                final Integer o = (Integer) nameCache.get(name);
+                if (o == null)
+                {
+                    throw new IllegalStateException("Update to a non-existing column: " + name);
+                }
+                int idx = -1;
+                if (duplicateColumns.contains(name))
+                {
+                    for (int i = 0; i < length; i += 1)
+                    {
+                        if (columnChanged[i] == false && ObjectUtilities.equal(name, columnNames[i]))
+                        {
+                            idx = i;
+                            break;
+                        }
+                    }
+                    if (idx < 0)
+                    {
+                        idx = o.intValue();
+                    }
+                }
+                else
+                {
+                    idx = o.intValue();
+                }
+                final boolean changed = !ObjectUtilities.equal(value, columnValue[idx].getValue());
+                final DefaultDataFlags flagedValue = new DefaultDataFlags(name, value, changed);
+                columnNames[idx] = name;
+                columnOldValue[idx] = columnValue[idx];
+                columnValue[idx] = flagedValue;
+                columnChanged[idx] = changed;
+            }
+            catch (DataSourceException ex)
+            {
+                ex.printStackTrace();
+            }
+        }
+    }
+
+    private void ensureCapacity(final int requestedSize)
+    {
+        final int capacity = this.columnNames.length;
+        if (capacity > requestedSize)
+        {
+            return;
+        }
+        final int newSize = Math.max(capacity << 1, requestedSize + 10);
+
+        final String[] newColumnNames = new String[newSize];
+        System.arraycopy(columnNames, 0, newColumnNames, 0, length);
+        this.columnNames = newColumnNames;
+
+        final boolean[] newColumnChanged = new boolean[newSize];
+        System.arraycopy(columnChanged, 0, newColumnChanged, 0, length);
+        this.columnChanged = newColumnChanged;
+
+        final int[] newColumnPrev = new int[newSize];
+        System.arraycopy(columnPrev, 0, newColumnPrev, 0, length);
+        this.columnPrev = newColumnPrev;
+
+        final DataFlags[] newColumnValue = new DataFlags[newSize];
+        System.arraycopy(columnValue, 0, newColumnValue, 0, length);
+        this.columnValue = newColumnValue;
+
+        final DataFlags[] newOldColumnValue = new DataFlags[newSize];
+        System.arraycopy(columnOldValue, 0, newOldColumnValue, 0, length);
+        this.columnOldValue = newOldColumnValue;
+    }
+
+    public DataFlags getFlags(final String col) throws DataSourceException
+    {
+        final int idx = findColumn(col);
+        if (idx == -1)
+        {
+            return null;
+        }
+        return getFlags(idx);
+    }
+
+    public DataFlags getFlags(final int col) throws DataSourceException
+    {
+        if (col < 0 || col >= length)
+        {
+            throw new IndexOutOfBoundsException("Column-Index " + col + " is invalid.");
+        }
+
+        if (columnChanged[col] != false)
+        {
+            return columnValue[col];
+        }
+
+        final String columnName = columnNames[col];
+        if (duplicateColumns.contains(columnName))
+        {
+            for (int i = col - 1; i >= 0; i--)
+            {
+                if (columnNames[i].equals(columnName) && columnChanged[i] == true)
+                {
+                    return columnValue[i];
+                }
+            }
+        }
+
+        return columnValue[col];
+    }
+}
diff --git a/source/org/jfree/report/data/GlobalMasterRow.java b/source/org/jfree/report/data/GlobalMasterRow.java
new file mode 100644
index 0000000..7c42a7a
--- /dev/null
+++ b/source/org/jfree/report/data/GlobalMasterRow.java
@@ -0,0 +1,375 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GlobalMasterRow.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.flow.ReportContext;
+
+/**
+ * This data row holds all statefull information from the datasources of the
+ * report.
+ * <p/>
+ * When doing subreports, a datarow only has access to its own dataset and the
+ * columns from the next direct subreport, which have been marked as exported.
+ *
+ * @author Thomas Morgner
+ */
+public final class GlobalMasterRow
+{
+  // private StaticDataRow previousRow;
+  private ReportDataRow reportDataRow;
+  private ParameterDataRow parameterDataRow;
+  private ExpressionDataRow expressionDataRow;
+  private GlobalMasterRow parentDataRow;
+  private FastGlobalView globalView;
+  private ImportedVariablesDataRow importedDataRow;
+
+  private GlobalMasterRow()
+  {
+  }
+
+  public static GlobalMasterRow createReportRow(final ReportContext reportContext)
+  {
+    GlobalMasterRow gmr = new GlobalMasterRow();
+    gmr.globalView = new FastGlobalView();
+    gmr.expressionDataRow = new ExpressionDataRow(gmr, reportContext, 10);
+    return gmr;
+  }
+
+  public static GlobalMasterRow createReportRow(final GlobalMasterRow parentRow,
+                                                final ReportContext reportContext)
+  {
+    GlobalMasterRow gmr = createReportRow(reportContext);
+    gmr.parentDataRow = parentRow;
+    return gmr;
+  }
+
+  public ExpressionDataRow getExpressionDataRow()
+  {
+    return expressionDataRow;
+  }
+
+  public ReportDataRow getReportDataRow()
+  {
+    return reportDataRow;
+  }
+
+  public void setReportDataRow(final ReportDataRow reportDataRow)
+          throws DataSourceException
+  {
+    if (this.reportDataRow != null)
+    {
+      final int dataColCount = this.reportDataRow.getColumnCount();
+      for (int i = dataColCount - 1; i >= 0; i--)
+      {
+        final String columnName = this.reportDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          globalView.removeColumn(columnName);
+        }
+      }
+    }
+
+    this.reportDataRow = reportDataRow;
+
+    if (reportDataRow != null)
+    {
+      final boolean readable = reportDataRow.getReportData().isReadable();
+      final int dataColCount = reportDataRow.getColumnCount();
+      for (int i = 0; i < dataColCount; i++)
+      {
+        final String columnName = reportDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          if (readable)
+          {
+            final Object columnValue = reportDataRow.get(i);
+            globalView.putField(columnName, columnValue, false);
+          }
+          else
+          {
+            globalView.putField(columnName, null, false);
+          }
+        }
+      }
+    }
+  }
+
+  public ParameterDataRow getParameterDataRow()
+  {
+    return parameterDataRow;
+  }
+
+  public void setParameterDataRow(final ParameterDataRow parameterDataRow)
+          throws DataSourceException
+  {
+    if (this.parameterDataRow != null)
+    {
+      final int parameterCount = this.parameterDataRow.getColumnCount();
+      for (int i = parameterCount - 1; i >= 0; i--)
+      {
+        final String columnName = this.parameterDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          globalView.removeColumn(columnName);
+        }
+      }
+    }
+
+    this.parameterDataRow = parameterDataRow;
+
+    if (parameterDataRow != null)
+    {
+      final int parameterCount = parameterDataRow.getColumnCount();
+      for (int i = 0; i < parameterCount; i++)
+      {
+        final String columnName = parameterDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          final Object columnValue = parameterDataRow.get(i);
+          globalView.putField(columnName, columnValue, false);
+        }
+      }
+    }
+  }
+
+  public GlobalMasterRow getParentDataRow()
+  {
+    return parentDataRow;
+  }
+
+  public ImportedVariablesDataRow getImportedDataRow()
+  {
+    return importedDataRow;
+  }
+
+  public void setExportedDataRow(final ImportedVariablesDataRow importedDataRow)
+          throws DataSourceException
+  {
+    if (importedDataRow != null)
+    {
+      final int parameterCount = importedDataRow.getColumnCount();
+      for (int i = parameterCount - 1; i >= 0; i--)
+      {
+        final String columnName = importedDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          globalView.removeColumn(columnName);
+        }
+      }
+    }
+
+    this.importedDataRow = importedDataRow;
+    if (importedDataRow != null)
+    {
+      final int parameterCount = importedDataRow.getColumnCount();
+      for (int i = 0; i < parameterCount; i++)
+      {
+        final String columnName = importedDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          final Object columnValue = importedDataRow.get(i);
+          globalView.putField(columnName, columnValue, false);
+        }
+      }
+    }
+  }
+
+  /**
+   * Derives an instance of this datarow. That copy is completly disconnected
+   * from the original one and no change made to that copy affects the original
+   * datarow.
+   *
+   * @return the derived datarow.
+   */
+  public GlobalMasterRow derive() throws DataSourceException
+  {
+    return derive(null);
+  }
+
+  private GlobalMasterRow derive(GlobalMasterRow subReportRow)
+          throws DataSourceException
+  {
+    final GlobalMasterRow dataRow = new GlobalMasterRow();
+    dataRow.parameterDataRow = parameterDataRow;
+    dataRow.reportDataRow = reportDataRow;
+    dataRow.expressionDataRow = expressionDataRow.derive(dataRow);
+    dataRow.globalView = globalView.derive();
+    if (parentDataRow != null)
+    {
+      dataRow.parentDataRow = parentDataRow.derive(subReportRow);
+    }
+    dataRow.importedDataRow = importedDataRow;
+    return dataRow;
+  }
+
+  /**
+   * This advances the cursor by one row and updates the flags.
+   *
+   * @return
+   * @throws DataSourceException
+   */
+  public GlobalMasterRow advance() throws DataSourceException
+  {
+    return advance(false, null);
+  }
+
+  private GlobalMasterRow advance(final boolean deepTraversingOnly,
+                                    final GlobalMasterRow subReportRow)
+          throws DataSourceException
+  {
+    GlobalMasterRow dataRow = new GlobalMasterRow();
+    dataRow.globalView = globalView.advance();
+    dataRow.parameterDataRow = parameterDataRow;
+
+    if (deepTraversingOnly == false && reportDataRow != null)
+    {
+      dataRow.reportDataRow = reportDataRow.advance();
+    }
+    else
+    {
+      dataRow.reportDataRow = reportDataRow;
+    }
+    dataRow.updateGlobalView();
+    if (expressionDataRow != null)
+    {
+      dataRow.expressionDataRow =
+              expressionDataRow.advance(dataRow, deepTraversingOnly);
+    }
+    if (parentDataRow != null)
+    {
+      // the parent row should get a grip on our data as well - just for the
+      // deep traversing fun and so on ..
+      dataRow.parentDataRow = parentDataRow.advance(true, dataRow);
+    }
+    if (importedDataRow != null)
+    {
+      if (subReportRow == null)
+      {
+        throw new NullPointerException();
+      }
+      dataRow.importedDataRow = importedDataRow.advance(subReportRow);
+      dataRow.updateImportedParameterView();
+    }
+    return dataRow;
+  }
+
+  private void updateImportedParameterView() throws DataSourceException
+  {
+    if (importedDataRow == null)
+    {
+      return;
+    }
+
+    final int parameterCount = importedDataRow.getColumnCount();
+    for (int i = 0; i < parameterCount; i++)
+    {
+      final String columnName = importedDataRow.getColumnName(i);
+      if (columnName != null)
+      {
+        final Object columnValue = importedDataRow.get(i);
+        globalView.putField(columnName, columnValue, true);
+      }
+    }
+  }
+
+  /** This updates the global view. */
+  private void updateGlobalView() throws DataSourceException
+  {
+    if (parameterDataRow != null)
+    {
+      final int parameterCount = parameterDataRow.getColumnCount();
+      for (int i = 0; i < parameterCount; i++)
+      {
+        final String columnName = parameterDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          final Object columnValue = parameterDataRow.get(i);
+          globalView.putField(columnName, columnValue, true);
+        }
+      }
+    }
+    if (reportDataRow != null)
+    {
+      final int dataColCount = reportDataRow.getColumnCount();
+      for (int i = 0; i < dataColCount; i++)
+      {
+        final String columnName = reportDataRow.getColumnName(i);
+        if (columnName != null)
+        {
+          final Object columnValue = reportDataRow.get(i);
+          globalView.putField(columnName, columnValue, true);
+        }
+      }
+    }
+  }
+
+  public boolean isAdvanceable() throws DataSourceException
+  {
+    if (reportDataRow == null)
+    {
+      return false;
+    }
+    return reportDataRow.isAdvanceable();
+  }
+
+  public DataRow getGlobalView()
+  {
+    return globalView;
+  }
+
+  /**
+   * A call back method to communicate structural changes back to the master
+   * rows. (This is only called from the expression row, as all other datarows
+   * are static).
+   *
+   * @param chEvent
+   */
+  public void dataRowChanged(final MasterDataRowChangeEvent chEvent)
+          throws DataSourceException
+  {
+    // rebuild the global view and tracks changes ..
+    final int type = chEvent.getType();
+    if (type == MasterDataRowChangeEvent.COLUMN_ADDED)
+    {
+      globalView.putField(chEvent.getColumnName(), chEvent.getColumnValue(), false);
+    }
+    else if (type == MasterDataRowChangeEvent.COLUMN_UPDATED)
+    {
+      globalView.putField(chEvent.getColumnName(), chEvent.getColumnValue(), true);
+    }
+    else if (type == MasterDataRowChangeEvent.COLUMN_REMOVED)
+    {
+      globalView.removeColumn(chEvent.getColumnName());
+    }
+  }
+}
diff --git a/source/org/jfree/report/data/GlobalView.java b/source/org/jfree/report/data/GlobalView.java
new file mode 100644
index 0000000..85ae81b
--- /dev/null
+++ b/source/org/jfree/report/data/GlobalView.java
@@ -0,0 +1,314 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GlobalView.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.util.LazyNameMap;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * The global view holds all *named* data columns. Expressions which have no
+ * name will not appear here. There is a slot for each name - if expressions
+ * share the same name, the last name wins.
+ * <p/>
+ * This acts as some kind of global variables heap - which allows named
+ * functions to export their values to a global space.
+ * <p/>
+ * This datarow is optimized for named access - the sequential access is only
+ * generated when absolutly needed.
+ *
+ * @author Thomas Morgner
+ */
+public final class GlobalView implements DataRow
+{
+  private DataFlags[] oldData;
+  private LazyNameMap oldCache;
+  private DataFlags[] data;
+  private LazyNameMap nameCache;
+  private int length;
+
+  private GlobalView()
+  {
+  }
+
+  public static GlobalView createView()
+  {
+    GlobalView gv = new GlobalView();
+    gv.nameCache = new LazyNameMap();
+    gv.oldCache = new LazyNameMap();
+    gv.data = new DataFlags[10];
+    gv.oldData = new DataFlags[0];
+    return gv;
+  }
+
+
+  private void ensureCapacity(int requestedSize)
+  {
+    final int capacity = this.data.length;
+    if (capacity > requestedSize)
+    {
+      return;
+    }
+    final int newSize = Math.max(capacity * 2, requestedSize + 10);
+
+    final DataFlags[] newData = new DataFlags[newSize];
+    System.arraycopy(data, 0, newData, 0, length);
+
+    this.data = newData;
+  }
+
+  /**
+   * This adds the expression to the data-row and queries the expression for the
+   * first time.
+   *
+   * @param name  the name of the field (cannot be null)
+   * @param value the value of that field (may be null)
+   * @throws DataSourceException
+   */
+  public synchronized void putField(final String name,
+                                    final Object value,
+                                    final boolean update)
+      throws DataSourceException
+  {
+    if (name == null)
+    {
+      throw new NullPointerException("Name must not be null.");
+    }
+
+    final LazyNameMap.NameCarrier nc = nameCache.get(name);
+    final DefaultDataFlags flagedValue = new DefaultDataFlags
+        (name, value, computeChange(name, value));
+    if (nc != null)
+    {
+      this.data[nc.getValue()] = flagedValue;
+      if (update == false)
+      {
+        nc.increase();
+      }
+      return;
+    }
+
+    // oh fine, a new one ...
+    // step 1: Search for a free slot
+    for (int i = 0; i < length; i++)
+    {
+      DataFlags dataFlags = data[i];
+      if (dataFlags == null)
+      {
+        data[i] = flagedValue;
+        nameCache.setValue(name, i);
+        return;
+      }
+    }
+
+    // step 2: No Free Slot, so add
+    ensureCapacity(length + 1);
+    data[length] = flagedValue;
+    nameCache.setValue(name, length);
+    this.length += 1;
+  }
+
+  private boolean computeChange(String name, Object newValue)
+      throws DataSourceException
+  {
+    final LazyNameMap.NameCarrier onc = oldCache.get(name);
+    if (onc == null)
+    {
+      // A new data item, not known before ...
+      return true;
+    }
+
+    final DataFlags dataFlags = oldData[onc.getValue()];
+    if (dataFlags == null)
+    {
+      return true;
+    }
+    return ObjectUtilities.equal(dataFlags.getValue(), newValue) == false;
+  }
+
+  /**
+   * Returns the value of the expression or column in the tablemodel using the
+   * given column number as index. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(int col) throws DataSourceException
+  {
+    final DataFlags flag = getFlags(col);
+    if (flag == null)
+    {
+      return null;
+    }
+    return flag.getValue();
+  }
+
+  /**
+   * Returns the value of the function, expression or column using its specific
+   * name. The given name is translated into a valid column number and the the
+   * column is queried. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(String col) throws DataSourceException
+  {
+    final DataFlags flag = getFlags(col);
+    if (flag == null)
+    {
+      return null;
+    }
+    return flag.getValue();
+  }
+
+  /**
+   * Returns the name of the column, expression or function. For columns from
+   * the tablemodel, the tablemodels <code>getColumnName</code> method is
+   * called. For functions, expressions and report properties the assigned name
+   * is returned.
+   *
+   * @param col the item index.
+   * @return the name.
+   */
+  public String getColumnName(int col)
+  {
+    final DataFlags flag = getFlags(col);
+    if (flag == null)
+    {
+      return null;
+    }
+    return flag.getName();
+  }
+
+  /**
+   * Returns the number of columns, expressions and functions and marked
+   * ReportProperties in the report.
+   *
+   * @return the item count.
+   */
+  public int getColumnCount()
+  {
+    return length;
+  }
+
+  public DataFlags getFlags(String col)
+  {
+    final LazyNameMap.NameCarrier idx = nameCache.get(col);
+    if (idx != null)
+    {
+      final int idxVal = idx.getValue();
+      final DataFlags df = data[idxVal];
+      if (df != null)
+      {
+        return df;
+      }
+    }
+
+    final LazyNameMap.NameCarrier oidx = oldCache.get(col);
+    if (oidx == null)
+    {
+      return null;
+    }
+
+    final int oidxVal = oidx.getValue();
+    if (oidxVal < oldData.length)
+    {
+      return oldData[oidxVal];
+    }
+    return null;
+  }
+
+  public DataFlags getFlags(int col)
+  {
+    final DataFlags df = data[col];
+    if (df != null)
+    {
+      return df;
+    }
+    return oldData[col];
+  }
+
+  public GlobalView derive()
+  {
+    GlobalView gv = new GlobalView();
+    gv.oldCache = (LazyNameMap) oldCache.clone();
+    gv.data = (DataFlags[]) data.clone();
+    gv.oldData = (DataFlags[]) oldData.clone();
+    gv.length = length;
+    gv.nameCache = (LazyNameMap) nameCache.clone();
+    return gv;
+  }
+
+  public GlobalView advance()
+  {
+    GlobalView gv = new GlobalView();
+    gv.oldCache = (LazyNameMap) nameCache.clone();
+    gv.oldData = (DataFlags[]) data.clone();
+    gv.data = new DataFlags[gv.oldData.length];
+    gv.length = length;
+    gv.nameCache = new LazyNameMap();
+    return gv;
+  }
+
+  /**
+   * Note: Dont remove the column. It will stay around here as long as the
+   * process lives.
+   *
+   * @param name
+   */
+  public synchronized void removeColumn(String name)
+  {
+    final LazyNameMap.NameCarrier idx = nameCache.get(name);
+    if (idx == null)
+    {
+      return;
+    }
+    idx.decrease();
+    if (idx.getInstanceCount() < 1)
+    {
+      nameCache.remove(name);
+      data[idx.getValue()] = null;
+
+      // todo: In a sane world, we would now start to reindex the whole thing.
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/data/ImportedVariablesDataRow.java b/source/org/jfree/report/data/ImportedVariablesDataRow.java
new file mode 100644
index 0000000..b00ff09
--- /dev/null
+++ b/source/org/jfree/report/data/ImportedVariablesDataRow.java
@@ -0,0 +1,111 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ImportedVariablesDataRow.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.flow.ParameterMapping;
+
+/**
+ * Creation-Date: 06.03.2006, 18:15:06
+ *
+ * @author Thomas Morgner
+ */
+public class ImportedVariablesDataRow extends StaticDataRow
+{
+  private String[] outerNames;
+  private String[] innerNames;
+
+  public ImportedVariablesDataRow(final GlobalMasterRow innerRow)
+          throws DataSourceException
+  {
+    final DataRow globalView = innerRow.getGlobalView();
+    final int cols = globalView.getColumnCount();
+    this.outerNames = new String[cols];
+    this.innerNames = outerNames;
+    final Object[] values = new Object[outerNames.length];
+    for (int i = 0; i < outerNames.length; i++)
+    {
+      outerNames[i] = globalView.getColumnName(i);
+      values[i] = globalView.get(i);
+    }
+    setData(outerNames, values);
+  }
+
+  /**
+   * Maps the inner-row into the outer data row. The parameter mapping's name
+   * represents the *outer* name and the innernames.
+   *
+   * @param innerRow
+   * @param parameterMappings
+   * @throws DataSourceException
+   */
+  public ImportedVariablesDataRow(final GlobalMasterRow innerRow,
+                                  final ParameterMapping[] parameterMappings)
+          throws DataSourceException
+  {
+    this.outerNames = new String[parameterMappings.length];
+    this.innerNames = new String[parameterMappings.length];
+    final Object[] values = new Object[parameterMappings.length];
+    final DataRow globalView = innerRow.getGlobalView();
+    for (int i = 0; i < parameterMappings.length; i++)
+    {
+      final ParameterMapping mapping = parameterMappings[i];
+      String name = mapping.getAlias();
+      values[i] = globalView.get(name);
+      innerNames[i] = name;
+      outerNames[i] = mapping.getName();
+    }
+    setData(outerNames, values);
+  }
+
+  protected ImportedVariablesDataRow(final ImportedVariablesDataRow dataRow)
+  {
+    super(dataRow);
+    outerNames = dataRow.outerNames;
+    innerNames = dataRow.innerNames;
+  }
+
+  public ImportedVariablesDataRow advance (final GlobalMasterRow innerRow)
+          throws DataSourceException
+  {
+    final DataRow globalView = innerRow.getGlobalView();
+    final Object[] values = new Object[outerNames.length];
+    for (int i = 0; i < innerNames.length; i++)
+    {
+      String name = innerNames[i];
+      values[i] = globalView.get(name);
+    }
+    ImportedVariablesDataRow idr = new ImportedVariablesDataRow(this);
+    idr.setData(outerNames, values);
+    return idr;
+  }
+}
diff --git a/source/org/jfree/report/data/MasterDataRowChangeEvent.java b/source/org/jfree/report/data/MasterDataRowChangeEvent.java
new file mode 100644
index 0000000..5d397b9
--- /dev/null
+++ b/source/org/jfree/report/data/MasterDataRowChangeEvent.java
@@ -0,0 +1,71 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: MasterDataRowChangeEvent.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+/**
+ * Creation-Date: 03.03.2006, 15:34:53
+ *
+ * @author Thomas Morgner
+ */
+public class MasterDataRowChangeEvent
+{
+  public static final int COLUMN_ADDED = 1;
+  public static final int COLUMN_REMOVED = 2;
+  public static final int COLUMN_UPDATED = 3;
+
+  private int type;
+  private String columnName;
+  private Object columnValue;
+
+  public MasterDataRowChangeEvent(final int type,
+                                  final String columnName,
+                                  final Object columnValue)
+  {
+    this.type = type;
+    this.columnName = columnName;
+    this.columnValue = columnValue;
+  }
+
+  public String getColumnName()
+  {
+    return columnName;
+  }
+
+  public Object getColumnValue()
+  {
+    return columnValue;
+  }
+
+  public int getType()
+  {
+    return type;
+  }
+}
diff --git a/source/org/jfree/report/data/ParameterDataRow.java b/source/org/jfree/report/data/ParameterDataRow.java
new file mode 100644
index 0000000..0df9f1a
--- /dev/null
+++ b/source/org/jfree/report/data/ParameterDataRow.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ParameterDataRow.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.flow.ParameterMapping;
+import org.jfree.report.util.ReportParameters;
+
+/**
+ * This is the first datarow in each report. It holds the values of all declared
+ * input parameters. This datarow does not advance and does not keep track of
+ * any changes, as parameters are considered read-only once the reporting has
+ * started.
+ *
+ * @author Thomas Morgner
+ */
+public class ParameterDataRow extends StaticDataRow
+{
+  public ParameterDataRow(final ReportParameters parameters)
+  {
+    final String[] names = parameters.keys();
+    final Object[] values = new Object[parameters.size()];
+
+    for (int i = 0; i < names.length; i++)
+    {
+      final String key = names[i];
+      values[i] = parameters.get(key);
+    }
+    setData(names, values);
+  }
+
+  public ParameterDataRow(final ParameterMapping[] parameters, final DataRow dataRow)
+          throws DataSourceException
+  {
+    final String[] innerNames = new String[parameters.length];
+    final Object[] values = new Object[parameters.length];
+    for (int i = 0; i < parameters.length; i++)
+    {
+      final ParameterMapping parameter = parameters[i];
+      final String name = parameter.getName();
+      innerNames[i] = parameter.getAlias();
+      values[i] = dataRow.get(name);
+    }
+    setData(innerNames, values);
+  }
+}
diff --git a/source/org/jfree/report/data/PrecomputeNode.java b/source/org/jfree/report/data/PrecomputeNode.java
new file mode 100644
index 0000000..217a07e
--- /dev/null
+++ b/source/org/jfree/report/data/PrecomputeNode.java
@@ -0,0 +1,48 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrecomputeNode.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+/**
+ * Creation-Date: 24.11.2006, 13:51:02
+ *
+ * @author Thomas Morgner
+ */
+public interface PrecomputeNode
+{
+  public int getFunctionCount();
+
+  public String getFunctionName(int idx);
+
+  public Object getFunctionResult(int idx);
+
+  public PrecomputeNodeKey getKey();
+}
diff --git a/source/org/jfree/report/data/PrecomputeNodeImpl.java b/source/org/jfree/report/data/PrecomputeNodeImpl.java
new file mode 100644
index 0000000..67fdb24
--- /dev/null
+++ b/source/org/jfree/report/data/PrecomputeNodeImpl.java
@@ -0,0 +1,180 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrecomputeNodeImpl.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+import java.util.ArrayList;
+
+/**
+ * A precompute-node represents a resolved element or section of the report definition. Unlike the structural nodes,
+ * these nodes can always have childs.
+ * <p/>
+ * The resulting tree gets pruned as early as possible - nodes which do not contain precomputed or preserved expressions
+ * will not be stored.
+ *
+ * @author Thomas Morgner
+ */
+public class PrecomputeNodeImpl implements PrecomputeNode
+{
+  private PrecomputeNodeImpl parent;
+  private PrecomputeNodeImpl next;
+  private PrecomputeNodeImpl firstChild;
+  private PrecomputeNodeImpl lastChild;
+
+  private PrecomputeNodeKey key;
+  private ArrayList functionResults;
+  private ArrayList functionNames;
+
+  public PrecomputeNodeImpl(PrecomputeNodeKey key)
+  {
+    if (key == null)
+    {
+      throw new NullPointerException();
+    }
+    this.key = key;
+  }
+
+  public PrecomputeNodeKey getKey()
+  {
+    return key;
+  }
+
+  public PrecomputeNode getParent()
+  {
+    return parent;
+  }
+
+  protected void setParent(final PrecomputeNodeImpl parent)
+  {
+    this.parent = parent;
+  }
+
+  public PrecomputeNode getNext()
+  {
+    return next;
+  }
+
+  protected void setNext(final PrecomputeNodeImpl next)
+  {
+    this.next = next;
+  }
+
+  public PrecomputeNode getFirstChild()
+  {
+    return firstChild;
+  }
+
+  protected void setFirstChild(final PrecomputeNodeImpl firstChild)
+  {
+    this.firstChild = firstChild;
+  }
+
+  public PrecomputeNode getLastChild()
+  {
+    return lastChild;
+  }
+
+  protected void setLastChild(final PrecomputeNodeImpl lastChild)
+  {
+    this.lastChild = lastChild;
+  }
+
+  public void add(PrecomputeNodeImpl node)
+  {
+    if (firstChild == null)
+    {
+      firstChild = node;
+      firstChild.setParent(this);
+      lastChild = node;
+      return;
+    }
+
+    lastChild.setNext(node);
+    lastChild.setParent(this);
+  }
+
+  public void addFunction(final String name, final Object value)
+  {
+    if (this.functionNames == null)
+    {
+      functionNames = new ArrayList();
+      functionResults = new ArrayList();
+    }
+
+    this.functionNames.add(name);
+    this.functionResults.add(value);
+  }
+
+  public int getFunctionCount()
+  {
+    if (functionNames == null)
+    {
+      return 0;
+    }
+    return functionNames.size();
+  }
+
+  public String getFunctionName(int idx)
+  {
+    if (functionNames == null)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+    return (String) functionNames.get(idx);
+  }
+
+  public Object getFunctionResult(int idx)
+  {
+    if (functionResults == null)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+    return functionResults.get(idx);
+  }
+
+  public void prune()
+  {
+    if (parent == null)
+    {
+      return;
+    }
+
+    if (parent.getLastChild() != this)
+    {
+      throw new IllegalStateException("Cannot prune. Not the last child.");
+    }
+    if (parent.getFirstChild() == this)
+    {
+      parent.setFirstChild(null);
+    }
+    parent.setLastChild(null);
+  }
+}
diff --git a/source/org/jfree/report/data/PrecomputeNodeKey.java b/source/org/jfree/report/data/PrecomputeNodeKey.java
new file mode 100644
index 0000000..08aba6f
--- /dev/null
+++ b/source/org/jfree/report/data/PrecomputeNodeKey.java
@@ -0,0 +1,42 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrecomputeNodeKey.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+/**
+ * Creation-Date: Dec 6, 2006, 5:58:12 PM
+ *
+ * @author Thomas Morgner
+ */
+public interface PrecomputeNodeKey
+{
+  public boolean equals (PrecomputeNodeKey otherKey);
+}
diff --git a/source/org/jfree/report/data/PrecomputedExpressionSlot.java b/source/org/jfree/report/data/PrecomputedExpressionSlot.java
new file mode 100644
index 0000000..3d815da
--- /dev/null
+++ b/source/org/jfree/report/data/PrecomputedExpressionSlot.java
@@ -0,0 +1,99 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrecomputedExpressionSlot.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+
+/**
+ * Creation-Date: 25.11.2006, 15:18:58
+ *
+ * @author Thomas Morgner
+ */
+public class PrecomputedExpressionSlot implements ExpressionSlot
+{
+  private String name;
+  private Object value;
+  private boolean preserve;
+
+  public PrecomputedExpressionSlot(final String name,
+                                   final Object value,
+                                   final boolean preserve)
+  {
+    this.preserve = preserve;
+    this.name = name;
+    this.value = value;
+  }
+
+  public Object getValue() throws DataSourceException
+  {
+    return value;
+  }
+
+  public void advance() throws DataSourceException
+  {
+    // does nothing ...
+  }
+
+  public void updateDataRow(DataRow dataRow)
+  {
+    // does nothing ...
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public boolean isDeepTraversing()
+  {
+    return false;
+  }
+
+  /**
+   * Returns a clone of the object.
+   *
+   * @return A clone.
+   * @throws CloneNotSupportedException if cloning is not supported for some
+   *                                    reason.
+   */
+  public Object clone() throws CloneNotSupportedException
+  {
+    return super.clone();
+  }
+
+  public boolean isPreserve()
+  {
+    return preserve;
+  }
+
+}
diff --git a/source/org/jfree/report/data/PrecomputedValueRegistry.java b/source/org/jfree/report/data/PrecomputedValueRegistry.java
new file mode 100644
index 0000000..399a31d
--- /dev/null
+++ b/source/org/jfree/report/data/PrecomputedValueRegistry.java
@@ -0,0 +1,56 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrecomputedValueRegistry.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+/**
+ * Expression precomputation processes the report in a parallel process to
+ * retrieve the final value of an function. The final value of an expression
+ * is the value the expression would return before it goes out of scope.
+ *
+ * Precomputation can be generally considered expensive, so it should be done
+ * only once. During the precomputation run, no output is generated at all.
+ * Only named data-row expressions can be precomputed.
+ *
+ * @author Thomas Morgner
+ */
+public interface PrecomputedValueRegistry
+{
+  public void startElement (PrecomputeNodeKey element);
+  public void finishElement (PrecomputeNodeKey element);
+  public PrecomputeNode currentNode ();
+
+  public void addFunction(final String name, final Object value);
+
+  public void startElementPrecomputation(final PrecomputeNodeKey element);
+
+  public void finishElementPrecomputation(final PrecomputeNodeKey element);
+}
diff --git a/source/org/jfree/report/data/PrecomputedValueRegistryBuilder.java b/source/org/jfree/report/data/PrecomputedValueRegistryBuilder.java
new file mode 100644
index 0000000..8d19a67
--- /dev/null
+++ b/source/org/jfree/report/data/PrecomputedValueRegistryBuilder.java
@@ -0,0 +1,82 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrecomputedValueRegistryBuilder.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+/**
+ * This class is currently very primitive and enforces a recomputation of
+ * precomputed values each time.
+ *
+ * @author Thomas Morgner
+ */
+public class PrecomputedValueRegistryBuilder implements PrecomputedValueRegistry
+{
+  private PrecomputeNodeImpl node;
+
+  public PrecomputedValueRegistryBuilder()
+  {
+  }
+
+  public void startElementPrecomputation(final PrecomputeNodeKey element)
+  {
+    startElement(element);
+  }
+
+  public void finishElementPrecomputation(final PrecomputeNodeKey element)
+  {
+    finishElement(element);
+  }
+
+  public void startElement(PrecomputeNodeKey element)
+  {
+    PrecomputeNodeImpl newNode = new PrecomputeNodeImpl (element);
+    if (node != null)
+    {
+      newNode.setParent(node);
+    }
+    node = newNode;
+  }
+
+  public void finishElement(PrecomputeNodeKey element)
+  {
+    node = (PrecomputeNodeImpl) node.getParent();
+  }
+
+  public PrecomputeNode currentNode()
+  {
+    return node;
+  }
+
+  public void addFunction(final String name, final Object value)
+  {
+    node.addFunction(name, value);
+  }
+}
diff --git a/source/org/jfree/report/data/ReportContextImpl.java b/source/org/jfree/report/data/ReportContextImpl.java
new file mode 100644
index 0000000..55bb2e6
--- /dev/null
+++ b/source/org/jfree/report/data/ReportContextImpl.java
@@ -0,0 +1,206 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportContextImpl.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+import java.util.HashMap;
+
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.pentaho.reporting.libraries.formula.FormulaContext;
+
+/**
+ * Creation-Date: 20.11.2006, 12:19:34
+ *
+ * @author Thomas Morgner
+ */
+public class ReportContextImpl implements ReportContext
+{
+  private static class DataCarrier
+  {
+    private boolean locked;
+    private Object value;
+
+    public DataCarrier(final Object value)
+    {
+      this.value = value;
+    }
+
+    public void lock ()
+    {
+      locked = true;
+    }
+
+    public boolean isLocked()
+    {
+      return locked;
+    }
+
+    public Object getValue()
+    {
+      return value;
+    }
+
+    public void setValue(final Object value)
+    {
+      this.value = value;
+    }
+  }
+
+  private HashMap backend;
+  private String exportDescriptor;
+  private FormulaContext formulaContext;
+  private LayoutControllerFactory layoutControllerFactory;
+  private ResourceBundleFactory resourceBundleFactory;
+  private ReportStructureRoot reportStructureRoot;
+
+  public ReportContextImpl()
+  {
+    backend = new HashMap();
+  }
+
+  public void setReportStructureRoot(final ReportStructureRoot reportStructureRoot)
+  {
+    this.reportStructureRoot = reportStructureRoot;
+  }
+
+  public ReportStructureRoot getReportStructureRoot()
+  {
+    return reportStructureRoot;
+  }
+
+  public String getExportDescriptor()
+  {
+    return exportDescriptor;
+  }
+
+  public void setExportDescriptor(final String exportDescriptor)
+  {
+    this.exportDescriptor = exportDescriptor;
+  }
+
+  public FormulaContext getFormulaContext()
+  {
+    return formulaContext;
+  }
+
+  public void setFormulaContext(final FormulaContext formulaContext)
+  {
+    this.formulaContext = formulaContext;
+  }
+
+  public LayoutControllerFactory getLayoutControllerFactory()
+  {
+    return layoutControllerFactory;
+  }
+
+  public void setLayoutControllerFactory(final LayoutControllerFactory layoutControllerFactory)
+  {
+    this.layoutControllerFactory = layoutControllerFactory;
+  }
+
+  public void setAttribute(Object key, Object value)
+  {
+    final DataCarrier dc = (DataCarrier) backend.get(key);
+    if (dc == null)
+    {
+      if (value == null)
+      {
+        return;
+      }
+
+      final DataCarrier ndc = new DataCarrier(value);
+      backend.put (key, ndc);
+      return;
+    }
+
+    if (dc.isLocked())
+    {
+      throw new IllegalStateException("Context-Entry is locked.");
+    }
+    dc.setValue (value);
+  }
+
+  public void setSystemAttribute(Object key, Object value)
+  {
+    final DataCarrier dc = (DataCarrier) backend.get(key);
+    if (dc == null)
+    {
+      if (value == null)
+      {
+        return;
+      }
+
+      final DataCarrier ndc = new DataCarrier(value);
+      ndc.lock();
+      backend.put (key, ndc);
+      return;
+    }
+
+    if (dc.isLocked())
+    {
+      throw new IllegalStateException("Context-Entry is locked.");
+    }
+    dc.setValue (value);
+  }
+
+  public Object getAttribute(Object key)
+  {
+    final DataCarrier dc = (DataCarrier) backend.get(key);
+    if (dc == null)
+    {
+      return null;
+    }
+    return dc.getValue();
+  }
+
+  public boolean isSystemAttribute(Object key)
+  {
+    final DataCarrier dc = (DataCarrier) backend.get(key);
+    if (dc == null)
+    {
+      return false;
+    }
+    return dc.isLocked();
+  }
+
+  public ResourceBundleFactory getResourceBundleFactory()
+  {
+    return resourceBundleFactory;
+  }
+
+  public void setResourceBundleFactory(final ResourceBundleFactory resourceBundleFactory)
+  {
+    this.resourceBundleFactory = resourceBundleFactory;
+  }
+}
diff --git a/source/org/jfree/report/data/ReportDataRow.java b/source/org/jfree/report/data/ReportDataRow.java
new file mode 100644
index 0000000..62b8d61
--- /dev/null
+++ b/source/org/jfree/report/data/ReportDataRow.java
@@ -0,0 +1,280 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportDataRow.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSet;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportData;
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.util.IntegerCache;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * Creation-Date: 20.02.2006, 15:32:32
+ *
+ * @author Thomas Morgner
+ */
+public final class ReportDataRow implements DataRow
+{
+  private Map nameCache;
+  private DataFlags[] data;
+  private ReportData reportData;
+  private int cursor;
+
+  private ReportDataRow(final ReportData reportData) throws DataSourceException
+  {
+    if (reportData == null)
+    {
+      throw new NullPointerException();
+    }
+
+    synchronized (reportData)
+    {
+      this.reportData = reportData;
+
+      reportData.setCursorPosition(ReportData.BEFORE_FIRST_ROW);
+      final boolean readable;
+      if (reportData.isAdvanceable())
+      {
+        readable = reportData.next() && reportData.isReadable();
+        cursor = reportData.getCursorPosition();
+      }
+      else
+      {
+        readable = false;
+        cursor = 0;
+      }
+
+      final HashMap nameCache = new HashMap();
+      final int columnCount = reportData.getColumnCount();
+      this.data = new DataFlags[columnCount];
+
+      for (int i = 0; i < columnCount; i++)
+      {
+        final String columnName = reportData.getColumnName(i);
+        if (columnName != null)
+        {
+          nameCache.put(columnName, IntegerCache.getInteger(i));
+        }
+
+        if (readable)
+        {
+          final Object value = reportData.get(i);
+          this.data[i] = new DefaultDataFlags(columnName, value, true);
+        }
+        else
+        {
+          this.data[i] = new DefaultDataFlags(columnName, null, true);
+        }
+      }
+      this.nameCache = Collections.unmodifiableMap(nameCache);
+    }
+  }
+
+  private ReportDataRow(final ReportData reportData,
+                        final ReportDataRow reportDataRow)
+      throws DataSourceException
+  {
+    if (reportData == null)
+    {
+      throw new NullPointerException();
+    }
+
+    if (reportDataRow == null)
+    {
+      throw new NullPointerException();
+    }
+
+    synchronized (reportData)
+    {
+      this.reportData = reportData;
+      this.cursor = reportData.getCursorPosition();
+      final int columnCount = reportData.getColumnCount();
+      this.data = new DataFlags[columnCount];
+
+      for (int i = 0; i < columnCount; i++)
+      {
+        final String columnName = reportData.getColumnName(i);
+        final Object value = reportData.get(i);
+        final boolean changed = ObjectUtilities.equal(value, reportDataRow.get(i));
+        this.data[i] = new DefaultDataFlags(columnName, value, changed);
+      }
+      this.nameCache = reportDataRow.nameCache;
+    }
+  }
+
+  public static ReportDataRow createDataRow(final ReportDataFactory dataFactory,
+                                            final String query,
+                                            final DataSet parameters)
+      throws DataSourceException, ReportDataFactoryException
+  {
+    final ReportData reportData = dataFactory.queryData(query, parameters);
+    return new ReportDataRow(reportData);
+  }
+
+  /**
+   * Returns the value of the expression or column in the tablemodel using the given column number as index. For
+   * functions and expressions, the <code>getValue()</code> method is called and for columns from the tablemodel the
+   * tablemodel method <code>getValueAt(row, column)</code> gets called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(final int col) throws DataSourceException
+  {
+    return data[col].getValue();
+  }
+
+  /**
+   * Returns the value of the function, expression or column using its specific name. The given name is translated into
+   * a valid column number and the the column is queried. For functions and expressions, the <code>getValue()</code>
+   * method is called and for columns from the tablemodel the tablemodel method <code>getValueAt(row, column)</code>
+   * gets called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(final String col) throws DataSourceException
+  {
+    final Integer colIdx = (Integer) nameCache.get(col);
+    if (colIdx == null)
+    {
+      throw new DataSourceException
+          ("Invalid name specified. There is no such column.");
+    }
+
+    return data[colIdx.intValue()].getValue();
+  }
+
+  /**
+   * Returns the name of the column, expression or function. For columns from the tablemodel, the tablemodels
+   * <code>getColumnName</code> method is called. For functions, expressions and report properties the assigned name is
+   * returned.
+   *
+   * @param col the item index.
+   * @return the name.
+   */
+  public String getColumnName(final int col)
+  {
+    return data[col].getName();
+  }
+
+  /**
+   * Returns the number of columns, expressions and functions and marked ReportProperties in the report.
+   *
+   * @return the item count.
+   */
+  public int getColumnCount()
+  {
+    return data.length;
+  }
+
+  public DataFlags getFlags(final String col) throws DataSourceException
+  {
+    final Integer colIdx = (Integer) nameCache.get(col);
+    if (colIdx == null)
+    {
+      throw new DataSourceException
+          ("Invalid name specified. There is no such column.");
+    }
+
+    return data[colIdx.intValue()];
+  }
+
+  public DataFlags getFlags(final int col)
+  {
+    return data[col];
+  }
+
+  /**
+   * Advances to the next row and attaches the given master row to the objects contained in that client data row.
+   *
+   * @param master
+   * @return
+   */
+  public ReportDataRow advance() throws DataSourceException
+  {
+    synchronized (reportData)
+    {
+      if (reportData.getCursorPosition() != cursor)
+      {
+        // directly go to the position we need.
+        if (reportData.setCursorPosition(cursor + 1) == false)
+        {
+          throw new DataSourceException("Unable to advance cursor position");
+        }
+      }
+      else
+      {
+        if (reportData.next() == false)
+        {
+          throw new DataSourceException("Unable to advance cursor position");
+        }
+      }
+      return new ReportDataRow(reportData, this);
+    }
+  }
+
+  public boolean isAdvanceable() throws DataSourceException
+  {
+    synchronized (reportData)
+    {
+      if (reportData.getCursorPosition() != cursor)
+      {
+        // directly go to the position we need.
+        if (reportData.setCursorPosition(cursor) == false)
+        {
+          return false;
+        }
+      }
+      return reportData.isAdvanceable();
+    }
+  }
+
+  public ReportData getReportData()
+  {
+    return reportData;
+  }
+
+  public int getCursor()
+  {
+    return cursor;
+  }
+}
diff --git a/source/org/jfree/report/data/RunningExpressionSlot.java b/source/org/jfree/report/data/RunningExpressionSlot.java
new file mode 100644
index 0000000..85c40da
--- /dev/null
+++ b/source/org/jfree/report/data/RunningExpressionSlot.java
@@ -0,0 +1,174 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: RunningExpressionSlot.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.data;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportData;
+import org.jfree.report.expressions.Expression;
+import org.jfree.report.expressions.ExpressionRuntime;
+import org.jfree.report.expressions.Function;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 25.11.2006, 15:18:58
+ *
+ * @author Thomas Morgner
+ */
+public class RunningExpressionSlot
+    implements ExpressionSlot, ExpressionRuntime
+{
+  private StaticExpressionRuntimeData staticRuntimeData;
+  private Expression expression;
+  private Object value;
+  private String name;
+  private boolean queried;
+  private DataRow dataRow;
+
+  public RunningExpressionSlot(final Expression expression,
+                               final StaticExpressionRuntimeData runtimeData,
+                               final PrecomputeNode precomputeNode)
+  {
+    this.staticRuntimeData = runtimeData;
+    this.expression = expression;
+    this.name = expression.getName();
+    this.expression.setRuntime(this);
+    this.expression.setRuntime(null);
+  }
+
+  public Expression getExpression()
+  {
+    return expression;
+  }
+
+  public Object getValue() throws DataSourceException
+  {
+    if (queried == false)
+    {
+      //noinspection SynchronizeOnNonFinalField
+      synchronized (expression)
+      {
+        expression.setRuntime(this);
+        value = expression.computeValue();
+        expression.setRuntime(null);
+      }
+      queried = true;
+    }
+    return value;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public DataRow getDataRow()
+  {
+    return dataRow;
+  }
+
+  public Object clone() throws CloneNotSupportedException
+  {
+    return super.clone();
+  }
+
+  public void updateDataRow(final DataRow dataRow)
+  {
+    this.dataRow = dataRow;
+  }
+
+  /**
+   * Returns the report data used in this section. If subreports are used, this
+   * does not reflect the complete report data.
+   * <p/>
+   * All access to the report data must be properly synchronized. Failure to do
+   * so may result in funny results. Do not assume that the report data will be
+   * initialized on the current cursor positon.
+   *
+   * @return
+   */
+  public ReportData getData()
+  {
+    return staticRuntimeData.getData();
+  }
+
+  public Object getDeclaringParent()
+  {
+    return staticRuntimeData.getDeclaringParent();
+  }
+
+  public Configuration getConfiguration()
+  {
+    return staticRuntimeData.getConfiguration();
+  }
+
+  public ResourceBundleFactory getResourceBundleFactory()
+  {
+    return staticRuntimeData.getResourceBundleFactory();
+  }
+
+  public void advance() throws DataSourceException
+  {
+    if (expression instanceof Function)
+    {
+      Function f = (Function) expression;
+      expression.setRuntime(this);
+      expression = f.advance();
+      f.setRuntime(null);
+      expression.setRuntime(null);
+    }
+    value = null;
+    queried = false;
+  }
+
+  public boolean isDeepTraversing()
+  {
+    return expression.isDeepTraversing();
+  }
+
+  public int getCurrentRow()
+  {
+    return staticRuntimeData.getCurrentRow();
+  }
+
+  public ReportContext getReportContext()
+  {
+    return staticRuntimeData.getReportContext();
+  }
+
+  public boolean isPreserve()
+  {
+    return expression.isPreserve();
+  }
+}
diff --git a/source/org/jfree/report/data/StaticDataRow.java b/source/org/jfree/report/data/StaticDataRow.java
new file mode 100644
index 0000000..3e01460
--- /dev/null
+++ b/source/org/jfree/report/data/StaticDataRow.java
@@ -0,0 +1,225 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticDataRow.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.util.IntegerCache;
+
+/**
+ * This is a static datarow holding a value for each name in the datarow. This
+ * datarow does not hold dataflags and thus does not track the changes done to
+ * the data inside.
+ * <p/>
+ * The StaticDataRow is a derived view and is used to provide a safe collection
+ * of the values of the previous datarow.
+ *
+ * @author Thomas Morgner
+ */
+public class StaticDataRow implements DataRow
+{
+  private String[] names;
+  private Object[] values;
+  private Map nameCache;
+
+  protected StaticDataRow()
+  {
+  }
+
+  protected StaticDataRow(StaticDataRow dataRow)
+  {
+    if (dataRow == null)
+    {
+      throw new NullPointerException();
+    }
+
+    this.nameCache = dataRow.nameCache;
+    this.names = dataRow.names;
+    this.values = dataRow.values;
+  }
+
+  public StaticDataRow(DataRow dataRow) throws DataSourceException
+  {
+    if (dataRow == null)
+    {
+      throw new NullPointerException();
+    }
+
+    HashMap nameCache = new HashMap();
+    synchronized (dataRow)
+    {
+      final int columnCount = dataRow.getColumnCount();
+      this.names = new String[columnCount];
+      this.values = new Object[dataRow.getColumnCount()];
+      for (int i = 0; i < columnCount; i++)
+      {
+        names[i] = dataRow.getColumnName(i);
+        values[i] = dataRow.get(i);
+        if (names[i] != null)
+        {
+          nameCache.put(names[i], IntegerCache.getInteger(i));
+        }
+      }
+    }
+    this.nameCache = Collections.unmodifiableMap(nameCache);
+  }
+
+  public StaticDataRow(String[] names, Object[] values)
+  {
+    setData(names, values);
+  }
+
+  protected void setData(String[] names, Object[] values)
+  {
+    if (names == null)
+    {
+      throw new NullPointerException();
+    }
+    if (values == null)
+    {
+      throw new NullPointerException();
+    }
+    final int length;
+    if (names.length == values.length)
+    {
+      length = names.length;
+      this.names = (String[]) names.clone();
+      this.values = (Object[]) values.clone();
+    }
+    else
+    {
+      length = Math.min(names.length, values.length);
+      this.names = new String[length];
+      this.values = new Object[length];
+      System.arraycopy(names, 0, this.names, 0, length);
+      System.arraycopy(values, 0, this.values, 0, length);
+    }
+
+    final HashMap nameCache = new HashMap();
+    for (int i = 0; i < length; i++)
+    {
+      final String name = names[i];
+      if (name != null)
+      {
+        nameCache.put(name, IntegerCache.getInteger(i));
+      }
+    }
+    this.nameCache = Collections.unmodifiableMap(nameCache);
+  }
+
+  protected void updateData(final Object[] values)
+  {
+    if (values.length != this.values.length)
+    {
+      throw new IllegalArgumentException("You should preserve the number of columns.");
+    }
+
+    this.values = (Object[]) values.clone();
+  }
+
+  /**
+   * Returns the value of the expression or column in the tablemodel using the
+   * given column number as index. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(int col) throws DataSourceException
+  {
+    return values[col];
+  }
+
+  /**
+   * Returns the value of the function, expression or column using its specific
+   * name. The given name is translated into a valid column number and the the
+   * column is queried. For functions and expressions, the
+   * <code>getValue()</code> method is called and for columns from the
+   * tablemodel the tablemodel method <code>getValueAt(row, column)</code> gets
+   * called.
+   *
+   * @param col the item index.
+   * @return the value.
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get(String col) throws DataSourceException
+  {
+    final Integer idx = (Integer) nameCache.get(col);
+    if (idx == null)
+    {
+      return null;
+    }
+    return values[idx.intValue()];
+  }
+
+  /**
+   * Returns the name of the column, expression or function. For columns from
+   * the tablemodel, the tablemodels <code>getColumnName</code> method is
+   * called. For functions, expressions and report properties the assigned name
+   * is returned.
+   *
+   * @param col the item index.
+   * @return the name.
+   */
+  public String getColumnName(int col) throws DataSourceException
+  {
+    return names[col];
+  }
+
+  /**
+   * Returns the number of columns, expressions and functions and marked
+   * ReportProperties in the report.
+   *
+   * @return the item count.
+   */
+  public int getColumnCount() throws DataSourceException
+  {
+    return values.length;
+  }
+
+  public DataFlags getFlags(String col) throws DataSourceException
+  {
+    return new DefaultDataFlags(col, get(col), false);
+  }
+
+  public DataFlags getFlags(int col) throws DataSourceException
+  {
+    return new DefaultDataFlags(names[col], values[col], false);
+  }
+}
diff --git a/source/org/jfree/report/data/StaticExpressionRuntimeData.java b/source/org/jfree/report/data/StaticExpressionRuntimeData.java
new file mode 100644
index 0000000..a4d2325
--- /dev/null
+++ b/source/org/jfree/report/data/StaticExpressionRuntimeData.java
@@ -0,0 +1,111 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticExpressionRuntimeData.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.data;
+
+import org.jfree.report.ReportData;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * This class holds all expression-runtime information, which are known when
+ * the expression gets added to the datarow. Once added, they won't change
+ * anymore.
+ *
+ * @author Thomas Morgner
+ */
+public class StaticExpressionRuntimeData
+{
+  private Object declaringParent;
+  private Configuration configuration;
+  private ReportData data;
+  private int currentRow;
+  private ReportContext reportContext;
+
+  public StaticExpressionRuntimeData()
+  {
+  }
+
+  public int getCurrentRow()
+  {
+    return currentRow;
+  }
+
+  public void setCurrentRow(final int currentRow)
+  {
+    this.currentRow = currentRow;
+  }
+
+  public ReportData getData()
+  {
+    return data;
+  }
+
+  public void setData(final ReportData data)
+  {
+    this.data = data;
+  }
+
+  public ResourceBundleFactory getResourceBundleFactory()
+  {
+    return reportContext.getResourceBundleFactory();
+  }
+
+  public void setDeclaringParent(final Object declaringParent)
+  {
+    this.declaringParent = declaringParent;
+  }
+
+  public void setConfiguration(final Configuration configuration)
+  {
+    this.configuration = configuration;
+  }
+
+  public Object getDeclaringParent()
+  {
+    return declaringParent;
+  }
+
+  public Configuration getConfiguration()
+  {
+    return configuration;
+  }
+
+  public ReportContext getReportContext()
+  {
+    return reportContext;
+  }
+
+  public void setReportContext(final ReportContext reportContext)
+  {
+    this.reportContext = reportContext;
+  }
+}
diff --git a/source/org/jfree/report/engine.css b/source/org/jfree/report/engine.css
new file mode 100644
index 0000000..a14420d
--- /dev/null
+++ b/source/org/jfree/report/engine.css
@@ -0,0 +1,45 @@
+/**
+ * The StyleSheet mapping for the built-in elements. This mapping is only
+ * active, if no namespace aware XML-parser touched the elements.
+ */
+ at namespace xml url(http://www.w3.org/XML/1998/namespace);
+ at namespace report url(http://jfreereport.sourceforge.net/namespaces/engine);
+ at namespace url(http://jfreereport.sourceforge.net/namespaces/engine);
+
+/**
+ * Everything except the content element is now considered a block-level element.
+ * This looks like a sane default to me.
+* {
+  display: block;
+}
+ */
+
+content {
+  content: attr("report|content");
+  display: inline;
+}
+
+content[report|isDate=true] {
+  content: format(attr("report|content", date), date);
+}
+
+content[report|isDate=true][format] {
+  content: format(attr("report|content", date), date, attr("format",string));
+}
+
+content[report|isNumber=true] {
+  content: format(attr("report|content", number), number, "#,##0.00");
+}
+
+content[report|isNumber=true][format] {
+  content: format(attr("report|content", number), number, attr("format",string));
+}
+
+content[report|isNumber=true][report|isInteger=true] {
+  content: format(attr("report|content", number), number, "#,##0");
+}
+
+content[report|isNumber=true][report|isInteger=true][format] {
+  content: format(attr("report|content", number), number, attr("format",string));
+}
+
diff --git a/source/org/jfree/report/event/ReportProgressEvent.java b/source/org/jfree/report/event/ReportProgressEvent.java
new file mode 100644
index 0000000..813c24c
--- /dev/null
+++ b/source/org/jfree/report/event/ReportProgressEvent.java
@@ -0,0 +1,77 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportProgressEvent.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.event;
+
+import java.util.EventObject;
+
+/**
+ * Creation-Date: 15.11.2006, 21:02:25
+ *
+ * @author Thomas Morgner
+ */
+public class ReportProgressEvent extends EventObject
+{
+  public static final int COMPUTING_LAYOUT = 0;
+  public static final int PRECOMPUTING_VALUES = 1;
+  public static final int PAGINATING = 2;
+  public static final int GENERATING_CONTENT = 3;
+
+  private int activity;
+  private int row;
+  private int page;
+
+  public ReportProgressEvent(final Object source,
+                             final int activity,
+                             final int row,
+                             final int page)
+  {
+    super(source);
+    this.page = page;
+    this.activity = activity;
+    this.row = row;
+  }
+
+  public int getRow()
+  {
+    return row;
+  }
+
+  public int getActivity()
+  {
+    return activity;
+  }
+
+  public int getPage()
+  {
+    return page;
+  }
+}
diff --git a/source/org/jfree/report/event/ReportProgressListener.java b/source/org/jfree/report/event/ReportProgressListener.java
new file mode 100644
index 0000000..5162470
--- /dev/null
+++ b/source/org/jfree/report/event/ReportProgressListener.java
@@ -0,0 +1,46 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportProgressListener.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.event;
+
+import java.util.EventListener;
+
+/**
+ * Creation-Date: 15.11.2006, 21:02:51
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportProgressListener extends EventListener
+{
+  public void reportProcessingStarted (ReportProgressEvent event);
+  public void reportProcessingUpdate (ReportProgressEvent event);
+  public void reportProcessingFinished (ReportProgressEvent event);
+}
diff --git a/source/org/jfree/report/expressions/AbstractExpression.java b/source/org/jfree/report/expressions/AbstractExpression.java
new file mode 100644
index 0000000..53e1e5d
--- /dev/null
+++ b/source/org/jfree/report/expressions/AbstractExpression.java
@@ -0,0 +1,211 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions;
+
+import java.util.Locale;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.jfree.report.structure.Element;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * A baseclass for simple, non-positionally parametrized expressions.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractExpression implements Expression
+{
+  private transient ExpressionRuntime runtime;
+  private String name;
+  private boolean deepTraversing;
+  private boolean precompute;
+  private boolean preserve;
+
+  protected AbstractExpression()
+  {
+  }
+
+  /**
+   * Returns the name of the expression. An expression without a name cannot be
+   * referenced from outside the element.
+   *
+   * @return the function name.
+   */
+  public String getName()
+  {
+    return name;
+  }
+
+  /**
+   * Sets the name of the expression.
+   *
+   * @param name the name.
+   */
+  public void setName(final String name)
+  {
+    this.name = name;
+  }
+
+  /**
+   * Clones the expression, expression should be reinitialized after the
+   * cloning. <P> Expression maintain no state, cloning is done at the beginning
+   * of the report processing to disconnect the used expression from any other
+   * object space.
+   *
+   * @return A clone of this expression.
+   * @throws CloneNotSupportedException this should never happen.
+   */
+  public Object clone() throws CloneNotSupportedException
+  {
+    return (AbstractExpression) super.clone();
+  }
+
+  /**
+   * Return a new instance of this expression. The copy is initialized and uses
+   * the same parameters as the original, but does not share any objects.
+   *
+   * @return a copy of this function.
+   */
+  public Expression getInstance()
+  {
+    try
+    {
+      final AbstractExpression abstractExpression = (AbstractExpression) clone();
+      abstractExpression.runtime = null;
+      return abstractExpression;
+    }
+    catch (CloneNotSupportedException cne)
+    {
+      return null;
+    }
+  }
+
+  /**
+   * Defines the DataRow used in this expression. The dataRow is set when the
+   * report processing starts and can be used to access the values of functions,
+   * expressions and the reports datasource.
+   *
+   * @param runtime the runtime information for the expression
+   */
+  public void setRuntime(final ExpressionRuntime runtime)
+  {
+    this.runtime = runtime;
+  }
+
+  public ExpressionRuntime getRuntime()
+  {
+    return runtime;
+  }
+
+  /**
+   * Returns the current {@link DataRow}.
+   *
+   * @return the data row.
+   */
+  protected DataRow getDataRow()
+  {
+    if (runtime == null)
+    {
+      return null;
+    }
+    return runtime.getDataRow();
+  }
+
+  protected ResourceBundleFactory getResourceBundleFactory()
+  {
+    if (runtime == null)
+    {
+      return null;
+    }
+    return runtime.getResourceBundleFactory();
+  }
+
+  protected Configuration getReportConfiguration()
+  {
+    if (runtime == null)
+    {
+      return null;
+    }
+    return runtime.getConfiguration();
+  }
+
+  protected Locale getParentLocale ()
+  {
+    if (runtime == null)
+    {
+      return null;
+    }
+
+    final Object declaringParent = runtime.getDeclaringParent();
+    if (declaringParent instanceof Element)
+    {
+      final Element declaringElement = (Element) declaringParent;
+      return declaringElement.getLocale();
+    }
+
+    final ReportContext reportContext = runtime.getReportContext();
+    final ReportStructureRoot reportStructureRoot = reportContext.getReportStructureRoot();
+    return reportStructureRoot.getLocale();
+  }
+
+  public boolean isPrecompute()
+  {
+    return precompute;
+  }
+
+  public void setPrecompute(final boolean precompute)
+  {
+    this.precompute = precompute;
+  }
+
+  public boolean isDeepTraversing()
+  {
+    return deepTraversing;
+  }
+
+  public void setDeepTraversing(final boolean deepTraversing)
+  {
+    this.deepTraversing = deepTraversing;
+  }
+
+  public boolean isPreserve()
+  {
+    return preserve;
+  }
+
+  public void setPreserve(final boolean preserve)
+  {
+    this.preserve = preserve;
+  }
+}
diff --git a/source/org/jfree/report/expressions/ColumnAggregationExpression.java b/source/org/jfree/report/expressions/ColumnAggregationExpression.java
new file mode 100644
index 0000000..82e556d
--- /dev/null
+++ b/source/org/jfree/report/expressions/ColumnAggregationExpression.java
@@ -0,0 +1,58 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ColumnAggregationExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataSourceException;
+
+/**
+ * Creation-Date: 04.01.2006, 17:23:01
+ *
+ * @author Thomas Morgner
+ */
+public abstract class ColumnAggregationExpression extends AbstractExpression
+{
+  protected ColumnAggregationExpression()
+  {
+  }
+
+  protected abstract int getFieldListParameterPosition();
+
+  protected Object[] getFieldValues() throws DataSourceException
+  {
+    return getFieldValues(Object.class);
+  }
+
+  protected Object[] getFieldValues(Class type) throws DataSourceException
+  {
+    return null; // todo
+  }
+
+}
diff --git a/source/org/jfree/report/expressions/Expression.java b/source/org/jfree/report/expressions/Expression.java
new file mode 100644
index 0000000..304e4ad
--- /dev/null
+++ b/source/org/jfree/report/expressions/Expression.java
@@ -0,0 +1,164 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: Expression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.expressions;
+
+import java.io.Serializable;
+
+import org.jfree.report.DataSourceException;
+
+/**
+ * An expression is a lightweight computation that does not maintain a state.
+ *
+ * Expressions are used to calculate values within a single row of a report.
+ * Expressions can use a dataRow to access other fields, expressions or
+ * functions within the current row in the report.
+ *
+ * Statefull computations can be implemented using functions.
+ *
+ * @author Thomas Morgner
+ * @see Function
+ */
+public interface Expression extends Cloneable, Serializable
+{
+  /**
+   * Returns the name of the expression. An expression without a name cannot be
+   * referenced from outside the element.
+   *
+   * @return the function name.
+   */
+  public String getName();
+
+  /**
+   * Sets the name of the expression.
+   *
+   * @param name the name.
+   */
+  public void setName(String name);
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException;
+
+  /**
+   * Clones the expression, expression should be reinitialized after the
+   * cloning. <P> Expression maintain no state, cloning is done at the beginning
+   * of the report processing to disconnect the used expression from any other
+   * object space.
+   *
+   * @return A clone of this expression.
+   * @throws CloneNotSupportedException this should never happen.
+   */
+  public Object clone()
+          throws CloneNotSupportedException;
+
+
+  /**
+   * Return a new instance of this expression. The copy is initialized and uses
+   * the same parameters as the original, but does not share any objects.
+   *
+   * @return a copy of this function.
+   */
+  public Expression getInstance();
+
+  /**
+   * Defines the DataRow used in this expression. The dataRow is set when the
+   * report processing starts and can be used to access the values of functions,
+   * expressions and the reports datasource.
+   *
+   * @param runtime the runtime information for the expression
+   */
+  public void setRuntime(ExpressionRuntime runtime);
+
+  /**
+   * A deep-traversing expression declares that it should receive updates from
+   * all subreports. This mode should be activated if the expression's result
+   * depends on values contained in the subreport.
+   *
+   * @return true, if the expression is deep-traversing, false otherwise.
+   */
+  public boolean isDeepTraversing ();
+
+  /**
+   * Defines, whether the expression is deep-traversing.
+   *
+   * @param deepTraversing true, if the expression is deep-traversing, false
+   * otherwise.
+   */
+  public void setDeepTraversing (boolean deepTraversing);
+
+  /**
+   * Returns, whether the expression will be precomputed. For precomputed
+   * expressions a parallel evaluation process is started and the result to
+   * which the expression evaluates before it gets out of scope will be used
+   * whenever an other expression queries this expression's value.
+   *
+   * @return true, if the expression is precomputed, false otherwise.
+   */
+  public boolean isPrecompute();
+
+  /**
+   * Defines, whether the expression will be precomputed. For precomputed
+   * expressions a parallel evaluation process is started and the result to
+   * which the expression evaluates before it gets out of scope will be used
+   * whenever an other expression queries this expression's value.
+   *
+   * @param precompute true, if the expression is precomputed, false otherwise.
+   */
+  public void setPrecompute(boolean precompute);
+
+  /**
+   * Checks, whether the expression's result should be preserved in the
+   * precomputed value registry. This way, the last value for that expression
+   * can be retrieved after the report has been finished.
+   *
+   * The preserve-function will only preserve the last value that has been
+   * evaluated before the expression went out of scope.
+   *
+   * @return true, if the expression's results should be preserved,
+   * false otherwise.
+   */
+  public boolean isPreserve();
+
+  /**
+   * Defines, whether the expression's result should be preserved in the
+   * precomputed value registry. This way, the last value for that expression
+   * can be retrieved after the report has been finished.
+   *
+   * @param preserve true, if the expression's results should be preserved,
+   * false otherwise.
+   */
+  public void setPreserve(boolean preserve);
+}
diff --git a/source/org/jfree/report/expressions/ExpressionException.java b/source/org/jfree/report/expressions/ExpressionException.java
new file mode 100644
index 0000000..70c97d1
--- /dev/null
+++ b/source/org/jfree/report/expressions/ExpressionException.java
@@ -0,0 +1,62 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExpressionException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataSourceException;
+
+/**
+ * Creation-Date: 08.10.2006, 16:12:43
+ *
+ * @author Thomas Morgner
+ */
+public class ExpressionException extends DataSourceException
+{
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   */
+  public ExpressionException(final String message)
+  {
+    super(message);
+  }
+
+  /**
+   * Creates an exception.
+   *
+   * @param message the exception message.
+   * @param ex      the parent exception.
+   */
+  public ExpressionException(final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+}
diff --git a/source/org/jfree/report/expressions/ExpressionRuntime.java b/source/org/jfree/report/expressions/ExpressionRuntime.java
new file mode 100644
index 0000000..e4b5abe
--- /dev/null
+++ b/source/org/jfree/report/expressions/ExpressionRuntime.java
@@ -0,0 +1,71 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExpressionRuntime.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.ReportData;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 24.01.2006, 16:58:34
+ *
+ * @author Thomas Morgner
+ */
+public interface ExpressionRuntime
+{
+  /**
+   * Returns the datarow.
+   *
+   * @return
+   */
+  public DataRow getDataRow();
+  public Configuration getConfiguration();
+  public ResourceBundleFactory getResourceBundleFactory();
+
+  /**
+   * Returns the report data used in this section. If subreports are used,
+   * this does not reflect the complete report data.
+   * <p>
+   * All access to the report data must be properly synchronized. Failure to
+   * do so may result in funny results. Do not assume that the report data
+   * will be initialized on the current cursor positon.
+   *
+   * @return
+   * @see ExpressionRuntime#getCurrentRow()
+   */
+  public ReportData getData();
+  public int getCurrentRow();
+
+  public Object getDeclaringParent();
+  public ReportContext getReportContext();
+}
diff --git a/source/org/jfree/report/expressions/FormulaExpression.java b/source/org/jfree/report/expressions/FormulaExpression.java
new file mode 100644
index 0000000..0d18d28
--- /dev/null
+++ b/source/org/jfree/report/expressions/FormulaExpression.java
@@ -0,0 +1,193 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FormulaExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.flow.ReportContext;
+import org.pentaho.reporting.libraries.formula.parser.ParseException;
+import org.pentaho.reporting.libraries.formula.Formula;
+import org.pentaho.reporting.libraries.formula.FormulaContext;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 04.11.2006, 19:24:04
+ *
+ * @author Thomas Morgner
+ */
+public class FormulaExpression extends AbstractExpression
+{
+  private transient Formula compiledFormula;
+  private String formulaNamespace;
+  private String formulaExpression;
+  private String formula;
+
+  public FormulaExpression()
+  {
+  }
+
+  private synchronized FormulaContext getFormulaContext()
+  {
+    final ReportContext globalContext = getRuntime().getReportContext();
+    return globalContext.getFormulaContext();
+  }
+
+  public String getFormula()
+  {
+    return formula;
+  }
+
+  public String getFormulaNamespace()
+  {
+    return formulaNamespace;
+  }
+
+  public String getFormulaExpression()
+  {
+    return formulaExpression;
+  }
+
+  public void setFormula(final String formula)
+  {
+    this.formula = formula;
+    if (formula == null)
+    {
+      formulaNamespace = null;
+      formulaExpression = null;
+    }
+    else
+    {
+      final int separator = formula.indexOf(':');
+      if (separator <= 0 || ((separator + 1) == formula.length()))
+      {
+        if (formula.startsWith("="))
+        {
+          formulaNamespace = "report";
+          formulaExpression = formula.substring(1);
+        }
+        else
+        {
+          // error: invalid formula.
+          formulaNamespace = null;
+          formulaExpression = null;
+        }
+      }
+      else
+      {
+        formulaNamespace = formula.substring(0, separator);
+        formulaExpression = formula.substring(separator + 1);
+      }
+    }
+    this.compiledFormula = null;
+  }
+
+  private Object computeRegularValue()
+  {
+    try
+    {
+      if (compiledFormula == null)
+      {
+        compiledFormula = new Formula(formulaExpression);
+      }
+
+      final ReportFormulaContext context =
+          new ReportFormulaContext(getFormulaContext(), getDataRow());
+      try
+      {
+        compiledFormula.initialize(context);
+        return compiledFormula.evaluate();
+      }
+      finally
+      {
+        context.setDataRow(null);
+      }
+    }
+    catch (Exception e)
+    {
+      DebugLog.log("Failed to compute the regular value.", e);
+      return null;
+    }
+  }
+
+  /**
+   * Returns the compiled formula. The formula is not connected to a formula
+   * context.
+   *
+   * @return the formula.
+   * @throws ParseException if the formula contains syntax errors.
+   */
+  public Formula getCompiledFormula()
+      throws ParseException
+  {
+    if (compiledFormula == null)
+    {
+      compiledFormula = new Formula(formulaExpression);
+    }
+    return compiledFormula;
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+    try
+    {
+      return computeRegularValue();
+    }
+    catch (Exception e)
+    {
+      return null;
+    }
+  }
+
+  /**
+   * Clones the expression, expression should be reinitialized after the
+   * cloning. <P> Expression maintain no state, cloning is done at the beginning
+   * of the report processing to disconnect the used expression from any other
+   * object space.
+   *
+   * @return A clone of this expression.
+   * @throws CloneNotSupportedException this should never happen.
+   */
+  public Object clone() throws CloneNotSupportedException
+  {
+    final FormulaExpression o = (FormulaExpression) super.clone();
+    if (compiledFormula != null)
+    {
+      o.compiledFormula = (Formula) compiledFormula.clone();
+    }
+    return o;
+  }
+}
diff --git a/source/org/jfree/report/expressions/FormulaFunction.java b/source/org/jfree/report/expressions/FormulaFunction.java
new file mode 100644
index 0000000..c01c517
--- /dev/null
+++ b/source/org/jfree/report/expressions/FormulaFunction.java
@@ -0,0 +1,308 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FormulaFunction.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.flow.ReportContext;
+import org.pentaho.reporting.libraries.formula.Formula;
+import org.pentaho.reporting.libraries.formula.FormulaContext;
+import org.pentaho.reporting.libraries.formula.parser.ParseException;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 04.11.2006, 19:24:04
+ *
+ * @author Thomas Morgner
+ */
+public class FormulaFunction extends AbstractExpression implements Function
+{
+  private String formulaNamespace;
+  private String formulaExpression;
+  private String formula;
+
+  private String initialNamespace;
+  private String initialExpression;
+  private String initial;
+  private transient Formula compiledFormula;
+  private boolean initialized;
+
+  public FormulaFunction()
+  {
+  }
+
+  private synchronized FormulaContext getFormulaContext()
+  {
+    final ReportContext globalContext = getRuntime().getReportContext();
+    return globalContext.getFormulaContext();
+  }
+
+  public String getInitial()
+  {
+    return initial;
+  }
+
+  public String getInitialExpression()
+  {
+    return initialExpression;
+  }
+
+  public String getInitialNamespace()
+  {
+    return initialNamespace;
+  }
+
+  public void setInitial(final String initial)
+  {
+    this.initial = initial;
+    if (initial == null)
+    {
+      initialNamespace = null;
+      initialExpression = null;
+    }
+    else
+    {
+      final int separator = initial.indexOf(':');
+      if (separator <= 0 || ((separator + 1) == initial.length()))
+      {
+        if (formula.startsWith("="))
+        {
+          initialNamespace = "report";
+          initialExpression = initial.substring(1);
+        }
+        else
+        {
+          // error: invalid formula.
+          initialNamespace = null;
+          initialExpression = null;
+        }
+      }
+      else
+      {
+        initialNamespace = initial.substring(0, separator);
+        initialExpression = initial.substring(separator + 1);
+      }
+    }
+  }
+
+
+  public String getFormula()
+  {
+    return formula;
+  }
+
+  public String getFormulaNamespace()
+  {
+    return formulaNamespace;
+  }
+
+  public String getFormulaExpression()
+  {
+    return formulaExpression;
+  }
+
+  public void setFormula(final String formula)
+  {
+    this.formula = formula;
+    if (formula == null)
+    {
+      formulaNamespace = null;
+      formulaExpression = null;
+    }
+    else
+    {
+      final int separator = formula.indexOf(':');
+      if (separator <= 0 || ((separator + 1) == formula.length()))
+      {
+        if (formula.startsWith("="))
+        {
+          formulaNamespace = "report";
+          formulaExpression = formula.substring(1);
+        }
+        else
+        {
+          // error: invalid formula.
+          formulaNamespace = null;
+          formulaExpression = null;
+        }
+      }
+      else
+      {
+        formulaNamespace = formula.substring(0, separator);
+        formulaExpression = formula.substring(separator + 1);
+      }
+    }
+    this.compiledFormula = null;
+  }
+
+  /**
+   * When the advance method is called, the function is asked to perform the
+   * next step of its computation.
+   * <p/>
+   * The original function must not be altered during that step (or more
+   * correctly, calling advance on the original expression again must not return
+   * a different result).
+   *
+   * @return a copy of the function containing the new state.
+   */
+  public Function advance() throws DataSourceException
+  {
+    try
+    {
+      return (Function) clone();
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new DataSourceException("Unable to derive a new instance");
+    }
+  }
+
+  private Object computeInitialValue()
+  {
+    try
+    {
+      if (initial != null)
+      {
+        final Formula initFormula = new Formula(initialExpression);
+        final ReportFormulaContext context =
+            new ReportFormulaContext(getFormulaContext(), getDataRow());
+        context.setDeclaringElement(getRuntime().getDeclaringParent());
+        try
+        {
+          initFormula.initialize(context);
+          return initFormula.evaluate();
+        }
+        finally
+        {
+          context.setDeclaringElement(null);
+          context.setDataRow(null);
+        }
+      }
+
+      // if the code above did not trigger, compute a regular thing ..
+      return computeRegularValue();
+    }
+    catch (Exception e)
+    {
+      DebugLog.log("Failed to compute the initial value.");
+      return null;
+    }
+  }
+
+  private Object computeRegularValue()
+  {
+    try
+    {
+      if (compiledFormula == null)
+      {
+        compiledFormula = new Formula(formulaExpression);
+      }
+
+      final ReportFormulaContext context =
+          new ReportFormulaContext(getFormulaContext(), getDataRow());
+      context.setDeclaringElement(getRuntime().getDeclaringParent());
+      try
+      {
+        compiledFormula.initialize(context);
+        return compiledFormula.evaluate();
+      }
+      finally
+      {
+        context.setDeclaringElement(null);
+        context.setDataRow(null);
+      }
+    }
+    catch (Exception e)
+    {
+      DebugLog.log("Failed to compute the regular value.", e);
+      return null;
+    }
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+    try
+    {
+      if (initialized == false)
+      {
+        initialized = true;
+        return computeInitialValue();
+      }
+      return computeRegularValue();
+    }
+    catch (Exception e)
+    {
+      return null;
+    }
+  }
+
+  /**
+   * Clones the expression, expression should be reinitialized after the
+   * cloning. <P> Expression maintain no state, cloning is done at the beginning
+   * of the report processing to disconnect the used expression from any other
+   * object space.
+   *
+   * @return A clone of this expression.
+   * @throws CloneNotSupportedException this should never happen.
+   */
+  public Object clone() throws CloneNotSupportedException
+  {
+    final FormulaFunction o = (FormulaFunction) super.clone();
+    if (compiledFormula != null)
+    {
+      o.compiledFormula = (Formula) compiledFormula.clone();
+    }
+    return o;
+  }
+
+
+  /**
+   * Returns the compiled formula. The formula is not connected to a formula
+   * context.
+   *
+   * @return the formula.
+   * @throws ParseException if the formula contains syntax errors.
+   */
+  public Formula getCompiledFormula()
+      throws ParseException
+  {
+    if (compiledFormula == null)
+    {
+      compiledFormula = new Formula(formulaExpression);
+    }
+    return compiledFormula;
+  }
+}
diff --git a/source/org/jfree/report/expressions/Function.java b/source/org/jfree/report/expressions/Function.java
new file mode 100644
index 0000000..7c5ca44
--- /dev/null
+++ b/source/org/jfree/report/expressions/Function.java
@@ -0,0 +1,59 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: Function.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataSourceException;
+
+/**
+ * The interface for report functions.  A report function separates the business
+ * logic from presentation of the result.
+ * <p/>
+ * Since JFreeReport 0.9 functions are considered immutable. During the
+ * advancement process, the function returns a new instance with the updated
+ * state.
+ *
+ * @author Thomas Morgner
+ */
+public interface Function extends Expression
+{
+  /**
+   * When the advance method is called, the function is asked to perform the
+   * next step of its computation.
+   * <p/>
+   * The original function must not be altered during that step (or more
+   * correctly, calling advance on the original expression again must not return
+   * a different result).
+   *
+   * @return a copy of the function containing the new state.
+   */
+  public Function advance() throws DataSourceException;
+}
diff --git a/source/org/jfree/report/expressions/ProxyExpressionRuntime.java b/source/org/jfree/report/expressions/ProxyExpressionRuntime.java
new file mode 100644
index 0000000..7bc82c6
--- /dev/null
+++ b/source/org/jfree/report/expressions/ProxyExpressionRuntime.java
@@ -0,0 +1,107 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ProxyExpressionRuntime.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.ReportData;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 22.04.2006, 14:17:54
+ *
+ * @author Thomas Morgner
+ */
+public class ProxyExpressionRuntime implements ExpressionRuntime
+{
+  private ExpressionRuntime parent;
+
+  public ProxyExpressionRuntime(final ExpressionRuntime parent)
+  {
+    if (parent == null)
+    {
+      throw new NullPointerException();
+    }
+    this.parent = parent;
+  }
+
+  /**
+   * Returns the datarow.
+   *
+   * @return
+   */
+  public DataRow getDataRow()
+  {
+    return parent.getDataRow();
+  }
+
+  public Configuration getConfiguration()
+  {
+    return parent.getConfiguration();
+  }
+
+  public ResourceBundleFactory getResourceBundleFactory()
+  {
+    return parent.getResourceBundleFactory();
+  }
+
+  /**
+   * Returns the report data used in this section. If subreports are used, this
+   * does not reflect the complete report data.
+   * <p/>
+   * All access to the report data must be properly synchronized. Failure to do
+   * so may result in funny results. Do not assume that the report data will be
+   * initialized on the current cursor positon.
+   *
+   * @return
+   */
+  public ReportData getData()
+  {
+    return parent.getData();
+  }
+
+  public int getCurrentRow()
+  {
+    return parent.getCurrentRow();
+  }
+
+  public Object getDeclaringParent()
+  {
+    return parent.getDeclaringParent();
+  }
+
+  public ReportContext getReportContext()
+  {
+    return parent.getReportContext();
+  }
+
+}
diff --git a/source/org/jfree/report/expressions/ReportFormulaContext.java b/source/org/jfree/report/expressions/ReportFormulaContext.java
new file mode 100644
index 0000000..e8c32d1
--- /dev/null
+++ b/source/org/jfree/report/expressions/ReportFormulaContext.java
@@ -0,0 +1,175 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportFormulaContext.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.expressions;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.pentaho.reporting.libraries.formula.ContextEvaluationException;
+import org.pentaho.reporting.libraries.formula.FormulaContext;
+import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue;
+import org.pentaho.reporting.libraries.formula.LocalizationContext;
+import org.pentaho.reporting.libraries.formula.function.FunctionRegistry;
+import org.pentaho.reporting.libraries.formula.operators.OperatorFactory;
+import org.pentaho.reporting.libraries.formula.typing.Type;
+import org.pentaho.reporting.libraries.formula.typing.TypeRegistry;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.AnyType;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.DateTimeType;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.NumberType;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType;
+
+/**
+ * Creation-Date: 29.11.2006, 17:54:33
+ *
+ * @author Thomas Morgner
+ */
+public class ReportFormulaContext implements FormulaContext
+{
+  private FormulaContext backend;
+  private DataRow dataRow;
+  private Object declaringElement;
+
+  public ReportFormulaContext(FormulaContext backend,
+                              DataRow dataRow)
+  {
+    this.backend = backend;
+    this.dataRow = dataRow;
+  }
+
+  public LocalizationContext getLocalizationContext()
+  {
+    return backend.getLocalizationContext();
+  }
+
+  public Configuration getConfiguration()
+  {
+    return backend.getConfiguration();
+  }
+
+  public FunctionRegistry getFunctionRegistry()
+  {
+    return backend.getFunctionRegistry();
+  }
+
+  public TypeRegistry getTypeRegistry()
+  {
+    return backend.getTypeRegistry();
+  }
+
+  public OperatorFactory getOperatorFactory()
+  {
+    return backend.getOperatorFactory();
+  }
+
+  public boolean isReferenceDirty(Object name) throws ContextEvaluationException
+  {
+    try
+    {
+      final DataFlags flags = dataRow.getFlags(String.valueOf(name));
+      if (flags == null)
+      {
+        throw new ContextEvaluationException
+            (new LibFormulaErrorValue(LibFormulaErrorValue.ERROR_REFERENCE_NOT_RESOLVABLE));
+      }
+      return flags.isChanged();
+    }
+    catch (Exception e)
+    {
+      throw new ContextEvaluationException
+          (new LibFormulaErrorValue(LibFormulaErrorValue.ERROR_REFERENCE_NOT_RESOLVABLE));
+    }
+  }
+
+  public Type resolveReferenceType(Object name)
+  {
+    try
+    {
+      final DataFlags flags = dataRow.getFlags(String.valueOf(name));
+      if (flags != null)
+      {
+        if (flags.isDate())
+        {
+          return DateTimeType.DATE_TYPE;
+        }
+        if (flags.isNumeric())
+        {
+          return NumberType.GENERIC_NUMBER;
+        }
+        return TextType.TYPE;
+      }
+    }
+    catch (DataSourceException ex)
+    {
+    }
+    return AnyType.TYPE;
+  }
+
+  public Object resolveReference(Object name) throws ContextEvaluationException
+  {
+    if (name == null)
+    {
+      throw new NullPointerException();
+    }
+    try
+    {
+      return dataRow.get(String.valueOf(name));
+    }
+    catch (DataSourceException e)
+    {
+      DebugLog.log("Error while resolving formula reference: ", e);
+      throw new ContextEvaluationException(new LibFormulaErrorValue
+          (LibFormulaErrorValue.ERROR_REFERENCE_NOT_RESOLVABLE));
+    }
+  }
+
+  public DataRow getDataRow()
+  {
+    return dataRow;
+  }
+
+  public void setDataRow(final DataRow dataRow)
+  {
+    this.dataRow = dataRow;
+  }
+
+  public Object getDeclaringElement()
+  {
+    return declaringElement;
+  }
+
+  public void setDeclaringElement(final Object declaringElement)
+  {
+    this.declaringElement = declaringElement;
+  }
+}
diff --git a/source/org/jfree/report/expressions/formula/sys/Attr-Function.properties b/source/org/jfree/report/expressions/formula/sys/Attr-Function.properties
new file mode 100644
index 0000000..7a90421
--- /dev/null
+++ b/source/org/jfree/report/expressions/formula/sys/Attr-Function.properties
@@ -0,0 +1,7 @@
+display-name=ATTR
+description=Queries an static attribute from the declaring parent.
+parameter.0.description=Attribute Namespace
+parameter.0.display-name=Attribute Namespace
+parameter.1.description=Attribute Name
+parameter.1.display-name=Attribute Name
+
diff --git a/source/org/jfree/report/expressions/formula/sys/AttrFunction.java b/source/org/jfree/report/expressions/formula/sys/AttrFunction.java
new file mode 100644
index 0000000..22daf71
--- /dev/null
+++ b/source/org/jfree/report/expressions/formula/sys/AttrFunction.java
@@ -0,0 +1,100 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AttrFunction.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.expressions.formula.sys;
+
+import org.jfree.report.expressions.ReportFormulaContext;
+import org.jfree.report.structure.Element;
+import org.pentaho.reporting.libraries.formula.function.Function;
+import org.pentaho.reporting.libraries.formula.function.ParameterCallback;
+import org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair;
+import org.pentaho.reporting.libraries.formula.FormulaContext;
+import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue;
+import org.pentaho.reporting.libraries.formula.EvaluationException;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.ErrorType;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.AnyType;
+
+/**
+ * Creation-Date: 24.11.2006, 13:02:41
+ *
+ * @author Thomas Morgner
+ */
+public class AttrFunction implements Function
+{
+  public AttrFunction()
+  {
+  }
+
+  public String getCanonicalName()
+  {
+    return "ATTR";
+  }
+
+  public TypeValuePair evaluate(FormulaContext context,
+                                ParameterCallback parameters)
+      throws EvaluationException
+  {
+    // we expect strings and will check, whether the reference for theses
+    // strings is dirty.
+    if (context instanceof ReportFormulaContext == false)
+    {
+      return new TypeValuePair(ErrorType.TYPE, new LibFormulaErrorValue
+          (LibFormulaErrorValue.ERROR_REFERENCE_NOT_RESOLVABLE));
+    }
+
+    final ReportFormulaContext reportFormulaContext =
+        (ReportFormulaContext) context;
+    Object declaringElement = reportFormulaContext.getDeclaringElement();
+    if (declaringElement instanceof Element == false)
+    {
+      return new TypeValuePair(ErrorType.TYPE, new LibFormulaErrorValue
+          (LibFormulaErrorValue.ERROR_REFERENCE_NOT_RESOLVABLE));
+    }
+
+    final Element element = (Element) declaringElement;
+
+    if (parameters.getParameterCount() == 1)
+    {
+      final String value = (String) parameters.getValue(0);
+      return new TypeValuePair(AnyType.TYPE, element.getAttribute(value));
+    }
+    else if (parameters.getParameterCount() == 2)
+    {
+      final String namespace = (String) parameters.getValue(0);
+      final String attrName = (String) parameters.getValue(1);
+      return new TypeValuePair(AnyType.TYPE,
+          element.getAttribute(namespace, attrName));
+    }
+    return new TypeValuePair(ErrorType.TYPE, new LibFormulaErrorValue
+        (LibFormulaErrorValue.ERROR_INVALID_ARGUMENT));
+  }
+
+}
diff --git a/source/org/jfree/report/expressions/formula/sys/AttrFunctionDescription.java b/source/org/jfree/report/expressions/formula/sys/AttrFunctionDescription.java
new file mode 100644
index 0000000..05d4e62
--- /dev/null
+++ b/source/org/jfree/report/expressions/formula/sys/AttrFunctionDescription.java
@@ -0,0 +1,108 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AttrFunctionDescription.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.expressions.formula.sys;
+
+import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription;
+import org.pentaho.reporting.libraries.formula.function.FunctionCategory;
+import org.pentaho.reporting.libraries.formula.function.userdefined.UserDefinedFunctionCategory;
+import org.pentaho.reporting.libraries.formula.typing.Type;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType;
+import org.pentaho.reporting.libraries.formula.typing.coretypes.AnyType;
+
+
+/**
+ * Creation-Date: 29.11.2006, 18:04:18
+ *
+ * @author Thomas Morgner
+ */
+public class AttrFunctionDescription extends AbstractFunctionDescription
+{
+  public AttrFunctionDescription()
+  {
+    super("ATTR", "org.jfree.report.expressions.formula.sys.Attr-Function");
+  }
+
+  public int getParameterCount()
+  {
+    return 1;
+  }
+
+  public boolean isInfiniteParameterCount()
+  {
+    return false;
+  }
+
+  public Type getParameterType(int position)
+  {
+    return TextType.TYPE;
+  }
+
+  public Type getValueType()
+  {
+    return AnyType.TYPE;
+  }
+
+  /**
+   * Defines, whether the parameter at the given position is mandatory. A
+   * mandatory parameter must be filled in, while optional parameters need not
+   * to be filled in.
+   *
+   * @return
+   */
+  public boolean isParameterMandatory(int position)
+  {
+    if (position == 0)
+    {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Returns the default value for an optional parameter. If the value returned
+   * here is null, then this either means, that the parameter is mandatory or
+   * that the default value is computed by the expression itself.
+   *
+   * @param position
+   * @return
+   */
+  public Object getDefaultValue(int position)
+  {
+    return null;
+  }
+
+  public FunctionCategory getCategory()
+  {
+    return UserDefinedFunctionCategory.CATEGORY;
+  }
+
+}
diff --git a/source/org/jfree/report/expressions/sys/GetValueExpression.java b/source/org/jfree/report/expressions/sys/GetValueExpression.java
new file mode 100644
index 0000000..0cb71fa
--- /dev/null
+++ b/source/org/jfree/report/expressions/sys/GetValueExpression.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GetValueExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.expressions.sys;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.expressions.AbstractExpression;
+
+/**
+ * Creation-Date: 02.12.2006, 22:07:57
+ *
+ * @author Thomas Morgner
+ */
+public class GetValueExpression extends AbstractExpression
+{
+  private String field;
+
+  public GetValueExpression()
+  {
+  }
+
+  public GetValueExpression(final String field)
+  {
+    this.field = field;
+  }
+
+  public String getField()
+  {
+    return field;
+  }
+
+  public void setField(final String field)
+  {
+    this.field = field;
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+    return getDataRow().get(getField());
+  }
+}
diff --git a/source/org/jfree/report/expressions/sys/GroupByExpression.java b/source/org/jfree/report/expressions/sys/GroupByExpression.java
new file mode 100644
index 0000000..cf38347
--- /dev/null
+++ b/source/org/jfree/report/expressions/sys/GroupByExpression.java
@@ -0,0 +1,130 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GroupByExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions.sys;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.expressions.AbstractExpression;
+
+/**
+ * Creation-Date: 08.10.2006, 16:28:37
+ *
+ * @author Thomas Morgner
+ */
+public class GroupByExpression extends AbstractExpression
+{
+  private ArrayList fields;
+  private transient String[] fieldsCached;
+
+  public GroupByExpression()
+  {
+    this.fields = new ArrayList();
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+    final DataRow dr = getDataRow();
+    final String[] columns = getField();
+    for (int i = 0; i < columns.length; i++)
+    {
+      String column = columns[i];
+      DataFlags df = dr.getFlags(column);
+      if (df == null)
+      {
+        // invalid column or invalid implementation ...
+        continue;
+      }
+      if (df.isChanged())
+      {
+        //Log.debug ("Field: " + df.getName() + " has changed to " + df.getValue());
+        return Boolean.TRUE;
+      }
+    }
+    return Boolean.FALSE;
+  }
+
+  public void setField (final int index, final String field)
+  {
+    if (fields.size() == index)
+    {
+      fields.add(field);
+    }
+    else
+    {
+      fields.set(index, field);
+    }
+    fieldsCached = null;
+  }
+
+  public String getField (final int index)
+  {
+    return (String) fields.get(index);
+  }
+
+  public int getFieldCount ()
+  {
+    return fields.size();
+  }
+
+  public String[] getField ()
+  {
+    if (fieldsCached == null)
+    {
+      fieldsCached = (String[]) fields.toArray(new String[fields.size()]);
+    }
+    return (String[]) fieldsCached.clone();
+  }
+
+  public void setField (final String[] fields)
+  {
+    this.fields.clear();
+    this.fields.addAll(Arrays.asList(fields));
+    this.fieldsCached = (String[]) fields.clone();
+  }
+
+  public Object clone() throws CloneNotSupportedException
+  {
+    GroupByExpression co = (GroupByExpression) super.clone();
+    co.fields = (ArrayList) fields.clone();
+    co.fieldsCached = fieldsCached;
+    return co;
+  }
+}
diff --git a/source/org/jfree/report/expressions/sys/IsEmptyDataExpression.java b/source/org/jfree/report/expressions/sys/IsEmptyDataExpression.java
new file mode 100644
index 0000000..c5f7afa
--- /dev/null
+++ b/source/org/jfree/report/expressions/sys/IsEmptyDataExpression.java
@@ -0,0 +1,82 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IsEmptyDataExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions.sys;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportData;
+import org.jfree.report.expressions.AbstractExpression;
+import org.jfree.report.expressions.ExpressionRuntime;
+
+/**
+ * Creation-Date: 31.01.2006, 18:55:09
+ *
+ * @author Thomas Morgner
+ */
+public class IsEmptyDataExpression extends AbstractExpression
+{
+  public IsEmptyDataExpression()
+  {
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+
+    final ExpressionRuntime runtime = getRuntime();
+    if (runtime == null)
+    {
+      return null;
+    }
+
+    final ReportData data = runtime.getData();
+    if (data == null)
+    {
+      return null;
+    }
+    synchronized(data)
+    {
+      if (data.getCursorPosition() > 0)
+      {
+        return Boolean.FALSE;
+      }
+      if (data.isAdvanceable() == false)
+      {
+        return Boolean.TRUE;
+      }
+      return Boolean.FALSE;
+    }
+  }
+}
diff --git a/source/org/jfree/report/expressions/sys/IsEmptyExpression.java b/source/org/jfree/report/expressions/sys/IsEmptyExpression.java
new file mode 100644
index 0000000..1e04ba1
--- /dev/null
+++ b/source/org/jfree/report/expressions/sys/IsEmptyExpression.java
@@ -0,0 +1,91 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IsEmptyExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions.sys;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.expressions.AbstractExpression;
+
+/**
+ * Creation-Date: 27.01.2006, 20:42:19
+ *
+ * @author Thomas Morgner
+ */
+public class IsEmptyExpression extends AbstractExpression
+{
+  private Object value;
+
+  public IsEmptyExpression()
+  {
+  }
+
+  public Object getValue()
+  {
+    return value;
+  }
+
+  public void setValue(final Object value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+    if (value == null)
+    {
+      return Boolean.TRUE;
+    }
+    if (value instanceof String)
+    {
+      String s = (String) value;
+      if (s.trim().length() == 0)
+      {
+        return Boolean.TRUE;
+      }
+      return Boolean.FALSE;
+    }
+    if (value instanceof Number)
+    {
+      Number n = (Number) value;
+      if (n.intValue() == 0)
+      {
+        return Boolean.TRUE;
+      }
+      return Boolean.FALSE;
+    }
+    return Boolean.FALSE;
+  }
+}
diff --git a/source/org/jfree/report/expressions/sys/IsEndOfDataExpression.java b/source/org/jfree/report/expressions/sys/IsEndOfDataExpression.java
new file mode 100644
index 0000000..de1e1ca
--- /dev/null
+++ b/source/org/jfree/report/expressions/sys/IsEndOfDataExpression.java
@@ -0,0 +1,66 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IsEndOfDataExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions.sys;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportData;
+import org.jfree.report.expressions.AbstractExpression;
+
+/**
+ * Creation-Date: 19.02.2006, 19:15:45
+ *
+ * @author Thomas Morgner
+ */
+public class IsEndOfDataExpression extends AbstractExpression
+{
+  public IsEndOfDataExpression()
+  {
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+    ReportData data = getRuntime().getData();
+    synchronized(data)
+    {
+      if (data.isAdvanceable())
+      {
+        return Boolean.TRUE;
+      }
+      return Boolean.FALSE;
+    }
+  }
+}
diff --git a/source/org/jfree/report/expressions/sys/IsExportTypeExpression.java b/source/org/jfree/report/expressions/sys/IsExportTypeExpression.java
new file mode 100644
index 0000000..32737b1
--- /dev/null
+++ b/source/org/jfree/report/expressions/sys/IsExportTypeExpression.java
@@ -0,0 +1,80 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IsExportTypeExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions.sys;
+
+import org.jfree.report.expressions.AbstractExpression;
+import org.jfree.report.expressions.ExpressionException;
+import org.jfree.report.flow.ReportContext;
+
+
+/**
+ * Tests, whether a certain export type is currently used.
+ *
+ * @author Thomas Morgner
+ */
+public class IsExportTypeExpression extends AbstractExpression
+{
+  private String exportType;
+
+  public IsExportTypeExpression()
+  {
+  }
+
+  public String getExportType()
+  {
+    return exportType;
+  }
+
+  public void setExportType(final String exportType)
+  {
+    this.exportType = exportType;
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws ExpressionException
+  {
+    if (exportType == null)
+    {
+      return Boolean.FALSE;
+    }
+    final ReportContext reportContext = getRuntime().getReportContext();
+    if (reportContext.getExportDescriptor().startsWith(exportType))
+    {
+      return Boolean.TRUE;
+    }
+    return Boolean.FALSE;
+  }
+}
diff --git a/source/org/jfree/report/expressions/sys/IsNullExpression.java b/source/org/jfree/report/expressions/sys/IsNullExpression.java
new file mode 100644
index 0000000..fc1540f
--- /dev/null
+++ b/source/org/jfree/report/expressions/sys/IsNullExpression.java
@@ -0,0 +1,73 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IsNullExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.expressions.sys;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.expressions.AbstractExpression;
+
+/**
+ * Creation-Date: 27.01.2006, 20:42:19
+ *
+ * @author Thomas Morgner
+ */
+public class IsNullExpression extends AbstractExpression
+{
+  private Object value;
+
+  public IsNullExpression()
+  {
+  }
+
+  public Object getValue()
+  {
+    return value;
+  }
+
+  public void setValue(final Object value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Return the current expression value. <P> The value depends (obviously) on
+   * the expression implementation.
+   *
+   * @return the value of the function.
+   */
+  public Object computeValue() throws DataSourceException
+  {
+    if (value == null)
+    {
+      return Boolean.TRUE;
+    }
+    return Boolean.FALSE;
+  }
+}
diff --git a/source/org/jfree/report/flow/AbstractReportProcessor.java b/source/org/jfree/report/flow/AbstractReportProcessor.java
new file mode 100644
index 0000000..3045d65
--- /dev/null
+++ b/source/org/jfree/report/flow/AbstractReportProcessor.java
@@ -0,0 +1,110 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.data.ReportContextImpl;
+import org.jfree.report.flow.layoutprocessor.DefaultLayoutControllerFactory;
+import org.jfree.report.flow.layoutprocessor.LayoutController;
+import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory;
+import org.pentaho.reporting.libraries.formula.DefaultFormulaContext;
+
+/**
+ * Creation-Date: 10.11.2006, 16:07:26
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractReportProcessor implements ReportProcessor
+{
+  protected AbstractReportProcessor()
+  {
+  }
+
+  protected void processReportRun
+      (final ReportJob job,
+       final ReportTarget target)
+      throws ReportDataFactoryException,
+      DataSourceException, ReportProcessingException
+  {
+    synchronized (job)
+    {
+      final ReportContext context = createReportContext(job, target);
+      final LayoutControllerFactory layoutFactory =
+          context.getLayoutControllerFactory();
+      // we have the data and we have our position inside the report.
+      // lets generate something ...
+      final FlowController flowController = createFlowControler(context, job);
+
+      LayoutController layoutController =
+          layoutFactory.create(flowController, job.getReportStructureRoot(), null);
+
+      while (layoutController.isAdvanceable())
+      {
+        layoutController = layoutController.advance(target);
+        while (layoutController.isAdvanceable() == false &&
+               layoutController.getParent() != null)
+        {
+          final LayoutController parent = layoutController.getParent();
+          target.commit();
+          layoutController = parent.join(layoutController.getFlowController());
+        }
+      }
+      target.commit();
+    }
+  }
+
+  protected ReportContext createReportContext (final ReportJob job,
+                                               final ReportTarget target)
+  {
+    final ReportContextImpl context = new ReportContextImpl();
+    context.setExportDescriptor(target.getExportDescriptor());
+    final DefaultLayoutControllerFactory lcf = new DefaultLayoutControllerFactory();
+    lcf.initialize(job);
+    context.setLayoutControllerFactory(lcf);
+
+    final DefaultFormulaContext formulaContext = new DefaultFormulaContext();
+    context.setFormulaContext(formulaContext);
+    context.setResourceBundleFactory(job.getResourceBundleFactory());
+    context.setReportStructureRoot(job.getReportStructureRoot());
+    return context;
+  }
+
+  protected FlowController createFlowControler(final ReportContext context,
+                                               final ReportJob job)
+          throws DataSourceException
+  {
+    return new DefaultFlowController(context, job);
+  }
+
+}
diff --git a/source/org/jfree/report/flow/AbstractReportTarget.java b/source/org/jfree/report/flow/AbstractReportTarget.java
new file mode 100644
index 0000000..74866f1
--- /dev/null
+++ b/source/org/jfree/report/flow/AbstractReportTarget.java
@@ -0,0 +1,94 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.namespace.Namespaces;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+
+/**
+ * Creation-Date: 03.07.2006, 16:31:12
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractReportTarget implements ReportTarget
+{
+  private ResourceManager resourceManager;
+  private ResourceKey baseResource;
+  private ReportJob reportJob;
+
+  protected AbstractReportTarget(final ReportJob reportJob,
+                                 final ResourceManager resourceManager,
+                                 final ResourceKey baseResource)
+  {
+    if (reportJob == null)
+    {
+      throw new NullPointerException();
+    }
+    this.baseResource = baseResource;
+    this.reportJob = reportJob;
+
+    if (resourceManager == null)
+    {
+      this.resourceManager = new ResourceManager();
+      this.resourceManager.registerDefaults();
+    }
+    else
+    {
+      this.resourceManager = resourceManager;
+    }
+  }
+
+  protected NamespaceDefinition[] createDefaultNameSpaces()
+  {
+    return Namespaces.createFromConfig
+        (reportJob.getConfiguration(), "org.jfree.report.namespaces.",
+            getResourceManager());
+  }
+
+  protected ResourceManager getResourceManager()
+  {
+    return resourceManager;
+  }
+
+  protected ResourceKey getBaseResource()
+  {
+    return baseResource;
+  }
+
+  public ReportJob getReportJob()
+  {
+    return reportJob;
+  }
+
+
+}
diff --git a/source/org/jfree/report/flow/DefaultFlowController.java b/source/org/jfree/report/flow/DefaultFlowController.java
new file mode 100644
index 0000000..33558d2
--- /dev/null
+++ b/source/org/jfree/report/flow/DefaultFlowController.java
@@ -0,0 +1,364 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultFlowController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.data.CachingReportDataFactory;
+import org.jfree.report.data.ExpressionDataRow;
+import org.jfree.report.data.ExpressionSlot;
+import org.jfree.report.data.GlobalMasterRow;
+import org.jfree.report.data.ImportedVariablesDataRow;
+import org.jfree.report.data.ParameterDataRow;
+import org.jfree.report.data.PrecomputedValueRegistry;
+import org.jfree.report.data.PrecomputedValueRegistryBuilder;
+import org.jfree.report.data.ReportDataRow;
+import org.jfree.report.util.IntegerCache;
+import org.pentaho.reporting.libraries.base.util.FastStack;
+
+/**
+ * Creation-Date: 20.02.2006, 15:30:21
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultFlowController implements FlowController
+{
+  private static class ReportDataContext
+  {
+    private FastStack markStack;
+    private boolean advanceRequested;
+
+    public ReportDataContext(final FastStack markStack,
+                             boolean advanceRequested)
+    {
+      this.advanceRequested = advanceRequested;
+      this.markStack = markStack;
+    }
+
+    public boolean isAdvanceRequested()
+    {
+      return advanceRequested;
+    }
+
+    public FastStack getMarkStack()
+    {
+      return markStack;
+    }
+  }
+
+  private CachingReportDataFactory reportDataFactory;
+  private GlobalMasterRow dataRow;
+  private boolean advanceRequested;
+  private FastStack reportStack;
+  private FastStack markStack;
+  private FastStack expressionsStack;
+  private String exportDescriptor;
+  private ReportContext reportContext;
+  private ReportJob job;
+  private PrecomputedValueRegistry precomputedValueRegistry;
+
+  public DefaultFlowController(final ReportContext reportContext,
+                               final ReportJob job)
+      throws DataSourceException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+    if (reportContext == null)
+    {
+      throw new NullPointerException();
+    }
+
+    this.reportContext = reportContext;
+    this.job = job;
+    this.exportDescriptor = reportContext.getExportDescriptor();
+    this.reportDataFactory = new CachingReportDataFactory(job.getDataFactory());
+    this.reportStack = new FastStack();
+    this.markStack = new FastStack();
+    this.expressionsStack = new FastStack();
+    this.advanceRequested = false;
+    this.dataRow = GlobalMasterRow.createReportRow(reportContext);
+    this.dataRow.setParameterDataRow(new ParameterDataRow(job.getParameters()));
+    this.precomputedValueRegistry = new PrecomputedValueRegistryBuilder();
+  }
+
+  protected DefaultFlowController(final DefaultFlowController fc,
+                                  final GlobalMasterRow dataRow)
+  {
+    this.reportContext = fc.reportContext;
+    this.job = fc.job;
+    this.exportDescriptor = fc.exportDescriptor;
+    this.reportDataFactory = fc.reportDataFactory;
+    this.reportStack = (FastStack) fc.reportStack.clone();
+    this.markStack = (FastStack) fc.markStack.clone();
+    this.expressionsStack = (FastStack) fc.expressionsStack.clone();
+    this.advanceRequested = fc.advanceRequested;
+    this.dataRow = dataRow;
+    this.precomputedValueRegistry = fc.precomputedValueRegistry;
+  }
+
+
+  public FlowController performOperation(FlowControlOperation operation)
+      throws DataSourceException
+  {
+    if (operation == FlowControlOperation.ADVANCE)
+    {
+      if (dataRow.isAdvanceable() && advanceRequested == false)
+      {
+        DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+        fc.advanceRequested = true;
+        return fc;
+      }
+    }
+    else if (operation == FlowControlOperation.MARK)
+    {
+      DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+      fc.markStack.push(dataRow);
+      return fc;
+    }
+    else if (operation == FlowControlOperation.RECALL)
+    {
+      if (markStack.isEmpty())
+      {
+        return this;
+      }
+
+      DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+      fc.dataRow = (GlobalMasterRow) fc.markStack.pop();
+      fc.advanceRequested = false;
+      return fc;
+    }
+    else if (operation == FlowControlOperation.DONE)
+    {
+      // do not change the current data row..
+
+      DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+      fc.markStack.pop();
+      return fc;
+    }
+    else if (operation == FlowControlOperation.COMMIT)
+    {
+      if (isAdvanceRequested())
+      {
+        DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+        fc.dataRow = dataRow.advance();
+        fc.advanceRequested = false;
+        return fc;
+      }
+    }
+    return this;
+  }
+
+  public GlobalMasterRow getMasterRow()
+  {
+    return dataRow;
+  }
+
+
+  public boolean isAdvanceRequested()
+  {
+    return advanceRequested;
+  }
+
+  /**
+   * This should be called only once per report processing. A JFreeReport object
+   * defines the global master report - all other reports are subreport
+   * instances.
+   * <p/>
+   * The global master report receives its parameter set from the
+   * Job-Definition, while subreports will read their parameters from the
+   * current datarow state.
+   *
+   * @param query
+   * @return
+   * @throws ReportDataFactoryException
+   * @throws DataSourceException
+   */
+  public FlowController performQuery(final String query)
+      throws ReportDataFactoryException, DataSourceException
+  {
+
+    final GlobalMasterRow masterRow =
+        GlobalMasterRow.createReportRow(dataRow, reportContext);
+    masterRow.setParameterDataRow(new ParameterDataRow
+        (getReportJob().getParameters()));
+
+    masterRow.setReportDataRow(ReportDataRow.createDataRow
+        (reportDataFactory, query, dataRow.getGlobalView()));
+
+    final DefaultFlowController fc = new DefaultFlowController(this, masterRow);
+    fc.reportStack.push(new ReportDataContext(fc.markStack, advanceRequested));
+    fc.markStack = new FastStack();
+    fc.dataRow = masterRow;
+    return fc;
+  }
+
+  public FlowController performSubReportQuery(final String query,
+                                              final ParameterMapping[] inputParameters,
+                                              final ParameterMapping[] outputParameters
+                                              )
+      throws ReportDataFactoryException, DataSourceException
+  {
+    final GlobalMasterRow outerRow = dataRow.derive();
+
+    // create a view for the parameters of the report ...
+    final GlobalMasterRow masterRow =
+        GlobalMasterRow.createReportRow(outerRow, reportContext);
+
+    masterRow.setParameterDataRow
+        (new ParameterDataRow(inputParameters, outerRow.getGlobalView()));
+
+    // perform the query ...
+    // add the resultset ...
+    masterRow.setReportDataRow(ReportDataRow.createDataRow
+        (reportDataFactory, query, masterRow.getGlobalView()));
+
+    if (outputParameters == null)
+    {
+      outerRow.setExportedDataRow(new ImportedVariablesDataRow(masterRow));
+    }
+    else
+    {
+      // check and rebuild the parameter mapping from the inner to the outer
+      // context. Only deep-traversal expressions will be able to see these
+      // values (unless they have been defined as local variables).
+      outerRow.setExportedDataRow(new ImportedVariablesDataRow
+          (masterRow, outputParameters));
+    }
+
+    DefaultFlowController fc = new DefaultFlowController(this, masterRow);
+    fc.reportStack.push(new ReportDataContext(fc.markStack, advanceRequested));
+    fc.markStack = new FastStack();
+    fc.dataRow = masterRow;
+    return fc;
+  }
+
+  public FlowController activateExpressions(final ExpressionSlot[] expressions)
+      throws DataSourceException
+  {
+    if (expressions.length == 0)
+    {
+      DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+      fc.expressionsStack.push(IntegerCache.getInteger(0));
+      return fc;
+    }
+
+    final GlobalMasterRow dataRow = this.dataRow.derive();
+    final ExpressionDataRow edr = dataRow.getExpressionDataRow();
+    edr.pushExpressions(expressions);
+
+    DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+    final Integer exCount = IntegerCache.getInteger(expressions.length);
+    fc.expressionsStack.push(exCount);
+    return fc;
+  }
+
+  public FlowController deactivateExpressions() throws DataSourceException
+  {
+    final Integer counter = (Integer) this.expressionsStack.peek();
+    final int counterRaw = counter.intValue();
+    if (counterRaw == 0)
+    {
+      DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+      fc.expressionsStack.pop();
+      return fc;
+    }
+
+    final GlobalMasterRow dataRow = this.dataRow.derive();
+    final ExpressionDataRow edr = dataRow.getExpressionDataRow();
+
+    DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+    fc.expressionsStack.pop();
+    edr.popExpressions(counterRaw);
+    return fc;
+  }
+
+  public FlowController performReturnFromQuery() throws DataSourceException
+  {
+    DefaultFlowController fc = new DefaultFlowController(this, dataRow);
+    final ReportDataRow reportDataRow = dataRow.getReportDataRow();
+    if (reportDataRow == null)
+    {
+      return this;
+    }
+    // We dont close the report data, as some previously saved states may
+    // still reference it. (The caching report data factory takes care of
+    // that later.)
+
+    ReportDataContext context = (ReportDataContext) fc.reportStack.pop();
+    fc.dataRow = dataRow.getParentDataRow();
+    fc.dataRow = fc.dataRow.derive();
+    fc.dataRow.setExportedDataRow(null);
+    fc.markStack = context.getMarkStack();
+    fc.advanceRequested = context.isAdvanceRequested();
+    return fc;
+  }
+
+  public ReportJob getReportJob()
+  {
+    return job;
+  }
+
+  public String getExportDescriptor()
+  {
+    return exportDescriptor;
+  }
+
+  public ReportContext getReportContext()
+  {
+    return reportContext;
+  }
+
+  /**
+   * Returns the current expression slots of all currently active expressions.
+   *
+   * @return
+   * @throws org.jfree.report.DataSourceException
+   *
+   */
+  public ExpressionSlot[] getActiveExpressions() throws DataSourceException
+  {
+    return dataRow.getExpressionDataRow().getSlots();
+  }
+
+  public FlowController createPrecomputeInstance() throws DataSourceException
+  {
+    final DefaultFlowController precompute = new DefaultFlowController(this, dataRow.derive());
+    precompute.precomputedValueRegistry = new PrecomputedValueRegistryBuilder();
+    return precompute;
+  }
+
+  public PrecomputedValueRegistry getPrecomputedValueRegistry()
+  {
+    return precomputedValueRegistry;
+  }
+}
diff --git a/source/org/jfree/report/flow/DefaultReportJob.java b/source/org/jfree/report/flow/DefaultReportJob.java
new file mode 100644
index 0000000..3f4e6fb
--- /dev/null
+++ b/source/org/jfree/report/flow/DefaultReportJob.java
@@ -0,0 +1,157 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultReportJob.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.i18n.DefaultResourceBundleFactory;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.jfree.report.util.ReportParameters;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+import org.pentaho.reporting.libraries.base.config.HierarchicalConfiguration;
+
+/**
+ * Creation-Date: 22.02.2006, 12:47:53
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultReportJob
+implements ReportJob
+{
+  private ReportStructureRoot report;
+  private ReportDataFactory dataFactory;
+  private ReportParameters parameters;
+  private ModifiableConfiguration configuration;
+  private ResourceBundleFactory resourceBundleFactory;
+  private String name;
+  //private PageFormat pageFormat;
+
+  public DefaultReportJob(final ReportStructureRoot report)
+  {
+    this.resourceBundleFactory = new DefaultResourceBundleFactory();
+    this.report = report;
+    final ReportDataFactory dataFactory = report.getDataFactory();
+    if (dataFactory != null)
+    {
+      this.dataFactory = dataFactory.derive();
+    }
+    this.parameters = new ReportParameters(report.getInputParameters());
+    this.configuration = new HierarchicalConfiguration(report.getConfiguration());
+  }
+
+  public ModifiableConfiguration getConfiguration()
+  {
+    return configuration;
+  }
+
+  public ReportParameters getParameters()
+  {
+    return parameters;
+  }
+
+  public ReportStructureRoot getReportStructureRoot()
+  {
+    return report;
+  }
+
+  public ReportDataFactory getDataFactory()
+  {
+    return dataFactory;
+  }
+
+  public void setDataFactory(final ReportDataFactory dataFactory)
+  {
+    this.dataFactory = dataFactory;
+  }
+
+  public Object clone() throws CloneNotSupportedException
+  {
+    DefaultReportJob job = (DefaultReportJob) super.clone();
+    if (dataFactory != null)
+    {
+      job.dataFactory = dataFactory.derive();
+    }
+    job.parameters = (ReportParameters) parameters.clone();
+    job.configuration = (ModifiableConfiguration) configuration.clone();
+    return job;
+  }
+
+  public ReportJob derive()
+  {
+    try
+    {
+      return (ReportJob) clone();
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new IllegalStateException
+          ("A report job should always be cloneable.");
+    }
+  }
+
+  public synchronized void close()
+  {
+    if (dataFactory != null)
+    {
+      dataFactory.close();
+    }
+  }
+
+  public ResourceBundleFactory getResourceBundleFactory()
+  {
+    return resourceBundleFactory;
+  }
+
+  public void setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
+  {
+    this.resourceBundleFactory = resourceBundleFactory;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+//
+//  public PageFormat getPageFormat()
+//  {
+//    return pageFormat;
+//  }
+//
+//  public void setPageFormat(PageFormat pageFormat)
+//  {
+//    this.pageFormat = pageFormat;
+//  }
+}
diff --git a/source/org/jfree/report/flow/EmptyReportTarget.java b/source/org/jfree/report/flow/EmptyReportTarget.java
new file mode 100644
index 0000000..a3426bf
--- /dev/null
+++ b/source/org/jfree/report/flow/EmptyReportTarget.java
@@ -0,0 +1,112 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: EmptyReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportProcessingException;
+
+/**
+ * This target does nothing.
+ *
+ * @author Thomas Morgner
+ */
+public class EmptyReportTarget implements ReportTarget
+{
+  private ReportJob job;
+  private String reportDescriptor;
+
+  public EmptyReportTarget(final ReportJob job,
+                           final String reportDescriptor)
+  {
+    this.job = job;
+    this.reportDescriptor = reportDescriptor;
+  }
+
+  public void startReport(ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void startElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void processText(String text)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void processContent(final DataFlags value)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void endElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void endReport(ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public NamespaceDefinition getNamespaceByUri(String uri)
+  {
+    return null;
+  }
+
+  public ReportJob getReportJob()
+  {
+    return job;
+  }
+
+  public String getExportDescriptor()
+  {
+    return reportDescriptor;
+  }
+
+  public void commit() throws ReportProcessingException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/flow/FlowControlOperation.java b/source/org/jfree/report/flow/FlowControlOperation.java
new file mode 100644
index 0000000..2b51d52
--- /dev/null
+++ b/source/org/jfree/report/flow/FlowControlOperation.java
@@ -0,0 +1,119 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FlowControlOperation.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+/**
+ * These objects define, how the iteration over the report definition affects
+ * the data source.
+ *
+ * @author Thomas Morgner
+ */
+public class FlowControlOperation
+{
+  /**
+   * Stores the current datarow state for a later recall. Markpoints from different
+   * sources can be nested. Marking does not change the user datasource.
+   */
+  public static final FlowControlOperation MARK =
+          new FlowControlOperation("mark");
+  /**
+   * Requests that the datasource should be moved to the next row. An advance
+   * operation does not change the current cursor position. The cursor is not
+   * moved until a 'COMMIT' operation has been reached.
+   *
+   * Repeatable sections will perform an auto-commit based on the group in which
+   * they are in.
+   */
+  public static final FlowControlOperation ADVANCE =
+          new FlowControlOperation("advance");
+  /** Recalls a marked position. */
+  public static final FlowControlOperation RECALL =
+          new FlowControlOperation("recall");
+
+  /** Do nothing. */
+  public static final FlowControlOperation NO_OP =
+          new FlowControlOperation("no-op");
+
+  /**
+   * Finishes (and closes) the currently open context. If the last mark has been
+   * closed, the datasource is also closed.
+   * <p/>
+   * If all datasources have been closes, the empty datasource is used. This
+   * datasource cannot be closed (closing has no effect on it).
+   */
+  public static final FlowControlOperation DONE =
+          new FlowControlOperation("done");
+
+
+  private final String myName; // for debug only
+
+  /**
+   * A commit checks for an pending advance request and commites that request
+   * by moving the cursor of the currend datarow forward by one row.
+   */
+  public static final FlowControlOperation COMMIT =
+          new FlowControlOperation("commit");
+
+  protected FlowControlOperation(String name)
+  {
+    if (name == null)
+    {
+      throw new NullPointerException();
+    }
+    myName = name;
+  }
+
+  public String toString()
+  {
+    return myName;
+  }
+
+  public boolean equals(final Object o)
+  {
+    if (this == o)
+    {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass())
+    {
+      return false;
+    }
+
+    final FlowControlOperation that = (FlowControlOperation) o;
+
+    return myName.equals(that.myName);
+  }
+
+  public int hashCode()
+  {
+    return myName.hashCode();
+  }
+}
diff --git a/source/org/jfree/report/flow/FlowController.java b/source/org/jfree/report/flow/FlowController.java
new file mode 100644
index 0000000..a75442b
--- /dev/null
+++ b/source/org/jfree/report/flow/FlowController.java
@@ -0,0 +1,97 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FlowController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.data.ExpressionSlot;
+import org.jfree.report.data.GlobalMasterRow;
+import org.jfree.report.data.PrecomputedValueRegistry;
+
+/**
+ * A flow-controller is an immutable object. Whenever an method, that may change
+ * the internal state of the controller, is invoked, a new instance of the
+ * controller is returned.
+ *
+ * @author Thomas Morgner
+ */
+public interface FlowController
+{
+  public FlowController performOperation(FlowControlOperation operation)
+      throws DataSourceException;
+
+  public GlobalMasterRow getMasterRow();
+
+  public ReportContext getReportContext();
+
+  public String getExportDescriptor();
+
+  public boolean isAdvanceRequested();
+
+  public FlowController performQuery(final String query)
+      throws ReportDataFactoryException, DataSourceException;
+
+  public FlowController performSubReportQuery(final String query,
+                                              final ParameterMapping[] inputParameters,
+                                              final ParameterMapping[] outputParameters)
+      throws ReportDataFactoryException, DataSourceException;
+
+  /**
+   * Activates expressions that compute running values. This does not activate
+   * precomputed expressions.
+   *
+   * @param expressions
+   * @return
+   * @throws DataSourceException
+   */
+  public FlowController activateExpressions(final ExpressionSlot[] expressions)
+      throws DataSourceException;
+
+  /**
+   * Returns the current expression slots of all currently active expressions.
+   * (Maybe we should limit the access to the name and value of the expression
+   * instead?)
+   *
+   * @return
+   * @throws DataSourceException
+   */
+  public ExpressionSlot[] getActiveExpressions () throws DataSourceException;
+
+  public FlowController deactivateExpressions() throws DataSourceException;
+
+  public ReportJob getReportJob();
+
+  public FlowController performReturnFromQuery() throws DataSourceException;
+
+  public FlowController createPrecomputeInstance () throws DataSourceException;
+
+  public PrecomputedValueRegistry getPrecomputedValueRegistry();
+}
diff --git a/source/org/jfree/report/flow/LayoutExpressionRuntime.java b/source/org/jfree/report/flow/LayoutExpressionRuntime.java
new file mode 100644
index 0000000..655c71e
--- /dev/null
+++ b/source/org/jfree/report/flow/LayoutExpressionRuntime.java
@@ -0,0 +1,137 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LayoutExpressionRuntime.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.ReportData;
+import org.jfree.report.expressions.ExpressionRuntime;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 04.03.2006, 16:41:49
+ *
+ * @author Thomas Morgner
+ */
+public class LayoutExpressionRuntime implements ExpressionRuntime
+{
+  private DataRow dataRow;
+  private Configuration configuration;
+  private ReportData reportData;
+  private Object declaringParent;
+  private int currentRow;
+  private ReportContext reportContext;
+
+  public LayoutExpressionRuntime()
+  {
+  }
+
+  public void setCurrentRow(final int currentRow)
+  {
+    this.currentRow = currentRow;
+  }
+
+  public void setDataRow(final DataRow dataRow)
+  {
+    this.dataRow = dataRow;
+  }
+
+  public void setConfiguration(final Configuration configuration)
+  {
+    this.configuration = configuration;
+  }
+
+  public void setData(final ReportData reportData)
+  {
+    this.reportData = reportData;
+  }
+
+  public void setDeclaringParent(final Object declaringParent)
+  {
+    this.declaringParent = declaringParent;
+  }
+
+
+  /**
+   * Returns the datarow.
+   *
+   * @return
+   */
+  public DataRow getDataRow()
+  {
+    return dataRow;
+  }
+
+  public Configuration getConfiguration()
+  {
+    return configuration;
+  }
+
+  public ResourceBundleFactory getResourceBundleFactory()
+  {
+    return reportContext.getResourceBundleFactory();
+  }
+
+  /**
+   * Returns the report data used in this section. If subreports are used, this
+   * does not reflect the complete report data.
+   * <p/>
+   * All access to the report data must be properly synchronized. Failure to do
+   * so may result in funny results. Do not assume that the report data will be
+   * initialized on the current cursor positon.
+   *
+   * @return
+   */
+  public ReportData getData()
+  {
+    return reportData;
+  }
+
+  public Object getDeclaringParent()
+  {
+    return declaringParent;
+  }
+
+  public int getCurrentRow()
+  {
+    return currentRow;
+  }
+
+  public ReportContext getReportContext()
+  {
+    return reportContext;
+  }
+
+  public void setReportContext (final ReportContext reportContext)
+  {
+    this.reportContext = reportContext;
+  }
+}
diff --git a/source/org/jfree/report/flow/LibLayoutReportTarget.java b/source/org/jfree/report/flow/LibLayoutReportTarget.java
new file mode 100644
index 0000000..8c17a5f
--- /dev/null
+++ b/source/org/jfree/report/flow/LibLayoutReportTarget.java
@@ -0,0 +1,341 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LibLayoutReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jfree.layouting.LayoutProcess;
+import org.jfree.layouting.LayoutProcessState;
+import org.jfree.layouting.StateException;
+import org.jfree.layouting.input.style.StyleSheet;
+import org.jfree.layouting.layouter.context.DocumentContext;
+import org.jfree.layouting.layouter.feed.InputFeed;
+import org.jfree.layouting.layouter.feed.InputFeedException;
+import org.jfree.layouting.namespace.NamespaceCollection;
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.output.OutputProcessor;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.JFreeReport;
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.ReportProcessingException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+
+/**
+ * Creation-Date: 07.03.2006, 18:56:37
+ *
+ * @author Thomas Morgner
+ */
+public class LibLayoutReportTarget extends AbstractReportTarget
+  implements StatefullReportTarget
+{
+  protected static class LibLayoutReportTargetState
+      implements ReportTargetState
+  {
+    private LayoutProcessState layoutProcess;
+    private ReportJob reportJob;
+    private ResourceKey baseResourceKey;
+    private ResourceManager resourceManager;
+    private NamespaceCollection namespaceCollection;
+
+    public LibLayoutReportTargetState()
+    {
+    }
+
+    public void fill (final LibLayoutReportTarget target) throws StateException
+    {
+      this.layoutProcess = target.getLayoutProcess().saveState();
+      this.reportJob = target.getReportJob();
+      this.baseResourceKey = target.getBaseResource();
+      this.resourceManager = target.getResourceManager();
+      this.namespaceCollection = target.getNamespaces();
+    }
+
+    public ReportTarget restore(final OutputProcessor out)
+        throws StateException
+    {
+      final LayoutProcess layoutProcess = this.layoutProcess.restore(out);
+      return new LibLayoutReportTarget(reportJob,
+          baseResourceKey, resourceManager, layoutProcess, namespaceCollection);
+    }
+  }
+
+
+  private InputFeed feed;
+  private NamespaceCollection namespaces;
+  private LayoutProcess layoutProcess;
+
+  /**
+   *
+   * @param reportJob
+   * @param baseResourceKey  may be null, if the report has not gone through the parser
+   * @param resourceManager may be null, a generic resource manager will be built
+   * @param layoutProcess
+   */
+  public LibLayoutReportTarget (final ReportJob reportJob,
+                                final ResourceKey baseResourceKey,
+                                final ResourceManager resourceManager,
+                                final LayoutProcess layoutProcess)
+  {
+    super(reportJob, resourceManager, baseResourceKey);
+
+    if (layoutProcess == null)
+    {
+      throw new NullPointerException();
+    }
+    this.layoutProcess = layoutProcess;
+    this.feed = layoutProcess.getInputFeed();
+  }
+
+  protected LibLayoutReportTarget(final ReportJob reportJob,
+                               final ResourceKey baseResource,
+                               final ResourceManager resourceManager,
+                               final LayoutProcess layoutProcess,
+                               final NamespaceCollection namespaces)
+  {
+    this(reportJob, baseResource, resourceManager, layoutProcess);
+    this.namespaces = namespaces;
+  }
+
+  public ReportTargetState saveState() throws StateException
+  {
+    final LibLayoutReportTargetState state = new LibLayoutReportTargetState();
+    state.fill(this);
+    return state;
+  }
+
+  public void commit()
+  {
+
+  }
+
+  public NamespaceCollection getNamespaces()
+  {
+    return namespaces;
+  }
+
+  public boolean isPagebreakEncountered()
+  {
+    return layoutProcess.isPagebreakEncountered();
+  }
+
+  protected LayoutProcess getLayoutProcess()
+  {
+    return layoutProcess;
+  }
+
+  protected InputFeed getInputFeed ()
+  {
+    return feed;
+  }
+
+  public void startReport (ReportStructureRoot report)
+          throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      final InputFeed feed = getInputFeed();
+      feed.startDocument();
+      feed.startMetaInfo();
+
+      feed.addDocumentAttribute(DocumentContext.BASE_RESOURCE_ATTR, report.getBaseResource());
+      feed.addDocumentAttribute(DocumentContext.RESOURCE_MANAGER_ATTR, report.getResourceManager());
+
+      String strictStyleMode = "false";
+      if ("true".equals(strictStyleMode))
+      {
+        feed.addDocumentAttribute(DocumentContext.STRICT_STYLE_MODE, Boolean.TRUE);
+      }
+
+      final NamespaceDefinition[] namespaces = createDefaultNameSpaces();
+      for (int i = 0; i < namespaces.length; i++)
+      {
+        final NamespaceDefinition definition = namespaces[i];
+        feed.startMetaNode();
+        feed.setMetaNodeAttribute("type", "namespace");
+        feed.setMetaNodeAttribute("definition", definition);
+        feed.endMetaNode();
+      }
+
+      if (report instanceof JFreeReport)
+      {
+        final JFreeReport realReport = (JFreeReport) report;
+        final int size = realReport.getStyleSheetCount();
+        for (int i = 0; i < size; i++)
+        {
+          final StyleSheet styleSheet = realReport.getStyleSheet(i);
+          feed.startMetaNode();
+          feed.setMetaNodeAttribute("type", "style");
+          feed.setMetaNodeAttribute("#content", styleSheet);
+          feed.endMetaNode();
+        }
+      }
+
+      feed.endMetaInfo();
+      this.namespaces = feed.getNamespaceCollection();
+    }
+    catch (InputFeedException dse)
+    {
+      dse.printStackTrace();
+      throw new ReportProcessingException("Failed to process inputfeed", dse);
+    }
+
+  }
+
+  public void startElement (final AttributeMap attrs)
+          throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs);
+      final String type = ReportTargetUtil.getElemenTypeFromAttribute(attrs);
+      final InputFeed feed = getInputFeed();
+      feed.startElement(namespace, type);
+      handleAttributes(attrs);
+    }
+    catch (InputFeedException e)
+    {
+      throw new ReportProcessingException("Failed to process inputfeed", e);
+    }
+  }
+
+  public void processText(String text)
+      throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      final InputFeed feed = getInputFeed();
+      feed.addContent(text);
+    }
+    catch (InputFeedException e)
+    {
+      throw new ReportProcessingException("Failed to process inputfeed", e);
+    }
+  }
+
+  public void processContent (final DataFlags value)
+          throws DataSourceException, ReportProcessingException
+  {
+    final InputFeed feed = getInputFeed();
+    try
+    {
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "content", value.getValue());
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "isChanged", String.valueOf(value.isChanged()));
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "isDate", String.valueOf(value.isDate()));
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "isNegative", String.valueOf(value.isNegative()));
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "isNull", String.valueOf(value.isNull()));
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "isNumber", String.valueOf(value.isNumeric()));
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "isPositive", String.valueOf(value.isPositive()));
+      feed.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "isZero", String.valueOf(value.isZero()));
+    }
+    catch (InputFeedException e)
+    {
+      throw new ReportProcessingException("Failed to process inputfeed", e);
+    }
+  }
+
+  public NamespaceDefinition getNamespaceByUri(String uri)
+  {
+    if (uri == null)
+    {
+      return null;
+    }
+    return namespaces.getDefinition(uri);
+  }
+
+
+  protected void handleAttributes(AttributeMap map)
+          throws ReportProcessingException
+  {
+    try
+    {
+      final InputFeed feed = getInputFeed();
+      final String[] namespaces = map.getNameSpaces();
+      for (int i = 0; i < namespaces.length; i++)
+      {
+        final String namespace = namespaces[i];
+        final Map localAttrs = map.getAttributes(namespace);
+        final Iterator it = localAttrs.entrySet().iterator();
+        while (it.hasNext())
+        {
+          Map.Entry entry = (Map.Entry) it.next();
+          feed.setAttribute(namespace, (String) entry.getKey(), entry.getValue());
+        }
+      }
+    }
+    catch (InputFeedException e)
+    {
+      throw new ReportProcessingException("Failed to set attribute", e);
+    }
+  }
+
+  public void endElement (final AttributeMap attrs)
+          throws DataSourceException, ReportProcessingException
+  {
+    final InputFeed feed = getInputFeed();
+    try
+    {
+      feed.endElement();
+    }
+    catch (InputFeedException e)
+    {
+      throw new ReportProcessingException("Failed to process inputfeed", e);
+    }
+  }
+
+  public void endReport (ReportStructureRoot report)
+          throws DataSourceException,
+          ReportProcessingException
+  {
+    try
+    {
+      getInputFeed().endDocument();
+    }
+    catch (InputFeedException e)
+    {
+      throw new ReportProcessingException("Failed to process inputfeed", e);
+    }
+  }
+
+
+  public void resetPagebreakFlag()
+  {
+    getInputFeed().resetPageBreakFlag();
+  }
+
+  public String getExportDescriptor()
+  {
+    return getLayoutProcess().getOutputMetaData().getExportDescriptor();
+  }
+}
diff --git a/source/org/jfree/report/flow/ParameterMapping.java b/source/org/jfree/report/flow/ParameterMapping.java
new file mode 100644
index 0000000..1a767cb
--- /dev/null
+++ b/source/org/jfree/report/flow/ParameterMapping.java
@@ -0,0 +1,62 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ParameterMapping.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import java.io.Serializable;
+
+/**
+ * Creation-Date: Dec 6, 2006, 3:25:22 PM
+ *
+ * @author Thomas Morgner
+ */
+public class ParameterMapping implements Serializable
+{
+  private static final long serialVersionUID = -3666118451657430360L;
+  private String name;
+  private String alias;
+
+  public ParameterMapping(final String name, final String alias)
+  {
+    this.name = name;
+    this.alias = alias;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public String getAlias()
+  {
+    return alias;
+  }
+}
diff --git a/source/org/jfree/report/flow/ReportContext.java b/source/org/jfree/report/flow/ReportContext.java
new file mode 100644
index 0000000..79b43e4
--- /dev/null
+++ b/source/org/jfree/report/flow/ReportContext.java
@@ -0,0 +1,60 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportContext.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.pentaho.reporting.libraries.formula.FormulaContext;
+
+/**
+ * THe global report context. This context acts as global structure that holds
+ * all processing factories and allows to store global attributes. The
+ * attribute collection is a global collection, all layout controller have
+ * shared access to the same collection.
+ *
+ * Each report run (prepare, paginate, content-generate) uses its own context
+ * implementation - attributes are not shared or preserved among the different
+ * runs.
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportContext
+{
+  public FormulaContext getFormulaContext();
+  public LayoutControllerFactory getLayoutControllerFactory();
+  public String getExportDescriptor();
+  public ResourceBundleFactory getResourceBundleFactory();
+  public ReportStructureRoot getReportStructureRoot();
+
+  public void setAttribute (Object key, Object value);
+  public Object getAttribute (Object key);
+}
diff --git a/source/org/jfree/report/flow/ReportJob.java b/source/org/jfree/report/flow/ReportJob.java
new file mode 100644
index 0000000..ecfd6f8
--- /dev/null
+++ b/source/org/jfree/report/flow/ReportJob.java
@@ -0,0 +1,67 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportJob.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import java.io.Serializable;
+
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.i18n.ResourceBundleFactory;
+import org.jfree.report.util.ReportParameters;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+
+/**
+ * A report job holds all properties that are required to successfully execute
+ * a report process. A report job does not hold output target specific
+ * parameters like target file names etc.
+ */
+public interface ReportJob extends Serializable, Cloneable
+{
+  ModifiableConfiguration getConfiguration();
+
+  ReportParameters getParameters();
+
+  ReportStructureRoot getReportStructureRoot();
+
+  ReportDataFactory getDataFactory();
+
+  ReportJob derive();
+
+  void close();
+
+  ResourceBundleFactory getResourceBundleFactory();
+
+  String getName();
+
+//  PageFormat getPageFormat();
+//
+//  void setPageFormat(PageFormat pageFormat);
+}
diff --git a/source/org/jfree/report/flow/ReportProcessor.java b/source/org/jfree/report/flow/ReportProcessor.java
new file mode 100644
index 0000000..5ad8ebf
--- /dev/null
+++ b/source/org/jfree/report/flow/ReportProcessor.java
@@ -0,0 +1,49 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+
+/**
+ * The report processor is the public frontend to the reporting process.
+ * In its most generic appearance, it accepts a report job and fully processes
+ * that job without any other programmatic work required.
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportProcessor
+{
+  void processReport (ReportJob job)
+          throws ReportDataFactoryException, DataSourceException,
+          ReportProcessingException;
+}
diff --git a/source/org/jfree/report/flow/ReportStructureRoot.java b/source/org/jfree/report/flow/ReportStructureRoot.java
new file mode 100644
index 0000000..6ce6c49
--- /dev/null
+++ b/source/org/jfree/report/flow/ReportStructureRoot.java
@@ -0,0 +1,55 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportStructureRoot.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import java.util.Locale;
+
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.util.ReportParameters;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+
+public interface ReportStructureRoot
+{
+  public ReportDataFactory getDataFactory();
+
+  public ReportParameters getInputParameters();
+
+  public Configuration getConfiguration();
+
+  public Locale getLocale();
+
+  public ResourceManager getResourceManager();
+
+  public ResourceKey getBaseResource();
+}
diff --git a/source/org/jfree/report/flow/ReportTarget.java b/source/org/jfree/report/flow/ReportTarget.java
new file mode 100644
index 0000000..d87be79
--- /dev/null
+++ b/source/org/jfree/report/flow/ReportTarget.java
@@ -0,0 +1,71 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportProcessingException;
+
+/**
+ * The report target is responsible for the content creation. There are targets
+ * which forward all incomming calls to LibLayout, while other targets process
+ * the content directly.
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportTarget
+{
+  public void startReport (ReportStructureRoot report)
+          throws DataSourceException, ReportProcessingException;
+
+  public void startElement (final AttributeMap attrs)
+          throws DataSourceException, ReportProcessingException;
+
+  public void processText (final String text)
+          throws DataSourceException, ReportProcessingException;
+
+  public void processContent (final DataFlags value)
+          throws DataSourceException, ReportProcessingException;
+
+  public void endElement (final AttributeMap attrs)
+          throws DataSourceException, ReportProcessingException;
+
+  public void endReport (ReportStructureRoot report)
+          throws DataSourceException, ReportProcessingException;
+
+  public String getExportDescriptor();
+
+  public NamespaceDefinition getNamespaceByUri(String uri);
+
+  public void commit() throws ReportProcessingException;
+}
diff --git a/source/org/jfree/report/flow/ReportTargetState.java b/source/org/jfree/report/flow/ReportTargetState.java
new file mode 100644
index 0000000..68787dc
--- /dev/null
+++ b/source/org/jfree/report/flow/ReportTargetState.java
@@ -0,0 +1,47 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportTargetState.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import java.io.Serializable;
+
+import org.jfree.layouting.StateException;
+import org.jfree.layouting.output.OutputProcessor;
+
+/**
+ * Creation-Date: 11.11.2006, 19:03:09
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportTargetState extends Serializable
+{
+  public ReportTarget restore(OutputProcessor out) throws StateException;
+}
diff --git a/source/org/jfree/report/flow/ReportTargetUtil.java b/source/org/jfree/report/flow/ReportTargetUtil.java
new file mode 100644
index 0000000..fefd01b
--- /dev/null
+++ b/source/org/jfree/report/flow/ReportTargetUtil.java
@@ -0,0 +1,88 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportTargetUtil.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.structure.Element;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * Todo: Document me!
+ *
+ * @author Thomas Morgner
+ * @since 20.03.2007
+ */
+public class ReportTargetUtil
+{
+  private ReportTargetUtil()
+  {
+  }
+
+
+  public static String getNamespaceFromAttribute(final AttributeMap attrs)
+  {
+    final Object attribute = attrs.getAttribute
+        (JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE);
+    if (attribute instanceof String)
+    {
+      return (String) attribute;
+    }
+    return JFreeReportInfo.REPORT_NAMESPACE;
+  }
+
+  public static String getElemenTypeFromAttribute(final AttributeMap attrs)
+  {
+    final Object attribute = attrs.getAttribute
+        (JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE);
+    if (attribute instanceof String)
+    {
+      return (String) attribute;
+    }
+    return "element";
+  }
+
+  public static boolean isElementOfType(final String uri,
+                                          final String tagName,
+                                          final AttributeMap attrs)
+  {
+    final String namespace = getNamespaceFromAttribute(attrs);
+    if (ObjectUtilities.equal(namespace, uri) == false)
+    {
+      return false;
+    }
+
+    final String elementTagName = getElemenTypeFromAttribute(attrs);
+    return ObjectUtilities.equal(tagName, elementTagName);
+  }
+
+}
diff --git a/source/org/jfree/report/flow/SinglePassReportProcessor.java b/source/org/jfree/report/flow/SinglePassReportProcessor.java
new file mode 100644
index 0000000..6f13bf7
--- /dev/null
+++ b/source/org/jfree/report/flow/SinglePassReportProcessor.java
@@ -0,0 +1,67 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SinglePassReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+
+/**
+ * The abstract report processor implements a single-pass report processing
+ * schema. This is suitable for most raw exports and the streaming-liblayout
+ * export.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class SinglePassReportProcessor extends AbstractReportProcessor
+{
+  public SinglePassReportProcessor()
+  {
+  }
+
+  protected abstract ReportTarget createReportTarget (ReportJob job)
+          throws ReportProcessingException;
+
+  /**
+   * Bootstraps the local report processing. This way of executing the report
+   * must be supported by *all* report processor implementations. It should
+   * fully process the complete report.
+   *
+   * @param job
+   * @throws ReportDataFactoryException
+   */
+  public void processReport (ReportJob job)
+          throws ReportDataFactoryException,
+          DataSourceException, ReportProcessingException
+  {
+    processReportRun(job, createReportTarget(job));
+  }
+}
diff --git a/source/org/jfree/report/flow/StatefullReportTarget.java b/source/org/jfree/report/flow/StatefullReportTarget.java
new file mode 100644
index 0000000..96ab1c6
--- /dev/null
+++ b/source/org/jfree/report/flow/StatefullReportTarget.java
@@ -0,0 +1,44 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StatefullReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow;
+
+import org.jfree.layouting.StateException;
+
+/**
+ * Creation-Date: 11.11.2006, 19:02:57
+ *
+ * @author Thomas Morgner
+ */
+public interface StatefullReportTarget extends ReportTarget
+{
+  public ReportTargetState saveState() throws StateException;
+}
diff --git a/source/org/jfree/report/flow/flowing/FlowReportProcessor.java b/source/org/jfree/report/flow/flowing/FlowReportProcessor.java
new file mode 100644
index 0000000..21c3bf5
--- /dev/null
+++ b/source/org/jfree/report/flow/flowing/FlowReportProcessor.java
@@ -0,0 +1,114 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FlowReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow.flowing;
+
+import org.jfree.layouting.ChainingLayoutProcess;
+import org.jfree.layouting.DefaultLayoutProcess;
+import org.jfree.layouting.LayoutProcess;
+import org.jfree.layouting.output.OutputProcessor;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.AbstractReportProcessor;
+import org.jfree.report.flow.LibLayoutReportTarget;
+import org.jfree.report.flow.ReportJob;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+
+/**
+ * This is written to use LibLayout. It will never work with other report
+ * targets.
+ *
+ * @author Thomas Morgner
+ */
+public class FlowReportProcessor extends AbstractReportProcessor
+{
+  private OutputProcessor outputProcessor;
+
+  public FlowReportProcessor()
+  {
+  }
+
+  public OutputProcessor getOutputProcessor()
+  {
+    return outputProcessor;
+  }
+
+  public void setOutputProcessor(final OutputProcessor outputProcessor)
+  {
+    this.outputProcessor = outputProcessor;
+  }
+
+  protected LibLayoutReportTarget createTarget(final ReportJob job)
+  {
+    if (outputProcessor == null)
+    {
+      throw new IllegalStateException(
+              "OutputProcessor is invalid.");
+    }
+    final LayoutProcess layoutProcess =
+            new ChainingLayoutProcess(new DefaultLayoutProcess(outputProcessor));
+    final ResourceManager resourceManager = job.getReportStructureRoot().getResourceManager();
+    final ResourceKey resourceKey = job.getReportStructureRoot().getBaseResource();
+
+    return new LibLayoutReportTarget
+            (job, resourceKey, resourceManager, layoutProcess);
+  }
+
+  /**
+   * Bootstraps the local report processing. This way of executing the report
+   * must be supported by *all* report processor implementations. It should
+   * fully process the complete report.
+   *
+   * @param job
+   * @throws ReportDataFactoryException
+   */
+  public void processReport (final ReportJob job)
+          throws ReportDataFactoryException, DataSourceException,
+          ReportProcessingException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+
+    synchronized (job)
+    {
+      // first, compute the globals
+      processReportRun(job, createTarget(job));
+      // second, paginate (this splits the stream into flows)
+      processReportRun(job, createTarget(job));
+      // third, generate the content.
+      processReportRun(job, createTarget(job));
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/AbstractLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/AbstractLayoutController.java
new file mode 100644
index 0000000..570dde2
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/AbstractLayoutController.java
@@ -0,0 +1,145 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+
+/**
+ * Todo: Document me!
+ *
+ * @author Thomas Morgner
+ * @since 05.03.2007
+ */
+public abstract class AbstractLayoutController implements LayoutController
+{
+  private FlowController flowController;
+  private LayoutController parent;
+  private Object node;
+  private boolean initialized;
+
+  protected AbstractLayoutController()
+  {
+  }
+
+  /**
+   * Retrieves the parent of this layout controller. This allows childs to query
+   * their context.
+   *
+   * @return the layout controller's parent to <code>null</code> if there is no
+   * parent.
+   */
+  public LayoutController getParent()
+  {
+    return parent;
+  }
+
+
+  /**
+   * Initializes the layout controller. This method is called exactly once. It
+   * is the creators responsibility to call this method.
+   * <p/>
+   * Calling initialize after the first advance must result in a
+   * IllegalStateException.
+   *
+   * @param node           the currently processed object or layout node.
+   * @param flowController the current flow controller.
+   * @param parent         the parent layout controller that was responsible for
+   *                       instantiating this controller.
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public void initialize(final Object node, final FlowController flowController,
+                         final LayoutController parent)
+      throws DataSourceException, ReportDataFactoryException,
+      ReportProcessingException
+  {
+    if (initialized == true)
+    {
+      throw new IllegalStateException();
+    }
+
+    this.initialized = true;
+    this.node = node;
+    this.flowController = flowController;
+    this.parent = parent;
+  }
+
+  public Object clone()
+  {
+    try
+    {
+      return super.clone();
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new IllegalStateException("Clone failed?");
+    }
+  }
+
+
+  public FlowController getFlowController()
+  {
+    return flowController;
+  }
+
+
+  public Object getNode()
+  {
+    return node;
+  }
+
+
+  public boolean isInitialized()
+  {
+    return initialized;
+  }
+
+  /**
+   * Derives a copy of this controller that is suitable to perform a
+   * precomputation.
+   *
+   * @param fc
+   * @return
+   */
+  public LayoutController createPrecomputeInstance(FlowController fc)
+  {
+    final AbstractLayoutController lc = (AbstractLayoutController) clone();
+    lc.flowController = fc;
+    return lc;
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/BufferedReportTarget.java b/source/org/jfree/report/flow/layoutprocessor/BufferedReportTarget.java
new file mode 100644
index 0000000..48fccf4
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/BufferedReportTarget.java
@@ -0,0 +1,231 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BufferedReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import java.util.ArrayList;
+
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.flow.ReportTarget;
+
+/**
+ * Todo: Document me!
+ *
+ * @author Thomas Morgner
+ * @since 05.03.2007
+ */
+public class BufferedReportTarget implements ReportTarget, Cloneable
+{
+  public static class RecordedCall
+  {
+    private int methodId;
+    private Object parameters;
+
+    public RecordedCall(final int method, final Object parameters)
+    {
+      this.methodId = method;
+      this.parameters = parameters;
+    }
+
+    public int getMethod()
+    {
+      return methodId;
+    }
+
+    public Object getParameters()
+    {
+      return parameters;
+    }
+  }
+
+  private static final int MTH_START_REPORT = 1;
+  private static final int MTH_START_ELEMENT = 2;
+  private static final int MTH_PROCESS_TEXT = 3;
+  private static final int MTH_PROCESS_CONTENT = 4;
+  private static final int MTH_END_ELEMENT = 5;
+  private static final int MTH_END_REPORT = 6;
+
+  private ReportTarget target;
+  private ArrayList calls;
+
+  public BufferedReportTarget()
+  {
+    this.calls = new ArrayList();
+  }
+
+  public ReportTarget getTarget()
+  {
+    return target;
+  }
+
+  public void setTarget(final ReportTarget target)
+  {
+    this.target = target;
+  }
+
+  public void startReport(final ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+    calls.add(new RecordedCall
+        (BufferedReportTarget.MTH_START_REPORT, report));
+  }
+
+  public void startElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      calls.add(new RecordedCall
+          (BufferedReportTarget.MTH_START_ELEMENT, attrs.clone()));
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new ReportProcessingException("Failed to clone attributes", e);
+    }
+  }
+
+  public void processText(final String text)
+      throws DataSourceException, ReportProcessingException
+  {
+    calls.add(new RecordedCall
+        (BufferedReportTarget.MTH_PROCESS_TEXT, text));
+  }
+
+  public void processContent(final DataFlags value)
+      throws DataSourceException, ReportProcessingException
+  {
+    calls.add(new RecordedCall
+        (BufferedReportTarget.MTH_PROCESS_CONTENT, value));
+  }
+
+  public void endElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      calls.add(new RecordedCall
+          (BufferedReportTarget.MTH_END_ELEMENT, attrs.clone()));
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new ReportProcessingException("Failed to clone attributes", e);
+    }
+  }
+
+  public void endReport(final ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+    calls.add(new RecordedCall
+        (BufferedReportTarget.MTH_END_REPORT, report));
+  }
+
+  public String getExportDescriptor()
+  {
+    return target.getExportDescriptor();
+  }
+
+  public NamespaceDefinition getNamespaceByUri(final String uri)
+  {
+    return target.getNamespaceByUri(uri);
+  }
+
+  public void commit()
+      throws ReportProcessingException
+  {
+    // ignored ..
+  }
+
+  public void close(final ReportTarget target)
+      throws ReportProcessingException, DataSourceException
+  {
+    final RecordedCall[] objects = (RecordedCall[])
+        calls.toArray(new RecordedCall[calls.size()]);
+
+    for (int i = 0; i < objects.length; i++)
+    {
+      final RecordedCall call = objects[i];
+      switch(call.getMethod())
+      {
+        case BufferedReportTarget.MTH_START_REPORT:
+        {
+          target.startReport((ReportStructureRoot) call.getParameters());
+          break;
+        }
+        case BufferedReportTarget.MTH_START_ELEMENT:
+        {
+          target.startElement((AttributeMap) call.getParameters());
+          break;
+        }
+        case BufferedReportTarget.MTH_PROCESS_TEXT:
+        {
+          target.processText((String) call.getParameters());
+          break;
+        }
+        case BufferedReportTarget.MTH_PROCESS_CONTENT:
+        {
+          target.processContent((DataFlags) call.getParameters());
+          break;
+        }
+        case BufferedReportTarget.MTH_END_ELEMENT:
+        {
+          target.endElement((AttributeMap) call.getParameters());
+          break;
+        }
+        case BufferedReportTarget.MTH_END_REPORT:
+        {
+          target.endReport((ReportStructureRoot) call.getParameters());
+          break;
+        }
+        default:
+          throw new IllegalStateException("Invalid call recorded.");
+      }
+    }
+  }
+
+  public Object clone ()
+  {
+    try
+    {
+      final BufferedReportTarget o = (BufferedReportTarget) super.clone();
+      o.calls = (ArrayList) calls.clone();
+      return o;
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new IllegalStateException("Clone failed");
+    }
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/BufferingLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/BufferingLayoutController.java
new file mode 100644
index 0000000..092439e
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/BufferingLayoutController.java
@@ -0,0 +1,190 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BufferingLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportTarget;
+
+/**
+ * Todo: Document me!
+ *
+ * @author Thomas Morgner
+ * @since 05.03.2007
+ */
+public abstract class BufferingLayoutController
+    extends AbstractLayoutController
+{
+  private BufferedReportTarget reportTarget;
+  private LayoutController delegate;
+  private boolean finished;
+
+  protected BufferingLayoutController()
+  {
+    reportTarget = new BufferedReportTarget();
+  }
+
+  /**
+   * Advances the processing position.
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public LayoutController advance(final ReportTarget target)
+      throws DataSourceException, ReportDataFactoryException,
+      ReportProcessingException
+  {
+    reportTarget.setTarget(target);
+    if (delegate != null)
+    {
+      try
+      {
+        final BufferingLayoutController bc = (BufferingLayoutController) clone();
+        bc.delegate = delegate.advance(reportTarget);
+        return bc;
+      }
+      finally
+      {
+        reportTarget.setTarget(null);
+      }
+    }
+
+    // write all buffered changes to the real report target.
+    reportTarget.close(target);
+    if (getParent() == null)
+    {
+      final BufferingLayoutController bc = (BufferingLayoutController) clone();
+      bc.finished = true;
+      return bc;
+    }
+
+    return joinWithParent();
+  }
+
+  /**
+   * Joins the layout controller with the parent. This simply calls
+   * {@link #join(org.jfree.report.flow.FlowController)} on the parent. A join
+   * operation is necessary to propagate changes in the flow-controller to the
+   * parent for further processing.
+   *
+   * @return the joined parent.
+   * @throws IllegalStateException if this layout controller has no parent.
+   * @throws org.jfree.report.ReportProcessingException
+   * @throws org.jfree.report.ReportDataFactoryException
+   * @throws org.jfree.report.DataSourceException
+   */
+  protected LayoutController joinWithParent()
+      throws ReportProcessingException, ReportDataFactoryException,
+      DataSourceException
+  {
+    final LayoutController parent = getParent();
+    if (parent == null)
+    {
+      // skip to the next step ..
+      throw new IllegalStateException("There is no parent to join with. " +
+                                      "This should not happen in a sane environment!");
+    }
+
+    return parent.join(getFlowController());
+  }
+
+
+  /**
+   * Initializes the layout controller. This method is called exactly once. It
+   * is the creators responsibility to call this method.
+   * <p/>
+   * Calling initialize after the first advance must result in a
+   * IllegalStateException.
+   *
+   * @param node           the currently processed object or layout node.
+   * @param flowController the current flow controller.
+   * @param parent         the parent layout controller that was responsible for
+   *                       instantiating this controller.
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public void initialize(final Object node, final FlowController flowController,
+                         final LayoutController parent)
+      throws DataSourceException, ReportDataFactoryException,
+      ReportProcessingException
+  {
+    super.initialize(node, flowController, parent);
+    delegate = getInitialDelegate();
+  }
+
+  protected abstract LayoutController getInitialDelegate();
+
+  public boolean isAdvanceable()
+  {
+    if (delegate == null)
+    {
+      return finished == false;
+    }
+    return delegate.isAdvanceable();
+  }
+
+  /**
+   * Joins with a delegated process flow. This is generally called from a child
+   * flow and should *not* (I mean it!) be called from outside. If you do,
+   * you'll suffer.
+   *
+   * @param flowController the flow controller of the parent.
+   * @return the joined layout controller that incorperates all changes from
+   * the delegate.
+   */
+  public LayoutController join(final FlowController flowController)
+      throws ReportProcessingException, DataSourceException
+  {
+    // the delegation is finished, the element has returned.
+    final BufferingLayoutController bc = (BufferingLayoutController) clone();
+    bc.delegate = null;
+    return bc;
+  }
+
+  public Object clone()
+  {
+    final BufferingLayoutController o = (BufferingLayoutController) super.clone();
+    o.reportTarget = (BufferedReportTarget) reportTarget.clone();
+    return o;
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/ContentElementLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/ContentElementLayoutController.java
new file mode 100644
index 0000000..a34f2ab
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/ContentElementLayoutController.java
@@ -0,0 +1,150 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ContentElementLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.data.DefaultDataFlags;
+import org.jfree.report.expressions.Expression;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.LayoutExpressionRuntime;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.structure.ContentElement;
+import org.jfree.report.structure.Node;
+
+/**
+ * Creation-Date: 24.11.2006, 15:06:56
+ *
+ * @author Thomas Morgner
+ */
+public class ContentElementLayoutController extends ElementLayoutController
+{
+  public ContentElementLayoutController()
+  {
+  }
+
+  protected LayoutController processContent(final ReportTarget target)
+      throws DataSourceException, ReportProcessingException, ReportDataFactoryException
+  {
+
+    final Node node = getElement();
+    final FlowController flowController = getFlowController();
+    final LayoutExpressionRuntime er =
+        LayoutControllerUtil.getExpressionRuntime(flowController, node);
+    final ContentElement element = (ContentElement) node;
+    final Expression ex = element.getValueExpression();
+    final Object value;
+
+    if (ex != null)
+    {
+      try
+      {
+        ex.setRuntime(er);
+        value = ex.computeValue();
+      }
+      finally
+      {
+        ex.setRuntime(null);
+      }
+    }
+    else
+    {
+      value = null;
+    }
+
+    // This should be a very rare case indeed ..
+    if (value instanceof DataFlags)
+    {
+      target.processContent((DataFlags) value);
+
+      final ContentElementLayoutController derived = (ContentElementLayoutController) clone();
+      derived.setProcessingState(ElementLayoutController.FINISHING);
+      derived.setFlowController(flowController);
+      return derived;
+    }
+
+    if (value instanceof Node)
+    {
+      // we explictly allow structural content here.
+      // As this might be a very expensive thing, if we
+      // keep it in a single state, we continue on a separate state.
+      final Node valueNode = (Node) value;
+      valueNode.updateParent(node.getParent());
+      final ReportContext reportContext = flowController.getReportContext();
+      final LayoutControllerFactory layoutControllerFactory =
+          reportContext.getLayoutControllerFactory();
+
+      // actually, this is the same as if the element were a
+      // child element of a section. The only difference is
+      // that there can be only one child, and that there is no
+      // direct parent-child direction.
+
+      final ContentElementLayoutController derived =
+          (ContentElementLayoutController) clone();
+      derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN);
+      derived.setFlowController(flowController);
+
+      return layoutControllerFactory.create
+          (flowController, valueNode, derived);
+    }
+
+    if (ex != null)
+    {
+      target.processContent (new DefaultDataFlags(ex.getName(), value, true));
+    }
+
+    final ContentElementLayoutController derived = (ContentElementLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.FINISHING);
+    derived.setFlowController(flowController);
+    return derived;
+  }
+
+  /**
+   * Joins with a delegated process flow. This is generally called from a child
+   * flow and should *not* (I mean it!) be called from outside. If you do,
+   * you'll suffer.
+   *
+   * @param flowController the flow controller of the parent.
+   * @return the joined layout controller that incorperates all changes from
+   * the delegate.
+   */
+  public LayoutController join(final FlowController flowController)
+  {
+    final ContentElementLayoutController derived = (ContentElementLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.FINISHING);
+    derived.setFlowController(flowController);
+    return derived;
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/DefaultLayoutControllerFactory.java b/source/org/jfree/report/flow/layoutprocessor/DefaultLayoutControllerFactory.java
new file mode 100644
index 0000000..43f61d9
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/DefaultLayoutControllerFactory.java
@@ -0,0 +1,133 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultLayoutControllerFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.structure.Node;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * A layout controller factory that selects layout controllers by their node
+ * implementation type.
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultLayoutControllerFactory implements LayoutControllerFactory
+{
+  private HashMap registry;
+  private static final String PREFIX = "org.jfree.report.flow.structure.";
+
+  public DefaultLayoutControllerFactory()
+  {
+    registry = new HashMap();
+
+  }
+
+  public void initialize (final ReportJob job)
+  {
+    final Configuration configuration = job.getConfiguration();
+
+    final Iterator propertyKeys =
+        configuration.findPropertyKeys(DefaultLayoutControllerFactory.PREFIX);
+    while (propertyKeys.hasNext())
+    {
+      final String key = (String) propertyKeys.next();
+      final String nodeClassName = key.substring
+          (DefaultLayoutControllerFactory.PREFIX.length());
+      final String procClassName = configuration.getConfigProperty(key);
+
+      final Class nodeClass = load(nodeClassName);
+      final Object processor = ObjectUtilities.loadAndInstantiate
+          (procClassName, DefaultLayoutControllerFactory.class, LayoutController.class);
+      if (nodeClass == null || processor == null)
+      {
+        // sanity check ..
+        continue;
+      }
+
+      registry.put(nodeClassName, procClassName);
+    }
+  }
+
+  private Class load (final String className)
+  {
+    if (className == null)
+    {
+      return null;
+    }
+
+    final ClassLoader classLoader = ObjectUtilities.getClassLoader
+        (DefaultLayoutControllerFactory.class);
+    try
+    {
+      return classLoader.loadClass(className);
+    }
+    catch (ClassNotFoundException e)
+    {
+      return null;
+    }
+  }
+
+  public LayoutController create(final FlowController controller,
+                                 final Object node,
+                                 final LayoutController parent)
+      throws ReportProcessingException, ReportDataFactoryException, DataSourceException
+  {
+    Class nodeClass = node.getClass();
+    while (Node.class.isAssignableFrom(nodeClass))
+    {
+      final String targetClass = (String) registry.get(nodeClass.getName());
+      if (targetClass != null)
+      {
+        final LayoutController lc = (LayoutController)
+            ObjectUtilities.loadAndInstantiate (targetClass,
+                DefaultLayoutControllerFactory.class, LayoutController.class);
+        if (lc != null)
+        {
+          lc.initialize(node, controller, parent);
+          return lc;
+        }
+      }
+      nodeClass = nodeClass.getSuperclass();
+    }
+
+    throw new ReportProcessingException("No processor for node " + node);
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/ElementLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/ElementLayoutController.java
new file mode 100644
index 0000000..639bec9
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/ElementLayoutController.java
@@ -0,0 +1,574 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ElementLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.data.ExpressionSlot;
+import org.jfree.report.data.PrecomputeNodeKey;
+import org.jfree.report.data.PrecomputedExpressionSlot;
+import org.jfree.report.data.PrecomputedValueRegistry;
+import org.jfree.report.data.RunningExpressionSlot;
+import org.jfree.report.data.StaticExpressionRuntimeData;
+import org.jfree.report.expressions.Expression;
+import org.jfree.report.flow.FlowControlOperation;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.flow.LayoutExpressionRuntime;
+import org.jfree.report.structure.Element;
+import org.jfree.layouting.util.AttributeMap;
+
+/**
+ * Creation-Date: 24.11.2006, 13:56:30
+ *
+ * @author Thomas Morgner
+ */
+public abstract class ElementLayoutController
+    implements LayoutController
+{
+  protected static class ElementPrecomputeKey implements PrecomputeNodeKey
+  {
+    private String name;
+    private String id;
+    private String namespace;
+    private String tagName;
+
+    public ElementPrecomputeKey(final Element element)
+    {
+      this.name = element.getName();
+      this.tagName = element.getType();
+      this.namespace = element.getNamespace();
+      this.id = element.getId();
+    }
+
+    public boolean equals(final Object obj)
+    {
+      if (this == obj)
+      {
+        return true;
+      }
+      if (obj == null || getClass() != obj.getClass())
+      {
+        return false;
+      }
+
+      final ElementPrecomputeKey that = (ElementPrecomputeKey) obj;
+
+      if (id != null ? !id.equals(that.id) : that.id != null)
+      {
+        return false;
+      }
+      if (name != null ? !name.equals(that.name) : that.name != null)
+      {
+        return false;
+      }
+      if (namespace != null ? !namespace.equals(
+          that.namespace) : that.namespace != null)
+      {
+        return false;
+      }
+      if (tagName != null ? !tagName.equals(
+          that.tagName) : that.tagName != null)
+      {
+        return false;
+      }
+
+      return true;
+    }
+
+    public int hashCode()
+    {
+      int result = (name != null ? name.hashCode() : 0);
+      result = 29 * result + (id != null ? id.hashCode() : 0);
+      result = 29 * result + (namespace != null ? namespace.hashCode() : 0);
+      result = 29 * result + (tagName != null ? tagName.hashCode() : 0);
+      return result;
+    }
+
+    public boolean equals(final PrecomputeNodeKey otherKey)
+    {
+      return false;
+    }
+  }
+
+  public static final int NOT_STARTED = 0;
+  public static final int OPENED = 1;
+  public static final int WAITING_FOR_JOIN = 2;
+  public static final int FINISHING = 3;
+  //public static final int JOINING = 4;
+  public static final int FINISHED = 4;
+
+  private int processingState;
+  private FlowController flowController;
+  private Element element;
+  private LayoutController parent;
+  private boolean precomputing;
+  private AttributeMap attributeMap;
+  private int expressionsCount;
+  private int iterationCount;
+
+  protected ElementLayoutController()
+  {
+    this.processingState = ElementLayoutController.NOT_STARTED;
+  }
+
+
+  public String toString()
+  {
+    return "ElementLayoutController{" +
+        "processingState=" + processingState +
+        ", element=" + element +
+        ", precomputing=" + precomputing +
+        ", expressionsCount=" + expressionsCount +
+        ", iterationCount=" + iterationCount +
+        '}';
+  }
+
+  /**
+   * Retrieves the parent of this layout controller. This allows childs to query
+   * their context.
+   *
+   * @return the layout controller's parent to <code>null</code> if there is no
+   * parent.
+   */
+  public LayoutController getParent()
+  {
+    return parent;
+  }
+
+
+  /**
+   * Initializes the layout controller. This method is called exactly once. It
+   * is the creators responsibility to call this method.
+   * <p/>
+   * Calling initialize after the first advance must result in a
+   * IllegalStateException.
+   *
+   * @param node           the currently processed object or layout node.
+   * @param flowController the current flow controller.
+   * @param parent         the parent layout controller that was responsible for
+   *                       instantiating this controller.
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public void initialize(final Object node,
+                         final FlowController flowController,
+                         final LayoutController parent)
+      throws DataSourceException, ReportDataFactoryException,
+      ReportProcessingException
+  {
+
+    if (processingState != ElementLayoutController.NOT_STARTED)
+    {
+      throw new IllegalStateException();
+    }
+
+    this.element = (Element) node;
+    this.flowController = flowController;
+    this.parent = parent;
+    this.iterationCount = -1;
+  }
+
+  /**
+   * Advances the layout controller to the next state. This method delegates the
+   * call to one of the following methods: <ul> <li>{@link
+   * #startElement(org.jfree.report.flow.ReportTarget)} <li>{@link
+   * #processContent(org.jfree.report.flow.ReportTarget)} <li>{@link
+   * #finishElement(org.jfree.report.flow.ReportTarget)} </ul>
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public final LayoutController advance(final ReportTarget target)
+      throws DataSourceException, ReportProcessingException,
+      ReportDataFactoryException
+  {
+    final int processingState = getProcessingState();
+    switch (processingState)
+    {
+      case ElementLayoutController.NOT_STARTED:
+        return startElement(target);
+      case ElementLayoutController.OPENED:
+        return processContent(target);
+      case ElementLayoutController.FINISHING:
+        return finishElement(target);
+//      case ElementLayoutController.JOINING:
+//        return joinWithParent();
+      default:
+        throw new IllegalStateException();
+    }
+  }
+
+  /**
+   * This method is called for each newly instantiated layout controller. The
+   * returned layout controller instance should have a processing state of
+   * either 'OPEN' or 'FINISHING' depending on whether there is any content or
+   * any child nodes to process.
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  protected LayoutController startElement(final ReportTarget target)
+      throws DataSourceException, ReportProcessingException,
+      ReportDataFactoryException
+  {
+    final Element s = getElement();
+
+    FlowController fc = getFlowController();
+    // Step 3: Add the expressions. Any expressions defined for the subreport
+    // will work on the queried dataset.
+    fc = startData(target, fc);
+
+    final Expression[] expressions = s.getExpressions();
+    fc = performElementPrecomputation(expressions, fc);
+
+    if (s.isVirtual() == false)
+    {
+      attributeMap = computeAttributes(fc, s, target);
+      target.startElement(attributeMap);
+    }
+
+    final ElementLayoutController derived = (ElementLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.OPENED);
+    derived.setFlowController(fc);
+    derived.expressionsCount = expressions.length;
+    derived.attributeMap = attributeMap;
+    derived.iterationCount += 1;
+    return derived;
+  }
+
+  public AttributeMap getAttributeMap()
+  {
+    return attributeMap;
+  }
+
+  public int getExpressionsCount()
+  {
+    return expressionsCount;
+  }
+
+  public int getIterationCount()
+  {
+    return iterationCount;
+  }
+
+
+  protected FlowController startData(final ReportTarget target,
+                                     final FlowController fc)
+      throws DataSourceException, ReportProcessingException,
+      ReportDataFactoryException
+  {
+    return fc;
+  }
+
+  protected AttributeMap computeAttributes(final FlowController fc,
+                                           final Element element,
+                                           final ReportTarget target)
+      throws DataSourceException
+  {
+    final LayoutExpressionRuntime ler =
+        LayoutControllerUtil.getExpressionRuntime(fc, element);
+    return LayoutControllerUtil.processAttributes(element, target, ler);
+  }
+
+
+  /**
+   * Processes any content in this element. This method is called when the
+   * processing state is 'OPENED'. The returned layout controller will retain
+   * the 'OPENED' state as long as there is more content available. Once all
+   * content has been processed, the returned layout controller should carry a
+   * 'FINISHED' state.
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  protected abstract LayoutController processContent(final ReportTarget target)
+      throws DataSourceException, ReportProcessingException,
+      ReportDataFactoryException;
+
+  /**
+   * Finishes the processing of this element. This method is called when the
+   * processing state is 'FINISHING'. The element should be closed now and all
+   * privatly owned resources should be freed. If the element has a parent, it
+   * would be time to join up with the parent now, else the processing state
+   * should be set to 'FINISHED'.
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException       if there was a problem reading data from
+   *                                   the datasource.
+   * @throws ReportProcessingException if there was a general problem during the
+   *                                   report processing.
+   * @throws ReportDataFactoryException if there was an error trying query data.
+   */
+  protected LayoutController finishElement(final ReportTarget target)
+      throws ReportProcessingException, DataSourceException,
+      ReportDataFactoryException
+  {
+    final FlowController fc = handleDefaultEndElement(target);
+    final ElementLayoutController derived = (ElementLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.FINISHED);
+    derived.setFlowController(fc);
+    return derived;
+  }
+
+  protected FlowController handleDefaultEndElement (final ReportTarget target)
+      throws ReportProcessingException, DataSourceException,
+      ReportDataFactoryException
+  {
+    final Element e = getElement();
+    // Step 1: call End Element
+    if (e.isVirtual() == false)
+    {
+      target.endElement(getAttributeMap());
+    }
+
+    FlowController fc = getFlowController();
+    final PrecomputedValueRegistry pcvr =
+        fc.getPrecomputedValueRegistry();
+    // Step 2: Remove the expressions of this element
+    final int expressionsCount = getExpressionsCount();
+    if (expressionsCount != 0)
+    {
+      final ExpressionSlot[] activeExpressions = fc.getActiveExpressions();
+      for (int i = activeExpressions.length - expressionsCount; i < activeExpressions.length; i++)
+      {
+        final ExpressionSlot slot = activeExpressions[i];
+        pcvr.addFunction(slot.getName(), slot.getValue());
+      }
+      fc = fc.deactivateExpressions();
+    }
+
+    if (isPrecomputing() == false)
+    {
+      pcvr.finishElement(new ElementPrecomputeKey(e));
+    }
+
+    return fc;
+  }
+//
+//  /**
+//   * Joins the layout controller with the parent. This simply calls
+//   * {@link #join(org.jfree.report.flow.FlowController)} on the parent. A join
+//   * operation is necessary to propagate changes in the flow-controller to the
+//   * parent for further processing.
+//   *
+//   * @return the joined parent.
+//   * @throws IllegalStateException if this layout controller has no parent.
+//   */
+//  protected LayoutController joinWithParent()
+//      throws ReportProcessingException, ReportDataFactoryException,
+//      DataSourceException
+//  {
+//    final LayoutController parent = getParent();
+//    if (parent == null)
+//    {
+//      // skip to the next step ..
+//      throw new IllegalStateException("There is no parent to join with. " +
+//                                      "This should not happen in a sane environment!");
+//    }
+//
+//    return parent.join(getFlowController());
+//  }
+
+  public boolean isAdvanceable()
+  {
+    return processingState != ElementLayoutController.FINISHED;
+  }
+
+  public Element getElement()
+  {
+    return element;
+  }
+
+  public FlowController getFlowController()
+  {
+    return flowController;
+  }
+
+  public int getProcessingState()
+  {
+    return processingState;
+  }
+
+  public void setProcessingState(final int processingState)
+  {
+    this.processingState = processingState;
+  }
+
+  public void setFlowController(final FlowController flowController)
+  {
+    this.flowController = flowController;
+  }
+
+  public void setParent(final LayoutController parent)
+  {
+    this.parent = parent;
+  }
+
+  public Object clone()
+  {
+    try
+    {
+      return super.clone();
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new IllegalStateException("Clone must be supported.");
+    }
+  }
+
+  public boolean isPrecomputing()
+  {
+    return precomputing;
+  }
+
+  protected FlowController performElementPrecomputation(
+      final Expression[] expressions,
+      FlowController fc)
+      throws ReportProcessingException, ReportDataFactoryException,
+      DataSourceException
+  {
+    final Element element = getElement();
+    final PrecomputedValueRegistry pcvr = fc.getPrecomputedValueRegistry();
+    if (isPrecomputing() == false)
+    {
+      pcvr.startElement(new ElementPrecomputeKey(element));
+    }
+
+    if (expressions.length > 0)
+    {
+      final ExpressionSlot[] slots = new ExpressionSlot[expressions.length];
+      final StaticExpressionRuntimeData runtimeData =
+          LayoutControllerUtil.getStaticExpressionRuntime(fc, element);
+
+      for (int i = 0; i < expressions.length; i++)
+      {
+        final Expression expression = expressions[i];
+        if (isPrecomputing() == false && expression.isPrecompute())
+        {
+          // ok, we have to precompute the expression's value. For that
+          // we fork a new layout process, compute the value and then come
+          // back with the result.
+          final Object value = LayoutControllerUtil.performPrecompute
+              (i, new ElementPrecomputeKey(element),
+                  this, getFlowController());
+          slots[i] = new PrecomputedExpressionSlot(expression.getName(), value,
+              expression.isPreserve());
+        }
+        else
+        {
+          // thats a bit easier; we dont have to do anything special ..
+          slots[i] = new RunningExpressionSlot(expression, runtimeData,
+              pcvr.currentNode());
+        }
+      }
+
+      fc = fc.activateExpressions(slots);
+    }
+    return fc;
+  }
+
+
+  protected FlowController tryRepeatingCommit(final FlowController fc)
+      throws DataSourceException
+  {
+    if (isPrecomputing() == false)
+    {
+      // ok, the user wanted us to repeat. So we repeat if the group in which
+      // we are in, is not closed (and at least one advance has been fired
+      // since the last repeat request [to prevent infinite loops]) ...
+      final boolean advanceRequested = fc.isAdvanceRequested();
+      final boolean advanceable = fc.getMasterRow().isAdvanceable();
+      if (advanceable && advanceRequested)
+      {
+        // we check against the commited target; But we will not use the
+        // commited target if the group is no longer active...
+        final FlowController cfc =
+            fc.performOperation(FlowControlOperation.COMMIT);
+        final boolean groupFinished =
+            LayoutControllerUtil.isGroupFinished(cfc, getElement());
+        if (groupFinished == false)
+        {
+          return cfc;
+        }
+      }
+    }
+    return null;
+  }
+
+
+  /**
+   * Derives a copy of this controller that is suitable to perform a
+   * precomputation.
+   *
+   * @param fc
+   * @return
+   */
+  public LayoutController createPrecomputeInstance(final FlowController fc)
+  {
+    final ElementLayoutController lc = (ElementLayoutController) clone();
+    lc.setFlowController(fc);
+    lc.setParent(null);
+    lc.precomputing = true;
+    return lc;
+  }
+
+
+  public Object getNode()
+  {
+    return getElement();
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/LayoutController.java b/source/org/jfree/report/flow/layoutprocessor/LayoutController.java
new file mode 100644
index 0000000..198eb28
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/LayoutController.java
@@ -0,0 +1,135 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportTarget;
+
+/**
+ * The layout controller iterates over the report layout. It uses a flow
+ * controller to query the data.
+ *
+ * @author Thomas Morgner
+ */
+public interface LayoutController extends Cloneable
+{
+  /**
+   * Retrieves the parent of this layout controller. This allows childs to query
+   * their context.
+   *
+   * @return the layout controller's parent to <code>null</code> if there is no
+   * parent.
+   */
+  public LayoutController getParent();
+
+  /**
+   * Initializes the layout controller. This method is called exactly once. It
+   * is the creators responsibility to call this method.
+   * <p/>
+   * Calling initialize after the first advance must result in a
+   * IllegalStateException.
+   *
+   * @param node           the currently processed object or layout node.
+   * @param flowController the current flow controller.
+   * @param parent         the parent layout controller that was responsible for
+   *                       instantiating this controller.
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public void initialize(final Object node,
+                         final FlowController flowController,
+                         final LayoutController parent)
+      throws DataSourceException, ReportDataFactoryException,
+      ReportProcessingException;
+
+  /**
+   * Advances the processing position.
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public LayoutController advance(ReportTarget target)
+      throws DataSourceException, ReportDataFactoryException,
+      ReportProcessingException;
+
+  /**
+   * Checks, whether the layout controller would be advanceable. If this method
+   * returns true, it is generally safe to call the 'advance()' method.
+   *
+   * @return true, if the layout controller is advanceable, false otherwise.
+   */
+  public boolean isAdvanceable();
+
+  /**
+   * Joins with a delegated process flow. This is generally called from a child
+   * flow and should *not* (I mean it!) be called from outside. If you do,
+   * you'll suffer.
+   *
+   * @param flowController the flow controller of the parent.
+   * @return the joined layout controller that incorperates all changes from
+   * the delegate.
+   */
+  public LayoutController join(FlowController flowController)
+      throws DataSourceException, ReportDataFactoryException,
+      ReportProcessingException;
+
+  /**
+   * Creates a copy of this layout controller.
+   *
+   * @return a copy.
+   */
+  public Object clone();
+
+  /**
+   * Derives a copy of this controller that is suitable to perform a
+   * precomputation. The returned layout controller must be independent from
+   * the it's anchestor controller.
+   *
+   * @param fc a new flow controller for the precomputation.
+   * @return a copy that is suitable for precomputation.
+   */
+  public LayoutController createPrecomputeInstance(FlowController fc);
+
+  public FlowController getFlowController();
+  public Object getNode();
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/LayoutControllerFactory.java b/source/org/jfree/report/flow/layoutprocessor/LayoutControllerFactory.java
new file mode 100644
index 0000000..f1c978f
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/LayoutControllerFactory.java
@@ -0,0 +1,50 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LayoutControllerFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.FlowController;
+
+/**
+ * Creation-Date: 24.11.2006, 14:25:02
+ *
+ * @author Thomas Morgner
+ */
+public interface LayoutControllerFactory
+{
+  public LayoutController create (final FlowController controller,
+                                  final Object node,
+                                  final LayoutController parent)
+      throws ReportProcessingException, ReportDataFactoryException, DataSourceException;
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/LayoutControllerUtil.java b/source/org/jfree/report/flow/layoutprocessor/LayoutControllerUtil.java
new file mode 100644
index 0000000..057f429
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/LayoutControllerUtil.java
@@ -0,0 +1,574 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LayoutControllerUtil.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.CSSStyleRule;
+import org.jfree.layouting.input.style.StyleKey;
+import org.jfree.layouting.input.style.StyleKeyRegistry;
+import org.jfree.layouting.input.style.StyleRule;
+import org.jfree.layouting.input.style.values.CSSValue;
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.namespace.Namespaces;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.EmptyReportData;
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.data.GlobalMasterRow;
+import org.jfree.report.data.PrecomputeNode;
+import org.jfree.report.data.PrecomputeNodeKey;
+import org.jfree.report.data.PrecomputedValueRegistry;
+import org.jfree.report.data.ReportDataRow;
+import org.jfree.report.data.StaticExpressionRuntimeData;
+import org.jfree.report.expressions.Expression;
+import org.jfree.report.expressions.ExpressionRuntime;
+import org.jfree.report.flow.EmptyReportTarget;
+import org.jfree.report.flow.FlowControlOperation;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.LayoutExpressionRuntime;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Group;
+import org.jfree.report.structure.Node;
+import org.jfree.report.structure.Section;
+import org.pentaho.reporting.libraries.resourceloader.Resource;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+
+/**
+ * Creation-Date: 24.11.2006, 15:01:22
+ *
+ * @author Thomas Morgner
+ */
+public class LayoutControllerUtil
+{
+  public static final EmptyReportData EMPTY_REPORT_DATA = new EmptyReportData();
+
+  private LayoutControllerUtil()
+  {
+  }
+
+  public static int findNodeInParent(final Section parentSection,
+                                     final Node n)
+  {
+    final Node[] nodes = parentSection.getNodeArray();
+    for (int i = 0; i < nodes.length; i++)
+    {
+      final Node node = nodes[i];
+      if (node == n)
+      {
+        return i;
+      }
+    }
+    return -1;
+  }
+
+  public static StaticExpressionRuntimeData getStaticExpressionRuntime
+      (final FlowController fc,
+       final Object declaringParent)
+  {
+    final GlobalMasterRow dataRow = fc.getMasterRow();
+    final ReportJob reportJob = fc.getReportJob();
+    final StaticExpressionRuntimeData sdd = new StaticExpressionRuntimeData();
+    sdd.setData(dataRow.getReportDataRow().getReportData());
+    sdd.setDeclaringParent(declaringParent);
+    sdd.setConfiguration(reportJob.getConfiguration());
+    sdd.setReportContext(fc.getReportContext());
+    return sdd;
+  }
+
+
+  public static LayoutExpressionRuntime getExpressionRuntime
+      (final FlowController fc, final Object node)
+  {
+    final LayoutExpressionRuntime ler = new LayoutExpressionRuntime();
+    ler.setConfiguration(fc.getReportJob().getConfiguration());
+    ler.setReportContext(fc.getReportContext());
+
+    final GlobalMasterRow masterRow = fc.getMasterRow();
+    ler.setDataRow(masterRow.getGlobalView());
+
+    final ReportDataRow reportDataRow = masterRow.getReportDataRow();
+    if (reportDataRow == null)
+    {
+      ler.setData(EMPTY_REPORT_DATA);
+      ler.setCurrentRow(-1);
+    }
+    else
+    {
+      ler.setData(reportDataRow.getReportData());
+      ler.setCurrentRow(reportDataRow.getCursor());
+    }
+
+    ler.setDeclaringParent(node);
+    return ler;
+  }
+
+
+  public static FlowController processFlowOperations(FlowController fc,
+                                                     final FlowControlOperation[] ops)
+      throws DataSourceException
+  {
+    for (int i = 0; i < ops.length; i++)
+    {
+      final FlowControlOperation op = ops[i];
+      fc = fc.performOperation(op);
+    }
+    return fc;
+  }
+
+
+  /**
+   * Checks, whether the current group should continue. If there is no group, we assume that we should continue. (This
+   * emulates the control-break-algorithm's default behaviour if testing an empty set of arguments.)
+   *
+   * @param fc   the current flow controller holding the data
+   * @param node the current node.
+   * @return true, if the group is finished and we should stop reiterating it, false if the group is not finished and we
+   *         can start iterating it again.
+   * @throws org.jfree.report.DataSourceException
+   *
+   */
+  public static boolean isGroupFinished(final FlowController fc,
+                                        final Node node)
+      throws DataSourceException
+  {
+    final Node nodeParent = node.getParent();
+    if (nodeParent == null)
+    {
+      return false;
+    }
+    Group group = nodeParent.getGroup();
+    if (group == null)
+    {
+      return false;
+    }
+
+    // maybe we can move this state into the layoutstate itself so that
+    // we do not have to rebuild that crap all the time.
+    LayoutExpressionRuntime ler = null;
+
+    // OK, now we are almost complete.
+    while (group != null)
+    {
+      if (ler == null)
+      {
+        ler = getExpressionRuntime(fc, node);
+      }
+
+      ler.setDeclaringParent(group);
+
+      final Expression groupingExpression = group.getGroupingExpression();
+      if (groupingExpression != null)
+      {
+        groupingExpression.setRuntime(ler);
+        final Object groupFinished;
+        try
+        {
+          groupFinished = groupingExpression.computeValue();
+        }
+        finally
+        {
+          groupingExpression.setRuntime(null);
+        }
+
+        if (Boolean.TRUE.equals(groupFinished))
+        {
+          // If the group expression returns true, we should pack our belongings
+          // and stop with that process. The group is finished.
+
+          // In Cobol, this would mean that one of the group-fields has changed.
+          return true;
+        }
+      }
+
+      final Node parent = group.getParent();
+      if (parent == null)
+      {
+        group = null;
+      }
+      else
+      {
+        group = parent.getGroup();
+      }
+    }
+    return false;
+  }
+
+
+  private static void mergeDeclarationRule(final CSSDeclarationRule target,
+                                           final CSSDeclarationRule source)
+  {
+    final StyleKey[] styleKeys = source.getPropertyKeysAsArray();
+    for (int i = 0; i < styleKeys.length; i++)
+    {
+      final StyleKey key = styleKeys[i];
+      final CSSValue value = source.getPropertyCSSValue(key);
+      if (value == null)
+      {
+        continue;
+      }
+
+      final boolean sourceImportant = source.isImportant(key);
+      final boolean targetImportant = target.isImportant(key);
+      if (targetImportant)
+      {
+        continue;
+      }
+      target.setPropertyValue(key, value);
+      target.setImportant(key, sourceImportant);
+    }
+  }
+
+  private static CSSDeclarationRule processStyleAttribute
+      (final Object styleAttributeValue,
+       final Element node,
+       final ExpressionRuntime runtime,
+       CSSDeclarationRule targetRule)
+      throws DataSourceException
+  {
+    if (targetRule == null)
+    {
+      try
+      {
+        targetRule = (CSSDeclarationRule) node.getStyle().clone();
+      }
+      catch (CloneNotSupportedException e)
+      {
+        targetRule = new CSSStyleRule(null, null);
+      }
+    }
+
+
+    if (styleAttributeValue instanceof String)
+    {
+      // ugly, we have to parse that thing. Cant think of nothing
+      // worse than that.
+      final String styleText = (String) styleAttributeValue;
+      try
+      {
+        final ReportContext reportContext = runtime.getReportContext();
+        final ReportStructureRoot root = reportContext.getReportStructureRoot();
+        final ResourceKey baseResource = root.getBaseResource();
+        final ResourceManager resourceManager = root.getResourceManager();
+
+        final byte[] bytes = styleText.getBytes("UTF-8");
+        final ResourceKey key = resourceManager.createKey(bytes);
+        final Resource resource = resourceManager.create
+            (key, baseResource, StyleRule.class);
+
+        final CSSDeclarationRule parsedRule =
+            (CSSDeclarationRule) resource.getResource();
+        mergeDeclarationRule(targetRule, parsedRule);
+      }
+      catch (Exception e)
+      {
+        // ignore ..
+        e.printStackTrace();
+      }
+    }
+    else if (styleAttributeValue instanceof CSSStyleRule)
+    {
+      final CSSStyleRule styleRule =
+          (CSSStyleRule) styleAttributeValue;
+      mergeDeclarationRule(targetRule, styleRule);
+    }
+
+    // ok, not lets fill in the stuff from the style expressions ..
+    final Map styleExpressions = node.getStyleExpressions();
+    final Iterator styleExIt = styleExpressions.entrySet().iterator();
+
+    while (styleExIt.hasNext())
+    {
+      final Map.Entry entry = (Map.Entry) styleExIt.next();
+      final String name = (String) entry.getKey();
+      final Expression expression = (Expression) entry.getValue();
+      try
+      {
+        expression.setRuntime(runtime);
+        final Object value = expression.computeValue();
+        final StyleKey keyByName =
+            StyleKeyRegistry.getRegistry().findKeyByName(name);
+
+        if (value instanceof CSSValue)
+        {
+          final CSSValue cssvalue = (CSSValue) value;
+          if (keyByName != null)
+          {
+            targetRule.setPropertyValue(keyByName, cssvalue);
+          }
+          else
+          {
+            targetRule.setPropertyValueAsString(name, cssvalue.getCSSText());
+          }
+        }
+        else if (value != null)
+        {
+          targetRule.setPropertyValueAsString(name, String.valueOf(value));
+        }
+      }
+      finally
+      {
+        expression.setRuntime(null);
+      }
+    }
+    return targetRule;
+  }
+
+  private static AttributeMap collectAttributes(final Element node,
+                                                final ExpressionRuntime runtime)
+      throws DataSourceException
+  {
+
+    AttributeMap attributes = node.getAttributeMap();
+    final AttributeMap attributeExpressions = node.getAttributeExpressionMap();
+    if (attributeExpressions.isEmpty())
+    {
+      return attributes;
+    }
+    
+    final String[] namespaces = attributeExpressions.getNameSpaces();
+    for (int i = 0; i < namespaces.length; i++)
+    {
+      final String namespace = namespaces[i];
+      final Map attrEx = attributeExpressions.getAttributes(namespace);
+
+      final Iterator attributeExIt = attrEx.entrySet().iterator();
+      while (attributeExIt.hasNext())
+      {
+        final Map.Entry entry = (Map.Entry) attributeExIt.next();
+        final String name = (String) entry.getKey();
+        final Expression expression = (Expression) entry.getValue();
+        try
+        {
+          expression.setRuntime(runtime);
+          final Object value = expression.computeValue();
+          if (attributes.isReadOnly())
+          {
+            attributes = new AttributeMap(attributes);
+          }
+          attributes.setAttribute(namespace, name, value);
+        }
+        finally
+        {
+          expression.setRuntime(null);
+        }
+      }
+    }
+    return attributes.createUnmodifiableMap();
+  }
+
+  public static AttributeMap processAttributes(final Element node,
+                                               final ReportTarget target,
+                                               final ExpressionRuntime runtime)
+      throws DataSourceException
+  {
+    final AttributeMap attributes = collectAttributes(node, runtime);
+    CSSDeclarationRule rule = null;
+
+
+    final String[] attrNamespaces = attributes.getNameSpaces();
+    for (int i = 0; i < attrNamespaces.length; i++)
+    {
+      final String namespace = attrNamespaces[i];
+      final Map attributeMap = attributes.getAttributes(namespace);
+      if (attributeMap == null || attributeMap.isEmpty())
+      {
+        continue;
+      }
+
+      final NamespaceDefinition nsDef = target.getNamespaceByUri(namespace);
+      final Iterator attributeIt = attributeMap.entrySet().iterator();
+      while (attributeIt.hasNext())
+      {
+        final Map.Entry entry = (Map.Entry) attributeIt.next();
+        final String key = (String) entry.getKey();
+        if (isStyleAttribute(nsDef, node.getType(), key))
+        {
+          final Object styleAttributeValue = entry.getValue();
+          rule = processStyleAttribute(styleAttributeValue, node, runtime, rule);
+        }
+      }
+    }
+
+    // Just in case there was no style-attribute but there are style-expressions
+    if (rule == null)
+    {
+      rule = processStyleAttribute(null, node, runtime, rule);
+    }
+
+    if (rule != null && rule.isEmpty() == false)
+    {
+      final AttributeMap retval = new AttributeMap(attributes);
+      retval.setAttribute(Namespaces.LIBLAYOUT_NAMESPACE, "style", rule);
+      retval.makeReadOnly();
+      return retval;
+    }
+
+    return attributes;
+  }
+
+  private static boolean isStyleAttribute(final NamespaceDefinition def,
+                                          final String elementName,
+                                          final String attrName)
+  {
+    if (def == null)
+    {
+      return false;
+    }
+
+    final String[] styleAttr = def.getStyleAttribute(elementName);
+    for (int i = 0; i < styleAttr.length; i++)
+    {
+      final String styleAttrib = styleAttr[i];
+      if (attrName.equals(styleAttrib))
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  public static AttributeMap createEmptyMap(final String namespace,
+                                            final String tagName)
+  {
+    final AttributeMap map = new AttributeMap();
+    map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE,
+        Element.NAMESPACE_ATTRIBUTE, namespace);
+    map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE,
+        Element.TYPE_ATTRIBUTE, tagName);
+    return map;
+  }
+
+
+  public static Object performPrecompute(final int expressionPosition,
+                                         final PrecomputeNodeKey nodeKey,
+                                         final LayoutController layoutController,
+                                         final FlowController flowController)
+      throws ReportProcessingException, ReportDataFactoryException,
+      DataSourceException
+  {
+    final FlowController fc = flowController.createPrecomputeInstance();
+    final PrecomputedValueRegistry pcvr = fc.getPrecomputedValueRegistry();
+
+    pcvr.startElementPrecomputation(nodeKey);
+
+    final LayoutController rootLc = layoutController.createPrecomputeInstance(fc);
+    final LayoutController rootParent = rootLc.getParent();
+    final ReportTarget target = new EmptyReportTarget(fc.getReportJob(), fc.getExportDescriptor());
+
+    LayoutController lc = rootLc;
+    while (lc.isAdvanceable())
+    {
+      lc = lc.advance(target);
+      while (lc.isAdvanceable() == false && lc.getParent() != null)
+      {
+        final LayoutController parent = lc.getParent();
+        lc = parent.join(lc.getFlowController());
+      }
+    }
+
+    target.commit();
+    final PrecomputeNode precomputeNode = pcvr.currentNode();
+    final Object functionResult = precomputeNode.getFunctionResult(expressionPosition);
+    pcvr.finishElementPrecomputation(nodeKey);
+    return functionResult;
+//    throw new IllegalStateException
+//        ("Ups - we did not get to the root parent again. This is awful and we cannot continue.");
+  }
+
+
+  public static LayoutController skipInvisibleElement(final LayoutController layoutController)
+      throws ReportProcessingException, ReportDataFactoryException, DataSourceException
+  {
+    final FlowController fc = layoutController.getFlowController();
+    final ReportTarget target = new EmptyReportTarget(fc.getReportJob(), fc.getExportDescriptor());
+    final LayoutController rootParent = layoutController.getParent();
+
+    // Now start to iterate until the derived layout controller 'lc' that has this given parent
+    // wants to join.
+    LayoutController lc = layoutController;
+    while (lc.isAdvanceable())
+    {
+      lc = lc.advance(target);
+      while (lc.isAdvanceable() == false && lc.getParent() != null)
+      {
+        final LayoutController parent = lc.getParent();
+        lc = parent.join(lc.getFlowController());
+        if (parent == rootParent)
+        {
+          target.commit();
+          return lc;
+        }
+      }
+    }
+    target.commit();
+    throw new IllegalStateException
+        ("Ups - we did not get to the root parent again. This is awful and we cannot continue.");
+//    return lc;
+  }
+
+  public static Object evaluateExpression(final FlowController flowController,
+                                          final Object declaringParent,
+                                          final Expression expression)
+      throws DataSourceException
+  {
+    final ExpressionRuntime runtime =
+        getExpressionRuntime(flowController, declaringParent);
+
+    try
+    {
+      expression.setRuntime(runtime);
+      return expression.computeValue();
+    }
+    catch (DataSourceException dse)
+    {
+      throw dse;
+    }
+    catch (Exception e)
+    {
+      throw new DataSourceException("Failed to evaluate expression", e);
+    }
+    finally
+    {
+      expression.setRuntime(null);
+    }
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/ReportLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/ReportLayoutController.java
new file mode 100644
index 0000000..68f9daa
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/ReportLayoutController.java
@@ -0,0 +1,72 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.JFreeReport;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportTarget;
+
+/**
+ * Creation-Date: 24.11.2006, 13:56:50
+ *
+ * @author Thomas Morgner
+ */
+public class ReportLayoutController extends SectionLayoutController
+{
+  public ReportLayoutController()
+  {
+  }
+
+  protected FlowController startData(final ReportTarget target,
+                                     final FlowController fc)
+      throws DataSourceException,
+      ReportProcessingException, ReportDataFactoryException
+  {
+    final JFreeReport report = (JFreeReport) getElement();
+    target.startReport(report);
+    return fc.performQuery(report.getQuery());
+  }
+
+  protected FlowController finishData(final ReportTarget target,
+                                      final FlowController fc)
+      throws DataSourceException, ReportProcessingException
+  {
+    final JFreeReport report = (JFreeReport) getElement();
+    target.endReport(report);
+    // do something fancy ... query the data, for instance.
+    // this implies that we create a new global datarow.
+    return fc.performReturnFromQuery();
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/SectionLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/SectionLayoutController.java
new file mode 100644
index 0000000..e06240f
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/SectionLayoutController.java
@@ -0,0 +1,256 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SectionLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.expressions.Expression;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.structure.Node;
+import org.jfree.report.structure.Section;
+
+/**
+ * Creation-Date: 24.11.2006, 13:56:10
+ *
+ * @author Thomas Morgner
+ */
+public class SectionLayoutController extends ElementLayoutController
+{
+  // we store the child instead of the index, as the report can be manipulated
+  // it is safer this way ..
+  private Node[] nodes;
+  private int index;
+
+  public SectionLayoutController()
+  {
+  }
+
+  protected FlowController startData(final ReportTarget target,
+                                     final FlowController fc)
+      throws DataSourceException, ReportProcessingException,
+      ReportDataFactoryException
+  {
+    final Section s = (Section) getElement();
+    return LayoutControllerUtil.processFlowOperations
+        (fc, s.getOperationBefore());
+  }
+
+  protected LayoutController processContent(final ReportTarget target)
+      throws DataSourceException, ReportProcessingException,
+      ReportDataFactoryException
+  {
+
+    final FlowController flowController = getFlowController();
+
+    final Node[] nodes = getNodes();
+    final int currentIndex = getIndex();
+    if (currentIndex < nodes.length)
+    {
+      final Node node = nodes[currentIndex];
+      final SectionLayoutController derived = (SectionLayoutController) clone();
+      return processChild(derived, node, flowController);
+    }
+    else
+    {
+      final SectionLayoutController derived = (SectionLayoutController) clone();
+      derived.setProcessingState(ElementLayoutController.FINISHING);
+      return derived;
+    }
+  }
+
+  protected LayoutController processChild(final SectionLayoutController derived,
+                                          final Node node,
+                                          final FlowController flowController)
+      throws DataSourceException, ReportProcessingException,
+      ReportDataFactoryException
+  {
+    final ReportContext reportContext = flowController.getReportContext();
+    final LayoutControllerFactory layoutControllerFactory = reportContext.getLayoutControllerFactory();
+    if (isDisplayable(node))
+    {
+      derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN);
+      return layoutControllerFactory.create(flowController, node, derived);
+    }
+    else
+    {
+      derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN);
+      final LayoutController childLc = layoutControllerFactory.create(flowController, node, derived);
+      return LayoutControllerUtil.skipInvisibleElement(childLc);
+//      derived.setIndex(derived.getIndex() + 1);
+//      return LayoutControllerUtil.skipInvisibleElement(derived);
+    }
+  }
+
+  protected boolean isDisplayable(final Node node)
+      throws DataSourceException
+  {
+    if (node.isEnabled() == false)
+    {
+      return false;
+    }
+
+    final Expression expression = node.getDisplayCondition();
+    if (expression == null)
+    {
+      return true;
+    }
+
+    final Object result = LayoutControllerUtil.evaluateExpression(getFlowController(), node, expression);
+    if (Boolean.TRUE.equals(result))
+    {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Finishes the processing of this element. This method is called when the
+   * processing state is 'FINISHING'. The element should be closed now and all
+   * privatly owned resources should be freed. If the element has a parent, it
+   * would be time to join up with the parent now, else the processing state
+   * should be set to 'FINISHED'.
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if there was an error trying query
+   *                                    data.
+   */
+  protected LayoutController finishElement(final ReportTarget target)
+      throws ReportProcessingException, DataSourceException,
+      ReportDataFactoryException
+  {
+    FlowController fc = handleDefaultEndElement(target);
+
+    // unwind the stack ..
+    final Section s = (Section) getElement();
+    fc = finishData(target, fc);
+
+    if (s.isRepeat())
+    {
+      final FlowController cfc = tryRepeatingCommit(fc);
+      if (cfc != null)
+      {
+        // Go back to the beginning ...
+        final SectionLayoutController derived = (SectionLayoutController) clone();
+        derived.setProcessingState(ElementLayoutController.NOT_STARTED);
+        derived.setFlowController(cfc);
+        derived.resetSectionForRepeat();
+        return derived;
+      }
+    }
+
+    // Go back to the beginning ...
+    final SectionLayoutController derived = (SectionLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.FINISHED);
+    derived.setFlowController(fc);
+    return derived;
+  }
+
+  protected void resetSectionForRepeat()
+  {
+    setIndex(0);
+  }
+
+  protected FlowController finishData(final ReportTarget target,
+                                      final FlowController fc)
+      throws DataSourceException, ReportProcessingException
+  {
+    final Section s = (Section) getElement();
+    return LayoutControllerUtil.processFlowOperations
+        (fc, s.getOperationAfter());
+  }
+
+  /**
+   * Joins with a delegated process flow. This is generally called from a child
+   * flow and should *not* (I mean it!) be called from outside. If you do,
+   * you'll suffer.
+   *
+   * @param flowController the flow controller of the parent.
+   * @return the joined layout controller that incorperates all changes from the
+   *         delegate.
+   */
+  public LayoutController join(final FlowController flowController)
+  {
+    final Node[] nodes = getNodes();
+    int index = getIndex() + 1;
+    for (; index < nodes.length; index++)
+    {
+      final Node node = nodes[index];
+      if (node.isEnabled())
+      {
+        break;
+      }
+    }
+
+    if (index < nodes.length)
+    {
+      final SectionLayoutController derived = (SectionLayoutController) clone();
+      derived.setProcessingState(ElementLayoutController.OPENED);
+      derived.setFlowController(flowController);
+      derived.setIndex(index);
+      return derived;
+    }
+
+    final SectionLayoutController derived = (SectionLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.FINISHING);
+    derived.setFlowController(flowController);
+    return derived;
+  }
+
+  public Node[] getNodes()
+  {
+    if (nodes == null)
+    {
+      final Section s = (Section) getElement();
+      nodes = s.getNodeArray();
+    }
+    return nodes;
+  }
+
+  public int getIndex()
+  {
+    return index;
+  }
+
+  public void setIndex(final int index)
+  {
+    this.index = index;
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/StaticTextLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/StaticTextLayoutController.java
new file mode 100644
index 0000000..a0c55a4
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/StaticTextLayoutController.java
@@ -0,0 +1,123 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticTextLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.structure.StaticText;
+
+/**
+ * Creation-Date: 24.11.2006, 15:06:56
+ *
+ * @author Thomas Morgner
+ */
+public class StaticTextLayoutController extends AbstractLayoutController
+{
+  public static final int NOT_STARTED = 0;
+  public static final int FINISHED = 2;
+
+  private int state;
+
+  public StaticTextLayoutController()
+  {
+  }
+
+  /**
+   * Advances the processing position.
+   *
+   * @param target the report target that receives generated events.
+   * @return the new layout controller instance representing the new state.
+   *
+   * @throws DataSourceException        if there was a problem reading data from
+   *                                    the datasource.
+   * @throws ReportProcessingException  if there was a general problem during
+   *                                    the report processing.
+   * @throws ReportDataFactoryException if a query failed.
+   */
+  public LayoutController advance(final ReportTarget target)
+      throws DataSourceException, ReportDataFactoryException, ReportProcessingException
+  {
+    if (state != StaticTextLayoutController.NOT_STARTED)
+    {
+      throw new IllegalStateException();
+    }
+
+    final StaticText text = (StaticText) getNode();
+    target.processText(text.getText());
+
+    final StaticTextLayoutController derived = (StaticTextLayoutController) clone();
+    derived.state = StaticTextLayoutController.FINISHED;
+    return derived;
+  }
+
+  /**
+   * Joins with a delegated process flow. This is generally called from a child
+   * flow and should *not* (I mean it!) be called from outside. If you do,
+   * you'll suffer.
+   *
+   * @param flowController the flow controller of the parent.
+   * @return the joined layout controller that incorperates all changes from
+   * the delegate.
+   */
+  public LayoutController join(final FlowController flowController)
+  {
+    throw new UnsupportedOperationException("Static text does not have childs.");
+  }
+
+  /**
+   * Checks, whether the layout controller would be advanceable. If this method
+   * returns true, it is generally safe to call the 'advance()' method.
+   *
+   * @return true, if the layout controller is advanceable, false otherwise.
+   */
+  public boolean isAdvanceable()
+  {
+    return state != StaticTextLayoutController.FINISHED;
+  }
+
+  /**
+   * Derives a copy of this controller that is suitable to perform a
+   * precomputation. The returned layout controller must be independent from
+   * the it's anchestor controller.
+   *
+   * @param fc a new flow controller for the precomputation.
+   * @return a copy that is suitable for precomputation.
+   */
+  public LayoutController createPrecomputeInstance(final FlowController fc)
+  {
+    throw new UnsupportedOperationException
+        ("Static Text does not perform any precomputation.");
+  }
+}
diff --git a/source/org/jfree/report/flow/layoutprocessor/SubReportLayoutController.java b/source/org/jfree/report/flow/layoutprocessor/SubReportLayoutController.java
new file mode 100644
index 0000000..feaf9c0
--- /dev/null
+++ b/source/org/jfree/report/flow/layoutprocessor/SubReportLayoutController.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SubReportLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.layoutprocessor;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.structure.SubReport;
+
+/**
+ * Creation-Date: 24.11.2006, 13:56:57
+ *
+ * @author Thomas Morgner
+ */
+public class SubReportLayoutController extends SectionLayoutController
+{
+  public SubReportLayoutController()
+  {
+  }
+
+  protected FlowController startData(final ReportTarget target,
+                                     final FlowController fc)
+      throws DataSourceException,
+      ReportProcessingException, ReportDataFactoryException
+  {
+    final SubReport report = (SubReport) getElement();
+    return fc.performSubReportQuery(report.getQuery(),
+        report.getInputMappings(), report.getExportMappings());
+  }
+
+  protected FlowController finishData(final ReportTarget target,
+                                      final FlowController fc)
+      throws DataSourceException, ReportProcessingException
+  {
+    return fc.performReturnFromQuery();
+  }
+}
diff --git a/source/org/jfree/report/flow/paginating/PageState.java b/source/org/jfree/report/flow/paginating/PageState.java
new file mode 100644
index 0000000..2d88de8
--- /dev/null
+++ b/source/org/jfree/report/flow/paginating/PageState.java
@@ -0,0 +1,74 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PageState.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.paginating;
+
+import java.io.Serializable;
+
+import org.jfree.report.flow.ReportTargetState;
+import org.jfree.report.flow.layoutprocessor.LayoutController;
+
+/**
+ * Creation-Date: 11.11.2006, 19:01:53
+ *
+ * @author Thomas Morgner
+ */
+public class PageState implements Serializable
+{
+  private ReportTargetState targetState;
+  private LayoutController layoutController;
+  private int pageCursor;
+
+  public PageState(final ReportTargetState targetState,
+                   final LayoutController layoutController,
+                   final int pageCursor)
+  {
+    this.layoutController = layoutController;
+    this.pageCursor = pageCursor;
+    this.targetState = targetState;
+
+  }
+
+  public int getPageCursor()
+  {
+    return pageCursor;
+  }
+
+  public ReportTargetState getTargetState()
+  {
+    return targetState;
+  }
+
+  public LayoutController getLayoutController()
+  {
+    return layoutController;
+  }
+}
diff --git a/source/org/jfree/report/flow/paginating/PageStateList.java b/source/org/jfree/report/flow/paginating/PageStateList.java
new file mode 100644
index 0000000..f843510
--- /dev/null
+++ b/source/org/jfree/report/flow/paginating/PageStateList.java
@@ -0,0 +1,344 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PageStateList.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.paginating;
+
+import java.util.ArrayList;
+
+import org.jfree.layouting.StateException;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.util.WeakReferenceList;
+
+
+/**
+ * The ReportState list stores a report states for the beginning of every page. The list
+ * is filled on repagination and read when a report or a page of the report is printed.
+ * <p/>
+ * Important: This list stores page start report states, not arbitary report states. These
+ * ReportStates are special: they can be reproduced by calling processPage on the report.
+ * <p/>
+ * Internally this list is organized as a list of WeakReferenceLists, where every
+ * WeakReferenceList stores a certain number of page states. The first 20 states are
+ * stored in an ordinary list with strong-references, so these states never get
+ * GarbageCollected (and so they must never be restored by reprocessing them). The next
+ * 100 states are stored in 4-element ReferenceLists, so if a reference is lost, only 4
+ * states have to be reprocessed. All other states are stored in 10-element lists.
+ *
+ * @author Thomas Morgner
+ */
+public class PageStateList
+{
+  /**
+   * The position of the master element in the list. A greater value will reduce the
+   * not-freeable memory used by the list, but restoring a single page will require more
+   * time.
+   */
+
+  /**
+   * The maxmimum masterposition size.
+   */
+  private static final int MASTERPOSITIONS_MAX = 10;
+
+  /**
+   * The medium masterposition size.
+   */
+  private static final int MASTERPOSITIONS_MED = 4;
+
+  /**
+   * The max index that will be stored in the primary list.
+   */
+  private static final int PRIMARY_MAX = 20;
+
+  /**
+   * The max index that will be stored in the master4 list.
+   */
+  private static final int MASTER4_MAX = 120;
+
+  /**
+   * Internal WeakReferenceList that is capable to restore its elements. The elements in
+   * this list are page start report states.
+   */
+  private static final class MasterList extends WeakReferenceList
+  {
+    /**
+     * The master list.
+     */
+    private final PageStateList master;
+
+    /**
+     * Creates a new master list.
+     *
+     * @param list          the list.
+     * @param maxChildCount the maximum number of elements in this list.
+     */
+    private MasterList (final PageStateList list, final int maxChildCount)
+    {
+      super(maxChildCount);
+      this.master = list;
+    }
+
+    /**
+     * Function to restore the state of a child after the child was garbage collected.
+     *
+     * @param index the index.
+     * @return the restored ReportState of the given index, or null, if the state could
+     *         not be restored.
+     */
+    protected Object restoreChild (final int index)
+    {
+      final PageState master = (PageState) getMaster();
+      if (master == null)
+      {
+        return null;
+      }
+      final int max = getChildPos(index);
+      try
+      {
+        return this.restoreState(max, master);
+      }
+      catch (Exception rpe)
+      {
+        return null;
+      }
+    }
+
+    /**
+     * Internal handler function restore a state. Count denotes the number of pages
+     * required to be processed to restore the page, when the reportstate master is used
+     * as source element.
+     *
+     * @param count     the count.
+     * @param rootstate the root state.
+     * @return the report state.
+     *
+     * @throws ReportProcessingException if there was a problem processing the report.
+     */
+    private PageState restoreState (final int count, final PageState rootstate)
+        throws ReportProcessingException, StateException,
+        ReportDataFactoryException, DataSourceException
+    {
+      if (rootstate == null)
+      {
+        throw new NullPointerException("Master is null");
+      }
+      PageState state = rootstate;
+      for (int i = 0; i <= count; i++)
+      {
+        final PaginatingReportProcessor pageProcess = master.getPageProcess();
+        state = pageProcess.processPage(state);
+        set(state, i + 1);
+        // todo: How to prevent endless loops. Should we prevent them at all?
+      }
+      return state;
+    }
+  }
+
+  /**
+   * The list of master states. This is a list of WeakReferenceLists. These
+   * WeakReferenceLists contain their master state as first child. The weakReferenceLists
+   * have a maxSize of 10, so every 10th state will protected from being
+   * garbageCollected.
+   */
+  private ArrayList masterStates10; // all states > 120
+  /**
+   * The list of master states. This is a list of WeakReferenceLists. These
+   * WeakReferenceLists contain their master state as first child. The weakReferenceLists
+   * have a maxSize of 4, so every 4th state will protected from being garbageCollected.
+   */
+  private ArrayList masterStates4; // all states from 20 - 120
+
+  /**
+   * The list of primary states. This is a list of ReportStates and is used to store the
+   * first 20 elements of this state list.
+   */
+  private ArrayList primaryStates; // all states from 0 - 20
+
+  /**
+   * The number of elements in this list.
+   */
+  private int size;
+
+  private PaginatingReportProcessor pageProcess;
+
+  /**
+   * Creates a new reportstatelist. The list will be filled using the specified report and
+   * output target. Filling of the list is done elsewhere.
+   *
+   * @param proc the reportprocessor used to restore lost states (null not permitted).
+   * @throws NullPointerException if the report processor is <code>null</code>.
+   */
+  public PageStateList (final PaginatingReportProcessor proc)
+  {
+    if (proc == null)
+    {
+      throw new NullPointerException("ReportProcessor null");
+    }
+
+    this.pageProcess = proc;
+
+    primaryStates = new ArrayList();
+    masterStates4 = new ArrayList();
+    masterStates10 = new ArrayList();
+
+  }
+
+  /**
+   * Returns the index of the WeakReferenceList in the master list.
+   *
+   * @param pos         the position.
+   * @param maxListSize the maximum list size.
+   * @return the position within the masterStateList.
+   */
+  private int getMasterPos (final int pos, final int maxListSize)
+  {
+    //return (int) Math.floor(pos / maxListSize);
+    return (pos / maxListSize);
+  }
+
+  protected PaginatingReportProcessor getPageProcess ()
+  {
+    return pageProcess;
+  }
+
+  /**
+   * Returns the number of elements in this list.
+   *
+   * @return the number of elements in the list.
+   */
+  public int size ()
+  {
+    return this.size;
+  }
+
+  /**
+   * Adds this report state to the end of the list.
+   *
+   * @param state the report state.
+   */
+  public void add (final PageState state)
+  {
+    if (state == null)
+    {
+      throw new NullPointerException();
+    }
+
+    // the first 20 Elements are stored directly into an ArrayList
+    if (size() < PRIMARY_MAX)
+    {
+      primaryStates.add(state);
+      this.size++;
+    }
+    // the next 100 Elements are stored into a list of 4-element weakReference
+    //list. So if an Element gets lost (GCd), only 4 states need to be replayed.
+    else if (size() < MASTER4_MAX)
+    {
+      final int secPos = size() - PRIMARY_MAX;
+      final int masterPos = getMasterPos(secPos, MASTERPOSITIONS_MED);
+      if (masterPos >= masterStates4.size())
+      {
+        final MasterList master = new MasterList(this, MASTERPOSITIONS_MED);
+        masterStates4.add(master);
+        master.add(state);
+      }
+      else
+      {
+        final MasterList master = (MasterList) masterStates4.get(masterPos);
+        master.add(state);
+      }
+      this.size++;
+    }
+    // all other Elements are stored into a list of 10-element weakReference
+    //list. So if an Element gets lost (GCd), 10 states need to be replayed.
+    else
+    {
+      final int thirdPos = size() - MASTER4_MAX;
+      final int masterPos = getMasterPos(thirdPos, MASTERPOSITIONS_MAX);
+      if (masterPos >= masterStates10.size())
+      {
+        final MasterList master = new MasterList(this, MASTERPOSITIONS_MAX);
+        masterStates10.add(master);
+        master.add(state);
+      }
+      else
+      {
+        final MasterList master = (MasterList) masterStates10.get(masterPos);
+        master.add(state);
+      }
+      this.size++;
+    }
+  }
+
+  /**
+   * Removes all elements in the list.
+   */
+  public void clear ()
+  {
+    masterStates10.clear();
+    masterStates4.clear();
+    primaryStates.clear();
+    this.size = 0;
+  }
+
+  /**
+   * Retrieves the element on position <code>index</code> in this list.
+   *
+   * @param index the index.
+   * @return the report state.
+   */
+  public PageState get (int index)
+  {
+    if (index >= size() || index < 0)
+    {
+      throw new IndexOutOfBoundsException
+              ("Index is invalid. Index was " + index + "; size was " + size());
+    }
+    if (index < PRIMARY_MAX)
+    {
+      return (PageState) primaryStates.get(index);
+    }
+    else if (index < MASTER4_MAX)
+    {
+      index -= PRIMARY_MAX;
+      final MasterList master
+              = (MasterList) masterStates4.get(getMasterPos(index, MASTERPOSITIONS_MED));
+      return (PageState) master.get(index);
+    }
+    else
+    {
+      index -= MASTER4_MAX;
+      final MasterList master
+              = (MasterList) masterStates10.get(getMasterPos(index, MASTERPOSITIONS_MAX));
+      return (PageState) master.get(index);
+    }
+  }
+}
diff --git a/source/org/jfree/report/flow/paginating/PaginatingReportProcessor.java b/source/org/jfree/report/flow/paginating/PaginatingReportProcessor.java
new file mode 100644
index 0000000..7d540fe
--- /dev/null
+++ b/source/org/jfree/report/flow/paginating/PaginatingReportProcessor.java
@@ -0,0 +1,308 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PaginatingReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow.paginating;
+
+import org.jfree.layouting.ChainingLayoutProcess;
+import org.jfree.layouting.DefaultLayoutProcess;
+import org.jfree.layouting.LayoutProcess;
+import org.jfree.layouting.StateException;
+import org.jfree.layouting.output.pageable.PageableOutputProcessor;
+import org.jfree.layouting.util.IntList;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.AbstractReportProcessor;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.LibLayoutReportTarget;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.flow.ReportTargetState;
+import org.jfree.report.flow.layoutprocessor.LayoutController;
+import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Paginating report processors are multi-pass processors.
+ * <p/>
+ * This is written to use LibLayout. It will never work with other report
+ * targets.
+ *
+ * Be aware that this class is not synchronized.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class PaginatingReportProcessor extends AbstractReportProcessor
+{
+  private PageableOutputProcessor outputProcessor;
+  private PageStateList stateList;
+  private IntList physicalMapping;
+  private IntList logicalMapping;
+
+  protected PaginatingReportProcessor(final PageableOutputProcessor outputProcessor)
+  {
+    this.outputProcessor = outputProcessor;
+  }
+
+  public PageableOutputProcessor getOutputProcessor()
+  {
+    return outputProcessor;
+  }
+
+  protected LibLayoutReportTarget createTarget(final ReportJob job)
+  {
+    if (outputProcessor == null)
+    {
+      throw new IllegalStateException("OutputProcessor is invalid.");
+    }
+    final LayoutProcess layoutProcess =
+        new ChainingLayoutProcess(new DefaultLayoutProcess(outputProcessor));
+    final ResourceManager resourceManager = job.getReportStructureRoot().getResourceManager();
+    final ResourceKey resourceKey = job.getReportStructureRoot().getBaseResource();
+
+    return new LibLayoutReportTarget
+        (job, resourceKey, resourceManager, layoutProcess);
+  }
+
+//  public void processReport(ReportJob job)
+//      throws ReportDataFactoryException,
+//      DataSourceException, ReportProcessingException
+//  {
+//    prepareReportProcessing(job);
+//
+//  }
+
+  protected void prepareReportProcessing(final ReportJob job)
+      throws ReportDataFactoryException, DataSourceException, ReportProcessingException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+
+    final long start = System.currentTimeMillis();
+    // first, compute the globals
+    processReportRun(job, createTarget(job));
+    if (outputProcessor.isGlobalStateComputed() == false)
+    {
+      throw new ReportProcessingException
+          ("Pagination has not yet been finished.");
+    }
+
+    // second, paginate
+    processPaginationRun(job, createTarget(job));
+    if (outputProcessor.isPaginationFinished() == false)
+    {
+      throw new ReportProcessingException
+          ("Pagination has not yet been finished.");
+    }
+
+    if (outputProcessor.isContentGeneratable() == false)
+    {
+      throw new ReportProcessingException
+          ("Illegal State.");
+    }
+    final long end = System.currentTimeMillis();
+    System.out.println("Pagination-Time: " + (end - start));
+  }
+
+  protected PageStateList processPaginationRun(final ReportJob job,
+                                               final LibLayoutReportTarget target)
+      throws ReportDataFactoryException,
+      DataSourceException, ReportProcessingException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+    stateList = new PageStateList(this);
+    physicalMapping = new IntList(40);
+    logicalMapping = new IntList(20);
+
+    final ReportContext context = createReportContext(job, target);
+    final LayoutControllerFactory layoutFactory =
+        context.getLayoutControllerFactory();
+
+    // we have the data and we have our position inside the report.
+    // lets generate something ...
+    final FlowController flowController = createFlowControler(context, job);
+
+    LayoutController layoutController =
+        layoutFactory.create(flowController, job.getReportStructureRoot(), null);
+
+    try
+    {
+      stateList.add(new PageState(target.saveState(), layoutController,
+          outputProcessor.getPageCursor()));
+      int logPageCount = outputProcessor.getLogicalPageCount();
+      int physPageCount = outputProcessor.getPhysicalPageCount();
+
+      while (layoutController.isAdvanceable())
+      {
+        layoutController = layoutController.advance(target);
+        target.commit();
+
+        while (layoutController.isAdvanceable() == false &&
+               layoutController.getParent() != null)
+        {
+          final LayoutController parent = layoutController.getParent();
+          layoutController = parent.join(layoutController.getFlowController());
+        }
+
+        // check whether a pagebreak has been encountered.
+        if (target.isPagebreakEncountered())
+        {
+          // So we hit a pagebreak. Store the state for later reuse.
+          // A single state can refer to more than one physical page.
+
+          final int newLogPageCount = outputProcessor.getLogicalPageCount();
+          final int newPhysPageCount = outputProcessor.getPhysicalPageCount();
+
+          final int result = stateList.size() - 1;
+          for (; physPageCount < newPhysPageCount; physPageCount++)
+          {
+            physicalMapping.add(result);
+          }
+
+          for (; logPageCount < newLogPageCount; logPageCount++)
+          {
+            logicalMapping.add(result);
+          }
+
+          logPageCount = newLogPageCount;
+          physPageCount = newPhysPageCount;
+
+          final ReportTargetState targetState = target.saveState();
+          final PageState state =
+              new PageState (targetState, layoutController,
+              outputProcessor.getPageCursor());
+          stateList.add(state);
+
+          // This is an assertation that we do not run into invalid states
+          // later.
+          if (PaginatingReportProcessor.ASSERTATION)
+          {
+            final ReportTarget reportTarget =
+              targetState.restore(outputProcessor);
+          }
+
+          target.resetPagebreakFlag();
+        }
+      }
+
+      // And when we reached the end, add the remaining pages ..
+      final int newLogPageCount = outputProcessor.getLogicalPageCount();
+      final int newPhysPageCount = outputProcessor.getPhysicalPageCount();
+
+      final int result = stateList.size() - 1;
+      for (; physPageCount < newPhysPageCount; physPageCount++)
+      {
+        physicalMapping.add(result);
+      }
+
+      for (; logPageCount < newLogPageCount; logPageCount++)
+      {
+        logicalMapping.add(result);
+      }
+    }
+    catch (final StateException e)
+    {
+      throw new ReportProcessingException("Argh, Unable to save the state!");
+    }
+
+    DebugLog.log("After pagination we have " + stateList.size() + " states");
+    return stateList;
+  }
+
+  public boolean isPaginated()
+  {
+    return outputProcessor.isPaginationFinished();
+  }
+
+  protected PageState getLogicalPageState (final int page)
+  {
+    return stateList.get(logicalMapping.get(page));
+  }
+
+  protected PageState getPhysicalPageState (final int page)
+  {
+    return stateList.get(physicalMapping.get(page));
+  }
+
+  public PageState processPage(final PageState previousState)
+      throws StateException, ReportProcessingException,
+      ReportDataFactoryException, DataSourceException
+  {
+    final ReportTargetState targetState = previousState.getTargetState();
+    final LibLayoutReportTarget target =
+        (LibLayoutReportTarget) targetState.restore(outputProcessor);
+    outputProcessor.setPageCursor(previousState.getPageCursor());
+
+    LayoutController position = previousState.getLayoutController();
+
+    // we have the data and we have our position inside the report.
+    // lets generate something ...
+
+    while (position.isAdvanceable())
+    {
+      position = position.advance(target);
+      target.commit();
+
+      // else check whether this state is finished, and try to join the subflow
+      // with the parent.
+      while (position.isAdvanceable() == false &&
+             position.getParent() != null)
+      {
+        final LayoutController parent = position.getParent();
+        position = parent.join(position.getFlowController());
+      }
+
+      // check whether a pagebreak has been encountered.
+      if (target.isPagebreakEncountered())
+      {
+        // So we hit a pagebreak. Store the state for later reuse.
+        // A single state can refer to more than one physical page.
+        final PageState state = new PageState
+            (target.saveState(), position, outputProcessor.getPageCursor());
+        target.resetPagebreakFlag();
+        return state;
+      }
+
+    }
+
+    // reached the finish state .. this is bad!
+    return null;
+  }
+
+  private static final boolean ASSERTATION = true;
+}
diff --git a/source/org/jfree/report/flow/raw/RawReportProcessor.java b/source/org/jfree/report/flow/raw/RawReportProcessor.java
new file mode 100644
index 0000000..28b3458
--- /dev/null
+++ b/source/org/jfree/report/flow/raw/RawReportProcessor.java
@@ -0,0 +1,54 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: RawReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow.raw;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.flow.SinglePassReportProcessor;
+
+/**
+ * The Raw report processor defines the base for all non-layouting output
+ * methods. As no layouting is involved, this output method is lightning
+ * fast.
+ *
+ * @author Thomas Morgner
+ */
+public class RawReportProcessor extends SinglePassReportProcessor
+{
+  public RawReportProcessor()
+  {
+  }
+
+  protected ReportTarget createReportTarget(ReportJob job)
+  {
+    return new RawReportTarget(job);
+  }
+}
diff --git a/source/org/jfree/report/flow/raw/RawReportTarget.java b/source/org/jfree/report/flow/raw/RawReportTarget.java
new file mode 100644
index 0000000..f572295
--- /dev/null
+++ b/source/org/jfree/report/flow/raw/RawReportTarget.java
@@ -0,0 +1,114 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: RawReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow.raw;
+
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.flow.ReportTarget;
+
+/**
+ * The Raw report processor defines the base for all non-layouting output
+ * methods. As no layouting is involved, this output method is lightning
+ * fast.
+ *
+ * @author Thomas Morgner
+ */
+public class RawReportTarget implements ReportTarget
+{
+  private ReportJob reportJob;
+
+  public RawReportTarget(final ReportJob job)
+  {
+    this.reportJob = job;
+  }
+
+  public ReportJob getReportJob()
+  {
+    return reportJob;
+  }
+
+  public void startReport(final ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void startElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void processContent(final DataFlags value)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void endElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public void endReport(ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+  public NamespaceDefinition getNamespaceByUri(String uri)
+  {
+    return null;
+  }
+
+  public void processText(String text)
+      throws DataSourceException, ReportProcessingException
+  {
+
+  }
+
+
+  public void commit()
+  {
+
+  }
+
+  public String getExportDescriptor()
+  {
+    return "raw";
+  }
+}
diff --git a/source/org/jfree/report/flow/raw/XmlPrintReportProcessor.java b/source/org/jfree/report/flow/raw/XmlPrintReportProcessor.java
new file mode 100644
index 0000000..17133cb
--- /dev/null
+++ b/source/org/jfree/report/flow/raw/XmlPrintReportProcessor.java
@@ -0,0 +1,79 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: XmlPrintReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.raw;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.flow.SinglePassReportProcessor;
+import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter;
+
+/**
+ * Todo: Document me!
+ *
+ * @author Thomas Morgner
+ * @since 20.03.2007
+ */
+public class XmlPrintReportProcessor extends SinglePassReportProcessor
+{
+  private OutputStream outputStream;
+  private String encoding;
+
+
+  public XmlPrintReportProcessor(final OutputStream outputStream,
+                                 final String encoding)
+  {
+    this.outputStream = outputStream;
+    this.encoding = encoding;
+  }
+
+  protected ReportTarget createReportTarget(final ReportJob job)
+      throws ReportProcessingException
+  {
+    try
+    {
+      final OutputStreamWriter osw =
+          new OutputStreamWriter(outputStream, encoding);
+      final XmlWriter writer = new XmlWriter(osw);
+      writer.writeXmlDeclaration(encoding);
+      return new XmlPrintReportTarget(job, writer);
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("Failed to create writer", e);
+    }
+  }
+}
diff --git a/source/org/jfree/report/flow/raw/XmlPrintReportTarget.java b/source/org/jfree/report/flow/raw/XmlPrintReportTarget.java
new file mode 100644
index 0000000..6895cf6
--- /dev/null
+++ b/source/org/jfree/report/flow/raw/XmlPrintReportTarget.java
@@ -0,0 +1,282 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: XmlPrintReportTarget.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.flow.raw;
+
+import java.awt.Image;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.namespace.Namespaces;
+import org.jfree.layouting.namespace.NamespaceCollection;
+import org.jfree.layouting.namespace.DefaultNamespaceCollection;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.layouting.LibLayoutBoot;
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.util.AttributeNameGenerator;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.flow.ReportTargetUtil;
+import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter;
+import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport;
+import org.pentaho.reporting.libraries.xmlns.common.AttributeList;
+
+/**
+ * Todo: Document me!
+ *
+ * @author Thomas Morgner
+ * @since 20.03.2007
+ */
+public class XmlPrintReportTarget implements ReportTarget
+{
+  private ReportJob reportJob;
+  private XmlWriter writer;
+  private NamespaceCollection namespaces;
+  private AttributeNameGenerator namespacePrefixGenerator;
+
+  public XmlPrintReportTarget(final ReportJob job,
+                              final XmlWriter writer)
+  {
+    this.reportJob = job;
+    this.writer = writer;
+
+    final NamespaceDefinition[] reportNamespaces = Namespaces.createFromConfig
+        (reportJob.getConfiguration(), "org.jfree.report.namespaces.", null);
+    final NamespaceDefinition[] layoutNamespaces = Namespaces.createFromConfig
+        (LibLayoutBoot.getInstance().getGlobalConfig(),
+            "org.jfree.layouting.namespaces.", null);
+    DefaultNamespaceCollection namespaces = new DefaultNamespaceCollection();
+    namespaces.addDefinitions(reportNamespaces);
+    namespaces.addDefinitions(layoutNamespaces);
+    this.namespaces = namespaces;
+    this.namespacePrefixGenerator = new AttributeNameGenerator();
+  }
+
+  public ReportJob getReportJob()
+  {
+    return reportJob;
+  }
+
+  public void startReport(final ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      writer.writeComment("starting report");
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("IOError", e);
+    }
+  }
+
+  public void startElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+    final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs);
+    final String elementType =
+        ReportTargetUtil.getElemenTypeFromAttribute(attrs);
+
+    try
+    {
+      final AttributeList attrList = buildAttributeList(attrs);
+      validateNamespace(namespace, attrList);
+      writer.writeTag(namespace, elementType, attrList,
+          XmlWriterSupport.OPEN);
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("IOError", e);
+    }
+  }
+
+  public void processContent(final DataFlags value)
+      throws DataSourceException, ReportProcessingException
+  {
+    final Object rawvalue = value.getValue();
+    if (rawvalue == null)
+    {
+      return;
+    }
+
+    // special handler for image (possibly also for URL ..)
+    if (rawvalue instanceof Image)
+    {
+      // do nothing yet. We should define something for that later ..
+      return;
+    }
+
+    try
+    {
+      final String text = String.valueOf(rawvalue);
+      writer.writeTextNormalized(text, false);
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("Failed", e);
+    }
+  }
+
+  public void endElement(final AttributeMap attrs)
+      throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      writer.writeCloseTag();
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("IOError", e);
+    }
+  }
+
+  public void endReport(final ReportStructureRoot report)
+      throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      writer.writeComment("starting report");
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("IOError", e);
+    }
+  }
+
+  public NamespaceDefinition getNamespaceByUri(final String uri)
+  {
+    return namespaces.getDefinition(uri);
+  }
+
+  public void processText(final String text)
+      throws DataSourceException, ReportProcessingException
+  {
+    try
+    {
+      writer.writeTextNormalized(text, false);
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("IOError", e);
+    }
+  }
+
+
+  public void commit()
+      throws ReportProcessingException
+  {
+    try
+    {
+      writer.flush();
+    }
+    catch (IOException e)
+    {
+      throw new ReportProcessingException("Failed to flush", e);
+    }
+  }
+
+  public String getExportDescriptor()
+  {
+    return "raw/text+xml";
+  }
+
+  protected AttributeList buildAttributeList(final AttributeMap attrs)
+  {
+    final AttributeList attrList = new AttributeList();
+    final String[] namespaces = attrs.getNameSpaces();
+    for (int i = 0; i < namespaces.length; i++)
+    {
+      final String attrNamespace = namespaces[i];
+      if (isInternalNamespace(attrNamespace))
+      {
+        continue;
+      }
+
+      final Map localAttributes = attrs.getAttributes(attrNamespace);
+      final Iterator entries = localAttributes.entrySet().iterator();
+      while (entries.hasNext())
+      {
+        final Map.Entry entry = (Map.Entry) entries.next();
+        final String key = String.valueOf(entry.getKey());
+        validateNamespace(attrNamespace, attrList);
+        attrList.setAttribute(attrNamespace, key,
+            String.valueOf(entry.getValue()));
+      }
+    }
+    return attrList;
+  }
+
+  private void validateNamespace(final String uri, final AttributeList list)
+  {
+    if (writer.isNamespaceDefined(uri))
+    {
+      return;
+    }
+
+    if (list.isNamespaceUriDefined(uri))
+    {
+      return;
+    }
+
+    final NamespaceDefinition def = getNamespaceByUri(uri);
+    if (def != null)
+    {
+      final String prefix = def.getPreferredPrefix();
+      if (writer.isNamespacePrefixDefined(prefix) == false &&
+          list.isNamespacePrefixDefined(prefix) == false)
+      {
+        list.addNamespaceDeclaration (prefix, uri);
+      }
+      else
+      {
+        list.addNamespaceDeclaration
+            (namespacePrefixGenerator.generateName(prefix), uri);
+      }
+    }
+    else
+    {
+      list.addNamespaceDeclaration
+          (namespacePrefixGenerator.generateName("auto"), uri);
+    }
+  }
+
+  private boolean isInternalNamespace(final String namespace)
+  {
+    return JFreeReportInfo.REPORT_NAMESPACE.equals(namespace);
+  }
+
+}
diff --git a/source/org/jfree/report/flow/streaming/StreamingReportProcessor.java b/source/org/jfree/report/flow/streaming/StreamingReportProcessor.java
new file mode 100644
index 0000000..d1764ad
--- /dev/null
+++ b/source/org/jfree/report/flow/streaming/StreamingReportProcessor.java
@@ -0,0 +1,104 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StreamingReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.flow.streaming;
+
+import org.jfree.layouting.DefaultLayoutProcess;
+import org.jfree.layouting.LayoutProcess;
+import org.jfree.layouting.output.OutputProcessor;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.AbstractReportProcessor;
+import org.jfree.report.flow.LibLayoutReportTarget;
+import org.jfree.report.flow.ReportJob;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+
+/**
+ * This is written to use LibLayout. It will never work with other report
+ * targets.
+ *
+ * @author Thomas Morgner
+ */
+public class StreamingReportProcessor extends AbstractReportProcessor
+{
+  private OutputProcessor outputProcessor;
+
+  public StreamingReportProcessor()
+  {
+  }
+
+  public OutputProcessor getOutputProcessor()
+  {
+    return outputProcessor;
+  }
+
+  public void setOutputProcessor(final OutputProcessor outputProcessor)
+  {
+    this.outputProcessor = outputProcessor;
+  }
+
+  public void processReport(final ReportJob job)
+      throws ReportDataFactoryException, DataSourceException, ReportProcessingException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+
+    synchronized (job)
+    {
+      // first, compute the globals
+      processReportRun(job, createTarget(job));
+      // second, paginate (this splits the stream into flows)
+      processReportRun(job, createTarget(job));
+      // third, generate the content.
+      processReportRun(job, createTarget(job));
+    }
+  }
+
+  protected LibLayoutReportTarget createTarget(final ReportJob job)
+          throws ReportProcessingException
+  {
+    if (outputProcessor == null)
+    {
+      throw new IllegalStateException(
+              "OutputProcessor is invalid.");
+    }
+    final LayoutProcess layoutProcess =
+        new DefaultLayoutProcess(outputProcessor);
+    final ResourceManager resourceManager = job.getReportStructureRoot().getResourceManager();
+    final ResourceKey resourceKey = job.getReportStructureRoot().getBaseResource();
+
+    return new LibLayoutReportTarget
+            (job, resourceKey, resourceManager, layoutProcess);
+  }
+}
diff --git a/source/org/jfree/report/i18n/DefaultResourceBundleFactory.java b/source/org/jfree/report/i18n/DefaultResourceBundleFactory.java
new file mode 100644
index 0000000..874fbb1
--- /dev/null
+++ b/source/org/jfree/report/i18n/DefaultResourceBundleFactory.java
@@ -0,0 +1,74 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultResourceBundleFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.i18n;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * A default implementation of the ResourceBundleFactory, that creates resource bundles
+ * using the specified locale.
+ * <p/>
+ * If not defined otherwise, this implementation uses <code>Locale.getDefault()</code> as
+ * Locale.
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultResourceBundleFactory implements ResourceBundleFactory
+{
+
+  /**
+   * Creates a new DefaultResourceBundleFactory using the system's default locale as
+   * factory locale.
+   */
+  public DefaultResourceBundleFactory ()
+  {
+  }
+
+  /**
+   * Creates a resource bundle named by the given key and using the factory's defined
+   * locale.
+   *
+   * @param key the name of the resourcebundle, never null.
+   * @return the created resource bundle
+   *
+   * @throws NullPointerException if <code>key</code> is
+   *                              <code>null</code>
+   * @throws java.util.MissingResourceException
+   *                              if no resource bundle for the specified base name can be
+   *                              found
+   * @see ResourceBundle#getBundle(String,Locale)
+   */
+  public ResourceBundle getResourceBundle (final Locale locale, final String key)
+  {
+    return ResourceBundle.getBundle(key, locale);
+  }
+}
diff --git a/source/org/jfree/report/i18n/ResourceBundleFactory.java b/source/org/jfree/report/i18n/ResourceBundleFactory.java
new file mode 100644
index 0000000..b16d492
--- /dev/null
+++ b/source/org/jfree/report/i18n/ResourceBundleFactory.java
@@ -0,0 +1,58 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ResourceBundleFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.i18n;
+
+import java.io.Serializable;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * A resource bundle factory defines the locale for a report and is used to create
+ * resourcebundles.
+ *
+ * @author Thomas Morgner
+ */
+public interface ResourceBundleFactory extends Serializable
+{
+  public static final String DEFAULT_RESOURCE_BUNDLE_CONFIG_KEY =
+          "org.jfree.report.ResourceBundle";
+  /**
+   * Creates a resource bundle for the given key. How that key is interpreted depends on
+   * the used concrete implementation of this interface.
+   *
+   * @param key the key that identifies the resource bundle
+   * @return the created resource bundle
+   *
+   * @throws java.util.MissingResourceException
+   *          if no resource bundle for the specified base name can be found
+   */
+  public ResourceBundle getResourceBundle (final Locale locale, final String key);
+}
diff --git a/source/org/jfree/report/jfreereport.properties b/source/org/jfree/report/jfreereport.properties
new file mode 100644
index 0000000..5ecdfda
--- /dev/null
+++ b/source/org/jfree/report/jfreereport.properties
@@ -0,0 +1,144 @@
+#
+# The minimum loglevel that is logged
+org.jfree.base.LogLevel=Debug
+
+#
+# Where to log. Give a classname of a  valid LogTarget implementation.
+org.jfree.base.LogTarget=org.jfree.util.PrintStreamLogTarget
+
+#
+# Where to store cached configuration data
+#
+org.jfree.report.ConfigStore=org.jfree.report.modules.preferences.filesystem.FileConfigStorage
+
+#
+# Defines a stricter error handling, if set to true, then all errors that
+# occur during the report processing will cause the report processing to fail.
+# It is safe to set this to true, as valid reports never throw exceptions.
+#
+# Anyway, this defaults to false, as this the old behaviour, we don't want
+# to break backward compatibility yet.
+#
+org.jfree.report.StrictErrorHandling=true
+
+#
+# Enable aliasing for Graphics2D. This may result is textlayout errors.
+# If your text is not correctly aligned, disable this property.
+#
+org.jfree.report.layout.fontrenderer.UseAliasing=true
+
+#
+# This is a override setting. Some Graphics2D implementations have problems
+# with the font positioning. I don't know a way to resolve that bug on the root,
+# so if the bug happens to you, try setting this property to "true" to resolve
+# wrong or buggy string draw results.
+#
+org.jfree.report.layout.fontrenderer.IsBuggyFRC=false
+
+#
+# The old JFreeReport way of computing line heights is not working correctly
+# in some cases. Under some conditions, a character may exceed its normal
+# line height (for instance if it is an upper case letter with accents).
+# In that case, using the font size as line height is not working correctly,
+# causing the text to be clipped.
+#
+# If this property is set to true, the line height is computed from the maximum
+# character size for the specified font. If set to false, the line height is
+# set to match the declared font size, so that the old behaviour of previous
+# versions of JFreeReport is preserved.
+org.jfree.report.layout.fontrenderer.UseMaxCharBounds=false
+
+#
+# The old JFreeReport way of computing line heights is not working correctly
+# in some cases. Under some conditions, a character may exceed its normal
+# line height (for instance if it is an upper case letter with accents).
+# In that case, using the font size as line height is not working correctly,
+# causing the text to be clipped.
+#
+# If this property is set to true, no clipping is applied when performing the
+# text rendering. This minimizes the negative effects of the old line height
+# algorithm, but may cause artefacts in the output.
+org.jfree.report.layout.fontrenderer.ClipText=false
+
+#
+# Defines, whether the page layouter prints a massive amount of debug messages.
+# This is for debugging only, you wouldn't activate this in a production system.
+org.jfree.report.PrintOperationComment=true
+
+#
+# Defines, whether the content creation engine should warn on invalid columns.
+#
+org.jfree.report.content.DebugTextContent=false
+
+#
+# Defines, whether the report builder should be paranoid and check every
+# value for serializability. This defaults to false for performance reasons.
+org.jfree.report.ReportBuilderHint.ParanoidChecks=true
+
+#
+# Defines, whether the datarow prints warning on invalid columns. Requests to
+# invalid columns are non fatal, but these messages give usefull hints on invalid
+# report definitions.
+#
+# If set to true, an additional logging entry is added whenever an invalid column
+# is encountered.
+org.jfree.report.WarnInvalidColumns=true
+
+#
+# Defines, whether JFreeReport should query the default page format from the printerdriver.
+# If there is no printer installed on Windows, this seems to block the JavaVM until a
+# time out is reached.
+#
+# If this property is set to "true" a hard coded default is used instead.
+org.jfree.report.NoPrinterAvailable=false
+
+##
+# Layout controller implementations
+org.jfree.report.flow.structure.org.jfree.report.JFreeReport=org.jfree.report.flow.layoutprocessor.ReportLayoutController
+org.jfree.report.flow.structure.org.jfree.report.structure.SubReport=org.jfree.report.flow.layoutprocessor.SubReportLayoutController
+org.jfree.report.flow.structure.org.jfree.report.structure.Section=org.jfree.report.flow.layoutprocessor.SectionLayoutController
+org.jfree.report.flow.structure.org.jfree.report.structure.ContentElement=org.jfree.report.flow.layoutprocessor.ContentElementLayoutController
+org.jfree.report.flow.structure.org.jfree.report.structure.StaticText=org.jfree.report.flow.layoutprocessor.StaticTextLayoutController
+
+##
+# Known namespaces that should be included by default. (We have to match them later)
+org.jfree.report.namespaces.engine.Uri=http://jfreereport.sourceforge.net/namespaces/engine
+org.jfree.report.namespaces.engine.Default-Style=res://org/jfree/report/engine.css
+org.jfree.report.namespaces.engine.ClassAttr=class
+org.jfree.report.namespaces.engine.StyleAttr=style
+org.jfree.report.namespaces.engine.Prefix=report-engine
+
+org.jfree.report.namespaces.compatibility.Uri=http://jfreereport.sourceforge.net/namespaces/engine/compatiblity
+org.jfree.report.namespaces.compatibility.Default-Style=res://org/jfree/report/compat.css
+org.jfree.report.namespaces.compatibility.ClassAttr=class
+org.jfree.report.namespaces.compatibility.StyleAttr=style
+org.jfree.report.namespaces.compatibility.Prefix=report-compat
+
+
+###############
+# JFreeReport 0.9 Modules
+##
+org.jfree.report.modules.data.beans=
+org.jfree.report.modules.data.sql.Module=org.jfree.report.modules.data.sql.SQLReportDataModule
+org.jfree.report.modules.data.xpath=
+
+
+org.jfree.report.modules.factories.data.base.Module=org.jfree.report.modules.factories.data.base.ReportDataFactoryBaseModule
+org.jfree.report.modules.factories.data.sql.Module=org.jfree.report.modules.factories.data.sql.SQLDataFactoryModule
+
+org.jfree.report.modules.factories.report.base.Module=org.jfree.report.modules.factories.report.base.ReportFactoryBaseModule
+org.jfree.report.modules.factories.report.flow.Module=org.jfree.report.modules.factories.report.flow.FlowReportFactoryModule
+
+org.jfree.report.modules.preferences.base.Module=org.jfree.report.modules.preferences.base.ConfigStoreBaseModule
+org.jfree.report.modules.preferences.filesystem.Module=org.jfree.report.modules.preferences.filesystem.FileConfigStoreModule
+
+org.jfree.report.modules.misc.tablemodel.Module=org.jfree.report.modules.misc.tablemodel.TableModelModule
+org.jfree.report.modules.misc.survey.Module=org.jfree.report.modules.misc.survey.SurveyModule
+org.jfree.report.modules.misc.autotable.Module=org.jfree.report.modules.misc.autotable.AutoTableModule
+
+org.jfree.report.modules.gui.common.Module=org.jfree.report.modules.gui.common.GuiCommonModule
+org.jfree.report.modules.gui.swing.common.Module=org.jfree.report.modules.gui.swing.common.SwingCommonModule
+org.jfree.report.modules.gui.swing.preview.Module=org.jfree.report.modules.gui.swing.preview.SwingPreviewModule
+org.jfree.report.modules.gui.swing.printing.Module=org.jfree.report.modules.gui.swing.printing.SwingPrintingModule
+org.jfree.report.modules.gui.swing.html.Module=org.jfree.report.modules.gui.swing.html.SwingHtmlModule
+org.jfree.report.modules.gui.swing.pdf.Module=org.jfree.report.modules.gui.swing.pdf.SwingPdfModule
diff --git a/source/org/jfree/report/modules/data/beans/.placeholder b/source/org/jfree/report/modules/data/beans/.placeholder
new file mode 100644
index 0000000..3a9a7e3
--- /dev/null
+++ b/source/org/jfree/report/modules/data/beans/.placeholder
@@ -0,0 +1,2 @@
+This module will be implemented in the future. It will allow Bean-Queries so
+that data can be read from object hierarchies.
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/data/beans/NamedStaticReportDataFactory.java b/source/org/jfree/report/modules/data/beans/NamedStaticReportDataFactory.java
new file mode 100644
index 0000000..9b4e0d7
--- /dev/null
+++ b/source/org/jfree/report/modules/data/beans/NamedStaticReportDataFactory.java
@@ -0,0 +1,113 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: NamedStaticReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.data.beans;
+
+import java.util.HashMap;
+
+import org.jfree.report.DataSet;
+import org.jfree.report.ReportData;
+import org.jfree.report.ReportDataFactoryException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+
+/**
+ * Creation-Date: Jan 12, 2007, 2:16:00 PM
+ *
+ * @author Thomas Morgner
+ */
+public class NamedStaticReportDataFactory extends StaticReportDataFactory
+{
+  private ResourceKey contentBase;
+  private HashMap querymappings;
+
+  public NamedStaticReportDataFactory()
+  {
+    querymappings = new HashMap();
+  }
+
+  public void setQuery(String name, String queryString)
+  {
+    if (queryString == null)
+    {
+      querymappings.remove(name);
+    }
+    else
+    {
+      querymappings.put(name, queryString);
+    }
+  }
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query. The
+   * Parameterset given here may contain more data than actually needed.
+   * <p/>
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query
+   * @param parameters
+   * @return
+   */
+  public ReportData queryData(final String query, final DataSet parameters)
+          throws ReportDataFactoryException
+  {
+    if (query == null)
+    {
+      throw new NullPointerException("Query is null.");
+    }
+    final String realQuery = getQuery(query);
+    if (realQuery == null)
+    {
+      throw new ReportDataFactoryException("Query '" + query + "' is not recognized.");
+    }
+    return super.queryData(realQuery, parameters);
+  }
+
+  public String getQuery(String name)
+  {
+    return (String) querymappings.get(name);
+  }
+
+  public String[] getQueryNames()
+  {
+    return (String[]) querymappings.keySet().toArray(
+            new String[querymappings.size()]);
+  }
+
+  public ResourceKey getContentBase()
+  {
+    return contentBase;
+  }
+
+  public void setContentBase(final ResourceKey contentBase)
+  {
+    this.contentBase = contentBase;
+  }
+}
diff --git a/source/org/jfree/report/modules/data/beans/StaticReportDataFactory.java b/source/org/jfree/report/modules/data/beans/StaticReportDataFactory.java
new file mode 100644
index 0000000..eaf660d
--- /dev/null
+++ b/source/org/jfree/report/modules/data/beans/StaticReportDataFactory.java
@@ -0,0 +1,455 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.beans;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Constructor;
+
+import javax.swing.table.TableModel;
+
+import org.jfree.report.DataSet;
+import org.jfree.report.ReportData;
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.TableReportData;
+import org.jfree.report.util.CSVTokenizer;
+import org.jfree.report.util.DataSetUtility;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * This report data factory uses introspection to search for a report data
+ * source. The query has the following format:
+ *
+ * <full-qualified-classname&gr;#methodName(Parameters)
+ * <full-qualified-classname&gr;(constructorparams)#methodName(Parameters)
+ * <full-qualified-classname&gr;(constructorparams)
+ *
+ * @author Thomas Morgner
+ */
+public class StaticReportDataFactory implements ReportDataFactory
+{
+  public StaticReportDataFactory()
+  {
+  }
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query. The
+   * Parameterset given here may contain more data than actually needed.
+   * <p/>
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query
+   * @param parameters
+   * @return
+   */
+  public ReportData queryData(final String query, final DataSet parameters)
+          throws ReportDataFactoryException
+  {
+    final int methodSeparatorIdx = query.indexOf('#');
+
+    if ((methodSeparatorIdx + 1) >= query.length())
+    {
+      // If we have a method separator, then it cant be at the end of the text.
+      throw new ReportDataFactoryException("Malformed query: " + query);
+    }
+
+    if (methodSeparatorIdx == -1)
+    {
+      // we have no method. So this query must be a reference to a tablemodel
+      // instance.
+      final String[] parameterNames;
+      final int parameterStartIdx = query.indexOf('(');
+      final String constructorName;
+      if (parameterStartIdx == -1)
+      {
+        parameterNames = new String[0];
+        constructorName = query;
+      }
+      else
+      {
+        parameterNames = createParameterList(query, parameterStartIdx);
+        constructorName = query.substring(0, parameterStartIdx);
+      }
+
+      try
+      {
+        Constructor c = findDirectConstructor(constructorName, parameterNames.length);
+
+        Object[] params = new Object[parameterNames.length];
+        for (int i = 0; i < parameterNames.length; i++)
+        {
+          final String name = parameterNames[i];
+          params[i] = DataSetUtility.getByName(parameters, name);
+        }
+        final Object o = c.newInstance(params);
+        if (o instanceof TableModel)
+        {
+          return new TableReportData ((TableModel) o);
+        }
+
+        return (ReportData) o;
+      }
+      catch (Exception e)
+      {
+        throw new ReportDataFactoryException
+                ("Unable to instantiate class for non static call.", e);
+      }
+    }
+
+    return createComplexTableModel
+            (query, methodSeparatorIdx, parameters);
+  }
+
+  private ReportData createComplexTableModel(final String query,
+                                             final int methodSeparatorIdx,
+                                             final DataSet parameters)
+          throws ReportDataFactoryException
+  {
+    final String constructorSpec = query.substring(0, methodSeparatorIdx);
+    final int constParamIdx = constructorSpec.indexOf('(');
+    if (constParamIdx == -1)
+    {
+      // Either a static call or a default constructor call..
+      return loadFromDefaultConstructor(query, methodSeparatorIdx, parameters);
+    }
+
+    // We have to find a suitable constructor ..
+    final String className = query.substring(0, constParamIdx);
+    final String[] parameterNames = createParameterList(constructorSpec, constParamIdx);
+    final Constructor c = findIndirectConstructor(className, parameterNames.length);
+
+    final String methodQuery = query.substring(methodSeparatorIdx + 1);
+    final String[] methodParameterNames;
+    final String methodName;
+    final int parameterStartIdx = methodQuery.indexOf('(');
+    if (parameterStartIdx == -1)
+    {
+      // no parameters. Nice.
+      methodParameterNames = new String[0];
+      methodName = methodQuery;
+    }
+    else
+    {
+      methodName = methodQuery.substring(0, parameterStartIdx);
+      methodParameterNames = createParameterList(methodQuery, parameterStartIdx);
+    }
+    final Method m = findCallableMethod(className, methodName, methodParameterNames.length);
+
+    try
+    {
+      final Object[] constrParams = new Object[parameterNames.length];
+      for (int i = 0; i < parameterNames.length; i++)
+      {
+        final String name = parameterNames[i];
+          constrParams[i] = DataSetUtility.getByName(parameters, name);
+      }
+      final Object o = c.newInstance(constrParams);
+
+      final Object[] methodParams = new Object[methodParameterNames.length];
+      for (int i = 0; i < methodParameterNames.length; i++)
+      {
+        final String name = methodParameterNames[i];
+        methodParams[i] = DataSetUtility.getByName(parameters, name);
+      }
+      final Object data = m.invoke(o, methodParams);
+      if (data instanceof TableModel)
+      {
+        return new TableReportData((TableModel) data);
+      }
+      return (ReportData) data;
+    }
+    catch (Exception e)
+    {
+      throw new ReportDataFactoryException
+              ("Unable to instantiate class for non static call.");
+    }
+  }
+
+  private ReportData loadFromDefaultConstructor(final String query,
+                                                final int methodSeparatorIdx,
+                                                final DataSet parameters)
+      throws ReportDataFactoryException
+  {
+    final String className = query.substring(0, methodSeparatorIdx);
+    final String methodSpec = query.substring(methodSeparatorIdx + 1);
+    final String methodName;
+    final String[] parameterNames;
+    final int parameterStartIdx = methodSpec.indexOf('(');
+    if (parameterStartIdx == -1)
+    {
+      // no parameters. Nice.
+      parameterNames = new String[0];
+      methodName = methodSpec;
+    }
+    else
+    {
+      parameterNames = createParameterList(methodSpec, parameterStartIdx);
+      methodName = methodSpec.substring(0, parameterStartIdx);
+    }
+
+    try
+    {
+      final Method m = findCallableMethod(className, methodName, parameterNames.length);
+      Object[] params = new Object[parameterNames.length];
+      for (int i = 0; i < parameterNames.length; i++)
+      {
+        final String name = parameterNames[i];
+        params[i] = DataSetUtility.getByName(parameters, name);
+      }
+
+      if (Modifier.isStatic(m.getModifiers()))
+      {
+        final Object o = m.invoke(null, params);
+        if (o instanceof TableModel)
+        {
+          return new TableReportData((TableModel) o);
+        }
+        return (ReportData) o;
+      }
+
+      final ClassLoader classLoader = getClassLoader();
+      final Class c = classLoader.loadClass(className);
+      final Object o = c.newInstance();
+      if (o == null)
+      {
+        throw new ReportDataFactoryException
+                ("Unable to instantiate class for non static call.");
+      }
+      final Object data = m.invoke(o, params);
+      if (data instanceof TableModel)
+      {
+        return new TableReportData((TableModel) data);
+      }
+      return (ReportData) data;
+    }
+    catch (ReportDataFactoryException rdfe)
+    {
+      throw rdfe;
+    }
+    catch (Exception e)
+    {
+      throw new ReportDataFactoryException
+              ("Something went terribly wrong: ", e);
+    }
+  }
+
+  private String[] createParameterList(final String query,
+                                       final int parameterStartIdx)
+          throws ReportDataFactoryException
+  {
+    final int parameterEndIdx = query.lastIndexOf(')');
+    if (parameterEndIdx < parameterStartIdx)
+    {
+      throw new ReportDataFactoryException("Malformed query: " + query);
+    }
+    final String parameterText =
+            query.substring(parameterStartIdx + 1, parameterEndIdx);
+    final CSVTokenizer tokenizer = new CSVTokenizer(parameterText);
+    final int size = tokenizer.countTokens();
+    final String[] parameterNames = new String[size];
+    int i = 0;
+    while (tokenizer.hasMoreTokens())
+    {
+      parameterNames[i] = tokenizer.nextToken();
+      i += 1;
+    }
+    return parameterNames;
+  }
+
+  protected ClassLoader getClassLoader()
+  {
+    return ObjectUtilities.getClassLoader(StaticReportDataFactory.class);
+  }
+
+  private Method findCallableMethod(final String className,
+                                    final String methodName,
+                                    final int paramCount)
+          throws ReportDataFactoryException
+  {
+    ClassLoader classLoader = getClassLoader();
+
+    if (classLoader == null)
+    {
+      throw new ReportDataFactoryException("No classloader!");
+    }
+    try
+    {
+      Class c = classLoader.loadClass(className);
+      if (Modifier.isAbstract(c.getModifiers()))
+      {
+        throw new ReportDataFactoryException("Abstract class cannot be handled!");
+      }
+
+      Method[] methods = c.getMethods();
+      for (int i = 0; i < methods.length; i++)
+      {
+        final Method method = methods[i];
+        if (Modifier.isPublic(method.getModifiers()) == false)
+        {
+          continue;
+        }
+        if (method.getName().equals(methodName) == false)
+        {
+          continue;
+        }
+        final Class returnType = method.getReturnType();
+        if (method.getParameterTypes().length != paramCount)
+        {
+          continue;
+        }
+        if (TableModel.class.isAssignableFrom(returnType) ||
+            ReportData.class.isAssignableFrom(returnType))
+        {
+          return method;
+        }
+      }
+    }
+    catch (ClassNotFoundException e)
+    {
+      throw new ReportDataFactoryException("No such Class", e);
+    }
+    throw new ReportDataFactoryException("No such Method: " + className + "#" + methodName);
+  }
+
+  private Constructor findDirectConstructor(final String className,
+                                            final int paramCount)
+          throws ReportDataFactoryException
+  {
+    ClassLoader classLoader = getClassLoader();
+    if (classLoader == null)
+    {
+      throw new ReportDataFactoryException("No classloader!");
+    }
+
+    try
+    {
+      Class c = classLoader.loadClass(className);
+      if (TableModel.class.isAssignableFrom(c) == false &&
+          ReportData.class.isAssignableFrom(c) == false)
+      {
+        throw new ReportDataFactoryException("The specified class must be either a TableModel or a ReportData implementation.");
+      }
+      if (Modifier.isAbstract(c.getModifiers()))
+      {
+        throw new ReportDataFactoryException("The specified class cannot be instantiated: it is abstract.");
+      }
+
+      Constructor[] methods = c.getConstructors();
+      for (int i = 0; i < methods.length; i++)
+      {
+        final Constructor method = methods[i];
+        if (Modifier.isPublic(method.getModifiers()) == false)
+        {
+          continue;
+        }
+        if (method.getParameterTypes().length != paramCount)
+        {
+          continue;
+        }
+        return method;
+      }
+    }
+    catch (ClassNotFoundException e)
+    {
+      throw new ReportDataFactoryException("No such Class", e);
+    }
+    throw new ReportDataFactoryException
+        ("There is no constructor in class " + className +
+            " that accepts " + paramCount + " parameters.");
+  }
+
+
+  private Constructor findIndirectConstructor(final String className,
+                                            final int paramCount)
+          throws ReportDataFactoryException
+  {
+    ClassLoader classLoader = getClassLoader();
+    if (classLoader == null)
+    {
+      throw new ReportDataFactoryException("No classloader!");
+    }
+
+    try
+    {
+      Class c = classLoader.loadClass(className);
+      if (Modifier.isAbstract(c.getModifiers()))
+      {
+        throw new ReportDataFactoryException("The specified class cannot be instantiated: it is abstract.");
+      }
+
+      Constructor[] methods = c.getConstructors();
+      for (int i = 0; i < methods.length; i++)
+      {
+        final Constructor method = methods[i];
+        if (Modifier.isPublic(method.getModifiers()) == false)
+        {
+          continue;
+        }
+        if (method.getParameterTypes().length != paramCount)
+        {
+          continue;
+        }
+        return method;
+      }
+    }
+    catch (ClassNotFoundException e)
+    {
+      throw new ReportDataFactoryException("No such Class", e);
+    }
+    throw new ReportDataFactoryException
+        ("There is no constructor in class " + className +
+            " that accepts " + paramCount + " parameters.");
+  }
+
+
+  public void open()
+  {
+
+  }
+
+  public void close()
+  {
+
+  }
+
+  /**
+   * Derives a freshly initialized report data factory, which is independend of
+   * the original data factory. Opening or Closing one data factory must not
+   * affect the other factories.
+   *
+   * @return
+   */
+  public ReportDataFactory derive()
+  {
+    return this;
+  }
+}
diff --git a/source/org/jfree/report/modules/data/beans/StaticReportDataFactoryModule.java b/source/org/jfree/report/modules/data/beans/StaticReportDataFactoryModule.java
new file mode 100644
index 0000000..8c1160f
--- /dev/null
+++ b/source/org/jfree/report/modules/data/beans/StaticReportDataFactoryModule.java
@@ -0,0 +1,70 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticReportDataFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.beans;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * The module definition for the bean scripting framework support module.
+ *
+ * @author Thomas Morgner
+ */
+public class StaticReportDataFactoryModule extends AbstractModule
+{
+  /**
+   * DefaultConstructor. Loads the module specification.
+   *
+   * @throws ModuleInitializeException if an error occured.
+   */
+  public StaticReportDataFactoryModule ()
+          throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup operations. This
+   * method is called only once in a modules lifetime. If the initializing cannot be
+   * completed, throw a ModuleInitializeException to indicate the error,. The module will
+   * not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize (final SubSystem subSystem)
+          throws ModuleInitializeException
+  {
+  }
+}
diff --git a/source/org/jfree/report/modules/data/beans/module.properties b/source/org/jfree/report/modules/data/beans/module.properties
new file mode 100644
index 0000000..7667307
--- /dev/null
+++ b/source/org/jfree/report/modules/data/beans/module.properties
@@ -0,0 +1,20 @@
+#
+# Support for inline expressions using the BeanShell.
+#
+# External libraries: BeanShell > 1.2B6
+#
+
+module-info:
+  name: misc-data-beans
+  producer: The JFreeReport project - www.jfree.org/jfreereport
+  description: Classes to support automatic tablemodel creation.
+  version.major: 0
+  version.minor: 88
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 88
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/data/sql/ConnectionProvider.java b/source/org/jfree/report/modules/data/sql/ConnectionProvider.java
new file mode 100644
index 0000000..abc14dc
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/ConnectionProvider.java
@@ -0,0 +1,45 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConnectionProvider.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Creation-Date: 07.04.2006, 14:54:29
+ *
+ * @author Thomas Morgner
+ */
+public interface ConnectionProvider extends Serializable
+{
+  public Connection getConnection() throws SQLException;
+}
diff --git a/source/org/jfree/report/modules/data/sql/DriverConnectionProvider.java b/source/org/jfree/report/modules/data/sql/DriverConnectionProvider.java
new file mode 100644
index 0000000..c695b52
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/DriverConnectionProvider.java
@@ -0,0 +1,110 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DriverConnectionProvider.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+
+/**
+ * Creation-Date: 07.04.2006, 15:04:26
+ *
+ * @author Thomas Morgner
+ */
+public class DriverConnectionProvider implements ConnectionProvider
+{
+  private Properties properties;
+  private String url;
+  private String driver;
+  private transient Connection connection;
+
+  public DriverConnectionProvider()
+  {
+    this.properties = new Properties();
+  }
+
+  public String getProperty(final String key)
+  {
+    return properties.getProperty(key);
+  }
+
+  public Object setProperty(final String key, final String value)
+  {
+    return properties.setProperty(key, value);
+  }
+
+  public String getUrl()
+  {
+    return url;
+  }
+
+  public void setUrl(final String url)
+  {
+    this.url = url;
+  }
+
+  public String getDriver()
+  {
+    return driver;
+  }
+
+  public void setDriver(final String driver)
+  {
+    this.driver = driver;
+  }
+
+  public Connection getConnection() throws SQLException
+  {
+    if (url == null)
+    {
+      throw new NullPointerException("URL must not be null when connecting");
+    }
+
+    if (connection == null)
+    {
+      try
+      {
+        if (driver != null)
+        {
+          Class.forName(driver);
+        }
+      }
+      catch(Exception e)
+      {
+        throw new SQLException("Unable to load the driver", e.getMessage());
+      }
+
+      connection = DriverManager.getConnection(url, properties);
+    }
+    return connection;
+  }
+}
diff --git a/source/org/jfree/report/modules/data/sql/SQLParameterLookupParser.java b/source/org/jfree/report/modules/data/sql/SQLParameterLookupParser.java
new file mode 100644
index 0000000..504f035
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/SQLParameterLookupParser.java
@@ -0,0 +1,64 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SQLParameterLookupParser.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import java.util.ArrayList;
+
+import org.jfree.report.util.PropertyLookupParser;
+
+/**
+ * Creation-Date: 16.04.2006, 20:30:42
+ *
+ * @author Thomas Morgner
+ */
+public class SQLParameterLookupParser extends PropertyLookupParser
+{
+  private ArrayList fields;
+
+  public SQLParameterLookupParser()
+  {
+    this.fields = new ArrayList();
+    setMarkerChar('$');
+    setOpeningBraceChar('{');
+    setClosingBraceChar('}');
+  }
+
+  protected String lookupVariable(final String name)
+  {
+    fields.add(name);
+    return "?";
+  }
+
+  public String[] getFields()
+  {
+    return (String[]) fields.toArray(new String[fields.size()]);
+  }
+}
diff --git a/source/org/jfree/report/modules/data/sql/SQLReportData.java b/source/org/jfree/report/modules/data/sql/SQLReportData.java
new file mode 100644
index 0000000..c058381
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/SQLReportData.java
@@ -0,0 +1,230 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SQLReportData.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportData;
+
+/**
+ * Creation-Date: 19.02.2006, 17:37:42
+ *
+ * @author Thomas Morgner
+ */
+public class SQLReportData implements ReportData
+{
+  private ResultSet resultSet;
+  private int rowCount;
+  private int columnCount;
+  private int cursor;
+  private String[] columnNames;
+  private boolean labelMapping;
+
+  public SQLReportData(final ResultSet resultSet,
+                       final boolean labelMapping)
+      throws SQLException, DataSourceException
+  {
+    if (resultSet == null)
+    {
+      throw new NullPointerException();
+    }
+    if (resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY)
+    {
+      throw new IllegalArgumentException();
+    }
+    this.resultSet = resultSet;
+    this.labelMapping = labelMapping;
+
+    if (resultSet.last())
+    {
+      rowCount = resultSet.getRow();
+    }
+    else
+    {
+      rowCount = 0;
+    }
+
+    final ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
+    columnCount = resultSetMetaData.getColumnCount();
+    columnNames = new String[columnCount];
+    for (int i = 1; i <= columnCount; i++)
+    {
+      if (labelMapping)
+      {
+        columnNames[i - 1] = resultSetMetaData.getColumnLabel(i);
+      }
+      else
+      {
+        columnNames[i - 1] = resultSetMetaData.getColumnName(i);
+      }
+    }
+
+    if (resultSet.first() == false)
+    {
+      throw new DataSourceException("Unable to reset the dataset.");
+    }
+    cursor = 0;
+  }
+
+  public boolean isLabelMapping()
+  {
+    return labelMapping;
+  }
+
+  public int getRowCount() throws DataSourceException
+  {
+    return rowCount;
+  }
+
+  /**
+   * This operation checks, whether a call to next will be likely to succeed. If
+   * there is a next data row, this should return true.
+   *
+   * @return
+   * @throws org.jfree.report.DataSourceException
+   *
+   */
+  public boolean isAdvanceable() throws DataSourceException
+  {
+    return cursor < rowCount;
+  }
+
+  public int getColumnCount() throws DataSourceException
+  {
+    return columnCount;
+  }
+
+  public boolean setCursorPosition(final int row) throws DataSourceException
+  {
+    if (row < 0)
+    {
+      throw new DataSourceException("Negative row number is not valid");
+    }
+    if (row > rowCount)
+    {
+      return false;
+      // throw new DataSourceException("OutOfBounds:");
+    }
+
+    try
+    {
+      if (cursor == 0)
+      {
+        resultSet.beforeFirst();
+        return true;
+      }
+
+      if (resultSet.absolute(row))
+      {
+        cursor = row;
+        return true;
+      }
+      return false;
+      //throw new DataSourceException("Unable to scroll the resultset.");
+    }
+    catch (SQLException e)
+    {
+      throw new DataSourceException("Failed to move the cursor: ", e);
+    }
+  }
+
+  public boolean next() throws DataSourceException
+  {
+    try
+    {
+      if (resultSet.next())
+      {
+        cursor += 1;
+        return true;
+      }
+      else
+      {
+        return false;
+      }
+    }
+    catch (SQLException e)
+    {
+      throw new DataSourceException("Failed to move the cursor: ", e);
+    }
+  }
+
+  public void close() throws DataSourceException
+  {
+    try
+    {
+      resultSet.close();
+    }
+    catch (SQLException e)
+    {
+      throw new DataSourceException("Failed to close the resultset: ", e);
+    }
+  }
+
+  public String getColumnName(final int column) throws DataSourceException
+  {
+    return columnNames[column];
+  }
+
+  public Object get(final int column) throws DataSourceException
+  {
+    if (isReadable() == false)
+    {
+      throw new DataSourceException("Cannot read from this datasource");
+    }
+
+    try
+    {
+      final Object retval = resultSet.getObject(column + 1);
+      if (resultSet.wasNull())
+      {
+        return null;
+      }
+      return retval;
+    }
+    catch (SQLException e)
+    {
+      throw new DataSourceException("Failed to query data", e);
+    }
+  }
+
+  public int getCursorPosition() throws DataSourceException
+  {
+    return cursor;
+  }
+
+  public boolean isReadable() throws DataSourceException
+  {
+    return cursor > 0 && rowCount > 0;
+  }
+}
diff --git a/source/org/jfree/report/modules/data/sql/SQLReportDataFactory.java b/source/org/jfree/report/modules/data/sql/SQLReportDataFactory.java
new file mode 100644
index 0000000..ad19537
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/SQLReportDataFactory.java
@@ -0,0 +1,110 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SQLReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import java.sql.Connection;
+import java.util.HashMap;
+
+import org.jfree.report.DataSet;
+import org.jfree.report.ReportData;
+import org.jfree.report.ReportDataFactoryException;
+
+/**
+ * Creation-Date: 19.02.2006, 17:37:33
+ *
+ * @author Thomas Morgner
+ */
+public class SQLReportDataFactory extends SimpleSQLReportDataFactory
+{
+  private HashMap querymappings;
+
+  public SQLReportDataFactory(final Connection connection)
+  {
+    super(connection);
+    querymappings = new HashMap();
+  }
+
+
+  public SQLReportDataFactory(final ConnectionProvider connectionProvider)
+  {
+    super(connectionProvider);
+    querymappings = new HashMap();
+  }
+
+  public void setQuery(String name, String queryString)
+  {
+    if (queryString == null)
+    {
+      querymappings.remove(name);
+    }
+    else
+    {
+      querymappings.put(name, queryString);
+    }
+  }
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query. The
+   * Parameterset given here may contain more data than actually needed.
+   * <p/>
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query
+   * @param parameters
+   * @return
+   */
+  public ReportData queryData(final String query, final DataSet parameters)
+          throws ReportDataFactoryException
+  {
+    if (query == null)
+    {
+      throw new NullPointerException("Query is null.");
+    }
+    final String realQuery = getQuery(query);
+    if (realQuery == null)
+    {
+      throw new ReportDataFactoryException("Query '" + query + "' is not recognized.");
+    }
+    return super.queryData(realQuery, parameters);
+  }
+
+  public String getQuery(String name)
+  {
+    return (String) querymappings.get(name);
+  }
+
+  public String[] getQueryNames()
+  {
+    return (String[]) querymappings.keySet().toArray(
+            new String[querymappings.size()]);
+  }
+
+}
diff --git a/source/org/jfree/report/modules/data/sql/SQLReportDataModule.java b/source/org/jfree/report/modules/data/sql/SQLReportDataModule.java
new file mode 100644
index 0000000..e0a8640
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/SQLReportDataModule.java
@@ -0,0 +1,64 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SQLReportDataModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 07.04.2006, 14:45:02
+ *
+ * @author Thomas Morgner
+ */
+public class SQLReportDataModule extends AbstractModule
+{
+  public SQLReportDataModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException if an error ocurred while initializing
+   *                                   the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/data/sql/SimpleSQLReportDataFactory.java b/source/org/jfree/report/modules/data/sql/SimpleSQLReportDataFactory.java
new file mode 100644
index 0000000..5aa9d34
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/SimpleSQLReportDataFactory.java
@@ -0,0 +1,338 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SimpleSQLReportDataFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+
+import org.jfree.report.DataSet;
+import org.jfree.report.JFreeReportBoot;
+import org.jfree.report.ReportData;
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.TableReportData;
+import org.jfree.report.util.DataSetUtility;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 19.02.2006, 17:37:33
+ *
+ * @author Thomas Morgner
+ */
+public class SimpleSQLReportDataFactory implements ReportDataFactory, Cloneable
+{
+  private static final Object NULL_TOKEN = new Object();
+
+  private static class PreparedStatementCarrier
+  {
+    private PreparedStatement preparedStatement;
+    private String[] parameters;
+
+    public PreparedStatementCarrier(final PreparedStatement preparedStatement,
+                                    final String[] parameters)
+    {
+      this.preparedStatement = preparedStatement;
+      this.parameters = parameters;
+    }
+
+    public PreparedStatement getPreparedStatement()
+    {
+      return preparedStatement;
+    }
+
+    public String[] getParameters()
+    {
+      return parameters;
+    }
+  }
+
+  private HashMap preparedStatements;
+  private Connection connection;
+  private ConnectionProvider connectionProvider;
+
+  private boolean labelMapping;
+  private static final String COLUMN_NAME_MAPPING_KEY =
+          "org.jfree.report.modules.data.sql.ColumnNameMapping";
+
+  public SimpleSQLReportDataFactory(final Connection connection)
+  {
+    this (new StaticConnectionProvider(connection));
+  }
+
+  public SimpleSQLReportDataFactory(final ConnectionProvider connectionProvider)
+  {
+    if (connectionProvider == null)
+    {
+      throw new NullPointerException();
+    }
+    this.connectionProvider = connectionProvider;
+    this.preparedStatements = new HashMap();
+    final Configuration globalConfig =
+            JFreeReportBoot.getInstance().getGlobalConfig();
+    this.labelMapping = globalConfig.getConfigProperty
+            (SimpleSQLReportDataFactory.COLUMN_NAME_MAPPING_KEY, "Label").equals("Label");
+  }
+
+  public boolean isLabelMapping()
+  {
+    return labelMapping;
+  }
+
+  public void setLabelMapping(final boolean labelMapping)
+  {
+    this.labelMapping = labelMapping;
+  }
+
+  private synchronized Connection getConnection() throws SQLException
+  {
+    if (connection == null)
+    {
+      connection = connectionProvider.getConnection();
+    }
+    return connection;
+  }
+
+  private int getBestResultSetType() throws SQLException
+  {
+    final Connection connection = getConnection();
+    boolean supportsScrollInsensitive =
+            connection.getMetaData().supportsResultSetType
+                    (ResultSet.TYPE_SCROLL_INSENSITIVE);
+    boolean supportsScrollSensitive =
+            connection.getMetaData().supportsResultSetType
+                    (ResultSet.TYPE_SCROLL_SENSITIVE);
+
+    if (supportsScrollInsensitive)
+    {
+      return ResultSet.TYPE_SCROLL_INSENSITIVE;
+    }
+    if (supportsScrollSensitive)
+    {
+      return ResultSet.TYPE_SCROLL_SENSITIVE;
+    }
+    return ResultSet.TYPE_FORWARD_ONLY;
+  }
+
+  /**
+   * Queries a datasource. The string 'query' defines the name of the query. The
+   * Parameterset given here may contain more data than actually needed.
+   * <p/>
+   * The dataset may change between two calls, do not assume anything!
+   *
+   * @param query
+   * @param parameters
+   * @return
+   */
+  public synchronized ReportData queryData(final String query, final DataSet parameters)
+          throws ReportDataFactoryException
+  {
+    try
+    {
+      PreparedStatementCarrier pstmtCarrier = (PreparedStatementCarrier)
+              preparedStatements.get(query);
+      if (pstmtCarrier == null)
+      {
+        SQLParameterLookupParser parser = new SQLParameterLookupParser();
+        final String translatedQuery = parser.translateAndLookup(query);
+        PreparedStatement pstmt = getConnection().prepareStatement
+                (translatedQuery, getBestResultSetType(), ResultSet.CONCUR_READ_ONLY);
+        pstmtCarrier = new PreparedStatementCarrier(pstmt, parser.getFields());
+        preparedStatements.put(query, pstmtCarrier);
+      }
+
+      final PreparedStatement pstmt = pstmtCarrier.getPreparedStatement();
+      pstmt.clearParameters();
+
+      final String[] params = pstmtCarrier.getParameters();
+      for (int i = 0; i < params.length; i++)
+      {
+        final String param = params[i];
+        final Object pvalue = DataSetUtility.getByName(parameters, param, NULL_TOKEN);
+        if (pvalue == NULL_TOKEN)
+        {
+          // this either means, that the parameter is explicitly set to null
+          // or that there is no such column.
+          throw new ReportDataFactoryException ("Setting parameter '" +
+                    param + "' failed: No such column.");
+        }
+        else if (pvalue == null)
+        {
+          // this should work, but some driver are known to die here.
+          // they should be fed with setNull(..) instead; something
+          // we cant do as JDK1.2's JDBC does not define it.
+          pstmt.setObject(i+1, null);
+        }
+        else
+        {
+          pstmt.setObject(i+1, pvalue);
+        }
+      }
+      ResultSet res = pstmt.executeQuery();
+      final int resultSetType = res.getType();
+
+      if (resultSetType == ResultSet.TYPE_FORWARD_ONLY)
+      {
+        TableModel model = generateDefaultTableModel(res, labelMapping);
+        res.close();
+        return new TableReportData(model);
+      }
+      else
+      {
+        return new SQLReportData(res, labelMapping);
+      }
+    }
+    catch(ReportDataFactoryException rdfe)
+    {
+      throw rdfe;
+    }
+    catch (Exception e)
+    {
+      throw new ReportDataFactoryException("Failed at query: " + query, e);
+    }
+  }
+
+  public void open()
+  {
+
+  }
+
+  public synchronized void close()
+  {
+    if (connection == null)
+    {
+      return;
+    }
+
+    try
+    {
+      connection.close();
+    }
+    catch (SQLException e)
+    {
+      // we tried our very best ..
+    }
+    connection = null;
+  }
+
+  /**
+   * Generates a <code>TableModel</code> that gets its contents filled from a
+   * <code>ResultSet</code>. The column names of the <code>ResultSet</code> will form the
+   * column names of the table model.
+   * <p/>
+   * Hint: To customize the names of the columns, use the SQL column aliasing (done with
+   * <code>SELECT nativecolumnname AS "JavaColumnName" FROM ....</code>
+   *
+   * @param rs           the result set.
+   * @param labelMapping defines, whether to use column names or column labels to compute
+   *                     the column index.
+   * @return a closeable table model.
+   *
+   * @throws SQLException if there is a problem with the result set.
+   */
+  private TableModel generateDefaultTableModel
+          (final ResultSet rs, final boolean labelMapping)
+          throws SQLException
+  {
+    final ResultSetMetaData rsmd = rs.getMetaData();
+    final int colcount = rsmd.getColumnCount();
+    final ArrayList header = new ArrayList(colcount);
+    for (int i = 0; i < colcount; i++)
+    {
+      if (labelMapping)
+      {
+        final String name = rsmd.getColumnLabel(i + 1);
+        header.add(name);
+      }
+      else
+      {
+        final String name = rsmd.getColumnName(i + 1);
+        header.add(name);
+      }
+    }
+    final ArrayList rows = new ArrayList();
+    while (rs.next())
+    {
+      final Object[] column = new Object[colcount];
+      for (int i = 0; i < colcount; i++)
+      {
+        column[i] = rs.getObject(i + 1);
+        if (rs.wasNull())
+        {
+          column[i] = null;
+        }
+      }
+      rows.add(column);
+    }
+
+    final Object[] tempRows = rows.toArray();
+    final Object[][] rowMap = new Object[tempRows.length][];
+    for (int i = 0; i < tempRows.length; i++)
+    {
+      rowMap[i] = (Object[]) tempRows[i];
+    }
+    return new DefaultTableModel(rowMap, header.toArray());
+  }
+
+  /**
+   * Derives a freshly initialized report data factory, which is independend of
+   * the original data factory. Opening or Closing one data factory must not
+   * affect the other factories.
+   *
+   * @return
+   */
+  public ReportDataFactory derive()
+  {
+    try
+    {
+      return (ReportDataFactory) clone();
+    }
+    catch (CloneNotSupportedException e)
+    {
+      // this should not happen ..
+      throw new IllegalStateException("Clone failed?");
+    }
+  }
+
+  public Object clone () throws CloneNotSupportedException
+  {
+    SimpleSQLReportDataFactory dataFactory = (SimpleSQLReportDataFactory) super.clone();
+    dataFactory.connection = null;
+    dataFactory.preparedStatements = new HashMap();
+    return dataFactory;
+  }
+}
diff --git a/source/org/jfree/report/modules/data/sql/StaticConnectionProvider.java b/source/org/jfree/report/modules/data/sql/StaticConnectionProvider.java
new file mode 100644
index 0000000..8df589a
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/StaticConnectionProvider.java
@@ -0,0 +1,57 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticConnectionProvider.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.data.sql;
+
+import java.sql.Connection;
+
+/**
+ * Creation-Date: 07.04.2006, 14:54:57
+ *
+ * @author Thomas Morgner
+ */
+public class StaticConnectionProvider implements ConnectionProvider
+{
+  private Connection connection;
+
+  public StaticConnectionProvider(final Connection connection)
+  {
+    if (connection == null)
+    {
+      throw new NullPointerException();
+    }
+    this.connection = connection;
+  }
+
+  public Connection getConnection()
+  {
+    return connection;
+  }
+}
diff --git a/source/org/jfree/report/modules/data/sql/configuration.properties b/source/org/jfree/report/modules/data/sql/configuration.properties
new file mode 100644
index 0000000..6e60a89
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/configuration.properties
@@ -0,0 +1,15 @@
+#
+# Defines, whether ResultSetMetaData.getLabel() or ResultSetMetaData.getName()
+# should be used to map column names into column indices.
+#
+# Valid values are "Label" or "Name".
+#
+# Explaination: The JDBC specifications allow the use of both, column
+# names and column labels to query a column. As the ResultSetTablemodel
+# requires a one-to-one mapping between a column name and the column index
+# we have to limit the use to one of them.
+#
+# For most simple queries you may not see any differences. This value defaults
+# to Name for the sake of backward compatibility.
+org.jfree.report.modules.data.sql.ColumnNameMapping=Name
+
diff --git a/source/org/jfree/report/modules/data/sql/module.properties b/source/org/jfree/report/modules/data/sql/module.properties
new file mode 100644
index 0000000..37c4526
--- /dev/null
+++ b/source/org/jfree/report/modules/data/sql/module.properties
@@ -0,0 +1,14 @@
+module-info:
+  name: data-sql
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Classes to support SQL-Datasources
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/data/xpath/.placeholder b/source/org/jfree/report/modules/data/xpath/.placeholder
new file mode 100644
index 0000000..a83e816
--- /dev/null
+++ b/source/org/jfree/report/modules/data/xpath/.placeholder
@@ -0,0 +1,2 @@
+This module will be implemented in the future. It will allow Queries against
+XML-Documents using XPath.
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/factories/common/module.properties b/source/org/jfree/report/modules/factories/common/module.properties
new file mode 100644
index 0000000..437783a
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/common/module.properties
@@ -0,0 +1,14 @@
+module-info:
+  name: factory-common
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: XML-Parser base classes (generic)
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/factories/data/base/DataFactoryReadHandler.java b/source/org/jfree/report/modules/factories/data/base/DataFactoryReadHandler.java
new file mode 100644
index 0000000..f70a50f
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/base/DataFactoryReadHandler.java
@@ -0,0 +1,45 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DataFactoryReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.data.base;
+
+import org.jfree.report.ReportDataFactory;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: Jan 15, 2007, 6:53:20 PM
+ *
+ * @author Thomas Morgner
+ */
+public interface DataFactoryReadHandler extends XmlReadHandler
+{
+  public ReportDataFactory getDataFactory();
+}
diff --git a/source/org/jfree/report/modules/factories/data/base/DataFactoryReadHandlerFactory.java b/source/org/jfree/report/modules/factories/data/base/DataFactoryReadHandlerFactory.java
new file mode 100644
index 0000000..290233e
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/base/DataFactoryReadHandlerFactory.java
@@ -0,0 +1,81 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DataFactoryReadHandlerFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.data.base;
+
+import java.util.Iterator;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractReadHandlerFactory;
+
+/**
+ * Creation-Date: 27.11.2006, 11:48:02
+ *
+ * @author Thomas Morgner
+ */
+public class DataFactoryReadHandlerFactory extends AbstractReadHandlerFactory
+{
+
+  private static final String PREFIX_SELECTOR =
+      "org.jfree.report.modules.factories.data.data-factory-prefix.";
+
+  private static DataFactoryReadHandlerFactory readHandlerFactory;
+
+  public DataFactoryReadHandlerFactory()
+  {
+  }
+
+  protected Class getTargetClass()
+  {
+    return DataFactoryReadHandler.class;
+  }
+
+  public static synchronized DataFactoryReadHandlerFactory getInstance()
+  {
+    if (DataFactoryReadHandlerFactory.readHandlerFactory == null)
+    {
+      DataFactoryReadHandlerFactory.readHandlerFactory = new DataFactoryReadHandlerFactory();
+      final Configuration config = JFreeReportBoot.getInstance().getGlobalConfig();
+      final Iterator propertyKeys = config.findPropertyKeys(DataFactoryReadHandlerFactory.PREFIX_SELECTOR);
+      while (propertyKeys.hasNext())
+      {
+        final String key = (String) propertyKeys.next();
+        final String value = config.getConfigProperty(key);
+        if (value != null)
+        {
+          DataFactoryReadHandlerFactory.readHandlerFactory.configure(config, value);
+        }
+      }
+    }
+    return DataFactoryReadHandlerFactory.readHandlerFactory;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/base/ReportDataFactoryBaseModule.java b/source/org/jfree/report/modules/factories/data/base/ReportDataFactoryBaseModule.java
new file mode 100644
index 0000000..086dd98
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/base/ReportDataFactoryBaseModule.java
@@ -0,0 +1,63 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportDataFactoryBaseModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.data.base;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 09.04.2006, 17:46:08
+ *
+ * @author Thomas Morgner
+ */
+public class ReportDataFactoryBaseModule extends AbstractModule
+{
+  public ReportDataFactoryBaseModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException if an error ocurred while initializing
+   *                                   the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/base/ReportDataFactoryXmlResourceFactory.java b/source/org/jfree/report/modules/factories/data/base/ReportDataFactoryXmlResourceFactory.java
new file mode 100644
index 0000000..66d0a2f
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/base/ReportDataFactoryXmlResourceFactory.java
@@ -0,0 +1,58 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportDataFactoryXmlResourceFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.data.base;
+
+import org.jfree.report.JFreeReportBoot;
+import org.jfree.report.ReportDataFactory;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 08.04.2006, 14:25:23
+ *
+ * @author Thomas Morgner
+ */
+public class ReportDataFactoryXmlResourceFactory extends AbstractXmlResourceFactory
+{
+  public ReportDataFactoryXmlResourceFactory()
+  {
+  }
+
+  protected Configuration getConfiguration ()
+  {
+    return JFreeReportBoot.getInstance().getGlobalConfig();
+  }
+
+  public Class getFactoryType()
+  {
+    return ReportDataFactory.class;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/base/module.properties b/source/org/jfree/report/modules/factories/data/base/module.properties
new file mode 100644
index 0000000..343447e
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/base/module.properties
@@ -0,0 +1,14 @@
+module-info:
+  name: factory-data-base
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: XML-Parser base classes for Datasource parsers
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/factories/data/beans/StaticDataFactoryModule.java b/source/org/jfree/report/modules/factories/data/beans/StaticDataFactoryModule.java
new file mode 100644
index 0000000..4748e65
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/beans/StaticDataFactoryModule.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticDataFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.data.beans;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 07.04.2006, 17:44:46
+ *
+ * @author Thomas Morgner
+ */
+public class StaticDataFactoryModule extends AbstractModule
+{
+  public static final String NAMESPACE =
+          "http://jfreereport.sourceforge.net/namespaces/datasources/static";
+
+  public StaticDataFactoryModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException if an error ocurred while initializing
+   *                                   the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/beans/StaticDataResourceXmlFactoryModule.java b/source/org/jfree/report/modules/factories/data/beans/StaticDataResourceXmlFactoryModule.java
new file mode 100644
index 0000000..41ab046
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/beans/StaticDataResourceXmlFactoryModule.java
@@ -0,0 +1,80 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticDataResourceXmlFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.data.beans;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: 07.04.2006, 15:29:17
+ *
+ * @author Thomas Morgner
+ */
+public class StaticDataResourceXmlFactoryModule implements XmlFactoryModule
+{
+  public StaticDataResourceXmlFactoryModule()
+  {
+  }
+
+  public int getDocumentSupport(XmlDocumentInfo documentInfo)
+  {
+    final String rootNamespace = documentInfo.getRootElementNameSpace();
+    if (rootNamespace != null && rootNamespace.length() > 0)
+    {
+      if (StaticDataFactoryModule.NAMESPACE.equals(rootNamespace) == false)
+      {
+        return NOT_RECOGNIZED;
+      }
+      else if ("static-datasource".equals(documentInfo.getRootElement()))
+      {
+        return RECOGNIZED_BY_NAMESPACE;
+      }
+    }
+    else if ("static-datasource".equals(documentInfo.getRootElement()))
+    {
+      return RECOGNIZED_BY_TAGNAME;
+    }
+
+    return NOT_RECOGNIZED;
+  }
+
+  public String getDefaultNamespace(XmlDocumentInfo documentInfo)
+  {
+    return StaticDataFactoryModule.NAMESPACE;
+  }
+
+  public XmlReadHandler createReadHandler(XmlDocumentInfo documentInfo)
+  {
+    return new StaticDataSourceReadHandler();
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/beans/StaticDataSourceReadHandler.java b/source/org/jfree/report/modules/factories/data/beans/StaticDataSourceReadHandler.java
new file mode 100644
index 0000000..a4e1de1
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/beans/StaticDataSourceReadHandler.java
@@ -0,0 +1,121 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticDataSourceReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.data.beans;
+
+import java.util.ArrayList;
+
+import org.jfree.report.modules.factories.data.base.DataFactoryReadHandler;
+import org.jfree.report.modules.data.beans.NamedStaticReportDataFactory;
+import org.jfree.report.ReportDataFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertyReadHandler;
+
+/**
+ * Creation-Date: 07.04.2006, 17:47:53
+ *
+ * @author Thomas Morgner
+ */
+public class StaticDataSourceReadHandler extends AbstractXmlReadHandler
+  implements DataFactoryReadHandler
+{
+  private ArrayList queries;
+  private ReportDataFactory dataFactory;
+
+  public StaticDataSourceReadHandler()
+  {
+    queries = new ArrayList();
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws org.xml.sax.SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+
+    if (tagName.equals("query"))
+    {
+      XmlReadHandler queryReadHandler = new PropertyReadHandler();
+      queries.add(queryReadHandler);
+      return queryReadHandler;
+    }
+    return null;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws org.xml.sax.SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    final NamedStaticReportDataFactory srdf = new NamedStaticReportDataFactory();
+    for (int i = 0; i < queries.size(); i++)
+    {
+      final PropertyReadHandler handler = (PropertyReadHandler) queries.get(i);
+      srdf.setQuery(handler.getName(), handler.getResult());
+    }
+
+    srdf.setContentBase(getRootHandler().getSource());
+    dataFactory = srdf;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   */
+  public Object getObject() throws SAXException
+  {
+    return dataFactory;
+  }
+
+  public ReportDataFactory getDataFactory()
+  {
+    return dataFactory;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/beans/configuration.properties b/source/org/jfree/report/modules/factories/data/beans/configuration.properties
new file mode 100644
index 0000000..c0d0189
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/beans/configuration.properties
@@ -0,0 +1,16 @@
+#
+# Drop all other configuration stuff here.
+
+
+##
+# Do not modify the following lines. They connect this module to the central
+# parser registry.
+org.pentaho.reporting.libraries.resourceloader.factory.modules.org.jfree.report.ReportDataFactory.beans=org.jfree.report.modules.factories.data.beans.StaticDataResourceXmlFactoryModule
+
+#
+# Definitions for the DataSource-ReadHandlerFactory (which is used when
+# the datasource is defined as inline-xml)
+#
+org.jfree.report.modules.factories.data.data-factory-prefix.built-in.beans=org.jfree.report.modules.factories.data.beans.data-factory.
+org.jfree.report.modules.factories.data.beans.data-factory.namespace.static=http://jfreereport.sourceforge.net/namespaces/datasources/static
+org.jfree.report.modules.factories.data.beans.data-factory.tag.static.static-datasource=org.jfree.report.modules.factories.data.beans.StaticDataSourceReadHandler
diff --git a/source/org/jfree/report/modules/factories/data/beans/module.properties b/source/org/jfree/report/modules/factories/data/beans/module.properties
new file mode 100644
index 0000000..3052819
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/beans/module.properties
@@ -0,0 +1,14 @@
+module-info:
+  name: factory-data-static
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: XML-Parsers for Static-Datasources
+  version.major: 0
+  version.minor: 88
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.parser.base.ParserBaseModule
+  version.major: 0
+  version.minor: 88
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/factories/data/beans/staticdatasource.xsd b/source/org/jfree/report/modules/factories/data/beans/staticdatasource.xsd
new file mode 100644
index 0000000..75d2152
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/beans/staticdatasource.xsd
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<xsd:schema version="0.9"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:core="http://jfreereport.sourceforge.net/namespaces/engine/coretypes"
+            xmlns="http://jfreereport.sourceforge.net/namespaces/datasources/static"
+            targetNamespace="http://jfreereport.sourceforge.net/namespaces/datasources/static">
+  <xsd:annotation>
+    <xsd:documentation>
+      This schema describes the format of named Static-Datasource definitions in
+      JFreeReport. This document is aimed for the JFreeReport 0.8.8 and 0.9 release.
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:element name="static-datasource">
+    <xsd:annotation>
+      <xsd:documentation>
+        An datasource consists of an sequence of named queries.
+        Queries must be given in one of the following formats:
+
+        * <full-qualified-classname>#methodName(Parameters)
+        * <full-qualified-classname>(constructorparams)#methodName(Parameters)
+        * <full-qualified-classname>(constructorparams)
+
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="core:datasource-type">
+          <xsd:sequence>
+            <xsd:element ref="query" minOccurs="1" maxOccurs="unbounded"/>
+          </xsd:sequence>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="query">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:string">
+          <xsd:attribute name="name" type="xsd:string"/>
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+</xsd:schema>
diff --git a/source/org/jfree/report/modules/factories/data/sql/ConfigReadHandler.java b/source/org/jfree/report/modules/factories/data/sql/ConfigReadHandler.java
new file mode 100644
index 0000000..0901f33
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/ConfigReadHandler.java
@@ -0,0 +1,83 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConfigReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.data.sql;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+
+/**
+ * Creation-Date: 07.04.2006, 18:35:57
+ *
+ * @author Thomas Morgner
+ */
+public class ConfigReadHandler extends AbstractXmlReadHandler
+{
+  private Boolean labelMapping;
+
+  public ConfigReadHandler()
+  {
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+
+    String labelMappingAttr = attrs.getValue(getUri(), "label-mapping");
+    if (labelMappingAttr != null)
+    {
+      labelMapping = Boolean.valueOf(labelMappingAttr);
+    }
+  }
+
+  public Boolean isLabelMapping()
+  {
+    return labelMapping;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   * @throws SAXException if there is a parsing error.
+   */
+  public Object getObject() throws SAXException
+  {
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/sql/ConnectionReadHandler.java b/source/org/jfree/report/modules/factories/data/sql/ConnectionReadHandler.java
new file mode 100644
index 0000000..af742e5
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/ConnectionReadHandler.java
@@ -0,0 +1,45 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConnectionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.data.sql;
+
+import org.jfree.report.modules.data.sql.ConnectionProvider;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: Dec 17, 2006, 8:58:33 PM
+ *
+ * @author Thomas Morgner
+ */
+public interface ConnectionReadHandler extends XmlReadHandler
+{
+  public ConnectionProvider getProvider();
+}
diff --git a/source/org/jfree/report/modules/factories/data/sql/ConnectionReadHandlerFactory.java b/source/org/jfree/report/modules/factories/data/sql/ConnectionReadHandlerFactory.java
new file mode 100644
index 0000000..ebec1e6
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/ConnectionReadHandlerFactory.java
@@ -0,0 +1,81 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConnectionReadHandlerFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.data.sql;
+
+import java.util.Iterator;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractReadHandlerFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: Dec 17, 2006, 8:58:11 PM
+ *
+ * @author Thomas Morgner
+ */
+public class ConnectionReadHandlerFactory extends AbstractReadHandlerFactory
+{
+  private static final String PREFIX_SELECTOR =
+      "org.jfree.report.modules.factories.data.sql.connection-factory-prefix.";
+
+  private static ConnectionReadHandlerFactory readHandlerFactory;
+
+  public ConnectionReadHandlerFactory()
+  {
+  }
+
+  protected Class getTargetClass()
+  {
+    return ConnectionReadHandler.class;
+  }
+
+  public static synchronized ConnectionReadHandlerFactory getInstance()
+  {
+    if (readHandlerFactory == null)
+    {
+      readHandlerFactory = new ConnectionReadHandlerFactory();
+      final Configuration config = JFreeReportBoot.getInstance().getGlobalConfig();
+      final Iterator propertyKeys = config.findPropertyKeys(PREFIX_SELECTOR);
+      while (propertyKeys.hasNext())
+      {
+        final String key = (String) propertyKeys.next();
+        final String value = config.getConfigProperty(key);
+        if (value != null)
+        {
+          readHandlerFactory.configure(config, value);
+        }
+      }
+    }
+    return readHandlerFactory;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/factories/data/sql/DriverConnectionReadHandler.java b/source/org/jfree/report/modules/factories/data/sql/DriverConnectionReadHandler.java
new file mode 100644
index 0000000..91252d7
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/DriverConnectionReadHandler.java
@@ -0,0 +1,142 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DriverConnectionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.data.sql;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jfree.report.modules.data.sql.DriverConnectionProvider;
+import org.jfree.report.modules.data.sql.ConnectionProvider;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.StringReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertiesReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: 07.04.2006, 18:09:25
+ *
+ * @author Thomas Morgner
+ */
+public class DriverConnectionReadHandler extends AbstractXmlReadHandler
+  implements ConnectionReadHandler
+{
+  private StringReadHandler driverReadHandler;
+  private StringReadHandler urlReadHandler;
+  private PropertiesReadHandler propertiesReadHandler;
+  private ConnectionProvider driverConnectionProvider;
+
+  public DriverConnectionReadHandler()
+  {
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+    if ("driver".equals(tagName))
+    {
+      driverReadHandler = new StringReadHandler();
+      return driverReadHandler;
+    }
+    if ("url".equals(tagName))
+    {
+      urlReadHandler = new StringReadHandler();
+      return urlReadHandler;
+    }
+    if ("properties".equals(tagName))
+    {
+      propertiesReadHandler = new PropertiesReadHandler();
+      return propertiesReadHandler;
+    }
+    return null;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    final DriverConnectionProvider provider = new DriverConnectionProvider();
+    if (driverReadHandler != null)
+    {
+      provider.setDriver(driverReadHandler.getResult());
+    }
+    if (urlReadHandler != null)
+    {
+      provider.setUrl(urlReadHandler.getResult());
+    }
+    if (propertiesReadHandler != null)
+    {
+      final Properties p = (Properties) propertiesReadHandler.getObject();
+      final Iterator it = p.entrySet().iterator();
+      while (it.hasNext())
+      {
+        Map.Entry entry = (Map.Entry) it.next();
+        provider.setProperty((String) entry.getKey(), (String) entry.getValue());
+      }
+    }
+    driverConnectionProvider = provider;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   */
+  public Object getObject() throws SAXException
+  {
+    return driverConnectionProvider;
+  }
+
+  public ConnectionProvider getProvider()
+  {
+    return driverConnectionProvider;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/sql/SQLDataFactoryModule.java b/source/org/jfree/report/modules/factories/data/sql/SQLDataFactoryModule.java
new file mode 100644
index 0000000..6aa1d1e
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/SQLDataFactoryModule.java
@@ -0,0 +1,67 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SQLDataFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.data.sql;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 07.04.2006, 17:44:46
+ *
+ * @author Thomas Morgner
+ */
+public class SQLDataFactoryModule extends AbstractModule
+{
+  public static final String NAMESPACE =
+          "http://jfreereport.sourceforge.net/namespaces/datasources/sql";
+
+  public SQLDataFactoryModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException if an error ocurred while initializing
+   *                                   the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/sql/SQLDataFactoryReadHandler.java b/source/org/jfree/report/modules/factories/data/sql/SQLDataFactoryReadHandler.java
new file mode 100644
index 0000000..19ac6f7
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/SQLDataFactoryReadHandler.java
@@ -0,0 +1,160 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SQLDataFactoryReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.data.sql;
+
+import java.util.ArrayList;
+
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.modules.data.sql.ConnectionProvider;
+import org.jfree.report.modules.data.sql.SQLReportDataFactory;
+import org.jfree.report.modules.factories.data.base.DataFactoryReadHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertyReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 07.04.2006, 17:47:53
+ *
+ * @author Thomas Morgner
+ */
+public class SQLDataFactoryReadHandler extends AbstractXmlReadHandler
+  implements DataFactoryReadHandler
+{
+  private ConnectionReadHandler connectionProviderReadHandler;
+  private ArrayList queries;
+  private ConfigReadHandler configReadHandler;
+  private ReportDataFactory dataFactory;
+
+  public SQLDataFactoryReadHandler()
+  {
+    queries = new ArrayList();
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+
+    final ConnectionReadHandlerFactory factory = ConnectionReadHandlerFactory.getInstance();
+    final ConnectionReadHandler handler = (ConnectionReadHandler) factory.getHandler(uri, tagName);
+    if (handler != null)
+    {
+      connectionProviderReadHandler = handler;
+      return connectionProviderReadHandler;
+    }
+
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+    if (tagName.equals("config"))
+    {
+      configReadHandler = new ConfigReadHandler();
+      return configReadHandler;
+    }
+    if (tagName.equals("query"))
+    {
+      XmlReadHandler queryReadHandler = new PropertyReadHandler();
+      queries.add(queryReadHandler);
+      return queryReadHandler;
+    }
+    return null;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    ConnectionProvider provider = null;
+    if (connectionProviderReadHandler != null)
+    {
+      provider = connectionProviderReadHandler.getProvider();
+    }
+    if (provider == null)
+    {
+      provider = (ConnectionProvider)
+              getRootHandler().getHelperObject("connection-provider");
+    }
+    if (provider == null)
+    {
+      throw new ParseException
+          ("Unable to create SQL Factory: No connection provider.", getLocator());
+    }
+
+    SQLReportDataFactory srdf = new SQLReportDataFactory(provider);
+    if (configReadHandler != null)
+    {
+      final Boolean labelMapping = configReadHandler.isLabelMapping();
+      if (labelMapping != null)
+      {
+        srdf.setLabelMapping(labelMapping.booleanValue());
+      }
+    }
+    for (int i = 0; i < queries.size(); i++)
+    {
+      final PropertyReadHandler handler = (PropertyReadHandler) queries.get(i);
+      srdf.setQuery(handler.getName(), handler.getResult());
+    }
+    dataFactory = srdf;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   * @throws SAXException if there is a parsing error.
+   */
+  public Object getObject() throws SAXException
+  {
+    return dataFactory;
+  }
+
+  public ReportDataFactory getDataFactory()
+  {
+    return dataFactory;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/sql/SQLResourceXmlFactoryModule.java b/source/org/jfree/report/modules/factories/data/sql/SQLResourceXmlFactoryModule.java
new file mode 100644
index 0000000..4c38c39
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/SQLResourceXmlFactoryModule.java
@@ -0,0 +1,79 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SQLResourceXmlFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.data.sql;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+
+/**
+ * Creation-Date: 07.04.2006, 15:29:17
+ *
+ * @author Thomas Morgner
+ */
+public class SQLResourceXmlFactoryModule implements XmlFactoryModule
+{
+  public SQLResourceXmlFactoryModule()
+  {
+  }
+
+  public int getDocumentSupport(XmlDocumentInfo documentInfo)
+  {
+    final String rootNamespace = documentInfo.getRootElementNameSpace();
+    if (rootNamespace != null && rootNamespace.length() > 0)
+    {
+      if (SQLDataFactoryModule.NAMESPACE.equals(rootNamespace) == false)
+      {
+        return NOT_RECOGNIZED;
+      }
+      else if ("sql-datasource".equals(documentInfo.getRootElement()))
+      {
+        return RECOGNIZED_BY_NAMESPACE;
+      }
+    }
+    else if ("sql-datasource".equals(documentInfo.getRootElement()))
+    {
+      return RECOGNIZED_BY_TAGNAME;
+    }
+
+    return NOT_RECOGNIZED;
+  }
+
+  public String getDefaultNamespace(XmlDocumentInfo documentInfo)
+  {
+    return SQLDataFactoryModule.NAMESPACE;
+  }
+
+  public XmlReadHandler createReadHandler(XmlDocumentInfo documentInfo)
+  {
+    return new SQLDataFactoryReadHandler();
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/data/sql/configuration.properties b/source/org/jfree/report/modules/factories/data/sql/configuration.properties
new file mode 100644
index 0000000..65cd51c
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/configuration.properties
@@ -0,0 +1,19 @@
+#
+# Drop all other configuration stuff here.
+
+
+##
+# Do not modify the following lines. They connect this module to the central
+# parser registry.
+org.pentaho.reporting.libraries.resourceloader.factory.modules.org.jfree.report.ReportDataFactory.sql=org.jfree.report.modules.factories.data.sql.SQLResourceXmlFactoryModule
+
+#
+# All known prefixes from where to load the xml-parser-configuration.
+org.jfree.report.modules.factories.data.sql.connection-factory-prefix.built-in.driver=org.jfree.report.modules.factories.data.sql.connection-factories.
+
+org.jfree.report.modules.factories.data.sql.connection-factories.namespace.sql=http://jfreereport.sourceforge.net/namespaces/datasources/sql
+org.jfree.report.modules.factories.data.sql.connection-factories.tag.sql.connection=org.jfree.report.modules.factories.data.sql.DriverConnectionReadHandler
+
+org.jfree.report.modules.factories.data.data-factory-prefix.built-in.sql=org.jfree.report.modules.factories.data.sql.data-factory.
+org.jfree.report.modules.factories.data.sql.data-factory.namespace.static=http://jfreereport.sourceforge.net/namespaces/datasources/sql
+org.jfree.report.modules.factories.data.sql.data-factory.tag.static.static-datasource=org.jfree.report.modules.factories.data.sql.SQLDataFactoryReadHandler
diff --git a/source/org/jfree/report/modules/factories/data/sql/module.properties b/source/org/jfree/report/modules/factories/data/sql/module.properties
new file mode 100644
index 0000000..9a25bfc
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/module.properties
@@ -0,0 +1,14 @@
+module-info:
+  name: factory-data-sql
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: XML-Parsers for SQL-Datasources
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.factories.data.base.ReportDataFactoryBaseModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/factories/data/sql/sqldatasource.xsd b/source/org/jfree/report/modules/factories/data/sql/sqldatasource.xsd
new file mode 100644
index 0000000..2232fed
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/data/sql/sqldatasource.xsd
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+
+<xsd:schema version="0.9"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns="http://jfreereport.sourceforge.net/namespaces/datasources/sql"
+            targetNamespace="http://jfreereport.sourceforge.net/namespaces/datasources/sql">
+  <xsd:annotation>
+    <xsd:documentation>
+      This schema describes the format of SQL-Datasource definitions in
+      JFreeReport. This document is aimed for the JFreeReport 0.9 release.
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:element name="sql-datasource">
+    <xsd:annotation>
+      <xsd:documentation>
+        An datasource consists of an (optional) connection info block and a
+        sequence of named queries.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="connection" minOccurs="0" maxOccurs="1"/>
+        <xsd:element ref="query" minOccurs="1" maxOccurs="unbounded"/>
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="connection">
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="driver" minOccurs="1" maxOccurs="1"/>
+        <xsd:element ref="url" minOccurs="1" maxOccurs="1"/>
+        <xsd:element ref="properties" minOccurs="0" maxOccurs="1"/>
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="driver" type="xsd:string"/>
+
+  <xsd:element name="url" type="xsd:string"/>
+
+  <xsd:element name="properties">
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="1" maxOccurs="unbounded"/>
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="property">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:string">
+          <xsd:attribute name="name" type="xsd:string"/>
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="config">
+    <xsd:complexType>
+      <xsd:attribute name="label-mapping" type="xsd:boolean"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="query">
+    <xsd:complexType>
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:string">
+          <xsd:attribute name="name" type="xsd:string"/>
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+</xsd:schema>
diff --git a/source/org/jfree/report/modules/factories/report/base/JFreeReportXmlResourceFactory.java b/source/org/jfree/report/modules/factories/report/base/JFreeReportXmlResourceFactory.java
new file mode 100644
index 0000000..bb93293
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/base/JFreeReportXmlResourceFactory.java
@@ -0,0 +1,87 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JFreeReportXmlResourceFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.base;
+
+import org.jfree.report.JFreeReport;
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+import org.pentaho.reporting.libraries.resourceloader.ResourceData;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceCreationException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException;
+
+/**
+ * Creation-Date: 08.04.2006, 14:27:36
+ *
+ * @author Thomas Morgner
+ */
+public class  JFreeReportXmlResourceFactory extends AbstractXmlResourceFactory
+{
+  public JFreeReportXmlResourceFactory()
+  {
+  }
+
+  public Class getFactoryType()
+  {
+    return JFreeReport.class;
+  }
+
+  protected Configuration getConfiguration ()
+  {
+    return JFreeReportBoot.getInstance().getGlobalConfig();
+  }
+
+  protected Object finishResult(final Object res,
+                                final ResourceManager manager,
+                                final ResourceData data,
+                                final ResourceKey context)
+          throws ResourceCreationException, ResourceLoadingException
+  {
+    final JFreeReport report = (JFreeReport) res;
+    if (report == null)
+    {
+      throw new ResourceCreationException("Report has not been parsed.");
+    }
+    if (context != null)
+    {
+      report.setBaseResource(context);
+    }
+    else
+    {
+      report.setBaseResource(data.getKey());
+    }
+    report.setResourceManager(manager);
+
+    return report;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/base/NodeReadHandler.java b/source/org/jfree/report/modules/factories/report/base/NodeReadHandler.java
new file mode 100644
index 0000000..97aa047
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/base/NodeReadHandler.java
@@ -0,0 +1,45 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: NodeReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.report.base;
+
+import org.jfree.report.structure.Node;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: 27.11.2006, 11:49:26
+ *
+ * @author Thomas Morgner
+ */
+public interface NodeReadHandler extends XmlReadHandler
+{
+  public Node getNode();
+}
diff --git a/source/org/jfree/report/modules/factories/report/base/NodeReadHandlerFactory.java b/source/org/jfree/report/modules/factories/report/base/NodeReadHandlerFactory.java
new file mode 100644
index 0000000..af85955
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/base/NodeReadHandlerFactory.java
@@ -0,0 +1,81 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: NodeReadHandlerFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.factories.report.base;
+
+import java.util.Iterator;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractReadHandlerFactory;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 27.11.2006, 11:48:02
+ *
+ * @author Thomas Morgner
+ */
+public class NodeReadHandlerFactory extends AbstractReadHandlerFactory
+{
+
+  private static final String PREFIX_SELECTOR =
+      "org.jfree.report.modules.factories.report.base.node-factory-prefix.";
+
+  private static NodeReadHandlerFactory readHandlerFactory;
+
+  public NodeReadHandlerFactory()
+  {
+  }
+
+  protected Class getTargetClass()
+  {
+    return NodeReadHandler.class;
+  }
+
+  public static synchronized NodeReadHandlerFactory getInstance()
+  {
+    if (readHandlerFactory == null)
+    {
+      readHandlerFactory = new NodeReadHandlerFactory();
+      final Configuration config = JFreeReportBoot.getInstance().getGlobalConfig();
+      final Iterator propertyKeys = config.findPropertyKeys(PREFIX_SELECTOR);
+      while (propertyKeys.hasNext())
+      {
+        final String key = (String) propertyKeys.next();
+        final String value = config.getConfigProperty(key);
+        if (value != null)
+        {
+          readHandlerFactory.configure(config, value);
+        }
+      }
+    }
+    return readHandlerFactory;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/base/ReportFactoryBaseModule.java b/source/org/jfree/report/modules/factories/report/base/ReportFactoryBaseModule.java
new file mode 100644
index 0000000..348ef73
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/base/ReportFactoryBaseModule.java
@@ -0,0 +1,63 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportFactoryBaseModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.base;
+
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+
+/**
+ * Creation-Date: 10.04.2006, 10:36:48
+ *
+ * @author Thomas Morgner
+ */
+public class ReportFactoryBaseModule extends AbstractModule
+{
+  public ReportFactoryBaseModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException if an error ocurred while initializing
+   *                                   the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/base/SubReportXmlResourceFactory.java b/source/org/jfree/report/modules/factories/report/base/SubReportXmlResourceFactory.java
new file mode 100644
index 0000000..8ccaa46
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/base/SubReportXmlResourceFactory.java
@@ -0,0 +1,58 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SubReportXmlResourceFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.base;
+
+import org.jfree.report.JFreeReportBoot;
+import org.jfree.report.structure.SubReport;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory;
+
+/**
+ * Creation-Date: 08.04.2006, 14:27:36
+ *
+ * @author Thomas Morgner
+ */
+public class SubReportXmlResourceFactory extends AbstractXmlResourceFactory
+{
+  public SubReportXmlResourceFactory()
+  {
+  }
+  protected Configuration getConfiguration ()
+  {
+    return JFreeReportBoot.getInstance().getGlobalConfig();
+  }
+
+
+  public Class getFactoryType()
+  {
+    return SubReport.class;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/base/configuration.properties b/source/org/jfree/report/modules/factories/report/base/configuration.properties
new file mode 100644
index 0000000..6a8e198
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/base/configuration.properties
@@ -0,0 +1,3 @@
+#
+# All known prefixes from where to load the configuration.
+org.jfree.report.modules.factories.report.base.node-factory-prefix.built-in.flow=org.jfree.report.modules.factories.report.node-factories.
diff --git a/source/org/jfree/report/modules/factories/report/base/module.properties b/source/org/jfree/report/modules/factories/report/base/module.properties
new file mode 100644
index 0000000..2d7ef56
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/base/module.properties
@@ -0,0 +1,14 @@
+module-info:
+  name: factory-report-base
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Base classes for report definition parsers.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/factories/report/compatibility/extended/ExtendedXmlFactoryModule.java b/source/org/jfree/report/modules/factories/report/compatibility/extended/ExtendedXmlFactoryModule.java
new file mode 100644
index 0000000..f526e9b
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/compatibility/extended/ExtendedXmlFactoryModule.java
@@ -0,0 +1,62 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExtendedXmlFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.compatibility.extended;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: 08.04.2006, 14:38:47
+ *
+ * @author Thomas Morgner
+ */
+public class ExtendedXmlFactoryModule implements XmlFactoryModule
+{
+  public ExtendedXmlFactoryModule()
+  {
+  }
+
+  public int getDocumentSupport(XmlDocumentInfo documentInfo)
+  {
+    return 0;
+  }
+
+  public XmlReadHandler createReadHandler(XmlDocumentInfo documentInfo)
+  {
+    return null;
+  }
+
+  public String getDefaultNamespace(XmlDocumentInfo documentInfo)
+  {
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/compatibility/simple/SimpleXmlFactoryModule.java b/source/org/jfree/report/modules/factories/report/compatibility/simple/SimpleXmlFactoryModule.java
new file mode 100644
index 0000000..fe3592d
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/compatibility/simple/SimpleXmlFactoryModule.java
@@ -0,0 +1,62 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SimpleXmlFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.compatibility.simple;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+
+/**
+ * Creation-Date: 08.04.2006, 14:38:27
+ *
+ * @author Thomas Morgner
+ */
+public class SimpleXmlFactoryModule implements XmlFactoryModule
+{
+  public SimpleXmlFactoryModule()
+  {
+  }
+
+  public int getDocumentSupport(XmlDocumentInfo documentInfo)
+  {
+    return 0;
+  }
+
+  public XmlReadHandler createReadHandler(XmlDocumentInfo documentInfo)
+  {
+    return null;
+  }
+
+  public String getDefaultNamespace(XmlDocumentInfo documentInfo)
+  {
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/compatibility/simple/jfreereport.xsd b/source/org/jfree/report/modules/factories/report/compatibility/simple/jfreereport.xsd
new file mode 100644
index 0000000..3a43569
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/compatibility/simple/jfreereport.xsd
@@ -0,0 +1,891 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jfreereport.xsd"
+  
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:annotation>
+    <xs:documentation xml:lang="en">
+			Report Schema for JFreeReport version 0.8.5.
+			Initial port from DTD by:
+			Marc Batchelor
+			September 7, 2005
+			Pentaho Corporation
+		</xs:documentation>
+  </xs:annotation>
+  <xs:simpleType name="boolean">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="true"/>
+      <xs:enumeration value="false"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="fontstyle">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="plain"/>
+      <xs:enumeration value="bold"/>
+      <xs:enumeration value="italic"/>
+      <xs:enumeration value="bold-italic"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="alignmentEnum">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="left"/>
+      <xs:enumeration value="center"/>
+      <xs:enumeration value="right"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="valignmentEnum">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="top"/>
+      <xs:enumeration value="middle"/>
+      <xs:enumeration value="bottom"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="orientations">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="portrait"/>
+      <xs:enumeration value="landscape"/>
+      <xs:enumeration value="reverse_landscape"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:attributeGroup name="position">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				The position of an element is declared either relative to the last
+				defined element in the band (or (0,0) if the element is the first element),
+				or it is positioned absolute to the top left corner of the current band.
+				
+				When positioning an element be aware to take care of the elements width.
+				The next element should be placed at the absolute position x+width,
+				or the elements will overwrite each other.
+				
+				All Fontstyles default to plain and all boolean styles to false. If no font is
+				set either in Band nor in element, a compiled in default font is used.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attribute name="x" use="required"/>
+    <xs:attribute name="y" use="required"/>
+    <xs:attribute name="width" use="required"/>
+    <xs:attribute name="height" use="required"/>
+  </xs:attributeGroup>
+  <xs:attributeGroup name="basicform">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				Colors are specified in HTML Syntax, so use #FFFFFF for white and #000000
+				for black when using RGB numeric values. You may also use defined named
+				constants for the color, as "black", "white" and so on.
+				
+				The constants understood by the parser are:
+				"black", "blue", "cyan", darkGray", "gray", "green", "lightGray", "magenta",
+				"orange", "pink", "red", "white", "yellow"
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attribute name="color"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="dynamic" type="boolean"/>
+    <xs:attribute name="trim-text-content" type="boolean"/>
+    <xs:attribute name="visible" type="boolean"/>
+    <xs:attribute name="layout-cachable" type="boolean"/>
+    <xs:attribute name="href"/>
+    <xs:attribute name="reserved-literal"/>
+  </xs:attributeGroup>
+  <xs:attributeGroup name="fontdef">
+    <xs:attribute name="fontname"/>
+    <xs:attribute name="fontstyle" type="fontstyle"/>
+    <xs:attribute name="fontsize"/>
+    <xs:attribute name="fsbold" type="boolean"/>
+    <xs:attribute name="fsitalic" type="boolean"/>
+    <xs:attribute name="fsunderline" type="boolean"/>
+    <xs:attribute name="fsstrikethr" type="boolean"/>
+    <xs:attribute name="font-embedded" type="boolean"/>
+    <xs:attribute name="font-encoding"/>
+    <xs:attribute name="line-height"/>
+    <xs:attribute name="excel-wrap-text" type="boolean"/>
+    <xs:attribute name="alignment" type="alignmentEnum"/>
+    <xs:attribute name="vertical-alignment" type="valignmentEnum"/>
+  </xs:attributeGroup>
+  <xs:complexType name="itemelements" >
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="band" type="bandType"/>
+      <xs:element name="label" type="labelType"/>
+      <xs:element name="string-field" type="string-fieldType"/>
+      <xs:element name="resource-label" type="resource-labelType"/>
+      <xs:element name="resource-field" type="resource-fieldType"/>
+      <xs:element name="number-field" type="number-fieldType"/>
+      <xs:element name="date-field" type="date-fieldType"/>
+      <xs:element name="imageref" type="imagerefType"/>
+      <xs:element name="image-field" type="image-fieldType"/>
+      <xs:element name="imageurl-field" type="imageurl-fieldType"/>
+      <xs:element name="rectangle" type="rectangleType"/>
+      <xs:element name="line" type="lineType"/>
+      <xs:element name="drawable-field" type="drawable-fieldType"/>
+      <xs:element name="drawable-url-field" type="drawable-url-fieldType"/>
+      <xs:element name="drawableref" type="drawablerefType"/>
+      <xs:element name="shape-field" type="shape-fieldType"/>
+      <xs:element name="message-field" type="message-fieldType"/>
+      <xs:element name="anchor-field" type="anchor-fieldType"/>
+    </xs:choice>
+  </xs:complexType>
+  <xs:simpleType name="pageFormats">
+    <xs:restriction base="xs:token">
+      <xs:enumeration value="PAPER10X11"/>
+      <xs:enumeration value="PAPER10X13"/>
+      <xs:enumeration value="PAPER10X14"/>
+      <xs:enumeration value="PAPER12X11"/>
+      <xs:enumeration value="PAPER15X11"/>
+      <xs:enumeration value="PAPER7X9"/>
+      <xs:enumeration value="PAPER8X10"/>
+      <xs:enumeration value="PAPER9X11"/>
+      <xs:enumeration value="PAPER9X12"/>
+      <xs:enumeration value="A0"/>
+      <xs:enumeration value="A1"/>
+      <xs:enumeration value="A2"/>
+      <xs:enumeration value="A3"/>
+      <xs:enumeration value="A3_TRANSVERSE"/>
+      <xs:enumeration value="A3_EXTRA"/>
+      <xs:enumeration value="A3_EXTRATRANSVERSE"/>
+      <xs:enumeration value="A3_ROTATED"/>
+      <xs:enumeration value="A4"/>
+      <xs:enumeration value="A4_TRANSVERSE"/>
+      <xs:enumeration value="A4_EXTRA"/>
+      <xs:enumeration value="A4_PLUS"/>
+      <xs:enumeration value="A4_ROTATED"/>
+      <xs:enumeration value="A4_SMALL"/>
+      <xs:enumeration value="A5"/>
+      <xs:enumeration value="A5_TRANSVERSE"/>
+      <xs:enumeration value="A5_EXTRA"/>
+      <xs:enumeration value="A5_ROTATED"/>
+      <xs:enumeration value="A6"/>
+      <xs:enumeration value="A6_ROTATED"/>
+      <xs:enumeration value="A7"/>
+      <xs:enumeration value="A8"/>
+      <xs:enumeration value="A9"/>
+      <xs:enumeration value="A10"/>
+      <xs:enumeration value="ANSIC"/>
+      <xs:enumeration value="ANSID"/>
+      <xs:enumeration value="ANSIE"/>
+      <xs:enumeration value="ARCHA"/>
+      <xs:enumeration value="ARCHB"/>
+      <xs:enumeration value="ARCHC"/>
+      <xs:enumeration value="ARCHD"/>
+      <xs:enumeration value="ARCHE"/>
+      <xs:enumeration value="B0"/>
+      <xs:enumeration value="B1"/>
+      <xs:enumeration value="B2"/>
+      <xs:enumeration value="B3"/>
+      <xs:enumeration value="B4"/>
+      <xs:enumeration value="B4_ROTATED"/>
+      <xs:enumeration value="B5"/>
+      <xs:enumeration value="B5_TRANSVERSE"/>
+      <xs:enumeration value="B5_ROTATED"/>
+      <xs:enumeration value="B6"/>
+      <xs:enumeration value="B6_ROTATED"/>
+      <xs:enumeration value="B7"/>
+      <xs:enumeration value="B8"/>
+      <xs:enumeration value="B9"/>
+      <xs:enumeration value="B10"/>
+      <xs:enumeration value="C4"/>
+      <xs:enumeration value="C5"/>
+      <xs:enumeration value="C6"/>
+      <xs:enumeration value="COMM10"/>
+      <xs:enumeration value="DL"/>
+      <xs:enumeration value="DOUBLEPOSTCARD"/>
+      <xs:enumeration value="DOUBLEPOSTCARD_ROTATED"/>
+      <xs:enumeration value="ENV9"/>
+      <xs:enumeration value="ENV10"/>
+      <xs:enumeration value="ENV11"/>
+      <xs:enumeration value="ENV12"/>
+      <xs:enumeration value="ENV14"/>
+      <xs:enumeration value="ENVC0"/>
+      <xs:enumeration value="ENVC1"/>
+      <xs:enumeration value="ENVC2"/>
+      <xs:enumeration value="ENVC3"/>
+      <xs:enumeration value="ENVC4"/>
+      <xs:enumeration value="ENVC5"/>
+      <xs:enumeration value="ENVC6"/>
+      <xs:enumeration value="ENVC65"/>
+      <xs:enumeration value="ENVC7"/>
+      <xs:enumeration value="ENVCHOU3"/>
+      <xs:enumeration value="ENVCHOU3_ROTATED"/>
+      <xs:enumeration value="ENVCHOU4"/>
+      <xs:enumeration value="ENVCHOU4_ROTATED"/>
+      <xs:enumeration value="ENVDL"/>
+      <xs:enumeration value="ENVINVITE"/>
+      <xs:enumeration value="ENVISOB4"/>
+      <xs:enumeration value="ENVISOB5"/>
+      <xs:enumeration value="ENVISOB6"/>
+      <xs:enumeration value="ENVITALIAN"/>
+      <xs:enumeration value="ENVKAKU2"/>
+      <xs:enumeration value="ENVKAKU2_ROTATED"/>
+      <xs:enumeration value="ENVKAKU3"/>
+      <xs:enumeration value="ENVKAKU3_ROTATED"/>
+      <xs:enumeration value="ENVMONARCH"/>
+      <xs:enumeration value="ENVPERSONAL"/>
+      <xs:enumeration value="ENVPRC1"/>
+      <xs:enumeration value="ENVPRC1_ROTATED"/>
+      <xs:enumeration value="ENVPRC2"/>
+      <xs:enumeration value="ENVPRC2_ROTATED"/>
+      <xs:enumeration value="ENVPRC3"/>
+      <xs:enumeration value="ENVPRC3_ROTATED"/>
+      <xs:enumeration value="ENVPRC4"/>
+      <xs:enumeration value="ENVPRC4_ROTATED"/>
+      <xs:enumeration value="ENVPRC5"/>
+      <xs:enumeration value="ENVPRC5_ROTATED"/>
+      <xs:enumeration value="ENVPRC6"/>
+      <xs:enumeration value="ENVPRC6_ROTATED"/>
+      <xs:enumeration value="ENVPRC7"/>
+      <xs:enumeration value="ENVPRC7_ROTATED"/>
+      <xs:enumeration value="ENVPRC8"/>
+      <xs:enumeration value="ENVPRC8_ROTATED"/>
+      <xs:enumeration value="ENVPRC9"/>
+      <xs:enumeration value="ENVPRC9_ROTATED"/>
+      <xs:enumeration value="ENVPRC10"/>
+      <xs:enumeration value="ENVPRC10_ROTATED"/>
+      <xs:enumeration value="ENVYOU4"/>
+      <xs:enumeration value="ENVYOU4_ROTATED"/>
+      <xs:enumeration value="EXECUTIVE"/>
+      <xs:enumeration value="FANFOLDUS"/>
+      <xs:enumeration value="FANFOLDGERMAN"/>
+      <xs:enumeration value="FANFOLDGERMANLEGAL"/>
+      <xs:enumeration value="FOLIO"/>
+      <xs:enumeration value="ISOB0"/>
+      <xs:enumeration value="ISOB1"/>
+      <xs:enumeration value="ISOB2"/>
+      <xs:enumeration value="ISOB3"/>
+      <xs:enumeration value="ISOB4"/>
+      <xs:enumeration value="ISOB5"/>
+      <xs:enumeration value="ISOB5_EXTRA"/>
+      <xs:enumeration value="ISOB6"/>
+      <xs:enumeration value="ISOB7"/>
+      <xs:enumeration value="ISOB8"/>
+      <xs:enumeration value="ISOB9"/>
+      <xs:enumeration value="ISOB10"/>
+      <xs:enumeration value="LEDGER"/>
+      <xs:enumeration value="LEGAL"/>
+      <xs:enumeration value="LEGAL_EXTRA"/>
+      <xs:enumeration value="LETTER"/>
+      <xs:enumeration value="LETTER_TRANSVERSE"/>
+      <xs:enumeration value="LETTER_EXTRA"/>
+      <xs:enumeration value="LETTER_EXTRATRANSVERSE"/>
+      <xs:enumeration value="LETTER_PLUS"/>
+      <xs:enumeration value="LETTER_ROTATED"/>
+      <xs:enumeration value="LETTER_SMALL"/>
+      <xs:enumeration value="MONARCH"/>
+      <xs:enumeration value="NOTE"/>
+      <xs:enumeration value="POSTCARD"/>
+      <xs:enumeration value="POSTCARD_ROTATED"/>
+      <xs:enumeration value="PRC16K"/>
+      <xs:enumeration value="PRC16K_ROTATED"/>
+      <xs:enumeration value="PRC32K"/>
+      <xs:enumeration value="PRC32K_ROTATED"/>
+      <xs:enumeration value="PRC32K_BIG"/>
+      <xs:enumeration value="PRC32K_BIGROTATED"/>
+      <xs:enumeration value="QUARTO"/>
+      <xs:enumeration value="STATEMENT"/>
+      <xs:enumeration value="SUPERA"/>
+      <xs:enumeration value="SUPERB"/>
+      <xs:enumeration value="TABLOID"/>
+      <xs:enumeration value="TABLOIDEXTRA"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:element name="report">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+			   A report constists of several elements, which are all optional:
+			
+			   * reportheader
+				 printed at the first page
+			
+			   * reportfooter
+				 printed on the last page
+			
+			   * a page header
+				 Printed before any content is printed to the page.
+			
+			   * a page footer
+				 printed, after the last content for the page is printed
+				 The pagefooter is always positionated at the bottom of a page,
+				 regardless how much space of the page is filled.
+			
+			   * one or more group definitions in the "groups" element
+				 If no groups are defined, a default group is created to contain
+				 all data elements of the current report.
+			
+			   * the (optional) item band. This is where the data rows are printed.
+				 If no item band is defined, only printing is disabled. All
+				 calculations are performed regardless of the appearance of the
+				 items.
+			
+			   Attributes:
+				Width  = the width of the report in Java-Printing-Units
+				Height = the height of the report
+			
+				All printing units are defined in 1/72 inches, the default printing
+				resolution on java.awt.graphics.
+			
+				minPageFormat = a predefined page format, for instance "A4" or "US-LETTER"
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element name="configuration" type="configurationType"/>
+        <xs:element name="reportheader" type="reportheaderType"/>
+        <xs:element name="reportfooter" type="reportfooterType"/>
+        <xs:element name="pageheader" type="pageheaderType"/>
+        <xs:element name="pagefooter" type="pagefooterType"/>
+        <xs:element name="watermark" type="watermarkType"/>
+        <xs:element name="groups" type="groupsType"/>
+        <xs:element name="items" type="itemsType"/>
+        <xs:element name="functions" type="functionsType"/>
+        <xs:element name="include" type="includeType"/>
+        <xs:element name="parser-config" type="parser-configType"/>
+      </xs:choice>
+      <xs:attribute name="width"/>
+      <xs:attribute name="height"/>
+      <xs:attribute name="name"/>
+      <xs:attribute name="pageformat" type="pageFormats"/>
+      <xs:attribute name="orientation" type="orientations" default="portrait"/>
+      <xs:attribute name="leftmargin"/>
+      <xs:attribute name="rightmargin"/>
+      <xs:attribute name="topmargin"/>
+      <xs:attribute name="bottommargin"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:complexType name="number-fieldType" >
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attributeGroup ref="position"/>
+    <xs:attributeGroup ref="fontdef"/>
+    <xs:attribute name="format"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="nullstring"/>
+    <xs:attribute name="excel-format"/>
+  </xs:complexType>
+  <xs:complexType name="labelType"  mixed="true">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A simple label, static text that does not change. Labels define no
+				  'nullstring' as their content cannot be possibly null using a valid parser.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attributeGroup ref="position"/>
+    <xs:attributeGroup ref="fontdef"/>
+  </xs:complexType>
+  <xs:complexType name="string-fieldType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A simple text field.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attributeGroup ref="position"/>
+    <xs:attributeGroup ref="fontdef"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="nullstring"/>
+  </xs:complexType>
+  <xs:complexType name="date-fieldType" >
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attributeGroup ref="position"/>
+    <xs:attributeGroup ref="fontdef"/>
+    <xs:attribute name="format"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="nullstring"/>
+    <xs:attribute name="excel-format"/>
+  </xs:complexType>
+  <xs:complexType name="imagerefType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+					The image reference links an external image into the report.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="src" use="required"/>
+    <xs:attribute name="dynamic" type="boolean"/>
+    <xs:attribute name="visible" type="boolean"/>
+    <xs:attribute name="layout-cachable" type="boolean"/>
+    <xs:attribute name="scale" type="boolean"/>
+    <xs:attribute name="keepAspectRatio" type="boolean"/>
+    <xs:attribute name="href"/>
+  </xs:complexType>
+  <xs:complexType name="image-fieldType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				   The image reference links an external image into the report. This element expects an
+				   Graphics2D-Object in the datasource.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="dynamic" type="boolean"/>
+    <xs:attribute name="visible" type="boolean"/>
+    <xs:attribute name="layout-cachable" type="boolean"/>
+    <xs:attribute name="scale" type="boolean"/>
+    <xs:attribute name="keepAspectRatio" type="boolean"/>
+    <xs:attribute name="href"/>
+  </xs:complexType>
+  <xs:complexType name="imageurl-fieldType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				   The image reference links an external image into the report. This element expects an
+				   URL or URL-String in the datasource.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="dynamic" type="boolean"/>
+    <xs:attribute name="visible" type="boolean"/>
+    <xs:attribute name="layout-cachable" type="boolean"/>
+    <xs:attribute name="scale" type="boolean"/>
+    <xs:attribute name="keepAspectRatio" type="boolean"/>
+    <xs:attribute name="href"/>
+  </xs:complexType>
+  <xs:complexType name="rectangleType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  The rectangle is a filled rectangular area. No outline is drawn.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="position"/>
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attribute name="draw" type="boolean"/>
+    <xs:attribute name="fill" type="boolean"/>
+    <xs:attribute name="weight"/>
+  </xs:complexType>
+  <xs:complexType name="resource-labelType"  mixed="true">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A simple label, static text that does not change, the text
+				  contains a ResourceBundle key, which is looked up during the
+				  report processing.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attributeGroup ref="fontdef"/>
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="nullstring"/>
+    <xs:attribute name="resource-base"/>
+  </xs:complexType>
+  <xs:complexType name="resource-fieldType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A text field. The field data contains a ResourceBundle key,
+				  which is looked up during the report processing.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attributeGroup ref="fontdef"/>
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="nullstring"/>
+    <xs:attribute name="resource-base"/>
+    <xs:attribute name="fieldname" use="required"/>
+  </xs:complexType>
+  <xs:complexType name="lineType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  Creates a line shape element. When using relative coordinates,
+				  you should also supply a width and a height for the bounds.
+				
+				  JFreeReport will construct the bounds for the line shape using
+				  the x1, y1 coordinates and the given width or height. If no
+				  width or height is given, the missing values will be computed from
+				  the difference between x2 and x1 and y2 to y1.
+				
+				  This heuristic might fail for relative coordinates. In that case,
+				  use the alternate definition with an explicit 'width' and 'height'.
+				
+				  Line shapes will always be scaled, without preserving the aspect
+				  ratio.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attribute name="x1" use="required"/>
+    <xs:attribute name="y1" use="required"/>
+    <xs:attribute name="x2" use="required"/>
+    <xs:attribute name="y2" use="required"/>
+    <xs:attribute name="width"/>
+    <xs:attribute name="height"/>
+    <xs:attribute name="color"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="weight"/>
+  </xs:complexType>
+  <xs:complexType name="drawable-url-fieldType" >
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="href"/>
+  </xs:complexType>
+  <xs:complexType name="drawablerefType" >
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="href"/>
+    <xs:attribute name="src" use="required"/>
+    <xs:attribute name="name"/>
+  </xs:complexType>
+  <xs:complexType name="message-fieldType"  mixed="true">
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attributeGroup ref="position"/>
+    <xs:attributeGroup ref="fontdef"/>
+    <xs:attribute name="nullstring"/>
+  </xs:complexType>
+  <xs:complexType name="anchor-fieldType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  Anchors are not visible, so it makes no sense to define visual parameters.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attribute name="x" use="required"/>
+    <xs:attribute name="y" use="required"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="fieldname" use="required"/>
+  </xs:complexType>
+  <xs:complexType name="drawable-fieldType" >
+    <xs:attributeGroup ref="position"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="name"/>
+    <xs:attribute name="href"/>
+  </xs:complexType>
+  <xs:complexType name="shape-fieldType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A generic shape field. The shape is defined in the DataRow.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attributeGroup ref="position"/>
+    <xs:attributeGroup ref="basicform"/>
+    <xs:attribute name="fieldname" use="required"/>
+    <xs:attribute name="draw" type="boolean"/>
+    <xs:attribute name="fill" type="boolean"/>
+    <xs:attribute name="weight"/>
+  </xs:complexType>
+  <xs:complexType name="bandType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  Defines a sub band. Subbands cannot generate pagebreak for now.
+				  These bands inherit the style properties of their parents.
+				
+				  If no width is specified, the width will be computed according
+				  to the elements contained in that band.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="x"/>
+        <xs:attribute name="y"/>
+        <xs:attribute name="width"/>
+        <xs:attribute name="height"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="configurationType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  Configure this instance of the report. You may use all defined ReportConfigurationKeys
+				  as PropertyNames. See jfreereport.properties for more details.
+				
+				  This can be used to define the PDF-FontEncoding for an Report.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="reportheaderType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  The reportheader can contain any band-element.
+				  The height of the report header is ignored, if the header and footer is
+				  printed on an own page.
+				
+				  As with every element container you may define default font settings
+				  for sub elements without an own font definition.
+				
+				  In an header the ownpage is translated as pagebreak_after_print,
+				  on an footer that attribute is translated to pagebreak_before_print.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="height"/>
+        <xs:attribute name="fixed-position"/>
+        <xs:attribute name="pagebreak-after-print" type="boolean"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="reportfooterType" >
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="fixed-position"/>
+        <xs:attribute name="pagebreak-before-print" type="boolean"/>
+        <xs:attribute name="height"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="pageheaderType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  The pageheader can contain any band-element. Be aware, that the
+				  page header cannot create pagebreaks. If the content in the pageheader
+				  is to large for a single page (or no other content can fit on the
+				  page after the pageheader has printed), the report processing will
+				  fail.
+				
+				  As with every element container you may define default font settings
+				  for sub elements without an own font definition.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="onfirstpage" type="boolean"/>
+        <xs:attribute name="onlastpage" type="boolean"/>
+        <xs:attribute name="height"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="pagefooterType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  The pagefooter should not contain dynamic elements. Be aware, that the
+				  page header cannot create pagebreaks. If the content in the pageheader
+				  is to large for a single page (or no other content can fit on the
+				  page after the pageheader has printed), the report processing will
+				  fail.
+				
+				  Dynamic elements can change their height on every event. If the element
+				  changes during a pagebreak, it can happen, that there is not enough space
+				  to print the contents of the element. Dynamic element can also influence
+				  the page break detection in an invalid way - causing pagebreak to be
+				  issued to early or to late.
+				
+				  As with every element container you may define default font settings
+				  for sub elements without an own font definition.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="onfirstpage" type="boolean"/>
+        <xs:attribute name="onlastpage" type="boolean"/>
+        <xs:attribute name="height"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="parser-configType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				Defines the parser properties. These properties can be used as macros
+				in the report definition, similiar to the properties used in ANT-build files.
+				If a property with the name "property" is defined, then it can be referenced
+				later with "${property}" in any attribute value or CDATA section.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="watermarkType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  The watermark element is printed before any other element is
+				  printed on a new page. That band can consume the complete space
+				  of the page - it will never trigger a pagebreak.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="height"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="groupsType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  The tag encapsulates all groups. This tag helps to keep parsing
+				  simple. If no groups are defined, a default group is created and
+				  contains all elements of the report datarow
+			</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="group" type="groupType" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="groupType" >
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="groupheader" type="groupheaderType"/>
+      <xs:element name="groupfooter" type="groupfooterType"/>
+      <xs:element name="fields" type="fieldsType"/>
+    </xs:choice>
+    <xs:attribute name="name"/>
+  </xs:complexType>
+  <xs:complexType name="itemsType" >
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="pagebreak-after-print" type="boolean"/>
+        <xs:attribute name="pagebreak-before-print" type="boolean"/>
+        <xs:attribute name="fixed-position"/>
+        <xs:attribute name="height"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="functionsType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  Functions are defined in a function library.
+				  Every referenced function has to be defined in the
+				  library in order to be loaded and executed correctly.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="function" type="functionType"/>
+      <xs:element name="expression" type="expressionType"/>
+      <xs:element name="property-ref" type="property-refType"/>
+    </xs:choice>
+  </xs:complexType>
+  <xs:complexType name="includeType" >
+    <xs:attribute name="src" use="required"/>
+  </xs:complexType>
+  <xs:complexType name="groupheaderType" >
+    <xs:annotation>
+      <xs:documentation>
+				  A group header is printed before a group starts. A group start
+				  is invoked when one element that was referenced in the field list
+				  changes and on the start of the report generation.
+				
+				  If pagebreak-before-print is set to true, a page break will be forced before
+				  the group header is printed; a pagebreak-after-print does the same after
+				  the group header has been printed.
+				
+				  If repeat is set to true, this header is repeated after an pagebreak
+				  if this group is still active. If an other groupheader in an subgroup
+				  has the repeat flag set, all headers are printed in their order of
+				  appearance.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="pagebreak-after-print" type="boolean"/>
+        <xs:attribute name="pagebreak-before-print" type="boolean"/>
+        <xs:attribute name="repeat" type="boolean"/>
+        <xs:attribute name="height"/>
+        <xs:attribute name="fixed-position"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="groupfooterType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A group footer is printed when a group is finished. A group is
+				  finished, when one element, that was referenced in the field list,
+				  changes its value and at the end of the report generation.
+				
+				  If pagebreak-before-print is set to true, a page break will be forced before
+				  the group footer is printed; a pagebreak-after-print does the same after
+				  the group footer has been printed.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:complexContent>
+      <xs:extension base="itemelements">
+        <xs:attribute name="pagebreak-after-print" type="boolean"/>
+        <xs:attribute name="pagebreak-before-print" type="boolean"/>
+        <xs:attribute name="height"/>
+        <xs:attribute name="fixed-position"/>
+        <xs:attributeGroup ref="basicform"/>
+        <xs:attributeGroup ref="fontdef"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:complexType name="fieldsType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  The name of the fields or functions that have to change for
+				  a group break.
+				
+				  A report group may have more than one group element.
+				  A fields list may only contain strings defining the
+				  names of the items which form a group. This is not
+				  limited to items from the data model, you may also
+				  enter expressions here.
+				
+				  If you define a subgroup, then you'll have to include all
+				  fields of the parent group and at least one new field.
+				  The field is not required to exist. If the field does not
+				  exist during the report processing, the value 'null' is used
+				  as replacement for the field's content.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="field" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="functionType" >
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A defined function has a valid implementing class that implement
+				  the org.jfree.report.expressions.Function interface. Functions have access to the datarow and
+				  can access other functions or expressions or the datasource. Functions are statefull and maintain
+				  their state during the report generation. For stateless userdefined computations consider using
+				  an expression instead of functions, as expression are cheaper to compute and maintain when using
+				  huge reports.
+				
+				  Function parameters are given by propery elements. For visual
+				  editing, function must obey to the java-beans rules (use get*/set*
+				  methods, perhaps provide beaninfo and so on)
+				
+				  The deplevel attribute can be used to priorize the functions. Functions with an higher depencylevel
+				  are executed before any function with lower depency levels. Depencylevels lower than 0 are not allowed.
+
+			</xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="properties" type="propertiesType" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="class" use="required"/>
+    <xs:attribute name="name" use="required"/>
+    <xs:attribute name="deplevel"/>
+  </xs:complexType>
+  <xs:complexType name="expressionType" >
+    <xs:sequence>
+      <xs:element name="properties" type="propertiesType" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="class" use="required"/>
+    <xs:attribute name="name" use="required"/>
+    <xs:attribute name="deplevel"/>
+  </xs:complexType>
+  <xs:complexType name="property-refType"  mixed="true">
+    <xs:annotation>
+      <xs:documentation xml:lang="en">
+				  A reference to a report property. This property is predefined here and can be accessed
+				  as any datasource. The value defaults to null if no more data is given. The encoding parameter
+				  defaults to "text", "serialized-base64" is implemented later to allow serialized objects
+				  as value for the property.
+			</xs:documentation>
+    </xs:annotation>
+    <xs:attribute name="name" use="required"/>
+    <xs:attribute name="encoding"/>
+  </xs:complexType>
+  <xs:complexType name="propertyType"  mixed="true">
+    <xs:attribute name="name" use="required"/>
+    <xs:attribute name="class"/>
+  </xs:complexType>
+  <xs:complexType name="propertiesType" >
+    <xs:sequence>
+      <xs:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
diff --git a/source/org/jfree/report/modules/factories/report/compatibility/simple/report-085.dtd b/source/org/jfree/report/modules/factories/report/compatibility/simple/report-085.dtd
new file mode 100644
index 0000000..9200e17
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/compatibility/simple/report-085.dtd
@@ -0,0 +1,874 @@
+<!--
+  Report DTD for JFreeReport version 0.8.5.
+
+	ChangeLog:
+
+	2002-05-01: Taq: Added multiline-field and multiline-function element
+  2002-05-23: Changed the font style for extended attributes. The old attribute is also valid
+              and gets silently mapped to the new style by the parser.
+  2002-06-09: Added the rectangle shape element
+  2002-06-30: ImageField, ImageFunction
+  2002-07-10: ImageURLField, ImageURLFunction
+  2002-07-17: Updated missing attributes in Image* tags
+  2002-09-16: Removed BASELINE attribute from font definition, fixed Orientation-attribute declaration,
+              Bands can have a default font declaration
+  2002-10-16: All textelements have now a "dynamic" attribute which defaults to false
+  2002-12-01: Removed deprecated General and multiline-field and *-function tags
+              GroupHeader has "repeat" attribute
+  2002-12-02: Band-heights are no longer required. If they are set, they act as minimum-height.
+  2002-12-08: Added support for ReportConfiguration over XML
+  2003-01-25: ResourceLabel and ResourceField added
+              additional font style attributes added
+              all elements except the shape elements now able to be dynamic
+  2003-05-20: Added support for generic shape-field and drawable-field (since version 0.8.2)
+  ..
+  2004-04-04: Added support for fixed position of bands ..
+  ..
+  2005-02-16: Rewrote the DTD to match JFreeReport 0.8.5
+  2005-08-09: Added the layout attribute for bands.
+  2005-08-10: Added pagespan attribute
+  2005-10-12: Now all style attributes are optional, as they may have been
+              defined by an external stylesheet; added the component field type
+  2005-10-14: Link-Target-Windows can be defined.
+  2005-11-11; Repeating Group-Footers.
+  2006-02-18; Round Rectangles
+
+  Use this as Document type definition:
+
+  <!DOCTYPE report
+      PUBLIC "-//JFreeReport//DTD report definition//EN//simple/version 0.8.5"
+             "http://jfreereport.sourceforge.net/report-085.dtd">
+
+ -->
+
+<!ENTITY % boolean
+"true | false"
+>
+
+<!ENTITY % fontstyle
+"plain | bold | italic | bold-italic"
+>
+
+<!ENTITY % stroketypes
+"dashed | solid | dotted | dot-dot-dash | dot-dash"
+>
+
+<!ENTITY % alignmentEnum
+"left | center | right"
+>
+
+<!ENTITY % valignmentEnum
+"top | middle | bottom"
+>
+
+<!ENTITY % orientations
+"portrait | landscape | reverse_landscape"
+>
+
+<!--
+
+ The position of an element is declared either relative to the last
+ defined element in the band (or (0,0) if the element is the first element),
+ or it is positioned absolute to the top left corner of the current band.
+
+ When positioning an element be aware to take care of the elements width.
+ The next element should be placed at the absolute position x+width,
+ or the elements will overwrite each other.
+
+ All Fontstyles default to plain and all boolean styles to false. If no font is
+ set either in Band nor in element, a compiled in default font is used.
+
+ The X- and Y-Position is required, if the Static-LayoutManager is used.
+ That LayoutManager is the default layoutmanager.
+-->
+<!ENTITY % position
+"x           CDATA          #IMPLIED
+ y           CDATA          #IMPLIED
+ width       CDATA          #IMPLIED
+ height      CDATA          #IMPLIED"
+>
+
+<!--
+
+  Colors are specified in HTML Syntax, so use #FFFFFF for white and #000000
+  for black when using RGB numeric values. You may also use defined named
+  constants for the color, as "black", "white" and so on.
+
+  The constants understood by the parser are:
+  "black", "blue", "cyan", darkGray", "gray", "green", "lightGray", "magenta",
+  "orange", "pink", "red", "white", "yellow"
+
+  -->
+<!ENTITY % basicform
+" color                CDATA         #IMPLIED
+  styleClass           CDATA         #IMPLIED
+  name                 CDATA         #IMPLIED
+  dynamic              (%boolean;)   #IMPLIED
+  trim-text-content    (%boolean;)   #IMPLIED
+  visible              (%boolean;)   #IMPLIED
+  layout-cachable      (%boolean;)   #IMPLIED
+  href                 CDATA         #IMPLIED
+  href-window          CDATA         #IMPLIED
+  reserved-literal     CDATA         #IMPLIED"
+>
+
+<!ENTITY % fontdef
+" fontname       CDATA              #IMPLIED
+  fontstyle      (%fontstyle;)      #IMPLIED
+  fontsize       CDATA              #IMPLIED
+  fsbold         (%boolean;)        #IMPLIED
+  fsitalic       (%boolean;)        #IMPLIED
+  fsunderline    (%boolean;)        #IMPLIED
+  fsstrikethr    (%boolean;)        #IMPLIED
+  font-embedded  (%boolean;)        #IMPLIED
+  font-encoding  CDATA              #IMPLIED
+  line-height    CDATA              #IMPLIED
+  excel-wrap-text        (%boolean;)        #IMPLIED
+  alignment              (%alignmentEnum;)  #IMPLIED
+  vertical-alignment     (%valignmentEnum;) #IMPLIED"
+>
+
+
+<!ENTITY % itemelements
+"(label | string-field | number-field | date-field |
+imageref | image-field | imageurl-field | rectangle |
+resource-label | resource-field | line | round-rectangle |
+drawable-url-field | drawableref | component-field |
+message-field | anchor-field | resource-message |
+drawable-field | shape-field | band)*">
+
+
+<!--
+
+     Colordefinitions are given either as predefined names as defined
+     in HTML or as HTML-RGB-Color-Reference ("#rrggbb");
+
+ -->
+
+
+<!--
+
+   A report constists of several elements, which are all optional:
+
+   * reportheader
+     printed at the first page
+
+   * reportfooter
+     printed on the last page
+
+   * a page header
+     Printed before any content is printed to the page.
+
+   * a page footer
+     printed, after the last content for the page is printed
+     The pagefooter is always positionated at the bottom of a page,
+     regardless how much space of the page is filled.
+
+   * one or more group definitions in the "groups" element
+     If no groups are defined, a default group is created to contain
+     all data elements of the current report.
+
+   * the (optional) item band. This is where the data rows are printed.
+     If no item band is defined, only printing is disabled. All
+     calculations are performed regardless of the appearance of the
+     items.
+
+   Attributes:
+    Width  = the width of the report in Java-Printing-Units
+    Height = the height of the report
+
+    All printing units are defined in 1/72 inches, the default printing
+    resolution on java.awt.graphics.
+
+    minPageFormat = a predefined page format, for instance "A4" or "US-LETTER"
+
+
+  -->
+
+<!ENTITY % pageFormats
+"(  PAPER10X11 | PAPER10X13 | PAPER10X14 | PAPER12X11 | PAPER15X11 | PAPER7X9 | PAPER8X10 |
+    PAPER9X11 | PAPER9X12 | A0 | A1 | A2 | A3 | A3_TRANSVERSE | A3_EXTRA | A3_EXTRATRANSVERSE |
+    A3_ROTATED | A4 | A4_TRANSVERSE | A4_EXTRA | A4_PLUS | A4_ROTATED | A4_SMALL | A5 |
+    A5_TRANSVERSE | A5_EXTRA | A5_ROTATED | A6 | A6_ROTATED | A7 | A8 | A9 | A10 |
+    ANSIC | ANSID | ANSIE | ARCHA | ARCHB | ARCHC | ARCHD | ARCHE | B0 | B1 | B2 | B3 | B4 |
+    B4_ROTATED | B5 | B5_TRANSVERSE | B5_ROTATED | B6 | B6_ROTATED | B7 | B8 | B9 | B10 |
+    C4 | C5 | C6 | COMM10 | DL | DOUBLEPOSTCARD | DOUBLEPOSTCARD_ROTATED | ENV9 | ENV10 |
+    ENV11 | ENV12 | ENV14 | ENVC0 | ENVC1 | ENVC2 | ENVC3 | ENVC4 | ENVC5 | ENVC6 | ENVC65 | ENVC7 |
+    ENVCHOU3 | ENVCHOU3_ROTATED | ENVCHOU4 | ENVCHOU4_ROTATED | ENVDL | ENVINVITE | ENVISOB4 | ENVISOB5 |
+    ENVISOB6 | ENVITALIAN | ENVKAKU2 | ENVKAKU2_ROTATED | ENVKAKU3 | ENVKAKU3_ROTATED | ENVMONARCH |
+    ENVPERSONAL | ENVPRC1 | ENVPRC1_ROTATED | ENVPRC2 | ENVPRC2_ROTATED | ENVPRC3 | ENVPRC3_ROTATED |
+    ENVPRC4 | ENVPRC4_ROTATED | ENVPRC5 | ENVPRC5_ROTATED | ENVPRC6 | ENVPRC6_ROTATED | ENVPRC7 |
+    ENVPRC7_ROTATED | ENVPRC8 | ENVPRC8_ROTATED | ENVPRC9 | ENVPRC9_ROTATED | ENVPRC10 | ENVPRC10_ROTATED |
+    ENVYOU4 | ENVYOU4_ROTATED | EXECUTIVE | FANFOLDUS | FANFOLDGERMAN | FANFOLDGERMANLEGAL |
+    FOLIO | ISOB0 | ISOB1 | ISOB2 | ISOB3 | ISOB4 | ISOB5 | ISOB5_EXTRA | ISOB6 | ISOB7 | ISOB8 | ISOB9 |
+    ISOB10 | LEDGER | LEGAL | LEGAL_EXTRA | LETTER | LETTER_TRANSVERSE | LETTER_EXTRA | LETTER_EXTRATRANSVERSE |
+    LETTER_PLUS | LETTER_ROTATED | LETTER_SMALL | MONARCH | NOTE | POSTCARD | POSTCARD_ROTATED | PRC16K |
+    PRC16K_ROTATED | PRC32K | PRC32K_ROTATED | PRC32K_BIG | PRC32K_BIGROTATED | QUARTO | STATEMENT | SUPERA |
+    SUPERB | TABLOID | TABLOIDEXTRA )"
+>
+
+<!ELEMENT report   ((configuration | reportheader | reportfooter | no-data-band |
+                     pageheader | pagefooter | watermark | groups |
+                     items | functions | include | parser-config)*)>
+
+<!ATTLIST report
+width          CDATA           #IMPLIED
+height         CDATA           #IMPLIED
+name           CDATA           #IMPLIED
+pageformat     %pageFormats;   #IMPLIED
+orientation    (%orientations;) "portrait"
+leftmargin     CDATA           #IMPLIED
+rightmargin    CDATA           #IMPLIED
+topmargin      CDATA           #IMPLIED
+bottommargin   CDATA           #IMPLIED
+pagespan       CDATA           #IMPLIED
+>
+
+<!ELEMENT include EMPTY>
+<!ATTLIST include
+src            CDATA           #REQUIRED
+>
+
+<!--
+Defines the parser properties. These properties can be used as macros
+in the report definition, similiar to the properties used in ANT-build files.
+If a property with the name "property" is defined, then it can be referenced
+later with "${property}" in any attribute value or CDATA section.
+-->
+<!ELEMENT parser-config  (property*)>
+
+
+<!--
+
+  Configure this instance of the report. You may use all defined ReportConfigurationKeys
+  as PropertyNames. See jfreereport.properties for more details.
+
+  This can be used to define the PDF-FontEncoding for an Report.
+
+  -->
+<!ELEMENT configuration (property*)>
+
+<!--
+
+  The reportheader can contain any band-element.
+  The height of the report header is ignored, if the header and footer is
+  printed on an own page.
+
+  As with every element container you may define default font settings
+  for sub elements without an own font definition.
+
+  In an header the ownpage is translated as pagebreak_after_print,
+  on an footer that attribute is translated to pagebreak_before_print.
+  -->
+<!ELEMENT reportheader ( %itemelements; )>
+<!ATTLIST reportheader
+height                 CDATA           #IMPLIED
+fixed-position         CDATA           #IMPLIED
+pagebreak-after-print     (%boolean;)  #IMPLIED
+layout                 CDATA           #IMPLIED
+%basicform;
+%fontdef;
+>
+
+<!ELEMENT reportfooter ( %itemelements; )>
+<!ATTLIST reportfooter
+fixed-position         CDATA          #IMPLIED
+pagebreak-before-print   (%boolean;)  #IMPLIED
+height                 CDATA          #IMPLIED
+layout                 CDATA          #IMPLIED
+%basicform;
+%fontdef;
+>
+
+
+<!--
+
+  The pageheader can contain any band-element. Be aware, that the
+  page header cannot create pagebreaks. If the content in the pageheader
+  is to large for a single page (or no other content can fit on the
+  page after the pageheader has printed), the report processing will
+  fail.
+
+  As with every element container you may define default font settings
+  for sub elements without an own font definition.
+
+  -->
+<!ELEMENT pageheader ( %itemelements; )>
+<!ATTLIST pageheader
+onfirstpage    (%boolean;)   #IMPLIED
+onlastpage     (%boolean;)   #IMPLIED
+height         CDATA         #IMPLIED
+layout         CDATA         #IMPLIED
+%basicform;
+%fontdef;
+>
+
+<!--
+
+  The pagefooter should not contain dynamic elements. Be aware, that the
+  page header cannot create pagebreaks. If the content in the pageheader
+  is to large for a single page (or no other content can fit on the
+  page after the pageheader has printed), the report processing will
+  fail.
+
+  Dynamic elements can change their height on every event. If the element
+  changes during a pagebreak, it can happen, that there is not enough space
+  to print the contents of the element. Dynamic element can also influence
+  the page break detection in an invalid way - causing pagebreak to be
+  issued to early or to late.
+
+  As with every element container you may define default font settings
+  for sub elements without an own font definition.
+
+  -->
+<!ELEMENT pagefooter ( %itemelements; )>
+<!ATTLIST pagefooter
+onfirstpage    (%boolean;)   #IMPLIED
+onlastpage     (%boolean;)   #IMPLIED
+height         CDATA         #IMPLIED
+layout         CDATA         #IMPLIED
+%basicform;
+%fontdef;
+>
+
+<!--
+
+  The tag encapsulates all groups. This tag helps to keep parsing
+  simple. If no groups are defined, a default group is created and
+  contains all elements of the report datarow
+
+  -->
+<!ELEMENT groups (group*)>
+
+
+<!ELEMENT group  ((groupheader | groupfooter | fields)*)>
+<!ATTLIST group
+name           CDATA         #IMPLIED
+>
+
+<!--
+
+  A group header is printed before a group starts. A group start
+  is invoked when one element that was referenced in the field list
+  changes and on the start of the report generation.
+
+  If pagebreak-before-print is set to true, a page break will be forced before
+  the group header is printed; a pagebreak-after-print does the same after
+  the group header has been printed.
+
+  If repeat is set to true, this header is repeated after an pagebreak
+  if this group is still active. If an other groupheader in an subgroup
+  has the repeat flag set, all headers are printed in their order of
+  appearance.
+
+  -->
+<!ELEMENT groupheader ( %itemelements; )>
+<!ATTLIST groupheader
+pagebreak-after-print     (%boolean;)   #IMPLIED
+pagebreak-before-print    (%boolean;)   #IMPLIED
+repeat                    (%boolean;)   #IMPLIED
+height                    CDATA         #IMPLIED
+fixed-position            CDATA         #IMPLIED
+layout                    CDATA         #IMPLIED
+%basicform;
+%fontdef;
+>
+
+<!--
+
+  A group footer is printed when a group is finished. A group is
+  finished, when one element, that was referenced in the field list,
+  changes its value and at the end of the report generation.
+
+  If pagebreak-before-print is set to true, a page break will be forced before
+  the group footer is printed; a pagebreak-after-print does the same after
+  the group footer has been printed.
+
+  -->
+<!ELEMENT groupfooter ( %itemelements; )>
+<!ATTLIST groupfooter
+pagebreak-after-print     (%boolean;)   #IMPLIED
+pagebreak-before-print    (%boolean;)   #IMPLIED
+repeat                    (%boolean;)   #IMPLIED
+height                    CDATA         #IMPLIED
+fixed-position            CDATA         #IMPLIED
+layout                    CDATA         #IMPLIED
+%basicform;
+%fontdef;
+>
+
+<!--
+
+  The name of the fields or functions that have to change for
+  a group break.
+
+  A report group may have more than one group element.
+  A fields list may only contain strings defining the
+  names of the items which form a group. This is not
+  limited to items from the data model, you may also
+  enter expressions here.
+
+  If you define a subgroup, then you'll have to include all
+  fields of the parent group and at least one new field.
+  The field is not required to exist. If the field does not
+  exist during the report processing, the value 'null' is used
+  as replacement for the field's content.
+
+ -->
+<!ELEMENT fields  (field*)>
+<!ELEMENT field  (#PCDATA)>
+
+<!--
+
+  The watermark element is printed before any other element is
+  printed on a new page. That band can consume the complete space
+  of the page - it will never trigger a pagebreak.
+
+ -->
+<!ELEMENT watermark   ( %itemelements; )>
+<!ATTLIST watermark
+height         CDATA          #IMPLIED
+layout         CDATA          #IMPLIED
+%basicform;
+%fontdef;
+>
+
+
+<!ELEMENT items   ( %itemelements; )>
+<!ATTLIST items
+pagebreak-after-print     (%boolean;)   #IMPLIED
+pagebreak-before-print    (%boolean;)   #IMPLIED
+fixed-position            CDATA         #IMPLIED
+height                    CDATA         #IMPLIED
+layout                    CDATA         #IMPLIED
+%basicform;
+%fontdef;
+>
+
+<!--
+
+  Defines a sub band. Subbands cannot generate pagebreak for now.
+  These bands inherit the style properties of their parents.
+
+  If no width is specified, the width will be computed according
+  to the elements contained in that band.
+
+  -->
+<!ELEMENT band ( %itemelements; )>
+<!ATTLIST band
+x              CDATA          #IMPLIED
+y              CDATA          #IMPLIED
+width          CDATA          #IMPLIED
+height         CDATA          #IMPLIED
+layout         CDATA          #IMPLIED
+%basicform;
+%fontdef;
+>
+
+<!--
+  A simple label, static text that does not change. Labels define no
+  'nullstring' as their content cannot be possibly null using a valid parser.
+  -->
+<!ELEMENT label   (#PCDATA)>
+<!ATTLIST label
+%basicform;
+%position;
+%fontdef;
+>
+
+<!--
+  A simple text field.
+  -->
+<!ELEMENT string-field   EMPTY>
+<!ATTLIST string-field
+%basicform;
+%position;
+%fontdef;
+fieldname   CDATA    #REQUIRED
+nullstring  CDATA    #IMPLIED
+>
+
+<!--
+
+  A simple label, static text that does not change, the text
+  contains a ResourceBundle key, which is looked up during the
+  report processing.
+
+  -->
+<!ELEMENT resource-label   (#PCDATA)>
+<!ATTLIST resource-label
+%basicform;
+%fontdef;
+%position;
+nullstring           CDATA         #IMPLIED
+resource-base        CDATA         #IMPLIED
+>
+
+<!--
+
+  A text field. The field data contains a ResourceBundle key,
+  which is looked up during the report processing.
+
+  -->
+<!ELEMENT resource-field   EMPTY>
+<!ATTLIST resource-field
+%basicform;
+%fontdef;
+%position;
+nullstring           CDATA         #IMPLIED
+resource-base        CDATA         #IMPLIED
+fieldname            CDATA         #REQUIRED
+>
+
+
+<!ELEMENT number-field   EMPTY>
+<!ATTLIST number-field
+%basicform;
+%position;
+%fontdef;
+format		           CDATA        #IMPLIED
+fieldname            CDATA        #REQUIRED
+nullstring           CDATA        #IMPLIED
+excel-format		     CDATA        #IMPLIED
+>
+
+<!ELEMENT date-field   EMPTY>
+<!ATTLIST date-field
+%basicform;
+%position;
+%fontdef;
+format		           CDATA         #IMPLIED
+fieldname            CDATA         #REQUIRED
+nullstring           CDATA         #IMPLIED
+excel-format		     CDATA         #IMPLIED
+>
+
+
+<!--
+
+   The image reference links an external image into the report.
+
+  -->
+<!ELEMENT imageref   EMPTY>
+<!ATTLIST imageref
+%position;
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+src                  CDATA         #REQUIRED
+dynamic              (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+scale                (%boolean;)   #IMPLIED
+keepAspectRatio      (%boolean;)   #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+>
+<!--
+
+   The image reference links an external image into the report. This element expects an
+   Graphics2D-Object in the datasource.
+
+  -->
+<!ELEMENT image-field  EMPTY>
+<!ATTLIST image-field
+%position;
+fieldname            CDATA         #REQUIRED
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+dynamic              (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+scale                (%boolean;)   #IMPLIED
+keepAspectRatio      (%boolean;)   #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+>
+
+<!--
+
+   The image reference links an external image into the report. This element expects an
+   URL or URL-String in the datasource.
+
+  -->
+<!ELEMENT imageurl-field   EMPTY>
+<!ATTLIST imageurl-field
+%position;
+fieldname            CDATA         #REQUIRED
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+dynamic              (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+scale                (%boolean;)   #IMPLIED
+keepAspectRatio      (%boolean;)   #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+>
+
+<!--
+
+  The rectangle is a filled rectangular area. No outline is drawn.
+
+  -->
+<!ELEMENT rectangle EMPTY>
+<!ATTLIST rectangle
+%position;
+%basicform;
+draw                 (%boolean;)   #IMPLIED
+fill                 (%boolean;)   #IMPLIED
+weight               CDATA         #IMPLIED
+stroke-style         (%stroketypes;)   #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+>
+
+<!--
+
+  The rectangle is a filled rectangular area. No outline is drawn.
+
+  -->
+<!ELEMENT round-rectangle EMPTY>
+<!ATTLIST round-rectangle
+%position;
+%basicform;
+draw                 (%boolean;)   #IMPLIED
+fill                 (%boolean;)   #IMPLIED
+weight               CDATA         #IMPLIED
+stroke-style         (%stroketypes;)   #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+arc-width            CDATA         #IMPLIED
+arc-height           CDATA         #IMPLIED
+>
+
+<!--
+  Creates a line shape element. When using relative coordinates,
+  you should also supply a width and a height for the bounds.
+
+  JFreeReport will construct the bounds for the line shape using
+  the x1, y1 coordinates and the given width or height. If no
+  width or height is given, the missing values will be computed from
+  the difference between x2 and x1 and y2 to y1.
+
+  This heuristic might fail for relative coordinates. In that case,
+  use the alternate definition with an explicit 'width' and 'height'.
+
+  Line shapes will always be scaled, without preserving the aspect
+  ratio.
+ -->
+<!ELEMENT line      EMPTY>
+<!ATTLIST line
+x1                   CDATA         #IMPLIED
+y1                   CDATA         #IMPLIED
+x2                   CDATA         #IMPLIED
+y2                   CDATA         #IMPLIED
+width                CDATA         #IMPLIED
+height               CDATA         #IMPLIED
+color                CDATA         #IMPLIED
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+weight               CDATA         #IMPLIED
+stroke-style         (%stroketypes;)   #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+visible              (%boolean;)   #IMPLIED
+>
+
+
+<!--
+-->
+<!ELEMENT drawable-field   EMPTY>
+<!ATTLIST drawable-field
+%position;
+fieldname            CDATA         #REQUIRED
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+dynamic              (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+>
+
+<!ELEMENT drawable-url-field   EMPTY>
+<!ATTLIST drawable-url-field
+%position;
+fieldname            CDATA         #REQUIRED
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+dynamic              (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+>
+
+<!ELEMENT drawableref   EMPTY>
+<!ATTLIST drawableref
+%position;
+src                  CDATA         #REQUIRED
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+dynamic              (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+>
+
+<!ELEMENT component-field   EMPTY>
+<!ATTLIST component-field
+%position;
+fieldname            CDATA         #REQUIRED
+name                 CDATA         #IMPLIED
+styleClass           CDATA         #IMPLIED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+layout-cachable      (%boolean;)   #IMPLIED
+dynamic              (%boolean;)   #IMPLIED
+visible              (%boolean;)   #IMPLIED
+>
+
+
+<!--
+
+  A generic shape field. The shape is defined in the DataRow.
+
+  -->
+<!ELEMENT shape-field EMPTY>
+<!ATTLIST shape-field
+%position;
+%basicform;
+fieldname            CDATA         #REQUIRED
+href                 CDATA         #IMPLIED
+href-window          CDATA         #IMPLIED
+draw                 (%boolean;)   #IMPLIED
+fill                 (%boolean;)   #IMPLIED
+weight               CDATA         #IMPLIED
+stroke-style         (%stroketypes;)   #IMPLIED
+>
+
+<!ELEMENT message-field  (#PCDATA)>
+<!ATTLIST message-field
+%basicform;
+%position;
+%fontdef;
+nullstring           CDATA        #IMPLIED
+>
+
+<!--
+
+  A message field is text that contains placeholder for data from other columns.
+  The #PCDATA section contains a ResourceBundle key, which is looked up during the
+  report processing. That lookup result is used as format string.
+
+  -->
+<!ELEMENT resource-message   (#PCDATA)>
+<!ATTLIST resource-message
+%basicform;
+%fontdef;
+%position;
+nullstring           CDATA         #IMPLIED
+resource-base        CDATA         #IMPLIED
+>
+
+<!--
+  Anchors are not visible, so it makes no sense to define visual parameters.
+ -->
+<!ELEMENT anchor-field  EMPTY>
+<!ATTLIST anchor-field
+x                    CDATA        #IMPLIED
+y                    CDATA        #IMPLIED
+name                 CDATA        #IMPLIED
+styleClass           CDATA        #IMPLIED
+fieldname            CDATA        #REQUIRED
+>
+
+
+<!--
+
+  Functions are defined in a function library.
+  Every referenced function has to be defined in the
+  library in order to be loaded and executed correctly.
+
+  -->
+<!ELEMENT functions  (function | expression | property-ref)*>
+
+<!--
+
+  A reference to a report property. This property is predefined here and can be accessed
+  as any datasource. The value defaults to null if no more data is given. The encoding parameter
+  defaults to "text", "serialized-base64" is implemented later to allow serialized objects
+  as value for the property.
+
+-->
+<!ELEMENT property-ref  (#PCDATA)>
+<!ATTLIST property-ref
+name       CDATA   #REQUIRED
+encoding   CDATA   #IMPLIED
+class      CDATA   #IMPLIED
+>
+
+<!--
+
+  A defined function has a valid implementing class that implement
+  the org.jfree.report.function.Function interface. Functions have access to the datarow and
+  can access other functions or expressions or the datasource. Functions are statefull and maintain
+  their state during the report generation. For stateless userdefined computations consider using
+  an expression instead of functions, as expression are cheaper to compute and maintain when using
+  huge reports.
+
+  Function parameters are given by propery elements. For visual
+  editing, function must obey to the java-beans rules (use get*/set*
+  methods, perhaps provide beaninfo and so on)
+
+  The deplevel attribute can be used to priorize the functions. Functions with an higher depencylevel
+  are executed before any function with lower depency levels. Depencylevels lower than 0 are not allowed.
+  -->
+<!ELEMENT function   (properties?)>
+<!ATTLIST function
+class      CDATA    #REQUIRED
+name       CDATA    #REQUIRED
+deplevel   CDATA    #IMPLIED
+>
+
+
+<!--
+
+  An expression is a stateless userdefined function. It can access the datarow and the reportproperties
+  to perform its task. Using the datarow an expression has access to the datasource and other functions
+  and expressions.
+
+  Expression parameters are given by propery elements. For visual
+  editing, Expressions must obey to the java-beans rules (use get*/set*
+  methods, perhaps provide beaninfo and so on)
+
+  The deplevel attribute can be used to priorize the functions. Functions with an higher depencylevel
+  are executed before any function with lower depency levels. Depencylevels lower than 0 are not allowed.
+  -->
+<!ELEMENT expression   (properties?)>
+<!ATTLIST expression
+class      CDATA    #REQUIRED
+name       CDATA    #REQUIRED
+deplevel   CDATA    #IMPLIED
+>
+
+<!--
+
+  Defines a set of properties for a function.
+
+  -->
+<!ELEMENT properties  (property*)>
+
+<!--
+
+  A single property, a name - value pair.
+
+  -->
+<!ELEMENT property    (#PCDATA)>
+<!ATTLIST property
+name       CDATA    #REQUIRED
+class      CDATA    #IMPLIED
+>
+
diff --git a/source/org/jfree/report/modules/factories/report/compatibility/simple/simple.xsd b/source/org/jfree/report/modules/factories/report/compatibility/simple/simple.xsd
new file mode 100644
index 0000000..8e3c4ea
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/compatibility/simple/simple.xsd
@@ -0,0 +1,1008 @@
+<?xml version="1.0"?>
+
+<xsd:schema version="0.9"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns="http://jfreereport.sourceforge.net/namespaces/reports/simple"
+            targetNamespace="http://jfreereport.sourceforge.net/namespaces/reports/simple">
+  <xsd:annotation>
+    <xsd:documentation>
+      This schema describes the format of the simple report definitions in
+      JFreeReport. This document is aimed for the JFreeReport 0.9 release.
+
+      When parsing these report definitions, all generated elements and styles
+      get mapped into the HTML namespace. Definitions, which cannot be expressed
+      in HTML get mapped into the Compatiblity namespace instead.
+
+      The simple report definition format was the standard format for
+      JFreeReport 0.8.7 and older releases. Its use is now deprecated and
+      all reports should be migrated to the 'simplex' format.
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:attribute name="fontstyle">
+    <xsd:annotation>
+      <xsd:documentation>
+        The font style property is a short hand property to define the font
+        style of report elements.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="plain"/>
+        <xsd:enumeration value="bold"/>
+        <xsd:enumeration value="italic"/>
+        <xsd:enumeration value="bold-italic"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:attribute name="alignment">
+    <xsd:annotation>
+      <xsd:documentation>
+        The horizontal alignment decribes how content is aligned *within* the
+        element. It does not decribe the element's alignment in its parent and
+        it cannot be used to define alignments of elements within bands.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="left"/>
+        <xsd:enumeration value="center"/>
+        <xsd:enumeration value="right"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:attribute name="vertical-alignment">
+    <xsd:annotation>
+      <xsd:documentation>
+        The vertical alignment decribes how content is aligned *within* the
+        element. It does not decribe the element's alignment in its parent and
+        it cannot be used to define alignments of elements within bands.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="top"/>
+        <xsd:enumeration value="middle"/>
+        <xsd:enumeration value="bottom"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:attribute name="stroke-style">
+    <xsd:annotation>
+      <xsd:documentation>
+        The stroke style property defines the stroke type of shape elements.
+        Shape-elements in JFreeReport 0.8.7 were used to define backgrounds
+        of elements.
+
+        In JFreeReport 0.9, they are no longer connected to cell backgrounds,
+        and CSS style definitions should be used for that purpose.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="solid"/>
+        <xsd:enumeration value="dashed"/>
+        <xsd:enumeration value="dotted"/>
+        <xsd:enumeration value="dot-dash"/>
+        <xsd:enumeration value="dot-dot-dash"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:attribute name="pageformat" type="xsd:NMTOKEN" default="text">
+    <xsd:annotation>
+      <xsd:documentation>
+        The pageformat describes the default page size applied to the report.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="PAPER10X11"/>
+        <xsd:enumeration value="PAPER10X13"/>
+        <xsd:enumeration value="PAPER10X14"/>
+        <xsd:enumeration value="PAPER12X11"/>
+        <xsd:enumeration value="PAPER15X11"/>
+        <xsd:enumeration value="PAPER7X9"/>
+        <xsd:enumeration value="PAPER8X10"/>
+        <xsd:enumeration value="PAPER9X11"/>
+        <xsd:enumeration value="PAPER9X12"/>
+        <xsd:enumeration value="A0"/>
+        <xsd:enumeration value="A1"/>
+        <xsd:enumeration value="A2"/>
+        <xsd:enumeration value="A3"/>
+        <xsd:enumeration value="A3_TRANSVERSE"/>
+        <xsd:enumeration value="A3_EXTRA"/>
+        <xsd:enumeration value="A3_EXTRATRANSVERSE"/>
+        <xsd:enumeration value="A3_ROTATED"/>
+        <xsd:enumeration value="A4"/>
+        <xsd:enumeration value="A4_TRANSVERSE"/>
+        <xsd:enumeration value="A4_EXTRA"/>
+        <xsd:enumeration value="A4_PLUS"/>
+        <xsd:enumeration value="A4_ROTATED"/>
+        <xsd:enumeration value="A4_SMALL"/>
+        <xsd:enumeration value="A5"/>
+        <xsd:enumeration value="A5_TRANSVERSE"/>
+        <xsd:enumeration value="A5_EXTRA"/>
+        <xsd:enumeration value="A5_ROTATED"/>
+        <xsd:enumeration value="A6"/>
+        <xsd:enumeration value="A6_ROTATED"/>
+        <xsd:enumeration value="A7"/>
+        <xsd:enumeration value="A8"/>
+        <xsd:enumeration value="A9"/>
+        <xsd:enumeration value="A10"/>
+        <xsd:enumeration value="ANSIC"/>
+        <xsd:enumeration value="ANSID"/>
+        <xsd:enumeration value="ANSIE"/>
+        <xsd:enumeration value="ARCHA"/>
+        <xsd:enumeration value="ARCHB"/>
+        <xsd:enumeration value="ARCHC"/>
+        <xsd:enumeration value="ARCHD"/>
+        <xsd:enumeration value="ARCHE"/>
+        <xsd:enumeration value="B0"/>
+        <xsd:enumeration value="B1"/>
+        <xsd:enumeration value="B2"/>
+        <xsd:enumeration value="B3"/>
+        <xsd:enumeration value="B4"/>
+        <xsd:enumeration value="B4_ROTATED"/>
+        <xsd:enumeration value="B5"/>
+        <xsd:enumeration value="B5_TRANSVERSE"/>
+        <xsd:enumeration value="B5_ROTATED"/>
+        <xsd:enumeration value="B6"/>
+        <xsd:enumeration value="B6_ROTATED"/>
+        <xsd:enumeration value="B7"/>
+        <xsd:enumeration value="B8"/>
+        <xsd:enumeration value="B9"/>
+        <xsd:enumeration value="B10"/>
+        <xsd:enumeration value="C4"/>
+        <xsd:enumeration value="C5"/>
+        <xsd:enumeration value="C6"/>
+        <xsd:enumeration value="COMM10"/>
+        <xsd:enumeration value="DL"/>
+        <xsd:enumeration value="DOUBLEPOSTCARD"/>
+        <xsd:enumeration value="DOUBLEPOSTCARD_ROTATED"/>
+        <xsd:enumeration value="ENV9"/>
+        <xsd:enumeration value="ENV10"/>
+        <xsd:enumeration value="ENV11"/>
+        <xsd:enumeration value="ENV12"/>
+        <xsd:enumeration value="ENV14"/>
+        <xsd:enumeration value="ENVC0"/>
+        <xsd:enumeration value="ENVC1"/>
+        <xsd:enumeration value="ENVC2"/>
+        <xsd:enumeration value="ENVC3"/>
+        <xsd:enumeration value="ENVC4"/>
+        <xsd:enumeration value="ENVC5"/>
+        <xsd:enumeration value="ENVC6"/>
+        <xsd:enumeration value="ENVC65"/>
+        <xsd:enumeration value="ENVC7"/>
+        <xsd:enumeration value="ENVCHOU3"/>
+        <xsd:enumeration value="ENVCHOU3_ROTATED"/>
+        <xsd:enumeration value="ENVCHOU4"/>
+        <xsd:enumeration value="ENVCHOU4_ROTATED"/>
+        <xsd:enumeration value="ENVDL"/>
+        <xsd:enumeration value="ENVINVITE"/>
+        <xsd:enumeration value="ENVISOB4"/>
+        <xsd:enumeration value="ENVISOB5"/>
+        <xsd:enumeration value="ENVISOB6"/>
+        <xsd:enumeration value="ENVITALIAN"/>
+        <xsd:enumeration value="ENVKAKU2"/>
+        <xsd:enumeration value="ENVKAKU2_ROTATED"/>
+        <xsd:enumeration value="ENVKAKU3"/>
+        <xsd:enumeration value="ENVKAKU3_ROTATED"/>
+        <xsd:enumeration value="ENVMONARCH"/>
+        <xsd:enumeration value="ENVPERSONAL"/>
+        <xsd:enumeration value="ENVPRC1"/>
+        <xsd:enumeration value="ENVPRC1_ROTATED"/>
+        <xsd:enumeration value="ENVPRC2"/>
+        <xsd:enumeration value="ENVPRC2_ROTATED"/>
+        <xsd:enumeration value="ENVPRC3"/>
+        <xsd:enumeration value="ENVPRC3_ROTATED"/>
+        <xsd:enumeration value="ENVPRC4"/>
+        <xsd:enumeration value="ENVPRC4_ROTATED"/>
+        <xsd:enumeration value="ENVPRC5"/>
+        <xsd:enumeration value="ENVPRC5_ROTATED"/>
+        <xsd:enumeration value="ENVPRC6"/>
+        <xsd:enumeration value="ENVPRC6_ROTATED"/>
+        <xsd:enumeration value="ENVPRC7"/>
+        <xsd:enumeration value="ENVPRC7_ROTATED"/>
+        <xsd:enumeration value="ENVPRC8"/>
+        <xsd:enumeration value="ENVPRC8_ROTATED"/>
+        <xsd:enumeration value="ENVPRC9"/>
+        <xsd:enumeration value="ENVPRC9_ROTATED"/>
+        <xsd:enumeration value="ENVPRC10"/>
+        <xsd:enumeration value="ENVPRC10_ROTATED"/>
+        <xsd:enumeration value="ENVYOU4"/>
+        <xsd:enumeration value="ENVYOU4_ROTATED"/>
+        <xsd:enumeration value="EXECUTIVE"/>
+        <xsd:enumeration value="FANFOLDUS"/>
+        <xsd:enumeration value="FANFOLDGERMAN"/>
+        <xsd:enumeration value="FANFOLDGERMANLEGAL"/>
+        <xsd:enumeration value="FOLIO"/>
+        <xsd:enumeration value="ISOB0"/>
+        <xsd:enumeration value="ISOB1"/>
+        <xsd:enumeration value="ISOB2"/>
+        <xsd:enumeration value="ISOB3"/>
+        <xsd:enumeration value="ISOB4"/>
+        <xsd:enumeration value="ISOB5"/>
+        <xsd:enumeration value="ISOB5_EXTRA"/>
+        <xsd:enumeration value="ISOB6"/>
+        <xsd:enumeration value="ISOB7"/>
+        <xsd:enumeration value="ISOB8"/>
+        <xsd:enumeration value="ISOB9"/>
+        <xsd:enumeration value="ISOB10"/>
+        <xsd:enumeration value="LEDGER"/>
+        <xsd:enumeration value="LEGAL"/>
+        <xsd:enumeration value="LEGAL_EXTRA"/>
+        <xsd:enumeration value="LETTER"/>
+        <xsd:enumeration value="LETTER_TRANSVERSE"/>
+        <xsd:enumeration value="LETTER_EXTRA"/>
+        <xsd:enumeration value="LETTER_EXTRATRANSVERSE"/>
+        <xsd:enumeration value="LETTER_PLUS"/>
+        <xsd:enumeration value="LETTER_ROTATED"/>
+        <xsd:enumeration value="LETTER_SMALL"/>
+        <xsd:enumeration value="MONARCH"/>
+        <xsd:enumeration value="NOTE"/>
+        <xsd:enumeration value="POSTCARD"/>
+        <xsd:enumeration value="POSTCARD_ROTATED"/>
+        <xsd:enumeration value="PRC16K"/>
+        <xsd:enumeration value="PRC16K_ROTATED"/>
+        <xsd:enumeration value="PRC32K"/>
+        <xsd:enumeration value="PRC32K_ROTATED"/>
+        <xsd:enumeration value="PRC32K_BIG"/>
+        <xsd:enumeration value="PRC32K_BIGROTATED"/>
+        <xsd:enumeration value="QUARTO"/>
+        <xsd:enumeration value="STATEMENT"/>
+        <xsd:enumeration value="SUPERA"/>
+        <xsd:enumeration value="SUPERB"/>
+        <xsd:enumeration value="TABLOID"/>
+        <xsd:enumeration value="TABLOIDEXTRA"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:attribute name="orientation">
+    <xsd:annotation>
+      <xsd:documentation>
+        The orientation attribute describes the page orientation.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="portrait"/>
+        <xsd:enumeration value="landscape"/>
+        <xsd:enumeration value="reverse_landscape"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+
+  <xsd:element name="configuration">
+    <xsd:annotation>
+      <xsd:documentation>
+        Configures the report using the report configuration collection.
+
+        This allows to tweak the report processing in various ways and is the
+        primary method to specify default properties for the export methods.
+
+        Configuration properties only accept plain String values.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element name="property" minOccurs="0" maxOccurs="unbounded">
+          <xsd:complexType mixed="true">
+            <xsd:simpleContent>
+              <xsd:extension base="xsd:string">
+                <xsd:attribute name="name" type="xsd:string"/>
+              </xsd:extension>
+            </xsd:simpleContent>
+          </xsd:complexType>
+        </xsd:element>
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="parser-config">
+    <xsd:annotation>
+      <xsd:documentation>
+        The parser config defines a simple macro-language to replace defined
+        tokens found in text or attribute values during the parsing.
+
+        Support for the parser config has been dropped in JFreeReport 0.9, as
+        a clean stylesheet definition has the same effect at runtime.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element name="property" minOccurs="0" maxOccurs="unbounded">
+          <xsd:complexType mixed="true">
+            <xsd:simpleContent>
+              <xsd:extension base="xsd:string">
+                <xsd:attribute name="name" type="xsd:string"/>
+              </xsd:extension>
+            </xsd:simpleContent>
+          </xsd:complexType>
+        </xsd:element>
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="include">
+    <xsd:complexType>
+      <xsd:attribute name="src" type="xsd:anyURI" use="required"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="report">
+    <xsd:annotation>
+      <xsd:documentation>
+        The report element is the root element of the report definition.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:restriction base="xsd:anyType">
+          <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element ref="configuration"/>
+            <xsd:element ref="parser-config"/>
+            <xsd:element ref="include"/>
+            <xsd:element ref="reportheader"/>
+            <xsd:element ref="reportfooter"/>
+            <xsd:element ref="pageheader"/>
+            <xsd:element ref="pagefooter"/>
+            <xsd:element ref="no-data-band"/>
+            <xsd:element ref="watermark"/>
+            <xsd:element ref="groups"/>
+            <xsd:element ref="items"/>
+            <xsd:element ref="functions"/>
+          </xsd:choice>
+          <xsd:attribute name="width" type="xsd:positiveInteger" use="optional"/>
+          <xsd:attribute name="height" type="xsd:positiveInteger" use="optional"/>
+          <xsd:attribute name="name" type="xsd:string" use="optional"/>
+          <xsd:attribute ref="orientation" use="optional"/>
+          <xsd:attribute ref="pageformat" use="optional"/>
+          <xsd:attribute name="leftmargin" type="xsd:positiveInteger" use="optional"/>
+          <xsd:attribute name="topmargin" type="xsd:positiveInteger" use="optional"/>
+          <xsd:attribute name="rightmargin" type="xsd:positiveInteger" use="optional"/>
+          <xsd:attribute name="bottommargin" type="xsd:positiveInteger" use="optional"/>
+          <xsd:attribute name="pagespan" type="xsd:positiveInteger" use="optional"/>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attributeGroup name="position-attr-group">
+    <xsd:attribute name="x" type="xsd:string" use="optional"/>
+    <xsd:attribute name="y" type="xsd:string" use="optional"/>
+    <xsd:attribute name="width" type="xsd:string" use="optional"/>
+    <xsd:attribute name="height" type="xsd:string" use="optional"/>
+  </xsd:attributeGroup>
+
+  <xsd:attributeGroup name="basicform-attr-group">
+    <xsd:annotation>
+      <xsd:documentation>
+        The 'dynamic' attribute is ignored now. All elements now behave as
+        if they were dynamic by default. If the dynamic flag is not set at
+        parse time or if it is set to false, a maximum-size equal to the given
+        size is enforced on the element to copy the old behaviour.
+
+        The 'visible' flag is translated into 'display:none' if found to be false.
+
+        The 'styleClass' attribute is translated into the corresponding 'class'
+        attribute of the HTML namespace.
+
+        The 'layout-cachable' flag is ignored. If there is caching, then it must
+        be smart enough to safely detect uncachable conditions.
+
+        The 'href' and 'href-window' get mapped into the 'target-name' and
+        '-x-href-target' style properties.
+
+        The 'trim-text-content' and 'reserved-literal' get mapped into the
+        'text-overflow-mode' and 'text-overflow-ellipsis' style properties
+        instead.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:attribute name="color" type="xsd:string" use="optional"/>
+    <xsd:attribute name="styleClass" type="xsd:string" use="optional"/>
+    <xsd:attribute name="name" type="xsd:string" use="optional"/>
+    <xsd:attribute name="dynamic" type="xsd:boolean" use="optional"/>
+    <xsd:attribute name="visible" type="xsd:string" use="optional"/>
+    <xsd:attribute name="layout-cachable" type="xsd:string" use="optional"/>
+    <xsd:attribute name="href" type="xsd:anyURI" use="optional"/>
+    <xsd:attribute name="href-window" type="xsd:string" use="optional"/>
+    <xsd:attribute name="reserved-literal" type="xsd:string" use="optional"/>
+    <xsd:attribute name="trim-text-content" type="xsd:boolean" use="optional"/>
+  </xsd:attributeGroup>
+
+  <xsd:attributeGroup name="fontdef-attr-group">
+    <xsd:annotation>
+      <xsd:documentation>
+        The 'fontname' attribute is mapped into the 'fontface' style property.
+        The built-in java fonts get mapped into the built-in CSS-font faces.
+
+        The 'fontstyle' attribute gets mapped into the corresponding style sheet
+        values for 'font-weight' (for bold) and 'font-style' (for italics).
+
+        The 'fontsize' attribute is mapped into the 'font-size' style property.
+
+        The 'fs*' attributes also get mapped into the various corresponding
+        css font style attributes.
+
+        The 'lineheight' attribute here has a directly corresponding css style
+        property.
+
+        The 'excel-wrap-text' attribute gets mapped into the libLayout specific
+        style property '-x-liblayout-excel-wrap-text'.
+
+        The 'vertical-alignment' gets mapped into the corresponding css
+        attribute. Due to the different interpretation of that style property,
+        layouts might be affected by this translation.
+
+        The 'alignment' attribute is mapped directly to its CSS counterpart.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:attribute name="fontname" type="xsd:string" use="optional"/>
+    <xsd:attribute ref="fontstyle" use="optional"/>
+    <xsd:attribute name="fontsize" type="xsd:float" use="optional"/>
+    <xsd:attribute name="fsbold" type="xsd:boolean" use="optional"/>
+    <xsd:attribute name="fsitalics" type="xsd:boolean" use="optional"/>
+    <xsd:attribute name="fsunderline" type="xsd:boolean" use="optional"/>
+    <xsd:attribute name="fsstrikethr" type="xsd:boolean" use="optional"/>
+    <xsd:attribute name="lineheight" type="xsd:string" use="optional"/>
+    <xsd:attribute name="excel-wrap-text" type="xsd:boolean" use="optional"/>
+    <xsd:attribute ref="vertical-alignment" use="optional"/>
+    <xsd:attribute ref="alignment" use="optional"/>
+  </xsd:attributeGroup>
+
+
+  <xsd:complexType name="element-type">
+    <xsd:annotation>
+      <xsd:documentation>
+        If the parent of an element is a band, which has an absolute-positioning
+        layout manager, all direct child elements of that band get converted
+        into block elements with an absolute positioning (relative to this band),
+        else all direct child elements get converted into ordinary block level
+        elements.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexContent>
+      <xsd:restriction base="xsd:anyType">
+        <xsd:attributeGroup ref="position-attr-group"/>
+        <xsd:attributeGroup ref="basicform-attr-group"/>
+      </xsd:restriction>
+    </xsd:complexContent>
+  </xsd:complexType>
+
+  <xsd:element name="label">
+    <xsd:annotation>
+      <xsd:documentation>
+        A label gets mapped into a separate block element and a StaticText node
+        for the textual content.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="element-type">
+          <xsd:attributeGroup ref="fontdef-attr-group"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attribute name="fieldname" type="xsd:string" use="required"/>
+  <xsd:attribute name="nullstring" type="xsd:string" use="required"/>
+  <xsd:attribute name="resource-base" type="xsd:string" use="required"/>
+
+  <xsd:element name="string-field">
+    <xsd:annotation>
+      <xsd:documentation>
+        A string field is a simple value field with no content formating.
+
+        This field gets translated into a block level 'ContentElement' with a
+        standard GetValueExpression applied to it.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="element-type">
+          <xsd:attributeGroup ref="fontdef-attr-group"/>
+          <xsd:attribute ref="fieldname"/>
+          <xsd:attribute ref="nullstring"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="resource-label">
+    <xsd:annotation>
+      <xsd:documentation>
+        A resource-label looks up the given key in a resource-bundle.
+
+        This field gets translated into a block level 'ContentElement' with a
+        standard TranslateStaticValueExpression applied to it. The resource-base
+        attribute is translated into the corresponding expression parameter.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="element-type">
+          <xsd:attributeGroup ref="fontdef-attr-group"/>
+          <xsd:attribute ref="resource-base"/>
+          <xsd:attribute ref="nullstring"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="resource-field">
+    <xsd:annotation>
+      <xsd:documentation>
+        A resource-field reads a value column and uses that value as lookup
+        key for a resource-bundle based translation.
+
+        This field gets translated into a block level 'ContentElement' with a
+        standard TranslateValueExpression applied to it. The resource-base
+        attribute is translated into the corresponding expression parameter.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="element-type">
+          <xsd:attributeGroup ref="fontdef-attr-group"/>
+          <xsd:attribute ref="resource-base"/>
+          <xsd:attribute ref="nullstring"/>
+          <xsd:attribute ref="fieldname"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="resource-message">
+    <xsd:annotation>
+      <xsd:documentation>
+        A resource-message uses the given string to read a message-format string
+        from the resourcebundle. That message-format is then used to format the
+        data from the columns referenced in the message-format string.
+
+        This field gets translated into a block level 'ContentElement' with a
+        standard TranslateValueExpression applied to it. The resource-base
+        attribute is translated into the corresponding expression parameter.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="element-type">
+          <xsd:attributeGroup ref="fontdef-attr-group"/>
+          <xsd:attribute ref="resource-base"/>
+          <xsd:attribute ref="nullstring"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+
+  <xsd:complexType name="band-type">
+    <xsd:annotation>
+      <xsd:documentation>
+
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexContent>
+      <xsd:extension base="element-type">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+          <xsd:element ref="label"/>
+          <xsd:element ref="string-field"/>
+          <xsd:element ref="number-field"/>
+          <xsd:element ref="date-field"/>
+          <xsd:element ref="imageref"/>
+          <xsd:element ref="image-field"/>
+          <xsd:element ref="imageurl-field"/>
+          <xsd:element ref="rectangle"/>
+          <xsd:element ref="resource-label"/>
+          <xsd:element ref="resource-field"/>
+          <xsd:element ref="resource-message"/>
+          <xsd:element ref="line"/>
+          <xsd:element ref="round-rectangle"/>
+          <xsd:element ref="drawable-url-field"/>
+          <xsd:element ref="drawableref"/>
+          <xsd:element ref="component-field"/>
+          <xsd:element ref="message-field"/>
+          <xsd:element ref="anchor-field"/>
+          <xsd:element ref="drawable-field"/>
+          <xsd:element ref="shape-field"/>
+          <xsd:element ref="band"/>
+        </xsd:choice>
+        <xsd:attributeGroup ref="fontdef-attr-group"/>
+      </xsd:extension>
+    </xsd:complexContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="root-band-type">
+    <xsd:annotation>
+      <xsd:documentation>
+        The 'fixed-position' attribute is translated into an absolute positioned
+        element definition in CSS using 'position:absolute' and 'top: ? pt'.
+
+        The 'layout' attribute defines, whether the element will be a plain
+        block element ('display:block') or an element where all children will
+        be absolutly positioned. This is a parse-time translation, so code that
+        used to change the layout-manager afterwards will no longer work.
+        Only the two known layout manager implementation will be recognized.
+
+        Position attributes other than 'height' get ignored for root level bands.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexContent>
+      <xsd:extension base="band-type">
+        <xsd:attribute name="fixed-position" type="xsd:string" use="optional"/>
+        <xsd:attribute name="layout" type="xsd:string" use="optional"/>
+        <xsd:attribute name="pagebreak-after-print" type="xsd:boolean" use="optional"/>
+        <xsd:attribute name="pagebreak-before-print" type="xsd:boolean" use="optional"/>
+      </xsd:extension>
+    </xsd:complexContent>
+  </xsd:complexType>
+
+  <xsd:element name="reportheader">
+    <xsd:annotation>
+      <xsd:documentation>
+        The report header is the first band printed in the normal flow.
+        However, usually the first band on the page is the page header.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="reportfooter">
+    <xsd:annotation>
+      <xsd:documentation>
+        The report footer is the last band printed in the normal flow.
+        However, usually the last band on the page is the page footer.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="groupheader">
+    <xsd:annotation>
+      <xsd:documentation>
+        A group header is printed before a group starts. A group start
+        is invoked when one element that was referenced in the field list
+        changes and on the start of the report generation.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="groupfooter">
+    <xsd:annotation>
+      <xsd:documentation>
+        A group footer is printed when a group is finished. A group is
+        finished, when one element, that was referenced in the field list,
+        changes its value and at the end of the report generation.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="pageheader">
+    <xsd:annotation>
+      <xsd:documentation>
+        A page header is printed at the top of each page. If the page headers
+        content is too big for the page, it will be continued on the next page
+        and no page footer will be generated for these intermediate pages.
+
+        After adding the page header, at least one line of normal content is
+        printed, before the page footer is taken into account (and possibly
+        printed).
+
+        If the page header and the first line of content did not leave enough
+        space for the page footer, the page footer is considered overly large
+        and will be continued on a new page, for which no new pagefooter is
+        generated.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="pagefooter">
+    <xsd:annotation>
+      <xsd:documentation>
+        A page footer is printed at the bottom of every page. If the pagefooters
+        content cannot be printed on the current page, all subsequent pages
+        will not generate a pagefooter until that overly large pagefooter has
+        been completed.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="no-data-band">
+    <xsd:annotation>
+      <xsd:documentation>
+        This band is printed if there is no data. It will be generated as
+        'detail-section'.
+
+        The band is a standard-root-band with a display condition set to
+        'org.jfree.report.functions.sys.IsEmptyDataExpression'
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="watermark">
+    <xsd:annotation>
+      <xsd:documentation>
+        The watermark element is printed before any other element is
+        printed on a new page. That band can consume the complete space
+        of the page - it will never trigger a pagebreak.
+
+        This element is added as 'out-of-order' band to the report. It depends
+        on the output target whether this band definition will generate content.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="items">
+    <xsd:annotation>
+      <xsd:documentation>
+        The itemband holds the content. It will be generated as 'detail-section'.
+
+        The band is a standard-root-band with a display condition set to
+        'org.jfree.report.functions.sys.IsEmptyDataExpression'
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="root-band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="band">
+    <xsd:annotation>
+      <xsd:documentation>
+        A generic band. A band can hold other elements.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="band-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="fields">
+    <xsd:annotation>
+      <xsd:documentation>
+        This is a parse helper to keep group definitions together. The element
+        has no semantic meaning and does not create anything.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:restriction base="xsd:anyType">
+          <xsd:sequence>
+            <xsd:element name="field" type="xsd:string"/>
+          </xsd:sequence>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="group">
+    <xsd:annotation>
+      <xsd:documentation>
+        In JFreeReport 0.9 the grouping behaviour changed radiacally.
+        Groups in JFreeReport 0.8.x were no report elements, were limited to
+        simple column compare operations and were very restricted in their
+        definitions.
+
+        Nesting of groups was not expressed directly in neither the XML nor
+        the API of JFreeReport. Whether a group was a subgroup was dereived from
+        the field definitions of the groups. The group that defines a superset
+        of the other group's field list was marked as subgroup. Disjunct elements
+        were forbidden.
+
+        An old group definition gets mapped into the new format by defining the
+        group's grouping-expression to be a GroupByExpression. The groups are
+        nested by applying the same rules as described above.
+
+        As there is no group list object anymore, groups cannot be referenced
+        by functions using the old element searching methods.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:restriction base="xsd:anyType">
+          <xsd:sequence>
+            <xsd:element ref="fields"/>
+            <xsd:choice minOccurs="0" maxOccurs="unbounded">
+              <xsd:element ref="groupheader"/>
+              <xsd:element ref="groupfooter"/>
+            </xsd:choice>
+          </xsd:sequence>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="groups">
+    <xsd:annotation>
+      <xsd:documentation>
+        This is a parse helper to keep group definitions together. The element
+        has no semantic meaning and does not create anything.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:restriction base="xsd:anyType">
+          <xsd:sequence>
+            <xsd:element ref="group"/>
+          </xsd:sequence>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+
+
+
+  <xsd:element name="functions">
+    <xsd:annotation>
+      <xsd:documentation>
+        The function collection is one of the darkest chapters in parsing the
+        old report definitions. The old function model used global functions,
+        which got always called on all report events.
+
+        Since JFreeReport 0.9, functions are attached to elements and get only
+        called when that element is currently being processed. The function
+        model has been simplified by removing the global state and replacing
+        that state with a very local model.
+
+        When mapping JFreeReport 0.8.x function definitions into JFreeReport 0.9
+        report definitions, these global functions must be attached to their
+        referenced elements. For this, the parser has to know all functions and
+        how they possibly connect to the report elements. A mapping rule has
+        to be executed to convert the old function definition into an equivalent
+        JFreeReport 0.9 definition.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:restriction base="xsd:anyType">
+          <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element ref="expression"/>
+            <xsd:element ref="function"/>
+            <xsd:element ref="property-ref"/>
+          </xsd:choice>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attribute name="encoding" type="xsd:NMTOKEN" default="text">
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="base64"/>
+        <xsd:enumeration value="text"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:element name="property-definition" abstract="true">
+    <xsd:complexType mixed="true">
+      <xsd:annotation>
+        <xsd:documentation>
+          A property is a named entity used in Expressions and the configuration
+          definition.
+
+          If the encoding is set to 'base64', it is assumed, that
+          the content of this property is a base64 encoded serialized java-object.
+          If the encoding is set to 'text' (the default), the resulting string
+          will be used to build the object.
+
+          The 'class' attribute will be ignored for 'base64' encoded serialized
+          content.
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+        <xsd:extension base="xsd:anyType">
+          <xsd:sequence>
+            <xsd:element ref="property"/>
+          </xsd:sequence>
+          <xsd:attribute name="name" type="xsd:string"/>
+          <xsd:attribute name="class" type="xsd:string" use="optional"/>
+          <xsd:attribute ref="encoding"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="property-ref" substitutionGroup="property-definition">
+    <xsd:annotation>
+      <xsd:documentation>
+        A property-ref defines a report parameter.
+      </xsd:documentation>
+    </xsd:annotation>
+  </xsd:element>
+
+  <xsd:element name="property" substitutionGroup="property-definition">
+    <xsd:annotation>
+      <xsd:documentation>
+        A property is a named entity used in Expressions and the configuration
+        definition.
+      </xsd:documentation>
+    </xsd:annotation>
+  </xsd:element>
+
+  <xsd:element name="expression">
+    <xsd:annotation>
+      <xsd:documentation>
+        An expression computes a single value. An expression defined here can
+        be unnamed. Expressions without a name will not appear in the datarow
+        and cannot be referenced by other expressions.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute name="class" use="required" type="xsd:string"/>
+      <xsd:attribute name="name" use="required" type="xsd:string"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="function">
+    <xsd:annotation>
+      <xsd:documentation>
+        An expression computes a single value. An expression defined here can
+        be unnamed. Expressions without a name will not appear in the datarow
+        and cannot be referenced by other expressions.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute name="class" use="required" type="xsd:string"/>
+      <xsd:attribute name="name" use="required" type="xsd:string"/>
+    </xsd:complexType>
+  </xsd:element>
+
+
+</xsd:schema>
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/factories/report/flow/AbstractElementReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/AbstractElementReadHandler.java
new file mode 100644
index 0000000..0054409
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/AbstractElementReadHandler.java
@@ -0,0 +1,250 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractElementReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.util.ArrayList;
+
+import org.jfree.layouting.input.style.CSSStyleRule;
+import org.jfree.layouting.input.style.StyleKey;
+import org.jfree.report.modules.factories.report.base.NodeReadHandler;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Node;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertyReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.RootXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: 09.04.2006, 13:55:36
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractElementReadHandler
+    extends AbstractXmlReadHandler implements NodeReadHandler
+{
+  private boolean virtual;
+  private boolean enabled;
+  private String style;
+  private ArrayList expressionHandlers;
+  private ArrayList styleExpressionHandlers;
+  private ArrayList attributeExpressionHandlers;
+  private ArrayList attributeHandlers;
+  private ArrayList stylePropertyHandlers;
+  private DisplayConditionReadHandler displayConditionReadHandler;
+
+  protected AbstractElementReadHandler()
+  {
+    expressionHandlers = new ArrayList();
+    styleExpressionHandlers = new ArrayList();
+    attributeExpressionHandlers = new ArrayList();
+    stylePropertyHandlers = new ArrayList();
+    attributeHandlers = new ArrayList();
+  }
+
+  public boolean isEnabled()
+  {
+    return enabled;
+  }
+
+  public String getStyle()
+  {
+    return style;
+  }
+
+  /**
+   * Initialises the handler.
+   *
+   * @param rootHandler the root handler.
+   * @param tagName     the tag name.
+   */
+  public void init(final RootXmlReadHandler rootHandler,
+                   final String uri,
+                   final String tagName)
+  {
+    super.init(rootHandler, uri, tagName);
+
+    final Element element = getElement();
+    element.setNamespace(uri);
+    element.setType(tagName);
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    style = attrs.getValue(FlowReportFactoryModule.NAMESPACE, "style");
+    final String enabledValue = attrs.getValue(FlowReportFactoryModule.NAMESPACE, "enabled");
+    if (enabledValue != null)
+    {
+      enabled = "true".equals(enabledValue);
+    }
+    else
+    {
+      enabled = true;
+    }
+
+    final String virtualValue = attrs.getValue(FlowReportFactoryModule.NAMESPACE, "virtual");
+    if (virtualValue != null)
+    {
+      virtual = "true".equals(virtualValue);
+    }
+    else
+    {
+      virtual = false;
+    }
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+      throws SAXException
+  {
+    if (FlowReportFactoryModule.NAMESPACE.equals(uri))
+    {
+      if ("expression".equals(tagName))
+      {
+        ExpressionReadHandler erh = new ExpressionReadHandler();
+        expressionHandlers.add(erh);
+        return erh;
+      }
+      if ("style-expression".equals(tagName))
+      {
+        StyleExpressionReadHandler erh = new StyleExpressionReadHandler();
+        styleExpressionHandlers.add(erh);
+        return erh;
+      }
+      if ("style-property".equals(tagName))
+      {
+        PropertyReadHandler erh = new PropertyReadHandler();
+        stylePropertyHandlers.add(erh);
+        return erh;
+      }
+      if ("attribute-expression".equals(tagName))
+      {
+        AttributeExpressionReadHandler erh = new AttributeExpressionReadHandler();
+        attributeExpressionHandlers.add(erh);
+        return erh;
+      }
+      if ("attribute".equals(tagName))
+      {
+        AttributeReadHandler erh = new AttributeReadHandler();
+        attributeHandlers.add(erh);
+        return erh;
+      }
+      if ("display-condition".equals(tagName))
+      {
+        displayConditionReadHandler = new DisplayConditionReadHandler();
+        return displayConditionReadHandler;
+      }
+    }
+    return null;
+  }
+
+  protected void configureElement(Element e)
+  {
+    if (displayConditionReadHandler != null)
+    {
+      e.setDisplayCondition(displayConditionReadHandler.getExpression());
+    }
+    for (int i = 0; i < expressionHandlers.size(); i++)
+    {
+      final ExpressionReadHandler handler =
+          (ExpressionReadHandler) expressionHandlers.get(i);
+      e.addExpression(handler.getExpression());
+    }
+    for (int i = 0; i < styleExpressionHandlers.size(); i++)
+    {
+      final StyleExpressionReadHandler handler =
+          (StyleExpressionReadHandler) styleExpressionHandlers.get(i);
+      e.setStyleExpression(handler.getStyleKey(), handler.getExpression());
+    }
+    for (int i = 0; i < stylePropertyHandlers.size(); i++)
+    {
+
+      final PropertyReadHandler handler =
+          (PropertyReadHandler) stylePropertyHandlers.get(i);
+      final CSSStyleRule cssStyleRule = e.getStyle();
+      cssStyleRule.setPropertyValueAsString(handler.getName(), handler.getResult());
+    }
+    for (int i = 0; i < attributeExpressionHandlers.size(); i++)
+    {
+      final AttributeExpressionReadHandler handler =
+          (AttributeExpressionReadHandler) attributeExpressionHandlers.get(
+              i);
+      e.setAttributeExpression(handler.getAttributeName(),
+          handler.getExpression());
+    }
+    for (int i = 0; i < attributeHandlers.size(); i++)
+    {
+      final AttributeReadHandler handler =
+          (AttributeReadHandler) attributeHandlers.get(i);
+      e.setAttribute(handler.getNamespace(), handler.getName(), handler.getObject());
+    }
+    e.setEnabled(enabled);
+    e.setVirtual(virtual);
+    if (style != null)
+    {
+      e.setAttribute(FlowReportFactoryModule.NAMESPACE, "style", style);
+    }
+  }
+
+  protected abstract Element getElement();
+
+  public final Node getNode()
+  {
+    return getElement();
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not create an object.
+   *
+   * @return the object.
+   */
+  public Object getObject() throws SAXException
+  {
+    return getElement();
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/AbstractExpressionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/AbstractExpressionReadHandler.java
new file mode 100644
index 0000000..31484ec
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/AbstractExpressionReadHandler.java
@@ -0,0 +1,188 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractExpressionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.beans.IntrospectionException;
+
+import org.jfree.report.expressions.Expression;
+import org.jfree.report.expressions.FormulaExpression;
+import org.jfree.report.expressions.FormulaFunction;
+import org.jfree.report.util.CharacterEntityParser;
+import org.jfree.report.util.beans.BeanUtility;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * Creation-Date: 09.04.2006, 13:23:32
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractExpressionReadHandler
+    extends AbstractXmlReadHandler
+{
+  private Expression expression;
+  private BeanUtility expressionBeanUtility;
+  private CharacterEntityParser characterEntityParser;
+
+  public AbstractExpressionReadHandler()
+  {
+    this.characterEntityParser = CharacterEntityParser.createXMLEntityParser();
+  }
+
+  protected String getDefaultClassName()
+  {
+    return null;
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    String name = attrs.getValue(getUri(), "name");
+    String className = attrs.getValue(getUri(), "class");
+    String formula = attrs.getValue(getUri(), "formula");
+    if (className == null)
+    {
+      if (formula != null)
+      {
+        String initial = attrs.getValue(getUri(), "initial");
+        if (initial != null)
+        {
+          FormulaFunction function = new FormulaFunction();
+          function.setInitial(initial);
+          function.setFormula(formula);
+          this.expression = function;
+        }
+        else
+        {
+          FormulaExpression expression = new FormulaExpression();
+          expression.setFormula(formula);
+          this.expression = expression;
+        }
+      }
+      else
+      {
+        className = getDefaultClassName();
+        if (className == null)
+        {
+          throw new ParseException("Required attribute 'class' is missing.",
+              getRootHandler().getDocumentLocator());
+        }
+      }
+    }
+
+    if (expression == null)
+    {
+      expression = (Expression) ObjectUtilities.loadAndInstantiate
+        (className, AbstractExpressionReadHandler.class, Expression.class);
+      if (expression == null)
+      {
+        throw new ParseException("Expression '" + className +
+            "' is not valid. The specified class is not an expression or function.",
+             getRootHandler().getDocumentLocator());
+      }
+    }
+
+    expression.setName(name);
+    expression.setDeepTraversing("true".equals(attrs.getValue(getUri(), "deep-traversing")));
+    expression.setPrecompute("true".equals(attrs.getValue(getUri(), "precompute")));
+    expression.setPreserve("true".equals(attrs.getValue(getUri(), "preserve")));
+
+    try
+    {
+      expressionBeanUtility = new BeanUtility(expression);
+    }
+    catch (ClassCastException e)
+    {
+      throw new ParseException("Expression '" + className +
+          "' is not valid. The specified class is not an expression or function.",
+          e, getRootHandler().getDocumentLocator());
+    }
+    catch (IntrospectionException e)
+    {
+      throw new ParseException("Expression '" + className +
+          "' is not valid. Introspection failed for this expression.",
+          e, getRootHandler().getDocumentLocator());
+    }
+
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+      throws SAXException
+  {
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+    if (tagName.equals("property"))
+    {
+      return new TypedPropertyReadHandler
+          (expressionBeanUtility, expression.getName(),
+              characterEntityParser);
+    }
+    return null;
+  }
+
+  public Expression getExpression()
+  {
+    return expression;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   * @throws SAXException if there is a parsing error.
+   */
+  public Object getObject() throws SAXException
+  {
+    return expression;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/AttributeExpressionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/AttributeExpressionReadHandler.java
new file mode 100644
index 0000000..27e6299
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/AttributeExpressionReadHandler.java
@@ -0,0 +1,122 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AttributeExpressionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.StringReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 13:40:08
+ *
+ * @author Thomas Morgner
+ */
+public class AttributeExpressionReadHandler
+        extends AbstractExpressionReadHandler
+{
+  private StringReadHandler nameReadHandler;
+  private StringReadHandler namespaceUriReadHandler;
+  private String attributeName;
+  private String namespace;
+
+  public AttributeExpressionReadHandler()
+  {
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+    if (tagName.equals("attribute-name"))
+    {
+      nameReadHandler = new StringReadHandler();
+      return nameReadHandler;
+    }
+    if (tagName.equals("attribute-namespace-uri"))
+    {
+      namespaceUriReadHandler = new StringReadHandler();
+      return namespaceUriReadHandler;
+    }
+    return super.getHandlerForChild(uri, tagName, atts);
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    if (nameReadHandler == null)
+    {
+      throw new ParseException
+          ("Required element 'attribute-name' is missing.", getLocator());
+    }
+
+    attributeName = nameReadHandler.getResult();
+
+    if (namespaceUriReadHandler != null)
+    {
+      namespace = namespaceUriReadHandler.getResult();
+    }
+    if (namespace == null)
+    {
+      namespace = getNamespace();
+    }
+
+  }
+
+  public String getNamespace()
+  {
+    return namespace;
+  }
+
+  public String getAttributeName()
+  {
+    return attributeName;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/AttributeReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/AttributeReadHandler.java
new file mode 100644
index 0000000..1afff7e
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/AttributeReadHandler.java
@@ -0,0 +1,161 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AttributeReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+import org.jfree.report.util.CharacterEntityParser;
+import org.jfree.report.util.beans.BeanException;
+import org.jfree.report.util.beans.ConverterRegistry;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertyReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.Base64;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 09.04.2006, 12:58:24
+ *
+ * @author Thomas Morgner
+ */
+public class AttributeReadHandler extends PropertyReadHandler
+{
+  private String encoding;
+  private String className;
+  private Object value;
+  private CharacterEntityParser entityParser;
+  private String namespace;
+
+  public AttributeReadHandler()
+  {
+    this.entityParser = CharacterEntityParser.createXMLEntityParser();
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    try
+    {
+      final String result = getResult();
+      if ("base64".equals(encoding))
+      {
+        final byte[] data = Base64.decode(result.trim().toCharArray());
+        final ByteArrayInputStream bin = new ByteArrayInputStream(data);
+        final ObjectInputStream oin = new ObjectInputStream(bin);
+        value = oin.readObject();
+      }
+      else
+      {
+        if (className != null)
+        {
+          ClassLoader cl = ObjectUtilities.getClassLoader
+                  (AttributeReadHandler.class);
+          Class c = cl.loadClass(className);
+          ConverterRegistry.toPropertyValue
+                  (entityParser.decodeEntities(result), c);
+        }
+        else
+        {
+          ConverterRegistry.toPropertyValue
+                  (entityParser.decodeEntities(result), String.class);
+        }
+      }
+    }
+    catch (BeanException e)
+    {
+      throw new ParseException("Unable to set attribute '" + getName() + "'", e, getLocator());
+    }
+    catch (ClassNotFoundException e)
+    {
+      throw new ParseException("Unable to set attribute '" + getName() + "'", e, getLocator() );
+    }
+    catch (IOException e)
+    {
+      throw new ParseException("Unable to set attribute '" + getName() + "'", e, getLocator());
+    }
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    namespace = attrs.getValue(getUri(), "namespace-uri");
+    if (namespace == null)
+    {
+      namespace = getNamespace();
+    }
+
+    className = attrs.getValue(getUri(), "class");
+    if (className == null)
+    {
+      className = "java.lang.String";
+    }
+    encoding = attrs.getValue(getUri(), "encoding");
+    if (encoding == null)
+    {
+      encoding = "text";
+    }
+    else if (("text".equals(encoding) == false) && "base64".equals(encoding) == false)
+    {
+      DebugLog.log ("Invalid value for attribute 'encoding'. Defaulting to 'text'");
+      encoding = "text";
+    }
+  }
+
+  public String getNamespace()
+  {
+    return namespace;
+  }
+
+  /**
+   * Returns the object for this element.
+   *
+   * @return the object.
+   */
+  public Object getObject()
+  {
+    return value;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/ContentElementReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/ContentElementReadHandler.java
new file mode 100644
index 0000000..2c64b57
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/ContentElementReadHandler.java
@@ -0,0 +1,126 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ContentElementReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.structure.ContentElement;
+import org.jfree.report.structure.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 14:38:32
+ *
+ * @author Thomas Morgner
+ */
+public class ContentElementReadHandler extends AbstractElementReadHandler
+{
+  private ValueExpressionReadHandler valueExpressionReadHandler;
+  private ContentElement ce;
+
+  public ContentElementReadHandler()
+  {
+    ce = new ContentElement();
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws org.xml.sax.SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    final String format = attrs.getValue(FlowReportFactoryModule.NAMESPACE, "format");
+    ce.setAttribute(FlowReportFactoryModule.NAMESPACE, "format", format);
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+    if (tagName.equals("value-expression"))
+    {
+      valueExpressionReadHandler = new ValueExpressionReadHandler();
+      return valueExpressionReadHandler;
+    }
+    return super.getHandlerForChild(uri, tagName, atts);
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    if (valueExpressionReadHandler == null)
+    {
+      throw new ParseException("No valid value expression.", getLocator());
+    }
+
+    super.doneParsing();
+    configureElement(ce);
+    ce.setValueExpression(valueExpressionReadHandler.getExpression());
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   * @throws SAXException if there's a parsing error
+   */
+  public Object getObject() throws SAXException
+  {
+    return ce;
+  }
+
+  protected Element getElement()
+  {
+    return ce;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/DatasourceFactoryReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/DatasourceFactoryReadHandler.java
new file mode 100644
index 0000000..1cd4fa2
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/DatasourceFactoryReadHandler.java
@@ -0,0 +1,121 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DatasourceFactoryReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.modules.factories.data.base.DataFactoryReadHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.Resource;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceCreationException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceException;
+
+/**
+ * Creation-Date: 10.04.2006, 13:27:47
+ *
+ * @author Thomas Morgner
+ */
+public class DatasourceFactoryReadHandler extends AbstractXmlReadHandler
+  implements DataFactoryReadHandler
+{
+  private ReportDataFactory dataFactory;
+
+  public DatasourceFactoryReadHandler()
+  {
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    final String href = attrs.getValue(getUri(), "href");
+    if (href == null)
+    {
+      throw new ParseException("Required attribute 'href' is missing.", getLocator());
+    }
+    final ResourceKey key = getRootHandler().getSource();
+    final ResourceManager manager = getRootHandler().getResourceManager();
+    try
+    {
+      final ResourceKey derivedKey = manager.deriveKey(key, href);
+      final Resource resource = manager.create(derivedKey, null, ReportDataFactory.class);
+      getRootHandler().getDependencyCollector().add(resource);
+      dataFactory = (ReportDataFactory) resource.getResource();
+    }
+    catch (ResourceKeyCreationException e)
+    {
+      throw new ParseException
+          ("Unable to derive key for " + key + " and " + href, getLocator());
+    }
+    catch (ResourceCreationException e)
+    {
+      throw new ParseException
+          ("Unable to parse resource for " + key + " and " + href, getLocator());
+    }
+    catch (ResourceLoadingException e)
+    {
+      throw new ParseException
+          ("Unable to load resource data for " + key + " and " + href, getLocator());
+    }
+    catch (ResourceException e)
+    {
+      throw new ParseException("Unable to parse resource for " + key + " and " + href, getLocator());
+    }
+  }
+
+  public ReportDataFactory getDataFactory()
+  {
+    return dataFactory;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   * @throws SAXException if there is a parsing error.
+   */
+  public Object getObject() throws SAXException
+  {
+    return dataFactory;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/DetailSectionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/DetailSectionReadHandler.java
new file mode 100644
index 0000000..996f0e4
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/DetailSectionReadHandler.java
@@ -0,0 +1,62 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DetailSectionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.structure.DetailSection;
+import org.jfree.report.structure.Element;
+
+/**
+ * Creation-Date: 09.04.2006, 14:57:38
+ *
+ * @author Thomas Morgner
+ */
+public class DetailSectionReadHandler extends SectionReadHandler
+{
+  private DetailSection detailSection;
+
+  /**
+   * Creates a new generic read handler. The given namespace and tagname can be
+   * arbitary values and should not be confused with the ones provided by the
+   * XMLparser itself.
+   *
+   * @param namespace
+   * @param tagName
+   */
+  public DetailSectionReadHandler()
+  {
+    detailSection = new DetailSection();
+  }
+
+  protected Element getElement()
+  {
+    return detailSection;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/DisplayConditionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/DisplayConditionReadHandler.java
new file mode 100644
index 0000000..305d830
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/DisplayConditionReadHandler.java
@@ -0,0 +1,43 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DisplayConditionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+/**
+ * Creation-Date: 09.04.2006, 13:54:23
+ *
+ * @author Thomas Morgner
+ */
+public class DisplayConditionReadHandler extends AbstractExpressionReadHandler
+{
+  public DisplayConditionReadHandler()
+  {
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/ElementReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/ElementReadHandler.java
new file mode 100644
index 0000000..0549a28
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/ElementReadHandler.java
@@ -0,0 +1,225 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ElementReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.util.ArrayList;
+
+import org.jfree.report.structure.Element;
+import org.jfree.layouting.input.style.CSSStyleRule;
+import org.jfree.layouting.input.style.StyleKey;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertyReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+
+/**
+ * Creation-Date: 09.04.2006, 13:55:36
+ *
+ * @author Thomas Morgner
+ */
+public abstract class ElementReadHandler extends AbstractXmlReadHandler
+{
+  private boolean virtual;
+  private boolean enabled;
+  private String style;
+  private ArrayList expressionHandlers;
+  private ArrayList styleExpressionHandlers;
+  private ArrayList attributeExpressionHandlers;
+  private ArrayList attributeHandlers;
+  private ArrayList stylePropertyHandlers;
+  private DisplayConditionReadHandler displayConditionReadHandler;
+
+  protected ElementReadHandler()
+  {
+    expressionHandlers = new ArrayList();
+    styleExpressionHandlers = new ArrayList();
+    attributeExpressionHandlers = new ArrayList();
+    stylePropertyHandlers = new ArrayList();
+    attributeHandlers = new ArrayList();
+  }
+
+  public boolean isEnabled()
+  {
+    return enabled;
+  }
+
+  public String getStyle()
+  {
+    return style;
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    style = attrs.getValue(FlowReportFactoryModule.NAMESPACE, "style");
+    final String enabledValue = attrs.getValue(FlowReportFactoryModule.NAMESPACE, "enabled");
+    if (enabledValue != null)
+    {
+      enabled = "true".equals(enabledValue);
+    }
+    else
+    {
+      enabled = true;
+    }
+
+    final String virtualValue = attrs.getValue(FlowReportFactoryModule.NAMESPACE, "virtual");
+    if (virtualValue != null)
+    {
+      virtual = "true".equals(virtualValue);
+    }
+    else
+    {
+      virtual = false;
+    }
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (FlowReportFactoryModule.NAMESPACE.equals(uri))
+    {
+      if ("expression".equals(tagName))
+      {
+        ExpressionReadHandler erh = new ExpressionReadHandler();
+        expressionHandlers.add(erh);
+        return erh;
+      }
+      if ("style-expression".equals(tagName))
+      {
+        StyleExpressionReadHandler erh = new StyleExpressionReadHandler();
+        styleExpressionHandlers.add(erh);
+        return erh;
+      }
+      if ("style-property".equals(tagName))
+      {
+        PropertyReadHandler erh = new PropertyReadHandler();
+        stylePropertyHandlers.add(erh);
+        return erh;
+      }
+      if ("attribute-expression".equals(tagName))
+      {
+        AttributeExpressionReadHandler erh = new AttributeExpressionReadHandler();
+        attributeExpressionHandlers.add(erh);
+        return erh;
+      }
+      if ("attribute".equals(tagName))
+      {
+        AttributeReadHandler erh = new AttributeReadHandler();
+        attributeHandlers.add(erh);
+        return erh;
+      }
+      if ("display-condition".equals(tagName))
+      {
+        displayConditionReadHandler = new DisplayConditionReadHandler();
+        return displayConditionReadHandler;
+      }
+    }
+    return null;
+  }
+
+  protected void configureElement(Element e)
+  {
+    if (displayConditionReadHandler != null)
+    {
+      e.setDisplayCondition(displayConditionReadHandler.getExpression());
+    }
+    for (int i = 0; i < expressionHandlers.size(); i++)
+    {
+      final ExpressionReadHandler handler =
+              (ExpressionReadHandler) expressionHandlers.get(i);
+      e.addExpression(handler.getExpression());
+    }
+    for (int i = 0; i < styleExpressionHandlers.size(); i++)
+    {
+      final StyleExpressionReadHandler handler =
+              (StyleExpressionReadHandler) styleExpressionHandlers .get(i);
+      e.setStyleExpression(handler.getStyleKey(), handler.getExpression());
+    }
+    for (int i = 0; i < stylePropertyHandlers.size(); i++)
+    {
+
+      final PropertyReadHandler handler =
+              (PropertyReadHandler) stylePropertyHandlers .get(i);
+      final CSSStyleRule cssStyleRule = e.getStyle();
+      cssStyleRule.setPropertyValueAsString(handler.getName(), handler.getResult());
+    }
+    for (int i = 0; i < attributeExpressionHandlers.size(); i++)
+    {
+      final AttributeExpressionReadHandler handler =
+              (AttributeExpressionReadHandler) attributeExpressionHandlers .get(
+                      i);
+      e.setAttributeExpression(handler.getAttributeName(),
+              handler.getExpression());
+    }
+    for (int i = 0; i < attributeHandlers.size(); i++)
+    {
+      final AttributeReadHandler handler =
+              (AttributeReadHandler) attributeHandlers .get(i);
+      e.setAttribute(handler.getNamespace(), handler.getName(), handler.getObject());
+    }
+    e.setEnabled(enabled);
+    e.setVirtual(virtual);
+    if (style != null)
+    {
+      e.setAttribute(FlowReportFactoryModule.NAMESPACE,"style", style);
+    }
+  }
+
+  protected abstract Element getElement();
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   */
+  public Object getObject() throws SAXException
+  {
+    return getElement();
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/ExpressionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/ExpressionReadHandler.java
new file mode 100644
index 0000000..1dda5be
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/ExpressionReadHandler.java
@@ -0,0 +1,89 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExpressionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.StringReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: 09.04.2006, 13:40:08
+ *
+ * @author Thomas Morgner
+ */
+public class ExpressionReadHandler extends AbstractExpressionReadHandler
+{
+  private StringReadHandler nameReadHandler;
+
+  public ExpressionReadHandler()
+  {
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+    if (tagName.equals("name"))
+    {
+      nameReadHandler = new StringReadHandler();
+      return nameReadHandler;
+    }
+    return super.getHandlerForChild(uri, tagName, atts);
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    if (nameReadHandler != null)
+    {
+      getExpression().setName(nameReadHandler.getResult());
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/FlowOperationReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/FlowOperationReadHandler.java
new file mode 100644
index 0000000..1f2f546
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/FlowOperationReadHandler.java
@@ -0,0 +1,112 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FlowOperationReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.flow.FlowControlOperation;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 14:47:59
+ *
+ * @author Thomas Morgner
+ */
+public class FlowOperationReadHandler extends AbstractXmlReadHandler
+{
+  private FlowControlOperation operation;
+
+  public FlowOperationReadHandler()
+  {
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    final String value = attrs.getValue(getUri(), "operation");
+    if (value == null)
+    {
+      throw new ParseException("Required attribute 'operation' is missing.", getLocator());
+    }
+    final String valueTrimmed = value.trim();
+    if (FlowControlOperation.ADVANCE.toString().equals(valueTrimmed))
+    {
+      operation = FlowControlOperation.ADVANCE;
+    }
+    else if (FlowControlOperation.COMMIT.toString().equals(valueTrimmed))
+    {
+      operation = FlowControlOperation.COMMIT;
+    }
+    else if (FlowControlOperation.DONE.toString().equals(valueTrimmed))
+    {
+      operation = FlowControlOperation.DONE;
+    }
+    else if (FlowControlOperation.MARK.toString().equals(valueTrimmed))
+    {
+      operation = FlowControlOperation.MARK;
+    }
+    else if (FlowControlOperation.NO_OP.toString().equals(valueTrimmed))
+    {
+      operation = FlowControlOperation.NO_OP;
+    }
+    else if (FlowControlOperation.RECALL.toString().equals(valueTrimmed))
+    {
+      operation = FlowControlOperation.RECALL;
+    }
+    else
+    {
+      throw new ParseException("attribute 'operation' has an invalid value.", getLocator());
+    }
+  }
+
+  public FlowControlOperation getOperation()
+  {
+    return operation;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   * @throws SAXException if there is a parsing error.
+   */
+  public Object getObject() throws SAXException
+  {
+    return operation;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/FlowReportFactoryModule.java b/source/org/jfree/report/modules/factories/report/flow/FlowReportFactoryModule.java
new file mode 100644
index 0000000..921c1f2
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/FlowReportFactoryModule.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FlowReportFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+
+
+/**
+ * Creation-Date: 09.04.2006, 14:01:07
+ *
+ * @author Thomas Morgner
+ */
+public class FlowReportFactoryModule extends AbstractModule
+{
+  public static final String NAMESPACE =
+          "http://jfreereport.sourceforge.net/namespaces/reports/flow";
+
+
+  public FlowReportFactoryModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException if an error ocurred while initializing
+   *                                   the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/FlowXmlFactoryModule.java b/source/org/jfree/report/modules/factories/report/flow/FlowXmlFactoryModule.java
new file mode 100644
index 0000000..2779da1
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/FlowXmlFactoryModule.java
@@ -0,0 +1,80 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FlowXmlFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: 08.04.2006, 14:37:43
+ *
+ * @author Thomas Morgner
+ */
+public class FlowXmlFactoryModule implements XmlFactoryModule
+{
+  public FlowXmlFactoryModule()
+  {
+  }
+
+  public int getDocumentSupport(XmlDocumentInfo documentInfo)
+  {
+    final String rootNamespace = documentInfo.getRootElementNameSpace();
+    if (rootNamespace != null && rootNamespace.length() > 0)
+    {
+      if (FlowReportFactoryModule.NAMESPACE.equals(rootNamespace) == false)
+      {
+        return NOT_RECOGNIZED;
+      }
+      else if ("report".equals(documentInfo.getRootElement()))
+      {
+        return RECOGNIZED_BY_NAMESPACE;
+      }
+    }
+    else if ("report".equals(documentInfo.getRootElement()))
+    {
+      return RECOGNIZED_BY_TAGNAME;
+    }
+
+    return NOT_RECOGNIZED;
+
+  }
+
+  public String getDefaultNamespace(XmlDocumentInfo documentInfo)
+  {
+    return FlowReportFactoryModule.NAMESPACE;
+  }
+
+  public XmlReadHandler createReadHandler(XmlDocumentInfo documentInfo)
+  {
+    return new ReportReadHandler();
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/GroupReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/GroupReadHandler.java
new file mode 100644
index 0000000..586dace
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/GroupReadHandler.java
@@ -0,0 +1,106 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GroupReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Group;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 15:37:31
+ *
+ * @author Thomas Morgner
+ */
+public class GroupReadHandler extends SectionReadHandler
+{
+  private Group group;
+  private GroupingExpressionReadHandler groupingExpressionReadHandler;
+
+  public GroupReadHandler()
+  {
+    group = new Group();
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+      throws SAXException
+  {
+    XmlReadHandler base = super.getHandlerForChild(uri, tagName, atts);
+    if (base != null)
+    {
+      return base;
+    }
+    if (FlowReportFactoryModule.NAMESPACE.equals(uri))
+    {
+      if ("grouping-expression".equals(tagName))
+      {
+        groupingExpressionReadHandler = new GroupingExpressionReadHandler();
+        return groupingExpressionReadHandler;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    if (groupingExpressionReadHandler == null)
+    {
+      throw new ParseException
+          ("Required element 'grouping-expression' is missing.", getLocator());
+    }
+
+    super.doneParsing();
+    Group group = (Group) getElement();
+    group.setGroupingExpression(groupingExpressionReadHandler.getExpression());
+  }
+
+  protected Element getElement()
+  {
+    return group;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/GroupingExpressionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/GroupingExpressionReadHandler.java
new file mode 100644
index 0000000..2266c8b
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/GroupingExpressionReadHandler.java
@@ -0,0 +1,50 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GroupingExpressionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.expressions.sys.GroupByExpression;
+
+/**
+ * Creation-Date: 09.04.2006, 13:54:23
+ *
+ * @author Thomas Morgner
+ */
+public class GroupingExpressionReadHandler extends AbstractExpressionReadHandler
+{
+  public GroupingExpressionReadHandler()
+  {
+  }
+
+  protected String getDefaultClassName()
+  {
+    return GroupByExpression.class.getName();
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/OutOfOrderSectionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/OutOfOrderSectionReadHandler.java
new file mode 100644
index 0000000..20142a0
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/OutOfOrderSectionReadHandler.java
@@ -0,0 +1,103 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: OutOfOrderSectionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: 09.04.2006, 14:57:38
+ *
+ * @author Thomas Morgner
+ */
+public class OutOfOrderSectionReadHandler extends SectionReadHandler
+{
+  private Section outOfOrderSection;
+  private String role;
+  private boolean printInFlow;
+
+  /**
+   * Creates a new generic read handler. The given namespace and tagname can be
+   * arbitary values and should not be confused with the ones provided by the
+   * XMLparser itself.
+   *
+   * @param namespace
+   * @param tagName
+   */
+  public OutOfOrderSectionReadHandler()
+  {
+    outOfOrderSection = new Section();
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    role = attrs.getValue(getUri(), "role");
+    final String printInFlowValue = attrs.getValue(getUri(), "print-inflow");
+    if (printInFlowValue != null)
+    {
+      printInFlow = "true".equals(printInFlowValue);
+    }
+    else
+    {
+      printInFlow = true;
+    }
+
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   * @throws XmlReaderException if there is a reader error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    final Section outOfOrderSection = (Section) getElement();
+    outOfOrderSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "print-in-flow", String.valueOf(printInFlow));
+    outOfOrderSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role", role);
+  }
+
+  protected Element getElement()
+  {
+    return outOfOrderSection;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/PageFooterReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/PageFooterReadHandler.java
new file mode 100644
index 0000000..43d0483
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/PageFooterReadHandler.java
@@ -0,0 +1,78 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PageFooterReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: 09.04.2006, 14:57:38
+ *
+ * @author Thomas Morgner
+ */
+public class PageFooterReadHandler extends SectionReadHandler
+{
+  private Section outOfOrderSection;
+
+  /**
+   * Creates a new generic read handler. The given namespace and tagname can be
+   * arbitary values and should not be confused with the ones provided by the
+   * XMLparser itself.
+   *
+   * @param namespace
+   * @param tagName
+   */
+  public PageFooterReadHandler()
+  {
+    outOfOrderSection = new Section();
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   * @throws XmlReaderException if there is a reader error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    final Section outOfOrderSection = (Section) getElement();
+    outOfOrderSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "print-in-flow", "false");
+    outOfOrderSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role", "page-footer");
+  }
+
+  protected Element getElement()
+  {
+    return outOfOrderSection;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/PageHeaderReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/PageHeaderReadHandler.java
new file mode 100644
index 0000000..a3daf3f
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/PageHeaderReadHandler.java
@@ -0,0 +1,78 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PageHeaderReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: 09.04.2006, 14:57:38
+ *
+ * @author Thomas Morgner
+ */
+public class PageHeaderReadHandler extends SectionReadHandler
+{
+  private Section outOfOrderSection;
+
+  /**
+   * Creates a new generic read handler. The given namespace and tagname can be
+   * arbitary values and should not be confused with the ones provided by the
+   * XMLparser itself.
+   *
+   * @param namespace
+   * @param tagName
+   */
+  public PageHeaderReadHandler()
+  {
+    outOfOrderSection = new Section();
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   * @throws XmlReaderException if there is a reader error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    final Section outOfOrderSection = (Section) getElement();
+    outOfOrderSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "print-in-flow", "false");
+    outOfOrderSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role", "page-header");
+  }
+
+  protected Element getElement()
+  {
+    return outOfOrderSection;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/ParameterMappingReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/ParameterMappingReadHandler.java
new file mode 100644
index 0000000..d7b840d
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/ParameterMappingReadHandler.java
@@ -0,0 +1,94 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ParameterMappingReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 15:59:27
+ *
+ * @author Thomas Morgner
+ */
+public class ParameterMappingReadHandler extends AbstractXmlReadHandler
+{
+  private String name;
+  private String alias;
+
+  public ParameterMappingReadHandler()
+  {
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    name = attrs.getValue(getUri(), "name");
+    if (name == null)
+    {
+      throw new ParseException
+          ("Required attribute 'name' is missing.", getLocator());
+    }
+    alias = attrs.getValue(getUri(), "alias");
+    if (alias == null)
+    {
+      alias = name;
+    }
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public String getAlias()
+  {
+    return alias;
+  }
+
+  /**
+   * Returns the object for this element or null, if this element does not
+   * create an object.
+   *
+   * @return the object.
+   * @throws SAXException if there is a parsing error.
+   */
+  public Object getObject() throws SAXException
+  {
+    return getName();
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/ReportReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/ReportReadHandler.java
new file mode 100644
index 0000000..654c224
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/ReportReadHandler.java
@@ -0,0 +1,171 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jfree.report.JFreeReport;
+import org.jfree.report.modules.factories.data.base.DataFactoryReadHandlerFactory;
+import org.jfree.report.modules.factories.data.base.DataFactoryReadHandler;
+import org.jfree.report.structure.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.StringReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertiesReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 14:57:38
+ *
+ * @author Thomas Morgner
+ */
+public class ReportReadHandler extends SectionReadHandler
+{
+  private StringReadHandler queryReadHandler;
+  private PropertiesReadHandler propertiesReadHandler;
+  private DataFactoryReadHandler datasourceFactoryReadHandler;
+  private ArrayList styleSheetReadHandlers;
+  private JFreeReport report;
+
+  /**
+   * Creates a new generic read handler. The given namespace and tagname can be
+   * arbitary values and should not be confused with the ones provided by the
+   * XMLparser itself.
+   */
+  public ReportReadHandler()
+  {
+    report = new JFreeReport();
+    styleSheetReadHandlers = new ArrayList();
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    XmlReadHandler base = super.getHandlerForChild(uri, tagName, atts);
+    if (base != null)
+    {
+      return base;
+    }
+
+    final DataFactoryReadHandlerFactory factory = DataFactoryReadHandlerFactory.getInstance();
+    final DataFactoryReadHandler handler = (DataFactoryReadHandler) factory.getHandler(uri, tagName);
+    if (handler != null)
+    {
+      datasourceFactoryReadHandler = handler;
+      return handler;
+    }
+
+
+    if (FlowReportFactoryModule.NAMESPACE.equals(uri))
+    {
+      if ("query".equals(tagName))
+      {
+        queryReadHandler = new StringReadHandler();
+        return queryReadHandler;
+      }
+      if ("configuration".equals(tagName))
+      {
+        propertiesReadHandler = new PropertiesReadHandler();
+        return propertiesReadHandler;
+      }
+      if ("stylesheet".equals(tagName))
+      {
+        StyleSheetReadHandler srh = new StyleSheetReadHandler();
+        styleSheetReadHandlers.add(srh);
+        return srh;
+      }
+      if ("inline-stylesheet".equals(tagName))
+      {
+        StyleSheetReadHandler srh = new StyleSheetReadHandler();
+        styleSheetReadHandlers.add(srh);
+        return srh;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    if (queryReadHandler == null)
+    {
+      throw new ParseException
+              ("Required element 'query' is missing.", getLocator());
+    }
+    super.doneParsing();
+    JFreeReport report = (JFreeReport) getElement();
+    report.setQuery(queryReadHandler.getResult());
+    if (propertiesReadHandler != null)
+    {
+      final Properties p = propertiesReadHandler.getResult();
+      final Iterator entries = p.entrySet().iterator();
+      while (entries.hasNext())
+      {
+        Map.Entry entry = (Map.Entry) entries.next();
+        report.getEditableConfiguration().setConfigProperty
+                ((String) entry.getKey(), (String) entry.getValue());
+      }
+    }
+    if (datasourceFactoryReadHandler != null)
+    {
+      report.setDataFactory(datasourceFactoryReadHandler.getDataFactory());
+    }
+    for (int i = 0; i < styleSheetReadHandlers.size(); i++)
+    {
+      StyleSheetReadHandler handler = (StyleSheetReadHandler)
+              styleSheetReadHandlers.get(i);
+      report.addStyleSheet(handler.getStyleSheet());
+    }
+  }
+
+  protected Element getElement()
+  {
+    return report;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/SectionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/SectionReadHandler.java
new file mode 100644
index 0000000..6d5beaf
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/SectionReadHandler.java
@@ -0,0 +1,239 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SectionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.util.ArrayList;
+
+import org.jfree.report.modules.factories.report.base.NodeReadHandler;
+import org.jfree.report.modules.factories.report.base.NodeReadHandlerFactory;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+import org.jfree.report.structure.StaticText;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: 09.04.2006, 14:45:57
+ *
+ * @author Thomas Morgner
+ */
+public class SectionReadHandler extends AbstractElementReadHandler
+{
+  private Section section;
+  private StringBuffer textBuffer;
+  private ArrayList nodes;
+  private ArrayList operationsAfter;
+  private ArrayList operationsBefore;
+  private String repeat;
+
+  public SectionReadHandler()
+  {
+    nodes = new ArrayList();
+    operationsAfter = new ArrayList();
+    operationsBefore = new ArrayList();
+  }
+
+
+  public SectionReadHandler(final Section section)
+  {
+    this();
+    this.section = section;
+  }
+
+  protected Element getElement()
+  {
+    if (section == null)
+    {
+      section = new Section();
+    }
+    return section;
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+
+    final String repeatValue = attrs.getValue(getUri(), "repeat");
+    if (repeatValue != null)
+    {
+      repeat = repeatValue;
+    }
+
+    if (FlowReportFactoryModule.NAMESPACE.equals(getUri()) == false)
+    {
+      final Element element = getElement();
+      final int attrLength = attrs.getLength();
+      for (int i = 0; i < attrLength; i++)
+      {
+        final String uri = attrs.getURI(i);
+        final String local = attrs.getLocalName(i);
+        if (FlowReportFactoryModule.NAMESPACE.equals(uri) == false)
+        {
+          element.setAttribute(uri, local, attrs.getValue(i));
+        }
+      }
+    }
+  }
+
+  protected void configureElement(Element e)
+  {
+    super.configureElement(e);
+
+    final Section section = (Section) e;
+    if (repeat != null)
+    {
+      section.setRepeat("true".equals(repeat));
+    }
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (textBuffer != null)
+    {
+      nodes.add(new StaticText(textBuffer.toString()));
+      textBuffer = null;
+    }
+
+    final XmlReadHandler elementTypeHanders =
+            super.getHandlerForChild(uri, tagName, atts);
+    if (elementTypeHanders != null)
+    {
+      return elementTypeHanders;
+    }
+
+    if (FlowReportFactoryModule.NAMESPACE.equals(uri))
+    {
+      if ("operation-after".equals(tagName))
+      {
+        final FlowOperationReadHandler frh = new FlowOperationReadHandler();
+        operationsAfter.add(frh);
+        return frh;
+      }
+      else if ("operation-before".equals(tagName))
+      {
+        final FlowOperationReadHandler frh = new FlowOperationReadHandler();
+        operationsBefore.add(frh);
+        return frh;
+      }
+    }
+
+    final NodeReadHandlerFactory factory = NodeReadHandlerFactory.getInstance();
+    final NodeReadHandler handler = (NodeReadHandler) factory.getHandler(uri, tagName);
+    if (handler != null)
+    {
+      nodes.add(handler);
+      return handler;
+    }
+    return null;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    if (textBuffer != null)
+    {
+      nodes.add(new StaticText(textBuffer.toString()));
+      textBuffer = null;
+    }
+
+    final Section section = (Section) getElement();
+    configureElement(section);
+
+    for (int i = 0; i < nodes.size(); i++)
+    {
+      final Object wrapper = nodes.get(i);
+      if (wrapper instanceof StaticText)
+      {
+        section.addNode((StaticText) wrapper);
+      }
+      else if (wrapper instanceof NodeReadHandler)
+      {
+        NodeReadHandler nr = (NodeReadHandler) wrapper;
+        section.addNode(nr.getNode());
+      }
+    }
+    for (int i = 0; i < operationsAfter.size(); i++)
+    {
+      FlowOperationReadHandler handler =
+              (FlowOperationReadHandler) operationsAfter.get(i);
+      section.addOperationAfter(handler.getOperation());
+    }
+    for (int i = 0; i < operationsBefore.size(); i++)
+    {
+      FlowOperationReadHandler handler =
+              (FlowOperationReadHandler) operationsBefore.get(i);
+      section.addOperationBefore(handler.getOperation());
+    }
+  }
+
+
+
+  /**
+   * This method is called to process the character data between element tags.
+   *
+   * @param ch     the character buffer.
+   * @param start  the start index.
+   * @param length the length.
+   * @throws SAXException if there is a parsing error.
+   */
+  public void characters(final char[] ch, final int start, final int length)
+          throws SAXException
+  {
+    if (textBuffer == null)
+    {
+      textBuffer = new StringBuffer();
+    }
+    textBuffer.append(ch, start, length);
+  }
+
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/StyleExpressionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/StyleExpressionReadHandler.java
new file mode 100644
index 0000000..1d58381
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/StyleExpressionReadHandler.java
@@ -0,0 +1,74 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StyleExpressionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 13:40:08
+ *
+ * @author Thomas Morgner
+ */
+public class StyleExpressionReadHandler extends AbstractExpressionReadHandler
+{
+  private String styleKey;
+
+  public StyleExpressionReadHandler()
+  {
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws org.xml.sax.SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    final String styleKey = attrs.getValue
+        (FlowReportFactoryModule.NAMESPACE, "style-key");
+    if (styleKey == null)
+    {
+      throw new ParseException
+          ("Required attribute stylekey is missing.", getLocator());
+    }
+    this.styleKey = styleKey;
+    super.startParsing(attrs);
+  }
+
+  public String getStyleKey()
+  {
+    return styleKey;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/StyleKeyReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/StyleKeyReadHandler.java
new file mode 100644
index 0000000..4722bc1
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/StyleKeyReadHandler.java
@@ -0,0 +1,58 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StyleKeyReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.pentaho.reporting.libraries.xmlns.parser.StringReadHandler;
+
+
+/**
+ * Creation-Date: 09.04.2006, 13:48:17
+ *
+ * @author Thomas Morgner
+ * @deprecated remove me..
+ */
+public class StyleKeyReadHandler extends StringReadHandler
+{
+  public StyleKeyReadHandler()
+  {
+  }
+
+
+  /**
+   * Returns the object for this element.
+   *
+   * @return the object.
+   */
+  public Object getObject()
+  {
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/StyleSheetReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/StyleSheetReadHandler.java
new file mode 100644
index 0000000..0ec5a98
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/StyleSheetReadHandler.java
@@ -0,0 +1,152 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StyleSheetReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import org.jfree.layouting.input.style.StyleSheet;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.StringReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+import org.pentaho.reporting.libraries.resourceloader.Resource;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceCreationException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 12.04.2006, 14:53:29
+ *
+ * @author Thomas Morgner
+ */
+public class StyleSheetReadHandler extends StringReadHandler
+{
+  private StyleSheet styleSheet;
+
+  public StyleSheetReadHandler()
+  {
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    String href = attrs.getValue(getUri(), "href");
+    if (href != null)
+    {
+      final ResourceKey key = getRootHandler().getSource();
+      final ResourceManager manager = getRootHandler().getResourceManager();
+      try
+      {
+        final ResourceKey derivedKey = manager.deriveKey(key, href);
+        final Resource resource = manager.create(derivedKey, null,
+                StyleSheet.class);
+        getRootHandler().getDependencyCollector().add(resource);
+        styleSheet = (StyleSheet) resource.getResource();
+      }
+      catch (ResourceKeyCreationException e)
+      {
+        throw new ParseException
+            ("Unable to derive key for " + key + " and " + href, getLocator());
+      }
+      catch (ResourceCreationException e)
+      {
+        DebugLog.log("Unable to parse resource for " + key + " and " + href);
+      }
+      catch (ResourceLoadingException e)
+      {
+        DebugLog.log("Unable to load resource data for " + key + " and " + href);
+      }
+      catch (ResourceException e)
+      {
+        DebugLog.log("Unable to load resource for " + key + " and " + href);
+      }
+    }
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    if (this.styleSheet != null)
+    {
+      return;
+    }
+
+    final String styleText = getResult();
+    if (styleText.trim().length() == 0)
+    {
+      return;
+    }
+    try
+    {
+      final byte[] bytes = styleText.getBytes("UTF-8");
+
+      final ResourceKey baseKey = getRootHandler().getSource();
+      final ResourceManager resourceManager = getRootHandler().getResourceManager();
+      final ResourceKey rawKey = resourceManager.createKey(bytes);
+
+      final Resource resource = resourceManager.create
+              (rawKey, baseKey, StyleSheet.class);
+      this.styleSheet = (StyleSheet) resource.getResource();
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+  }
+
+  /**
+   * Returns the object for this element.
+   *
+   * @return the object.
+   */
+  public Object getObject()
+  {
+    return styleSheet;
+  }
+
+  public StyleSheet getStyleSheet()
+  {
+    return styleSheet;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/SubReportReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/SubReportReadHandler.java
new file mode 100644
index 0000000..d48b9ba
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/SubReportReadHandler.java
@@ -0,0 +1,152 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SubReportReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.util.ArrayList;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.SubReport;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.StringReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+/**
+ * Creation-Date: 09.04.2006, 14:57:38
+ *
+ * @author Thomas Morgner
+ */
+public class SubReportReadHandler extends SectionReadHandler
+{
+  private SubReport subReport;
+  private ArrayList importParameters;
+  private ArrayList exportParameters;
+  private StringReadHandler queryReadHandler;
+
+  public SubReportReadHandler()
+  {
+    subReport = new SubReport();
+    importParameters = new ArrayList();
+    exportParameters = new ArrayList();
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws org.xml.sax.SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    final String source = attrs.getValue(getUri(), "href");
+    if (source != null)
+    {
+      // start parsing ..
+    }
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    XmlReadHandler base = super.getHandlerForChild(uri, tagName, atts);
+    if (base != null)
+    {
+      return base;
+    }
+    if (FlowReportFactoryModule.NAMESPACE.equals(uri))
+    {
+      if ("import-parameter".equals(tagName))
+      {
+        ParameterMappingReadHandler handler = new ParameterMappingReadHandler();
+        importParameters.add(handler);
+        return handler;
+      }
+      if ("export-parameter".equals(tagName))
+      {
+        ParameterMappingReadHandler handler = new ParameterMappingReadHandler();
+        exportParameters.add(handler);
+        return handler;
+      }
+      if ("query".equals(tagName))
+      {
+        queryReadHandler = new StringReadHandler();
+        return queryReadHandler;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    SubReport report = (SubReport) getElement();
+    for (int i = 0; i < importParameters.size(); i++)
+    {
+      final ParameterMappingReadHandler handler =
+              (ParameterMappingReadHandler) importParameters.get(i);
+      report.addInputParameter(handler.getName(), handler.getAlias());
+    }
+    for (int i = 0; i < exportParameters.size(); i++)
+    {
+      final ParameterMappingReadHandler handler =
+              (ParameterMappingReadHandler) exportParameters.get(i);
+      report.addExportParameter(handler.getAlias(), handler.getName());
+    }
+    if (queryReadHandler == null)
+    {
+      throw new ParseException("Query is not specified.", getLocator());
+    }
+    final String result = queryReadHandler.getResult();
+    report.setQuery(result);
+  }
+
+  protected Element getElement()
+  {
+    return subReport;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/TypedPropertyReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/TypedPropertyReadHandler.java
new file mode 100644
index 0000000..bf48e48
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/TypedPropertyReadHandler.java
@@ -0,0 +1,228 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TypedPropertyReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+import java.beans.IntrospectionException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+import org.jfree.report.util.CharacterEntityParser;
+import org.jfree.report.util.beans.BeanException;
+import org.jfree.report.util.beans.BeanUtility;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.PropertyReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.Base64;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 09.04.2006, 12:58:24
+ *
+ * @author Thomas Morgner
+ */
+public class TypedPropertyReadHandler extends PropertyReadHandler
+{
+  private boolean plainContent;
+  private String encoding;
+  private String className;
+  private BeanUtility beanUtility;
+  private String expressionName;
+  private CharacterEntityParser entityParser;
+
+  public TypedPropertyReadHandler(final BeanUtility beanDescription,
+                                  final String expressionName,
+                                  final CharacterEntityParser entityParser)
+  {
+    if (beanDescription == null)
+    {
+      throw new NullPointerException(
+              "Expression must not be null");
+    }
+    if (entityParser == null)
+    {
+      throw new NullPointerException(
+              "EntityParser must not be null");
+    }
+    this.expressionName = expressionName;
+    this.beanUtility = beanDescription;
+    this.entityParser = entityParser;
+    this.plainContent = true;
+  }
+
+  /**
+   * Done parsing.
+   *
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    super.doneParsing();
+    try
+    {
+      if (plainContent)
+      {
+        final String result = getResult();
+        if ("base64".equals(encoding))
+        {
+          final byte[] data = Base64.decode(result.trim().toCharArray());
+          final ByteArrayInputStream bin = new ByteArrayInputStream(data);
+          final ObjectInputStream oin = new ObjectInputStream(bin);
+          final Object value = oin.readObject();
+          beanUtility.setProperty(getName(), value);
+        }
+        else
+        {
+          if (className != null)
+          {
+            ClassLoader cl = ObjectUtilities.getClassLoader
+                    (TypedPropertyReadHandler.class);
+            Class c = cl.loadClass(className);
+            beanUtility.setPropertyAsString
+                    (getName(), c, entityParser.decodeEntities(result));
+          }
+          else
+          {
+            beanUtility.setPropertyAsString
+                    (getName(), entityParser.decodeEntities(result));
+          }
+        }
+      }
+    }
+    catch (BeanException e)
+    {
+      e.printStackTrace();
+      throw new ParseException("Unable to assign property '" + getName()
+              + "' to expression '" + expressionName + "'", e, getLocator());
+    }
+    catch (ClassNotFoundException e)
+    {
+      throw new ParseException("Unable to assign property '" + getName()
+              + "' to expression '" + expressionName + "'", e, getLocator());
+    }
+    catch (IOException e)
+    {
+      throw new ParseException("Unable to assign property '" + getName()
+              + "' to expression '" + expressionName + "'", e, getLocator());
+    }
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+    className = attrs.getValue(getUri(), "class");
+    encoding = attrs.getValue(getUri(), "encoding");
+    if (encoding == null)
+    {
+      encoding = "text";
+    }
+    else if (("text".equals(encoding) == false) && "base64".equals(
+            encoding) == false)
+    {
+      DebugLog.log("Invalid value for attribute 'encoding'. Defaulting to 'text'");
+      encoding = "text";
+    }
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws SAXException       if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+          throws SAXException
+  {
+    if (isSameNamespace(uri) == false)
+    {
+      return null;
+    }
+
+    if ("property".equals(tagName))
+    {
+      plainContent = false;
+      final String name = atts.getValue(uri, "name");
+      if (name == null)
+      {
+        throw new ParseException("Required attribute 'name' is missing", getLocator());
+      }
+      try
+      {
+        final Class type = beanUtility.getPropertyType(name);
+        final Object property = type.newInstance();
+        final BeanUtility propertyUtility = new BeanUtility(property);
+        return new TypedPropertyReadHandler
+                (propertyUtility, expressionName, entityParser);
+      }
+      catch (BeanException e)
+      {
+        throw new ParseException("Property '" + name + "' for expression '" +
+                className + "' is not valid. The specified class was not found.",
+                e, getRootHandler().getDocumentLocator());
+      }
+      catch (IllegalAccessException e)
+      {
+        throw new ParseException(
+                "Property '" + name + "' for expression '" + className +
+                        "' is not valid. The specified class was not found.",
+                e, getRootHandler().getDocumentLocator());
+      }
+      catch (InstantiationException e)
+      {
+        throw new ParseException(
+                "Property '" + name + "' for expression '" + className +
+                        "' is not valid. The specified class cannot be instantiated.",
+                e, getRootHandler().getDocumentLocator());
+      }
+      catch (IntrospectionException e)
+      {
+        throw new ParseException(
+                "Property '" + name + "' for expression '" + className +
+                        "' is not valid. Introspection failed for this expression.",
+                e, getRootHandler().getDocumentLocator());
+      }
+    }
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/ValueExpressionReadHandler.java b/source/org/jfree/report/modules/factories/report/flow/ValueExpressionReadHandler.java
new file mode 100644
index 0000000..174be10
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/ValueExpressionReadHandler.java
@@ -0,0 +1,43 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ValueExpressionReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.flow;
+
+/**
+ * Creation-Date: 09.04.2006, 13:54:23
+ *
+ * @author Thomas Morgner
+ */
+public class ValueExpressionReadHandler extends AbstractExpressionReadHandler
+{
+  public ValueExpressionReadHandler()
+  {
+  }
+}
diff --git a/source/org/jfree/report/modules/factories/report/flow/configuration.properties b/source/org/jfree/report/modules/factories/report/flow/configuration.properties
new file mode 100644
index 0000000..2e987a5
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/configuration.properties
@@ -0,0 +1,38 @@
+##
+# Do not modify the following lines. They connect this module to the central
+# parser registry.
+org.pentaho.reporting.libraries.resourceloader.factory.modules.org.jfree.report.JFreeReport.flow=org.jfree.report.modules.factories.report.flow.FlowXmlFactoryModule
+org.pentaho.reporting.libraries.resourceloader.factory.modules.org.jfree.report.structure.SubReport.flow=org.jfree.report.modules.factories.report.flow.FlowXmlFactoryModule
+
+org.jfree.report.namespaces.xml-flow.Uri=http://jfreereport.sourceforge.net/namespaces/reports/flow
+org.jfree.report.namespaces.xml-flow.Default-Style=res://org/jfree/report/modules/factories/report/flow/flow.css
+org.jfree.report.namespaces.xml-flow.ClassAttr=class
+org.jfree.report.namespaces.xml-flow.StyleAttr=style
+org.jfree.report.namespaces.xml-flow.Prefix=xml-flow
+
+
+
+#
+# Handler-definition for the XML-parser.
+# Prefix is 'org.jfree.report.modules.factories.report.node-factories.'
+#
+# Declare the namespaces (this is independent of the ones defined above ..)
+# <prefix>"namespace."<ns-prefix>=<ns-uri>
+org.jfree.report.modules.factories.report.node-factories.namespace.flow=http://jfreereport.sourceforge.net/namespaces/reports/flow
+org.jfree.report.modules.factories.report.node-factories.default=org.jfree.report.modules.factories.report.flow.SectionReadHandler
+org.jfree.report.modules.factories.report.node-factories.default.flow=
+
+#
+# Next define the tags for which we want to customize the read-handler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.content=org.jfree.report.modules.factories.report.flow.ContentElementReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.section=org.jfree.report.modules.factories.report.flow.SectionReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.detail-section=org.jfree.report.modules.factories.report.flow.DetailSectionReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.out-of-order-section=org.jfree.report.modules.factories.report.flow.OutOfOrderSectionReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.page-header=org.jfree.report.modules.factories.report.flow.PageHeaderReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.page-footer=org.jfree.report.modules.factories.report.flow.PageFooterReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.group=org.jfree.report.modules.factories.report.flow.GroupReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow.sub-report=org.jfree.report.modules.factories.report.flow.SubReportReadHandler
+
+org.jfree.report.modules.factories.data.data-factory-prefix.built-in.flow=org.jfree.report.modules.factories.report.data-factories.
+org.jfree.report.modules.factories.report.data-factories.namespace.ext=http://jfreereport.sourceforge.net/namespaces/reports/flow
+org.jfree.report.modules.factories.report.data-factories.tag.ext.data-factory=org.jfree.report.modules.factories.report.flow.DatasourceFactoryReadHandler
diff --git a/source/org/jfree/report/modules/factories/report/flow/flow.css b/source/org/jfree/report/modules/factories/report/flow/flow.css
new file mode 100644
index 0000000..896b375
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/flow.css
@@ -0,0 +1,90 @@
+/**
+ * The StyleSheet mapping for the flow-parser. The flow xml report format places
+ * all control elements into the namespace '../namespaces/report/flow'.
+ *
+ * During the report processing, the LibLayoutReportTarget adds some control
+ * attributes to help the layouter. These attributes are always added to the
+ * namespace '../namespaces/engine/flow', regardless what namespace the element
+ * itself is in.
+ */
+ at namespace url(http://jfreereport.sourceforge.net/namespaces/reports/flow); /* set default namespace to HTML */
+ at namespace xml url(http://www.w3.org/XML/1998/namespace);
+ at namespace report url(http://jfreereport.sourceforge.net/namespaces/engine);
+
+/**
+ * The quoting of the attribute's name constant is an intentional violation
+ * of the CSS standard. This forces the 'flute' parser to return the attr(..)
+ * function as function object, which enables us to interpret the type
+ * parameter.
+ */
+
+resource-node {
+  content: attr("report|content", url);
+  display: inline;
+}
+
+external-node {
+  content: attr("report|content", raw);
+  display: inline;
+}
+
+content[report|content] {
+  content: attr("report|content");
+  display: inline;
+}
+
+content[report|content][report|isDate=true] {
+  content: format(attr("report|content", date), date);
+}
+
+content[report|content][report|isDate=true][format] {
+  content: format(attr("report|content", date), date, attr("format",string));
+}
+
+content[report|content][report|isNumber=true] {
+  content: format(attr("report|content", number), number, "#,##0.00");
+}
+
+content[report|content][report|isNumber=true][format] {
+  content: format(attr("report|content", number), number, attr("format",string));
+}
+
+content[report|content][report|isNumber=true][isInteger=true] {
+  content: format(attr("report|content", number), number, "#,##0");
+}
+
+content[report|content][report|isNumber=true][isInteger=true][format] {
+  content: format(attr("report|content", number), number, attr("format",string));
+}
+
+inner-stylesheet {
+  display:none;
+}
+
+stylesheet {
+  display:none;
+}
+
+query {
+  display: none;
+}
+
+configuration {
+  display: none;
+}
+
+datasource {
+  display: none;
+}
+
+group, report, sub-report, section, detail-section, page-header, page-footer {
+  display: block;
+}
+
+page-header {
+  position: running(header);
+}
+
+page-footer {
+  position: running(footer);
+}
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/factories/report/flow/flow.xsd b/source/org/jfree/report/modules/factories/report/flow/flow.xsd
new file mode 100644
index 0000000..a89b856
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/flow.xsd
@@ -0,0 +1,599 @@
+<?xml version="1.0"?>
+
+<xsd:schema version="0.9"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns="http://jfreereport.sourceforge.net/namespaces/reports/flow"
+            targetNamespace="http://jfreereport.sourceforge.net/namespaces/reports/flow">
+  <xsd:annotation>
+    <xsd:documentation>
+      This schema describes the format of the flow report definitions in
+      JFreeReport. This document is aimed for the JFreeReport 0.9 release.
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:element name="name" type="xsd:string"/>
+  <xsd:attribute name="formula" type="xsd:string"/>
+  <xsd:attribute name="initial" type="xsd:string"/>
+
+  <xsd:attribute name="encoding" default="text">
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="base64"/>
+        <xsd:enumeration value="text"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+
+  <xsd:element name="property-definition" abstract="true">
+    <xsd:complexType mixed="true">
+      <xsd:annotation>
+        <xsd:documentation>
+          A property is a named entity used in Expressions and the configuration
+          definition.
+
+          If the encoding is set to 'base64', it is assumed, that
+          the content of this property is a base64 encoded serialized java-object.
+          If the encoding is set to 'text' (the default), the resulting string
+          will be used to build the object.
+
+          The 'class' attribute will be ignored for 'base64' encoded serialized
+          content.
+        </xsd:documentation>
+      </xsd:annotation>
+      <xsd:complexContent>
+        <xsd:restriction base="xsd:anyType">
+          <xsd:sequence>
+            <xsd:element ref="property"/>
+          </xsd:sequence>
+          <xsd:attribute name="name" type="xsd:string"/>
+          <xsd:attribute ref="class" use="optional"/>
+          <xsd:attribute ref="encoding"/>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="property" substitutionGroup="property-definition">
+    <xsd:annotation>
+      <xsd:documentation>
+        A property is a named entity used in Expressions and the configuration
+        definition.
+      </xsd:documentation>
+    </xsd:annotation>
+  </xsd:element>
+
+  <xsd:attribute name="class" type="xsd:string"/>
+
+  <xsd:element name="attribute">
+    <xsd:annotation>
+      <xsd:documentation>
+        An attribute is a document format specific entity.
+
+        The 'class' attribute is required if the content is not base64 encoded.
+        If it is not given, a String value is assumed.
+
+        A namespace-uri is required. If no namespace uri is given, the
+        element's namespace is used instead.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:restriction base="xsd:anyType">
+          <xsd:attribute name="name" type="xsd:string" use="required"/>
+          <xsd:attribute name="namespace-uri" type="xsd:string"/>
+          <xsd:attribute ref="class" default="java.lang.String" use="optional"/>
+          <xsd:attribute ref="encoding"/>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="style-property">
+    <xsd:annotation>
+      <xsd:documentation>
+        A style-property defines a single style item. Each report-element also
+        supports the 'style' attribute, which defines the style properties using
+        the text format defined by the CSS3 standard.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType mixed="true">
+      <xsd:simpleContent>
+        <xsd:extension base="xsd:string">
+          <xsd:attribute name="name" type="xsd:string"/>
+        </xsd:extension>
+      </xsd:simpleContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="expression">
+    <xsd:annotation>
+      <xsd:documentation>
+        An expression computes a single value. An expression defined here can
+        be unnamed. Expressions without a name will not appear in the datarow
+        and cannot be referenced by other expressions.
+
+        Expressions can either be defined by specifying a classname or by
+        providing a formula. If a formula is given, this counts as if a
+        property named 'formula' of type string is defined in the
+        expression-class. The expression class defaults to the Formula
+        Expression.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute ref="class" use="optional"/>
+      <xsd:attribute name="name" type="xsd:string" use="optional"/>
+      <xsd:attribute ref="formula" use="optional"/>
+      <xsd:attribute ref="initial" use="optional"/>
+      <xsd:attribute name="deep-traversing" type="xsd:boolean" default="false" use="optional"/>
+      <xsd:attribute name="precompute" type="xsd:boolean" default="false" use="optional"/>
+      <xsd:attribute name="preserve" type="xsd:boolean" default="false" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attribute name="style-key" type="xsd:string"/>
+
+  <xsd:element name="style-expression">
+    <xsd:annotation>
+      <xsd:documentation>
+        A style expression computes a single style value. StyleExpressions
+        cannot be named expressions.
+
+        Expressions can either be defined by specifying a classname or by
+        providing a formula. If a formula is given, this counts as if a
+        property named 'formula' of type string is defined in the
+        expression-class. The expression class defaults to the Formula
+        Expression.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute ref="class" use="optional"/>
+      <xsd:attribute ref="style-key" use="required"/>
+      <xsd:attribute ref="formula" use="optional"/>
+      <xsd:attribute ref="initial" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="attribute-name" type="xsd:string"/>
+  <xsd:element name="attribute-namespace-uri" type="xsd:string"/>
+
+  <xsd:element name="attribute-expression">
+    <xsd:annotation>
+      <xsd:documentation>
+        An attribute expression computes a single attribute value.
+        AttributeExpressions cannot be named expressions.
+
+        Expressions can either be defined by specifying a classname or by
+        providing a formula. If a formula is given, this counts as if a
+        property named 'formula' of type string is defined in the
+        expression-class. The expression class defaults to the Formula
+        Expression.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="attribute-name" minOccurs="1" maxOccurs="1"/>
+        <xsd:element ref="attribute-namespace-uri" minOccurs="1" maxOccurs="1"/>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute ref="class" use="optional"/>
+      <xsd:attribute ref="formula" use="optional"/>
+      <xsd:attribute ref="initial" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="display-condition">
+    <xsd:annotation>
+      <xsd:documentation>
+        A display condition is an expression that evaluates to 'true', if the
+        element should be displayed. All other values count as 'false' effectivly
+        hiding the element.
+
+        The display-condition only affects the output. Even if the display
+        condition evaluates to false, the element will be processed and any
+        computation defined for the element will be performed.
+
+        Expressions can either be defined by specifying a classname or by
+        providing a formula. If a formula is given, this counts as if a
+        property named 'formula' of type string is defined in the
+        expression-class. The expression class defaults to the Formula
+        Expression.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute ref="class" use="optional"/>
+      <xsd:attribute ref="formula" use="optional"/>
+      <xsd:attribute ref="initial" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attribute name="virtual" type="xsd:boolean"/>
+  <xsd:attribute name="enabled" type="xsd:boolean"/>
+  <xsd:attribute name="style" type="xsd:string"/>
+
+
+  <xsd:complexType name="element-type">
+    <xsd:complexContent>
+      <xsd:restriction base="xsd:anyType">
+        <xsd:sequence>
+          <xsd:element ref="expression" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element ref="style-expression" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element ref="style-property" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element ref="attribute-expression" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element ref="attribute" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element ref="display-condition" minOccurs="0" maxOccurs="1"/>
+        </xsd:sequence>
+        <xsd:attribute ref="virtual"/>
+        <xsd:attribute ref="enabled"/>
+        <xsd:attribute ref="style"/>
+      </xsd:restriction>
+    </xsd:complexContent>
+  </xsd:complexType>
+
+  <xsd:element name="element" abstract="true">
+    <xsd:annotation>
+      <xsd:documentation>
+        The element type cannot be used directly. Like its java counterpart,
+        it is an abstract type. However, it is the base for all other element
+        types.
+
+        The style attribute is mapped into an attribute definition. Whether it
+        is interpreted depends on the context of the element. For most report
+        elements, this will have no effect at all (as report elements are not
+        handed over to LibLayout. Content-Elements are the only known exception.).
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:restriction base="element-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="value-expression">
+    <xsd:annotation>
+      <xsd:documentation>
+        A value expression is responsible to produce displayable content.
+        This expression type cannot be a named expression.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute ref="class" use="optional"/>
+      <xsd:attribute ref="formula" use="optional"/>
+      <xsd:attribute ref="initial" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="content" substitutionGroup="element">
+    <xsd:annotation>
+      <xsd:documentation>
+        The content element is the one that transfers data from the datasource
+        to the output stream. There are three different types of data accepted:
+
+        * Nodes: Structural information is processed, as if the element was an
+          direct child of the content element. Use this to generate report
+          definitions on the fly. Like any strong magic, this can hurt if used
+          in the wrong way.
+
+          Recognized HTML or any other document content is processed by this
+          handler as well.
+
+        * Text: If Strings are given, the text is added as if the text was a
+          TextNode.
+
+        * Anything else: .. Is passed to libLayout hoping that someone there is
+          able to handle the object. Passing anything other than Text, Images
+          or Drawables will certainly have not the desired effect.
+
+          Dates and Numbers are treated as special kind of text. LibLayout
+          defines style properties to specify formats for these objects.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="element-type">
+          <xsd:choice>
+            <xsd:element ref="value-expression" minOccurs="1"/>
+          </xsd:choice>
+          <xsd:attribute name="format" type="xsd:string" use="optional"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attribute name="operation">
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="mark"/>
+        <xsd:enumeration value="recall"/>
+        <xsd:enumeration value="advance"/>
+        <xsd:enumeration value="done"/>
+        <xsd:enumeration value="commit"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:element name="operation-before">
+    <xsd:complexType>
+      <xsd:attribute ref="operation"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="operation-after">
+    <xsd:complexType>
+      <xsd:attribute ref="operation"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attribute name="repeat" type="xsd:boolean"/>
+
+  <xsd:complexType name="section-type">
+    <xsd:complexContent mixed="true">
+      <xsd:extension base="element-type">
+        <xsd:sequence>
+          <xsd:element ref="operation-before" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element ref="operation-after" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:choice minOccurs="0" maxOccurs="unbounded">
+            <xsd:element ref="content"/>
+            <xsd:element ref="section"/>
+            <xsd:element ref="detail-section"/>
+            <xsd:element ref="out-of-order-section"/>
+            <xsd:element ref="page-header"/>
+            <xsd:element ref="page-footer"/>
+            <xsd:element ref="group"/>
+            <xsd:element ref="sub-report"/>
+            <xsd:any/>
+          </xsd:choice>
+        </xsd:sequence>
+        <xsd:attribute ref="repeat"/>
+      </xsd:extension>
+    </xsd:complexContent>
+  </xsd:complexType>
+
+  <xsd:element name="section" substitutionGroup="element">
+    <xsd:annotation>
+      <xsd:documentation>
+        A section is a container to hold other elements. Sections allow limited
+        influence over the data flow by specifying the 'operation-before' and
+        'operation-after' elements. Sections can be repeatable.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType mixed="true">
+      <xsd:complexContent>
+        <xsd:restriction base="section-type"/>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="detail-section" substitutionGroup="section"/>
+
+  <xsd:element name="out-of-order-section" substitutionGroup="section">
+    <xsd:annotation>
+      <xsd:documentation>
+        An out-of-order section defines a special band, which is printed outside
+        the normal document flow. Page headers and footers are specific examples
+        for this kind of elements.
+
+        An output target implementation is not required to understand or to
+        honor out-of-flow content. If the attribute 'print-inflow' is set to
+        'true' the same content is also copied into the normal document flow.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="section-type">
+          <xsd:attribute name="role" type="xsd:string"/>
+          <xsd:attribute name="print-inflow" type="xsd:boolean"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="page-header" substitutionGroup="section">
+    <xsd:annotation>
+      <xsd:documentation>
+        The page-header is a specific out-of-order band with the role hard-wired
+        to 'page-header' and a print-inflow value of 'false'.
+      </xsd:documentation>
+    </xsd:annotation>
+  </xsd:element>
+
+  <xsd:element name="page-footer" substitutionGroup="section">
+    <xsd:annotation>
+      <xsd:documentation>
+        The page-footer is a specific out-of-order band with the role hard-wired
+        to 'page-footer' and a print-inflow value of 'false'.
+      </xsd:documentation>
+    </xsd:annotation>
+  </xsd:element>
+
+  <xsd:element name="grouping-expression">
+    <xsd:annotation>
+      <xsd:documentation>
+        A grouping expression is a boolean expression, which defines whether a
+        group's content gets repeated.
+
+        Grouping-expressions cannot be named expressions.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+      </xsd:sequence>
+      <xsd:attribute ref="class" use="optional"/>
+      <xsd:attribute ref="formula" use="optional"/>
+      <xsd:attribute ref="initial" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="group" substitutionGroup="section">
+    <xsd:annotation>
+      <xsd:documentation>
+        A group is a special repeating structure. A group repeats as long as
+        the grouping condition of this and all parent groups evaluates to
+        true.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="section-type">
+          <xsd:all>
+            <xsd:element ref="grouping-expression"/>
+          </xsd:all>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="query" type="xsd:string"/>
+
+  <xsd:complexType name="report-definition-query">
+    <xsd:complexContent mixed="true">
+      <xsd:extension base="section-type">
+        <xsd:all>
+          <xsd:element ref="query"/>
+        </xsd:all>
+      </xsd:extension>
+    </xsd:complexContent>
+  </xsd:complexType>
+
+  <xsd:complexType name="report-definition-type">
+    <xsd:complexContent mixed="true">
+      <xsd:extension base="report-definition-query">
+        <xsd:sequence>
+          <xsd:element ref="operation-before" minOccurs="0" maxOccurs="unbounded"/>
+          <xsd:element ref="operation-after" minOccurs="0" maxOccurs="unbounded"/>
+        </xsd:sequence>
+      </xsd:extension>
+    </xsd:complexContent>
+  </xsd:complexType>
+
+
+
+  <xsd:element name="configuration">
+    <xsd:annotation>
+      <xsd:documentation>
+        Configures the report using the report configuration collection.
+
+        This allows to tweak the report processing in various ways and is the
+        primary method to specify default properties for the export methods.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:sequence>
+        <xsd:element name="property" minOccurs="0" maxOccurs="unbounded">
+          <xsd:complexType mixed="true">
+            <xsd:simpleContent>
+              <xsd:extension base="xsd:string">
+                <xsd:attribute name="name" type="xsd:string"/>
+              </xsd:extension>
+            </xsd:simpleContent>
+          </xsd:complexType>
+        </xsd:element>
+      </xsd:sequence>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:attribute name="href" type="xsd:anyURI"/>
+
+  <xsd:element name="datasource">
+    <xsd:complexType>
+      <xsd:attribute ref="href" use="required"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="stylesheet">
+    <xsd:annotation>
+      <xsd:documentation>
+        A stylesheet definition references an external stylesheet
+        file (in CSS3 format). The element has the same function as the
+        HTML-Link element (which is not used, as this is a report and no
+        HTML file.)
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType mixed="true">
+      <xsd:attribute ref="href" use="required"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="inline-stylesheet" type="xsd:string">
+    <xsd:annotation>
+      <xsd:documentation>
+        This includes the style sheet definition as character data.
+        This is equal to HTML's style-tag.
+      </xsd:documentation>
+    </xsd:annotation>
+  </xsd:element>
+
+  <xsd:element name="report" substitutionGroup="section">
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="report-definition-type">
+          <xsd:sequence>
+            <xsd:element ref="configuration" minOccurs="0" maxOccurs="1"/>
+            <xsd:element ref="datasource" minOccurs="0" maxOccurs="1"/>
+            <xsd:element ref="stylesheet" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element ref="inline-stylesheet" minOccurs="0" maxOccurs="unbounded"/>
+          </xsd:sequence>
+        </xsd:extension>
+      </xsd:complexContent>
+
+    </xsd:complexType>
+
+  </xsd:element>
+
+  <xsd:element name="import-parameter">
+    <xsd:annotation>
+      <xsd:documentation>
+        An input parameter definition. The column specified by 'name' of the
+        master report is mapped into the subreport. If an alias is given, the
+        parameter will be mapped by that name instead by its original name.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:attribute name="name" type="xsd:string" use="required"/>
+      <xsd:attribute name="alias" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="export-parameter">
+    <xsd:annotation>
+      <xsd:documentation>
+        An output parameter definition. The column specified by 'name' of the
+        subreport report is exported into the master report. If an alias is given, the
+        parameter will be mapped by that name instead by its original name.
+      </xsd:documentation>
+    </xsd:annotation>
+    <xsd:complexType>
+      <xsd:attribute name="name" type="xsd:string" use="required"/>
+      <xsd:attribute name="alias" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="sub-report" substitutionGroup="section">
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="report-definition-type">
+          <xsd:sequence>
+            <xsd:element ref="import-parameter" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element ref="export-parameter" minOccurs="0" maxOccurs="unbounded"/>
+          </xsd:sequence>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+
+</xsd:schema>
diff --git a/source/org/jfree/report/modules/factories/report/flow/module.properties b/source/org/jfree/report/modules/factories/report/flow/module.properties
new file mode 100644
index 0000000..e3a5659
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/flow/module.properties
@@ -0,0 +1,15 @@
+module-info:
+  name: factory-report-flow
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: XML-Parsers for Flow Report Definitions. Flow report definitions
+               are the native report definition format of JFreeReport 0.9.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.factories.report.base.ReportFactoryBaseModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/factories/report/simplex/SimplexXmlFactoryModule.java b/source/org/jfree/report/modules/factories/report/simplex/SimplexXmlFactoryModule.java
new file mode 100644
index 0000000..9b77c4f
--- /dev/null
+++ b/source/org/jfree/report/modules/factories/report/simplex/SimplexXmlFactoryModule.java
@@ -0,0 +1,63 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SimplexXmlFactoryModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.factories.report.simplex;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * The Simplex-Format will be a mix of the old simple xml format and the
+ * new flow format.
+ *
+ * @author Thomas Morgner
+ */
+public class SimplexXmlFactoryModule implements XmlFactoryModule
+{
+  public SimplexXmlFactoryModule()
+  {
+  }
+
+  public int getDocumentSupport(XmlDocumentInfo documentInfo)
+  {
+    return 0;
+  }
+
+  public XmlReadHandler createReadHandler(XmlDocumentInfo documentInfo)
+  {
+    return null;
+  }
+
+  public String getDefaultNamespace(XmlDocumentInfo documentInfo)
+  {
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/common/DefaultGuiContext.java b/source/org/jfree/report/modules/gui/common/DefaultGuiContext.java
new file mode 100644
index 0000000..31437bd
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/DefaultGuiContext.java
@@ -0,0 +1,72 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultGuiContext.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.common;
+
+import java.util.Locale;
+
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Creation-Date: 16.11.2006, 17:05:27
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultGuiContext implements GuiContext
+{
+  private Locale locale;
+  private IconTheme iconTheme;
+  private Configuration configuration;
+
+  public DefaultGuiContext(final Locale locale,
+                           final IconTheme iconTheme,
+                           final Configuration configuration)
+  {
+    this.locale = locale;
+    this.iconTheme = iconTheme;
+    this.configuration = configuration;
+  }
+
+  public Locale getLocale()
+  {
+    return locale;
+  }
+
+  public IconTheme getIconTheme()
+  {
+    return iconTheme;
+  }
+
+  public Configuration getConfiguration()
+  {
+    return configuration;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/common/DefaultIconTheme.java b/source/org/jfree/report/modules/gui/common/DefaultIconTheme.java
new file mode 100644
index 0000000..22765e9
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/DefaultIconTheme.java
@@ -0,0 +1,82 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultIconTheme.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.common;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import javax.swing.Icon;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 13.11.2006, 19:27:51
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultIconTheme implements IconTheme
+{
+  private String bundleName;
+
+  public DefaultIconTheme()
+  {
+    initialize(JFreeReportBoot.getInstance().getGlobalConfig());
+  }
+
+  public void initialize(Configuration configuration)
+  {
+    this.bundleName = configuration.getConfigProperty
+        ("org.jfree.report.modules.gui.common.IconThemeBundle");
+  }
+
+  public Icon getSmallIcon(Locale locale, String id)
+  {
+    return getResourceBundleSupport(locale).getIcon(id, false);
+  }
+
+  public Icon getLargeIcon(Locale locale, String id)
+  {
+    return getResourceBundleSupport(locale).getIcon(id, true);
+  }
+
+  private ResourceBundleSupport getResourceBundleSupport(Locale locale)
+  {
+    if (bundleName == null)
+    {
+      throw new IllegalStateException
+          ("No resource-bundle. Did you boot the engine?");
+    }
+    return new ResourceBundleSupport
+        (locale, ResourceBundle.getBundle(bundleName, locale));
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/common/GuiCommonModule.java b/source/org/jfree/report/modules/gui/common/GuiCommonModule.java
new file mode 100644
index 0000000..2fbcde5
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/GuiCommonModule.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GuiCommonModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.common;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 15.11.2006, 21:53:43
+ *
+ * @author Thomas Morgner
+ */
+public class GuiCommonModule extends AbstractModule
+{
+  public static final String RESOURCE_BASE_NAME =
+      "org.jfree.report.modules.gui.common.resources";
+
+  public GuiCommonModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/common/GuiContext.java b/source/org/jfree/report/modules/gui/common/GuiContext.java
new file mode 100644
index 0000000..b6631ee
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/GuiContext.java
@@ -0,0 +1,51 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GuiContext.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.common;
+
+import java.util.Locale;
+
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+
+/**
+ * Creation-Date: 16.11.2006, 17:06:38
+ *
+ * @author Thomas Morgner
+ */
+public interface GuiContext
+{
+  Locale getLocale();
+
+  IconTheme getIconTheme();
+
+  Configuration getConfiguration();
+}
diff --git a/source/org/jfree/report/modules/gui/common/IconTheme.java b/source/org/jfree/report/modules/gui/common/IconTheme.java
new file mode 100644
index 0000000..52211ff
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/IconTheme.java
@@ -0,0 +1,54 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IconTheme.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.common;
+
+import java.util.Locale;
+import javax.swing.Icon;
+
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+
+/**
+ * An Icon-Theme is an extension point to replace the icons that are used by
+ * JFreeReport. Icons provided by the theme must be available in two flavours:
+ * Large (24x24) and small (16x16).
+ *
+ * @author Thomas Morgner
+ */
+public interface IconTheme
+{
+  public void initialize(Configuration configuration);
+
+  public Icon getSmallIcon(Locale locale, String id);
+
+  public Icon getLargeIcon(Locale locale, String id);
+}
diff --git a/source/org/jfree/report/modules/gui/common/configuration.properties b/source/org/jfree/report/modules/gui/common/configuration.properties
new file mode 100644
index 0000000..872f3c9
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/configuration.properties
@@ -0,0 +1,6 @@
+#
+#
+
+# Default-Skin
+org.jfree.report.modules.gui.common.IconTheme=org.jfree.report.modules.gui.common.DefaultIconTheme
+org.jfree.report.modules.gui.common.IconThemeBundle=org/jfree/report/modules/gui/themes/default/theme
diff --git a/source/org/jfree/report/modules/gui/common/module.properties b/source/org/jfree/report/modules/gui/common/module.properties
new file mode 100644
index 0000000..8d9536f
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/module.properties
@@ -0,0 +1,20 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: gui-common
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: General GUI utility module.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+
+
diff --git a/source/org/jfree/report/modules/gui/common/resources.properties b/source/org/jfree/report/modules/gui/common/resources.properties
new file mode 100644
index 0000000..d66f65b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/common/resources.properties
@@ -0,0 +1,8 @@
+progress-dialog.page-label=
+progress-dialog.current-row-label=
+
+statusline.export.generic-failure-description={0} failed on export.
+statusline.export.error=Error: {0}
+statusline.export.success=The export has been completed successfully.
+statusline.export.aborted=The export has been aborted.
+statusline.export.working=Exporting ..
diff --git a/source/org/jfree/report/modules/gui/swing/common/AbstractActionPlugin.java b/source/org/jfree/report/modules/gui/swing/common/AbstractActionPlugin.java
new file mode 100644
index 0000000..498de05
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/AbstractActionPlugin.java
@@ -0,0 +1,254 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Window;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+import org.jfree.report.modules.gui.common.IconTheme;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+import org.pentaho.reporting.libraries.base.config.ExtendedConfiguration;
+import org.pentaho.reporting.libraries.base.config.ExtendedConfigurationWrapper;
+
+/**
+ * The AbstractExportPlugin provides a basic implementation of the ExportPlugin
+ * interface.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractActionPlugin implements ActionPlugin
+{
+  private PropertyChangeSupport propertyChangeSupport;
+
+  private boolean enabled;
+
+  /**
+   * Localised resources.
+   */
+  private ResourceBundleSupport baseResources;
+  private IconTheme iconTheme;
+  private String statusText;
+
+  /**
+   * The base resource class.
+   */
+  public static final String BASE_RESOURCE_CLASS =
+      "org.jfree.report.modules.gui.common.resources";
+  private SwingGuiContext context;
+  private ExtendedConfiguration configuration;
+
+  protected AbstractActionPlugin()
+  {
+    propertyChangeSupport = new PropertyChangeSupport(this);
+  }
+
+  public boolean initialize(final SwingGuiContext context)
+  {
+    this.context = context;
+    this.baseResources = new ResourceBundleSupport
+        (context.getLocale(), BASE_RESOURCE_CLASS);
+    this.iconTheme = context.getIconTheme();
+    this.configuration = new ExtendedConfigurationWrapper
+        (context.getConfiguration());
+    return true;
+  }
+
+  protected PropertyChangeSupport getPropertyChangeSupport()
+  {
+    return propertyChangeSupport;
+  }
+
+  public SwingGuiContext getContext()
+  {
+    return context;
+  }
+
+  public ExtendedConfiguration getConfig()
+  {
+    return configuration;
+  }
+
+  /**
+   * Returns true if the action is separated, and false otherwise. A separated
+   * action starts a new action group and will be spearated from previous
+   * actions on the menu and toolbar.
+   *
+   * @return true, if the action should be separated from previous actions,
+   *         false otherwise.
+   */
+  public boolean isSeparated()
+  {
+    return getConfig().getBoolProperty
+        (getConfigurationPrefix() + "separated");
+  }
+
+  /**
+   * Returns an error description for the last operation. This implementation
+   * provides a basic default failure description text and should be overriden
+   * to give a more detailed explaination.
+   *
+   * @return returns a error description.
+   */
+  public String getFailureDescription()
+  {
+    return baseResources.formatMessage
+        ("statusline.export.generic-failure-description", getDisplayName());
+  }
+
+  public String getStatusText()
+  {
+    return statusText;
+  }
+
+  public void setStatusText(final String statusText)
+  {
+    String oldText = this.statusText;
+    this.statusText = statusText;
+    propertyChangeSupport.firePropertyChange("statusText", oldText, statusText);
+  }
+
+  /**
+   * Returns true if the action should be added to the toolbar, and false
+   * otherwise.
+   *
+   * @return true, if the plugin should be added to the toolbar, false
+   *         otherwise.
+   */
+  public boolean isAddToToolbar()
+  {
+    return getConfig().getBoolProperty
+        (getConfigurationPrefix() + "add-to-toolbar");
+  }
+
+  /**
+   * Returns true if the action should be added to the menu, and false
+   * otherwise.
+   *
+   * @return A boolean.
+   */
+  public boolean isAddToMenu()
+  {
+    final String name = getConfigurationPrefix() + "add-to-menu";
+    return getConfig().getBoolProperty(name);
+  }
+
+  /**
+   * Creates a progress dialog, and tries to assign a parent based on the given
+   * preview proxy.
+   *
+   * @return the progress dialog.
+   */
+  protected ReportProgressDialog createProgressDialog()
+  {
+    final Window proxy = context.getWindow();
+    if (proxy instanceof Frame)
+    {
+      return new ReportProgressDialog((Frame) proxy);
+    }
+    else if (proxy instanceof Dialog)
+    {
+      return new ReportProgressDialog((Dialog) proxy);
+    }
+    else
+    {
+      return new ReportProgressDialog();
+    }
+  }
+
+  public void addPropertyChangeListener(final PropertyChangeListener l)
+  {
+    propertyChangeSupport.addPropertyChangeListener(l);
+  }
+
+  public void addPropertyChangeListener(final String property,
+                                        final PropertyChangeListener l)
+  {
+    propertyChangeSupport.addPropertyChangeListener(property, l);
+  }
+
+  public void removePropertyChangeListener(final PropertyChangeListener l)
+  {
+    propertyChangeSupport.removePropertyChangeListener(l);
+  }
+
+  public void setEnabled(final boolean enabled)
+  {
+    final boolean oldEnabled = this.enabled;
+    this.enabled = enabled;
+    propertyChangeSupport.firePropertyChange("enabled", oldEnabled, enabled);
+  }
+
+  public boolean isEnabled()
+  {
+    return enabled;
+  }
+
+  public IconTheme getIconTheme()
+  {
+    return iconTheme;
+  }
+
+  protected abstract String getConfigurationPrefix();
+
+
+  /**
+   * A sort key used to enforce a certain order within the actions.
+   *
+   * @return
+   */
+  public int getMenuOrder()
+  {
+    return getConfig().getIntProperty
+        (getConfigurationPrefix() + "menu-order", 0);
+  }
+
+  public int getToolbarOrder()
+  {
+    return getConfig().getIntProperty
+        (getConfigurationPrefix() + "toolbar-order", 0);
+  }
+
+  public String getRole()
+  {
+    return getConfig().getConfigProperty
+        (getConfigurationPrefix() + "role");
+  }
+
+  public int getRolePreference()
+  {
+    return getConfig().getIntProperty
+        (getConfigurationPrefix() + "role-preference", 0);
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/AbstractExportActionPlugin.java b/source/org/jfree/report/modules/gui/swing/common/AbstractExportActionPlugin.java
new file mode 100644
index 0000000..86f7928
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/AbstractExportActionPlugin.java
@@ -0,0 +1,137 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractExportActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Window;
+import java.lang.reflect.Constructor;
+
+import org.jfree.report.flow.ReportJob;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.apache.commons.logging.Log;
+
+/**
+ * Creation-Date: 02.12.2006, 14:21:07
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractExportActionPlugin extends AbstractActionPlugin
+  implements ExportActionPlugin
+{
+
+  public AbstractExportActionPlugin()
+  {
+  }
+
+
+  /**
+   * Creates a progress dialog, and tries to assign a parent based on the given
+   * preview proxy.
+   *
+   * @return the progress dialog.
+   */
+  protected ExportDialog createExportDialog(final String className)
+      throws InstantiationException
+  {
+    final Window proxy = getContext().getWindow();
+    if (proxy instanceof Frame)
+    {
+      final ClassLoader classLoader =
+          ObjectUtilities.getClassLoader(AbstractActionPlugin.class);
+      try
+      {
+        final Class aClass = classLoader.loadClass(className);
+        final Constructor constructor =
+            aClass.getConstructor(new Class[]{Frame.class});
+        return (ExportDialog) constructor.newInstance(new Object[]{proxy});
+      }
+      catch (Exception e)
+      {
+        DebugLog.log("Failed to instantiate Export-Dialog with a 'Frame'-parent: " + className);
+      }
+    }
+    else if (proxy instanceof Dialog)
+    {
+      final ClassLoader classLoader =
+          ObjectUtilities.getClassLoader(AbstractActionPlugin.class);
+      try
+      {
+        final Class aClass = classLoader.loadClass(className);
+        final Constructor constructor =
+            aClass.getConstructor(new Class[]{Dialog.class});
+        return (ExportDialog) constructor.newInstance(new Object[]{proxy});
+      }
+      catch (Exception e)
+      {
+        DebugLog.log("Failed to instantiate Export-Dialog with a 'Dialog'-parent: " + className, e);
+      }
+    }
+
+    final Object fallBack = ObjectUtilities.loadAndInstantiate
+        (className, AbstractActionPlugin.class, ExportDialog.class);
+    if (fallBack != null)
+    {
+      return (ExportDialog) fallBack;
+    }
+
+    DebugLog.log("Failed to instantiate Export-Dialog without a parent: " + className);
+    throw new InstantiationException("Failed to instantiate Export-Dialog");
+  }
+
+
+  /**
+   * Exports a report.
+   *
+   * @return A boolean.
+   */
+  public boolean performShowExportDialog(ReportJob job, String configKey)
+  {
+    try
+    {
+      final Configuration configuration = job.getConfiguration();
+      final String dialogClassName = configuration.getConfigProperty(configKey);
+      final ExportDialog dialog = createExportDialog(dialogClassName);
+      final boolean dialogResult = dialog.performQueryForExport(job, getContext());
+      return dialogResult;
+    }
+    catch (InstantiationException e)
+    {
+      DebugLog.log("Unable to configure the report job.");
+      setStatusText("Unable to configure the report job.");
+      return false;
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/AbstractExportDialog.java b/source/org/jfree/report/modules/gui/swing/common/AbstractExportDialog.java
new file mode 100644
index 0000000..b0333b0
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/AbstractExportDialog.java
@@ -0,0 +1,469 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AbstractExportDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JDialog;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.common.GuiContext;
+import org.jfree.report.modules.preferences.base.ConfigFactory;
+import org.jfree.report.modules.preferences.base.ConfigStorage;
+import org.jfree.report.modules.preferences.base.ConfigStoreException;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+public abstract class AbstractExportDialog extends JDialog
+  implements ExportDialog
+{
+  /**
+   * Internal action class to confirm the dialog and to validate the input.
+   */
+  private class ConfirmAction extends AbstractAction
+  {
+    /**
+     * Default constructor.
+     */
+    public ConfirmAction(final ResourceBundle resources)
+    {
+      putValue(Action.NAME, resources.getString("OptionPane.okButtonText"));
+    }
+
+    /**
+     * Receives notification that the action has occurred.
+     *
+     * @param e the action event.
+     */
+    public void actionPerformed(final ActionEvent e)
+    {
+      if (performValidate() && performConfirm())
+      {
+        setConfirmed(true);
+        setVisible(false);
+      }
+    }
+  }
+
+  /**
+   * Internal action class to cancel the report processing.
+   */
+  private class CancelAction extends AbstractAction
+  {
+    /**
+     * Default constructor.
+     */
+    public CancelAction(final ResourceBundle resources)
+    {
+      putValue(Action.NAME, resources.getString("OptionPane.cancelButtonText"));
+    }
+
+    /**
+     * Receives notification that the action has occurred.
+     *
+     * @param e the action event.
+     */
+    public void actionPerformed(final ActionEvent e)
+    {
+      setConfirmed(false);
+      setVisible(false);
+    }
+  }
+
+  private class ExportDialogValidator extends FormValidator
+  {
+    public ExportDialogValidator()
+    {
+      super();
+    }
+
+    public boolean performValidate()
+    {
+      return AbstractExportDialog.this.performValidate();
+    }
+
+    public Action getConfirmAction()
+    {
+      return AbstractExportDialog.this.getConfirmAction();
+    }
+  }
+
+  private class WindowCloseHandler extends WindowAdapter
+  {
+    public WindowCloseHandler()
+    {
+    }
+
+    /**
+     * Invoked when a window is in the process of being closed. The close
+     * operation can be overridden at this point.
+     */
+    public void windowClosing(final WindowEvent e)
+    {
+      final Action cancelAction = getCancelAction();
+      if (cancelAction != null)
+      {
+        cancelAction.actionPerformed(null);
+      }
+      else
+      {
+        setConfirmed(false);
+        setVisible(false);
+      }
+    }
+  }
+
+  private Action cancelAction;
+  private Action confirmAction;
+  private FormValidator formValidator;
+  private ResourceBundle resources;
+  private boolean confirmed;
+  private ReportJob reportJob;
+  private GuiContext guiContext;
+
+  /**
+   * Creates a non-modal dialog without a title and without a specified
+   * <code>Frame</code> owner.  A shared, hidden frame will be set as the owner
+   * of the dialog.
+   */
+  public AbstractExportDialog()
+  {
+    initialize();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Frame</code> as its owner.  If <code>owner</code> is
+   * <code>null</code>, a shared, hidden frame will be set as the owner of the
+   * dialog.
+   *
+   * @param owner the <code>Frame</code> from which the dialog is displayed
+   */
+  public AbstractExportDialog(final Frame owner)
+  {
+    super(owner);
+    initialize();
+  }
+
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Dialog</code> as its owner.
+   *
+   * @param owner the non-null <code>Dialog</code> from which the dialog is
+   *              displayed
+   */
+  public AbstractExportDialog(final Dialog owner)
+  {
+    super(owner);
+    initialize();
+  }
+
+  private void initialize()
+  {
+    ResourceBundle resources = ResourceBundle.getBundle(SwingCommonModule.BUNDLE_NAME);
+
+    cancelAction = new CancelAction(resources);
+    confirmAction = new ConfirmAction(resources);
+
+    formValidator = new ExportDialogValidator();
+    setModal(true);
+    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+    addWindowListener(new WindowCloseHandler());
+  }
+
+
+  public abstract JStatusBar getStatusBar();
+
+  protected Action getCancelAction()
+  {
+    return cancelAction;
+  }
+
+  protected void setCancelAction(final Action cancelAction)
+  {
+    this.cancelAction = cancelAction;
+  }
+
+  protected Action getConfirmAction()
+  {
+    return confirmAction;
+  }
+
+  protected void setConfirmAction(final Action confirmAction)
+  {
+    this.confirmAction = confirmAction;
+  }
+
+  protected abstract boolean performValidate();
+
+  protected FormValidator getFormValidator()
+  {
+    return formValidator;
+  }
+
+  protected abstract void initializeFromJob(ReportJob job,
+                                            final GuiContext guiContext);
+
+  protected ReportJob getReportJob()
+  {
+    return reportJob;
+  }
+
+  protected GuiContext getGuiContext()
+  {
+    return guiContext;
+  }
+
+  /**
+   * Opens the dialog to query all necessary input from the user. This will not
+   * start the processing, as this is done elsewhere.
+   *
+   * @param reportJob the report that should be processed.
+   * @return true, if the processing should continue, false otherwise.
+   */
+  public boolean performQueryForExport(final ReportJob reportJob,
+                                       final GuiContext guiContext)
+  {
+    this.reportJob = reportJob;
+    this.guiContext = guiContext;
+
+    final Locale locale = reportJob.getReportStructureRoot().getLocale();
+    setLocale(locale);
+    pack();
+    clear();
+    initializeFromJob(reportJob, guiContext);
+
+    final FormValidator formValidator = getFormValidator();
+    formValidator.setEnabled(false);
+    final ModifiableConfiguration repConf = reportJob.getConfiguration();
+    final boolean inputStorageEnabled = isInputStorageEnabled(repConf);
+
+    Configuration loadedConfiguration;
+    if (inputStorageEnabled)
+    {
+      loadedConfiguration = loadFromConfigStore(reportJob, repConf);
+    }
+    else
+    {
+      loadedConfiguration = repConf;
+    }
+
+    setDialogContents(loadedConfiguration);
+
+    formValidator.setEnabled(true);
+    formValidator.handleValidate();
+    setModal(true);
+    setVisible(true);
+    if (isConfirmed() == false)
+    {
+      return false;
+    }
+
+    formValidator.setEnabled(false);
+
+    final Configuration fullDialogContents = grabDialogContents(true);
+    final Enumeration configProperties =
+        fullDialogContents.getConfigProperties();
+    while (configProperties.hasMoreElements())
+    {
+      final String key = (String) configProperties.nextElement();
+      repConf.setConfigProperty(key, fullDialogContents.getConfigProperty(key));
+    }
+
+    if (inputStorageEnabled)
+    {
+      saveToConfigStore(reportJob, repConf);
+    }
+
+    formValidator.setEnabled(true);
+    this.reportJob = null;
+    return true;
+  }
+
+  private void saveToConfigStore(final ReportJob reportJob,
+                                 final Configuration reportConfiguration)
+  {
+    final String configPath = ConfigFactory.encodePath(
+        reportJob.getName() + getConfigurationSuffix());
+
+    try
+    {
+      final boolean fullStorageEnabled = isFullInputStorageEnabled(reportConfiguration);
+      final Configuration dialogContents = grabDialogContents(fullStorageEnabled);
+      final ConfigStorage storage = ConfigFactory.getInstance().getUserStorage();
+      storage.store(configPath, dialogContents);
+    }
+    catch (ConfigStoreException cse)
+    {
+      DebugLog.log("Unable to store the defaults in Export export dialog. [" + getClass() + "]");
+    }
+  }
+
+  private Configuration loadFromConfigStore(final ReportJob reportJob,
+                                            final Configuration defaultConfig)
+  {
+    final String configPath = ConfigFactory.encodePath(
+        reportJob.getName() + getConfigurationSuffix());
+    final ConfigStorage storage = ConfigFactory.getInstance().getUserStorage();
+    try
+    {
+      return storage.load(configPath, defaultConfig);
+    }
+    catch (Exception cse)
+    {
+      DebugLog.log("Unable to load the defaults in Export export dialog. [" + getClass() + "]");
+    }
+    return defaultConfig;
+  }
+
+  protected abstract String getConfigurationPrefix();
+
+  /**
+   * Returns a new (and not connected to the default config from the job)
+   * configuration containing all properties from the dialog.
+   *
+   * @param full
+   * @return
+   */
+  protected abstract Configuration grabDialogContents(boolean full);
+
+  protected abstract void setDialogContents(Configuration properties);
+
+  protected abstract String getConfigurationSuffix();
+
+  /**
+   * Retrieves the resources for this dialog. If the resources are not
+   * initialized, they get loaded on the first call to this method.
+   *
+   * @return this frames ResourceBundle.
+   */
+  protected ResourceBundle getResources()
+  {
+    if (resources == null)
+    {
+      resources = ResourceBundle.getBundle(getResourceBaseName());
+    }
+    return resources;
+  }
+
+  protected boolean isInputStorageEnabled(Configuration config)
+  {
+    final String confVal = config.getConfigProperty
+        (getConfigurationPrefix() + "StoreDialogContents");
+    return "none".equalsIgnoreCase(confVal) == false;
+  }
+
+  protected boolean isFullInputStorageEnabled(Configuration config)
+  {
+    final String confVal = config.getConfigProperty
+        (getConfigurationPrefix() + "StoreDialogContents");
+    return "all".equalsIgnoreCase(confVal);
+  }
+
+  /**
+   * Returns <code>true</code> if the user confirmed the selection, and
+   * <code>false</code> otherwise.  The file should only be saved if the result
+   * is <code>true</code>.
+   *
+   * @return A boolean.
+   */
+  public boolean isConfirmed()
+  {
+    return confirmed;
+  }
+
+  /**
+   * Defines whether this dialog has been finished using the 'OK' or the
+   * 'Cancel' option.
+   *
+   * @param confirmed set to <code>true</code>, if OK was pressed,
+   *                  <code>false</code> otherwise
+   */
+  protected void setConfirmed(final boolean confirmed)
+  {
+    this.confirmed = confirmed;
+  }
+
+  protected boolean performConfirm()
+  {
+    return true;
+  }
+
+  public abstract void clear();
+
+  protected abstract String getResourceBaseName();
+
+
+  /**
+   * Resolves file names for the exports. An occurence of "~/" at the beginning
+   * of the name will be replaced with the users home directory.
+   *
+   * @param baseDirectory the base directory as specified in the configuration.
+   * @return the file object pointing to that directory.
+   * @throws IllegalArgumentException if the base directory is null.
+   */
+  protected File resolvePath(String baseDirectory)
+  {
+    if (baseDirectory == null)
+    {
+      throw new IllegalArgumentException("The base directory must not be null");
+    }
+
+    if (baseDirectory.startsWith("~/") == false)
+    {
+      return new File(baseDirectory);
+    }
+    else
+    {
+      final String homeDirectory = System.getProperty("user.home");
+      if ("~/".equals(baseDirectory))
+      {
+        return new File(homeDirectory);
+      }
+      else
+      {
+        baseDirectory = baseDirectory.substring(2);
+        return new File(homeDirectory, baseDirectory);
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ActionFactory.java b/source/org/jfree/report/modules/gui/swing/common/ActionFactory.java
new file mode 100644
index 0000000..54cb775
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ActionFactory.java
@@ -0,0 +1,42 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ActionFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+/**
+ * Creation-Date: 16.11.2006, 16:18:56
+ *
+ * @author Thomas Morgner
+ */
+public interface ActionFactory
+{
+  public ActionPlugin[] getActions(SwingGuiContext context, String category);
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ActionPlugin.java b/source/org/jfree/report/modules/gui/swing/common/ActionPlugin.java
new file mode 100644
index 0000000..5bca898
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ActionPlugin.java
@@ -0,0 +1,128 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.beans.PropertyChangeListener;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+/**
+ * Creation-Date: 16.11.2006, 15:47:02
+ *
+ * @author Thomas Morgner
+ */
+public interface ActionPlugin
+{
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName ();
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription ();
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon ();
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon ();
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey ();
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey ();
+
+  /**
+   * Returns true if the action is separated, and false otherwise.
+   *
+   * @return A boolean.
+   */
+  public boolean isSeparated ();
+
+  /**
+   * Returns true if the action should be added to the toolbar, and false otherwise.
+   *
+   * @return A boolean.
+   */
+  public boolean isAddToToolbar ();
+
+  /**
+   * Returns true if the action should be added to the menu, and false otherwise.
+   *
+   * @return A boolean.
+   */
+  public boolean isAddToMenu ();
+
+  public void addPropertyChangeListener (PropertyChangeListener l);
+
+  public void addPropertyChangeListener (String property, PropertyChangeListener l);
+
+  public void removePropertyChangeListener (PropertyChangeListener l);
+
+  /**
+   * A sort key used to enforce a certain order within the actions.
+   *
+   * @return
+   */
+  public int getMenuOrder ();
+
+  public int getToolbarOrder ();
+
+  public String getRole();
+
+  public int getRolePreference ();
+
+  public boolean initialize(final SwingGuiContext context);
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ActionPluginMenuComparator.java b/source/org/jfree/report/modules/gui/swing/common/ActionPluginMenuComparator.java
new file mode 100644
index 0000000..b9d36b3
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ActionPluginMenuComparator.java
@@ -0,0 +1,95 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ActionPluginMenuComparator.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.util.Comparator;
+
+/**
+ * Creation-Date: 16.11.2006, 16:50:39
+ *
+ * @author Thomas Morgner
+ */
+public class ActionPluginMenuComparator implements Comparator
+{
+  public ActionPluginMenuComparator()
+  {
+  }
+
+  /**
+   * Compares its two arguments for order.  Returns a negative integer, zero, or
+   * a positive integer as the first argument is less than, equal to, or greater
+   * than the second.<p>
+   * <p/>
+   * The implementor must ensure that <tt>sgn(compare(x, y)) == -sgn(compare(y,
+   * x))</tt> for all <tt>x</tt> and <tt>y</tt>.  (This implies that
+   * <tt>compare(x, y)</tt> must throw an exception if and only if
+   * <tt>compare(y, x)</tt> throws an exception.)<p>
+   * <p/>
+   * The implementor must also ensure that the relation is transitive:
+   * <tt>((compare(x, y)>0) && (compare(y, z)>0))</tt> implies
+   * <tt>compare(x, z)>0</tt>.<p>
+   * <p/>
+   * Finally, the implementer must ensure that <tt>compare(x, y)==0</tt> implies
+   * that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all
+   * <tt>z</tt>.<p>
+   * <p/>
+   * It is generally the case, but <i>not</i> strictly required that
+   * <tt>(compare(x, y)==0) == (x.equals(y))</tt>.  Generally speaking, any
+   * comparator that violates this condition should clearly indicate this fact.
+   * The recommended language is "Note: this comparator imposes orderings that
+   * are inconsistent with equals."
+   *
+   * @param o1 the first object to be compared.
+   * @param o2 the second object to be compared.
+   * @return a negative integer, zero, or a positive integer as the first
+   *         argument is less than, equal to, or greater than the second.
+   * @throws ClassCastException if the arguments' types prevent them from being
+   *                            compared by this Comparator.
+   */
+  public int compare(final Object o1, final Object o2)
+  {
+    final ActionPlugin a1 = (ActionPlugin) o1;
+    final ActionPlugin a2 = (ActionPlugin) o2;
+
+    final int toolbarOrder = a1.getMenuOrder();
+    final int toolbarOrder2 = a2.getMenuOrder();
+    if (toolbarOrder < toolbarOrder2)
+    {
+      return -1;
+    }
+    if (toolbarOrder > toolbarOrder2)
+    {
+      return 1;
+    }
+    return 0;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ActionPluginToolbarComparator.java b/source/org/jfree/report/modules/gui/swing/common/ActionPluginToolbarComparator.java
new file mode 100644
index 0000000..722ae43
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ActionPluginToolbarComparator.java
@@ -0,0 +1,95 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ActionPluginToolbarComparator.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.util.Comparator;
+
+/**
+ * Creation-Date: 16.11.2006, 16:50:39
+ *
+ * @author Thomas Morgner
+ */
+public class ActionPluginToolbarComparator implements Comparator
+{
+  public ActionPluginToolbarComparator()
+  {
+  }
+
+  /**
+   * Compares its two arguments for order.  Returns a negative integer, zero, or
+   * a positive integer as the first argument is less than, equal to, or greater
+   * than the second.<p>
+   * <p/>
+   * The implementor must ensure that <tt>sgn(compare(x, y)) == -sgn(compare(y,
+   * x))</tt> for all <tt>x</tt> and <tt>y</tt>.  (This implies that
+   * <tt>compare(x, y)</tt> must throw an exception if and only if
+   * <tt>compare(y, x)</tt> throws an exception.)<p>
+   * <p/>
+   * The implementor must also ensure that the relation is transitive:
+   * <tt>((compare(x, y)>0) && (compare(y, z)>0))</tt> implies
+   * <tt>compare(x, z)>0</tt>.<p>
+   * <p/>
+   * Finally, the implementer must ensure that <tt>compare(x, y)==0</tt> implies
+   * that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all
+   * <tt>z</tt>.<p>
+   * <p/>
+   * It is generally the case, but <i>not</i> strictly required that
+   * <tt>(compare(x, y)==0) == (x.equals(y))</tt>.  Generally speaking, any
+   * comparator that violates this condition should clearly indicate this fact.
+   * The recommended language is "Note: this comparator imposes orderings that
+   * are inconsistent with equals."
+   *
+   * @param o1 the first object to be compared.
+   * @param o2 the second object to be compared.
+   * @return a negative integer, zero, or a positive integer as the first
+   *         argument is less than, equal to, or greater than the second.
+   * @throws ClassCastException if the arguments' types prevent them from being
+   *                            compared by this Comparator.
+   */
+  public int compare(final Object o1, final Object o2)
+  {
+    final ActionPlugin a1 = (ActionPlugin) o1;
+    final ActionPlugin a2 = (ActionPlugin) o2;
+
+    final int toolbarOrder = a1.getToolbarOrder();
+    final int toolbarOrder2 = a2.getToolbarOrder();
+    if (toolbarOrder < toolbarOrder2)
+    {
+      return -1;
+    }
+    if (toolbarOrder > toolbarOrder2)
+    {
+      return 1;
+    }
+    return 0;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/CenterLayout.java b/source/org/jfree/report/modules/gui/swing/common/CenterLayout.java
new file mode 100644
index 0000000..763d912
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/CenterLayout.java
@@ -0,0 +1,191 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * CenterLayout.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.io.Serializable;
+
+/**
+ * A layout manager that displays a single component in the center of its container.
+ *
+ * @author David Gilbert
+ */
+public class CenterLayout implements LayoutManager, Serializable
+{
+
+  /**
+   * For serialization.
+   */
+  private static final long serialVersionUID = 469319532333015042L;
+
+  /**
+   * Creates a new layout manager.
+   */
+  public CenterLayout()
+  {
+  }
+
+  /**
+   * Returns the preferred size.
+   *
+   * @param parent the parent.
+   * @return the preferred size.
+   */
+  public Dimension preferredLayoutSize(final Container parent)
+  {
+
+    synchronized (parent.getTreeLock())
+    {
+      final Insets insets = parent.getInsets();
+      if (parent.getComponentCount() > 0)
+      {
+        final Component component = parent.getComponent(0);
+        final Dimension d = component.getPreferredSize();
+        return new Dimension(
+            (int) d.getWidth() + insets.left + insets.right,
+            (int) d.getHeight() + insets.top + insets.bottom
+        );
+      }
+      else
+      {
+        return new Dimension(
+            insets.left + insets.right, insets.top + insets.bottom
+        );
+      }
+    }
+
+  }
+
+  /**
+   * Returns the minimum size.
+   *
+   * @param parent the parent.
+   * @return the minimum size.
+   */
+  public Dimension minimumLayoutSize(final Container parent)
+  {
+
+    synchronized (parent.getTreeLock())
+    {
+      final Insets insets = parent.getInsets();
+      if (parent.getComponentCount() > 0)
+      {
+        final Component component = parent.getComponent(0);
+        final Dimension d = component.getMinimumSize();
+        return new Dimension(d.width + insets.left + insets.right,
+            d.height + insets.top + insets.bottom);
+      }
+      else
+      {
+        return new Dimension(insets.left + insets.right,
+            insets.top + insets.bottom);
+      }
+    }
+
+  }
+
+  /**
+   * Lays out the components.
+   *
+   * @param parent the parent.
+   */
+  public void layoutContainer(final Container parent)
+  {
+
+    synchronized (parent.getTreeLock())
+    {
+      if (parent.getComponentCount() > 0)
+      {
+        final Insets insets = parent.getInsets();
+        final Dimension parentSize = parent.getSize();
+        final Component component = parent.getComponent(0);
+        final Dimension componentSize = component.getPreferredSize();
+        final int xx = insets.left + (
+            Math.max((parentSize.width - insets.left - insets.right
+                - componentSize.width) / 2, 0)
+        );
+        final int yy = insets.top + (
+            Math.max((parentSize.height - insets.top - insets.bottom
+                - componentSize.height) / 2, 0));
+        component.setBounds(xx, yy, componentSize.width,
+            componentSize.height);
+      }
+    }
+
+  }
+
+  /**
+   * Not used.
+   *
+   * @param comp the component.
+   */
+  public void addLayoutComponent(final Component comp)
+  {
+    // not used.
+  }
+
+  /**
+   * Not used.
+   *
+   * @param comp the component.
+   */
+  public void removeLayoutComponent(final Component comp)
+  {
+    // not used
+  }
+
+  /**
+   * Not used.
+   *
+   * @param name the component name.
+   * @param comp the component.
+   */
+  public void addLayoutComponent(final String name, final Component comp)
+  {
+    // not used
+  }
+
+  /**
+   * Not used.
+   *
+   * @param name the component name.
+   * @param comp the component.
+   */
+  public void removeLayoutComponent(final String name, final Component comp)
+  {
+    // not used
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/DefaultActionFactory.java b/source/org/jfree/report/modules/gui/swing/common/DefaultActionFactory.java
new file mode 100644
index 0000000..8f60294
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/DefaultActionFactory.java
@@ -0,0 +1,126 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultActionFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+
+/**
+ * Creation-Date: 16.11.2006, 16:28:03
+ *
+ * @author Thomas Morgner
+ */
+public class DefaultActionFactory implements ActionFactory
+{
+  private static final String PREFIX =
+      "org.jfree.report.modules.gui.swing.actions.";
+
+  public DefaultActionFactory()
+  {
+  }
+
+  public ActionPlugin[] getActions(SwingGuiContext context, String category)
+  {
+    final Configuration configuration = context.getConfiguration();
+    final String prefix = PREFIX + category;
+    final Iterator keys = configuration.findPropertyKeys(prefix);
+    if (keys.hasNext() == false)
+    {
+      return new ActionPlugin[0];
+    }
+
+    final HashMap plugins = new HashMap();
+    while (keys.hasNext())
+    {
+      final String key = (String) keys.next();
+      final String base = key.substring(prefix.length());
+      if (isPluginKey(base) == false)
+      {
+        continue;
+      }
+
+      final String clazz = configuration.getConfigProperty(key);
+      final Object maybeActionPlugin = ObjectUtilities.loadAndInstantiate
+          (clazz, DefaultActionFactory.class, ActionPlugin.class);
+      if (maybeActionPlugin == null)
+      {
+        continue;
+      }
+
+      final ActionPlugin plugin = (ActionPlugin) maybeActionPlugin;
+      if (plugin.initialize(context) == false)
+      {
+        continue;
+      }
+      final String role = plugin.getRole();
+      if (role == null)
+      {
+        plugins.put(plugin, plugin);
+      }
+      else
+      {
+        final ActionPlugin otherPlugin = (ActionPlugin) plugins.get(role);
+        if (otherPlugin != null)
+        {
+          if (plugin.getRolePreference() > otherPlugin.getRolePreference())
+          {
+            plugins.put(role, plugin);
+          }
+        }
+        else
+        {
+          plugins.put(role, plugin);
+        }
+      }
+    }
+
+    return (ActionPlugin[]) plugins.values().toArray
+        (new ActionPlugin[plugins.size()]);
+  }
+
+  private boolean isPluginKey(final String base)
+  {
+    if (base.length() < 1)
+    {
+      return false;
+    }
+    if (base.indexOf('.', 1) > 0)
+    {
+      return false;
+    }
+    return true;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/EncodingComboBoxModel.java b/source/org/jfree/report/modules/gui/swing/common/EncodingComboBoxModel.java
new file mode 100644
index 0000000..773ed27
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/EncodingComboBoxModel.java
@@ -0,0 +1,702 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: EncodingComboBoxModel.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.gui.swing.common;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import javax.swing.ComboBoxModel;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.fonts.encoding.EncodingRegistry;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * A model for the 'encoding' combo box. This combobox model presents a selection for all
+ * available string encodings.
+ *
+ * @author Thomas Morgner.
+ */
+public class EncodingComboBoxModel implements ComboBoxModel
+{
+  /**
+   * A default description.
+   */
+  private static final String ENCODING_DEFAULT_DESCRIPTION =
+          "[no description]";
+
+  /**
+   * The property that defines which encodings are available in the export dialogs.
+   */
+  public static final String AVAILABLE_ENCODINGS
+          = "org.jfree.report.modules.gui.base.EncodingsAvailable";
+
+  /**
+   * The encodings available properties value for all properties.
+   */
+  public static final String AVAILABLE_ENCODINGS_ALL = "all";
+  /**
+   * The encodings available properties value for properties defined in the properties
+   * file.
+   */
+  public static final String AVAILABLE_ENCODINGS_FILE = "file";
+  /**
+   * The encodings available properties value for no properties defined. The encoding
+   * selection will be disabled.
+   */
+  public static final String AVAILABLE_ENCODINGS_NONE = "none";
+
+  /**
+   * The name of the properties file used to define the available encodings. The property
+   * points to a resources in the classpath, not to a real file!
+   */
+  public static final String ENCODINGS_DEFINITION_FILE
+          = "org.jfree.report.modules.gui.base.EncodingsFile";
+
+  /**
+   * The default name for the encoding properties file. This property defaults to
+   * "/org/jfree/report/jfreereport-encodings.properties".
+   */
+  public static final String ENCODINGS_DEFINITION_FILE_DEFAULT
+          = "org/jfree/report/modules/gui/swing/common/jfreereport-encodings.properties";
+
+
+  /**
+   * An encoding comparator.
+   */
+  private static class EncodingCarrierComparator implements Comparator
+  {
+    public EncodingCarrierComparator ()
+    {
+    }
+
+    /**
+     * Compares its two arguments for order.  Returns a negative integer, zero, or a
+     * positive integer as the first argument is less than, equal to, or greater than the
+     * second.
+     *
+     * @param o1 the first object to be compared.
+     * @param o2 the second object to be compared.
+     * @return a negative integer, zero, or a positive integer as the first argument is
+     *         less than, equal to, or greater than the second.
+     *
+     * @throws java.lang.ClassCastException if the arguments' types prevent them from
+     *                                      being compared by this Comparator.
+     */
+    public int compare (final Object o1, final Object o2)
+    {
+      final EncodingCarrier e1 = (EncodingCarrier) o1;
+      final EncodingCarrier e2 = (EncodingCarrier) o2;
+      return e1.getName().toLowerCase().compareTo(e2.getName().toLowerCase());
+    }
+
+    /**
+     * Returns <code>true</code> if this object is equal to <code>o</code>, and
+     * <code>false</code> otherwise.
+     *
+     * @param o the object.
+     * @return A boolean.
+     */
+    public boolean equals (final Object o)
+    {
+      if (o == null)
+      {
+        return false;
+      }
+      return getClass().equals(o.getClass());
+    }
+
+    /**
+     * All comparators of this type are equal.
+     *
+     * @return A hash code.
+     */
+    public int hashCode ()
+    {
+      return getClass().hashCode();
+    }
+  }
+
+  /**
+   * An encoding carrier.
+   */
+  private static class EncodingCarrier
+  {
+    /**
+     * The encoding name.
+     */
+    private String name;
+
+    /**
+     * The encoding description.
+     */
+    private String description;
+
+    /**
+     * The display name.
+     */
+    private String displayName;
+
+    /**
+     * Creates a new encoding.
+     *
+     * @param name        the name (<code>null</code> not permitted).
+     * @param description the description.
+     */
+    public EncodingCarrier (final String name, final String description)
+    {
+      if (name == null)
+      {
+        throw new NullPointerException();
+      }
+      this.name = name;
+      this.description = description;
+      final StringBuffer dName = new StringBuffer();
+      dName.append(name);
+      dName.append(" (");
+      dName.append(description);
+      dName.append(")");
+      this.displayName = dName.toString();
+    }
+
+    /**
+     * Returns the name.
+     *
+     * @return The name.
+     */
+    public String getName ()
+    {
+      return name;
+    }
+
+    /**
+     * Returns the description.
+     *
+     * @return The description.
+     */
+    public String getDescription ()
+    {
+      return description;
+    }
+
+    /**
+     * Returns the display name (the regular name followed by the description in
+     * brackets).
+     *
+     * @return The display name.
+     */
+    public String getDisplayName ()
+    {
+      return displayName;
+    }
+
+    /**
+     * Returns <code>true</code> if the objects are equal, and <code>false</code>
+     * otherwise.
+     *
+     * @param o the object.
+     * @return A boolean.
+     */
+    public boolean equals (final Object o)
+    {
+      if (this == o)
+      {
+        return true;
+      }
+      if (!(o instanceof EncodingCarrier))
+      {
+        return false;
+      }
+
+      final EncodingCarrier carrier = (EncodingCarrier) o;
+
+      if (!name.equalsIgnoreCase(carrier.name))
+      {
+        return false;
+      }
+
+      return true;
+    }
+
+    /**
+     * Returns a hash code.
+     *
+     * @return The hash code.
+     */
+    public int hashCode ()
+    {
+      return name.hashCode();
+    }
+  }
+
+  /**
+   * Storage for the encodings.
+   */
+  private final ArrayList encodings;
+
+  /**
+   * Storage for registered listeners.
+   */
+  private ArrayList listDataListeners;
+
+  /**
+   * The selected index.
+   */
+  private int selectedIndex;
+
+  /**
+   * The selected object.
+   */
+  private Object selectedObject;
+
+  private ResourceBundle bundle;
+  public static final String BUNDLE_NAME = "org.jfree.report.modules.gui.swing.common.encoding-names";
+
+  /**
+   * Creates a new model.
+   * @param locale
+   */
+  public EncodingComboBoxModel(final Locale locale)
+  {
+    bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
+    encodings = new ArrayList();
+    listDataListeners = null;
+    selectedIndex = -1;
+  }
+
+  /**
+   * Adds an encoding.
+   *
+   * @param name        the name.
+   * @param description the description.
+   * @return <code>true</code> if the encoding is valid and added to the model,
+   *         <code>false</code> otherwise.
+   */
+  public boolean addEncoding (final String name, final String description)
+  {
+    if (EncodingRegistry.getInstance().isSupportedEncoding(name))
+    {
+      encodings.add(new EncodingCarrier(name, description));
+    }
+    else
+    {
+      return false;
+    }
+
+    fireContentsChanged();
+    return true;
+  }
+
+  /**
+   * Adds an encoding to the model without checking its validity.
+   *
+   * @param name        the name.
+   * @param description the description.
+   */
+  public void addEncodingUnchecked (final String name, final String description)
+  {
+    encodings.add(new EncodingCarrier(name, description));
+    fireContentsChanged();
+  }
+
+  public void removeEncoding (final String name)
+  {
+    if (encodings.remove(name))
+    {
+      fireContentsChanged();
+    }
+  }
+
+  /**
+   * Make sure, that this encoding is defined and selectable in the combobox model.
+   *
+   * @param encoding the encoding that should be verified.
+   */
+  public void ensureEncodingAvailable (final String encoding)
+  {
+    if (encoding == null)
+    {
+      throw new NullPointerException("Encoding must not be null");
+    }
+    final String desc = getEncodingDescription(encoding);
+    final EncodingCarrier ec = new EncodingCarrier(encoding, desc);
+    if (encodings.contains(ec) == false)
+    {
+      encodings.add(ec);
+      fireContentsChanged();
+    }
+  }
+
+  protected String getEncodingDescription (String encoding)
+  {
+    try
+    {
+      return bundle.getString(encoding);
+    }
+    catch(Exception e)
+    {
+      return ENCODING_DEFAULT_DESCRIPTION;
+    }
+  }
+
+  /**
+   * Sorts the encodings. Keep the selected object ...
+   */
+  public void sort ()
+  {
+    final Object selectedObject = getSelectedItem();
+    Collections.sort(encodings, new EncodingCarrierComparator());
+    setSelectedItem(selectedObject);
+    fireContentsChanged();
+  }
+
+  /**
+   * Notifies all registered listeners that the content of the model has changed.
+   */
+  protected void fireContentsChanged ()
+  {
+    if (listDataListeners == null)
+    {
+      return;
+    }
+    fireContentsChanged(0, getSize());
+  }
+
+  /**
+   * Notifies all registered listeners that the content of the model has changed.
+   */
+  protected void fireContentsChanged (int start, int length)
+  {
+    if (listDataListeners == null)
+    {
+      return;
+    }
+    final ListDataEvent evt = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, start, length);
+    for (int i = 0; i < listDataListeners.size(); i++)
+    {
+      final ListDataListener l = (ListDataListener) listDataListeners.get(i);
+      l.contentsChanged(evt);
+    }
+  }
+
+  /**
+   * Set the selected item. The implementation of this  method should notify all
+   * registered <code>ListDataListener</code>s that the contents have changed.
+   *
+   * @param anItem the list object to select or <code>null</code> to clear the selection
+   */
+  public void setSelectedItem (final Object anItem)
+  {
+    selectedObject = anItem;
+    if (anItem instanceof String)
+    {
+      final int size = getSize();
+      for (int i = 0; i < size; i++)
+      {
+        if (anItem.equals(getElementAt(i)))
+        {
+          selectedIndex = i;
+          fireContentsChanged(-1, -1);
+          return;
+        }
+      }
+    }
+    selectedIndex = -1;
+    fireContentsChanged(-1, -1);
+  }
+
+  /**
+   * Returns the selected index.
+   *
+   * @return The index.
+   */
+  public int getSelectedIndex ()
+  {
+    return selectedIndex;
+  }
+
+  /**
+   * Defines the selected index for this encoding model.
+   *
+   * @param index the selected index or -1 to clear the selection.
+   * @throws java.lang.IllegalArgumentException
+   *          if the given index is invalid.
+   */
+  public void setSelectedIndex (final int index)
+  {
+    if (index == -1)
+    {
+      selectedIndex = -1;
+      selectedObject = null;
+      fireContentsChanged(-1, -1);
+      return;
+    }
+    if (index < -1 || index >= getSize())
+    {
+      throw new IllegalArgumentException("Index is invalid.");
+    }
+    selectedIndex = index;
+    selectedObject = getElementAt(index);
+    fireContentsChanged(-1, -1);
+  }
+
+  /**
+   * Returns the selected encoding.
+   *
+   * @return The encoding (name).
+   */
+  public String getSelectedEncoding ()
+  {
+    if (selectedIndex == -1)
+    {
+      return null;
+    }
+    final EncodingCarrier ec = (EncodingCarrier) encodings.get(selectedIndex);
+    return ec.getName();
+  }
+
+  /**
+   * Returns the selected item.
+   *
+   * @return The selected item or <code>null</code> if there is no selection
+   */
+  public Object getSelectedItem ()
+  {
+    return selectedObject;
+  }
+
+  /**
+   * Returns the length of the list.
+   *
+   * @return the length of the list
+   */
+  public int getSize ()
+  {
+    return encodings.size();
+  }
+
+  /**
+   * Returns the value at the specified index.
+   *
+   * @param index the requested index
+   * @return the value at <code>index</code>
+   */
+  public Object getElementAt (final int index)
+  {
+    final EncodingCarrier ec = (EncodingCarrier) encodings.get(index);
+    return ec.getDisplayName();
+  }
+
+  /**
+   * Adds a listener to the list that's notified each time a change to the data model
+   * occurs.
+   *
+   * @param l the <code>ListDataListener</code> to be added
+   */
+  public void addListDataListener (final ListDataListener l)
+  {
+    if (listDataListeners == null)
+    {
+      listDataListeners = new ArrayList(5);
+    }
+    listDataListeners.add(l);
+  }
+
+  /**
+   * Removes a listener from the list that's notified each time a change to the data model
+   * occurs.
+   *
+   * @param l the <code>ListDataListener</code> to be removed
+   */
+  public void removeListDataListener (final ListDataListener l)
+  {
+    if (listDataListeners == null)
+    {
+      return;
+    }
+    listDataListeners.remove(l);
+  }
+
+  /**
+   * Creates a default model containing a selection of encodings.
+   *
+   * @return The default model.
+   */
+  public static EncodingComboBoxModel createDefaultModel (Locale locale)
+  {
+    final EncodingComboBoxModel ecb = new EncodingComboBoxModel(locale);
+
+    final String availEncs = getAvailableEncodings();
+    final boolean allEncodings =
+        availEncs.equalsIgnoreCase(AVAILABLE_ENCODINGS_ALL);
+
+    if (allEncodings || availEncs.equals(AVAILABLE_ENCODINGS_FILE))
+    {
+      final String encFile = getEncodingsDefinitionFile();
+      final InputStream in = ObjectUtilities.getResourceAsStream
+              (encFile, EncodingComboBoxModel.class);
+      if (in == null)
+      {
+        DebugLog.log
+                ("The specified encodings definition file was not found: " + encFile);
+      }
+      else
+      {
+        try
+        {
+//          final Properties defaultEncodings = getDefaultEncodings();
+          final Properties encDef = new Properties();
+          final BufferedInputStream bin = new BufferedInputStream(in);
+          encDef.load(bin);
+          bin.close();
+          final Enumeration en = encDef.keys();
+          while (en.hasMoreElements())
+          {
+            final String enc = (String) en.nextElement();
+            // if not set to "true"
+            if (encDef.getProperty(enc, "false").equalsIgnoreCase("true"))
+            {
+              // if the encoding is disabled ...
+              ecb.addEncoding (enc, ecb.getEncodingDescription(enc));
+            }
+          }
+        }
+        catch (IOException e)
+        {
+          DebugLog.log
+                  ("There was an error while reading the encodings definition file: " + encFile, e);
+        }
+      }
+    }
+    return ecb;
+  }
+
+  /**
+   * Returns the index of an encoding.
+   *
+   * @param encoding the encoding (name).
+   * @return The index.
+   */
+  public int indexOf (final String encoding)
+  {
+    return encodings.indexOf(new EncodingCarrier(encoding, null));
+  }
+
+  /**
+   * Returns an encoding.
+   *
+   * @param index the index.
+   * @return The index.
+   */
+  public String getEncoding (final int index)
+  {
+    final EncodingCarrier ec = (EncodingCarrier) encodings.get(index);
+    return ec.getName();
+  }
+
+  /**
+   * Returns a description.
+   *
+   * @param index the index.
+   * @return The description.
+   */
+  public String getDescription (final int index)
+  {
+    final EncodingCarrier ec = (EncodingCarrier) encodings.get(index);
+    return ec.getDescription();
+  }
+
+
+  /**
+   * Defines the loader settings for the available encodings shown to the user. The
+   * property defaults to AVAILABLE_ENCODINGS_ALL.
+   *
+   * @return either AVAILABLE_ENCODINGS_ALL, AVAILABLE_ENCODINGS_FILE or
+   *         AVAILABLE_ENCODINGS_NONE.
+   */
+  public static String getEncodingsDefinitionFile ()
+  {
+    return JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+            (ENCODINGS_DEFINITION_FILE, ENCODINGS_DEFINITION_FILE_DEFAULT);
+  }
+
+
+  /**
+   * Defines the loader settings for the available encodings shown to the user. The
+   * property defaults to AVAILABLE_ENCODINGS_ALL.
+   *
+   * @return either AVAILABLE_ENCODINGS_ALL, AVAILABLE_ENCODINGS_FILE or
+   *         AVAILABLE_ENCODINGS_NONE.
+   */
+  public static String getAvailableEncodings ()
+  {
+    return JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+            (AVAILABLE_ENCODINGS, AVAILABLE_ENCODINGS_ALL);
+  }
+
+  public void setSelectedEncoding (final String encoding)
+  {
+    if (encoding == null)
+    {
+      throw new NullPointerException();
+    }
+
+    final int size = encodings.size();
+    for (int i = 0; i < size; i++)
+    {
+      final EncodingCarrier carrier = (EncodingCarrier) encodings.get(i);
+      if (encoding.equals(carrier.getName()))
+      {
+        selectedIndex = i;
+        selectedObject = carrier.getDisplayName();
+        fireContentsChanged(-1, -1);
+        return;
+      }
+    }
+    // default fall-back to have a valid value ..
+    if (size > 0)
+    {
+      selectedIndex = 0;
+      selectedObject = getElementAt(0);
+      fireContentsChanged(-1, -1);
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ExceptionDialog.java b/source/org/jfree/report/modules/gui/swing/common/ExceptionDialog.java
new file mode 100644
index 0000000..7fdd516
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ExceptionDialog.java
@@ -0,0 +1,385 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExceptionDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.UIManager;
+
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.jfree.report.modules.gui.swing.common.action.ActionButton;
+
+/**
+ * The exception dialog is used to display an exception and the exceptions stacktrace to
+ * the user.
+ *
+ * @author Thomas Morgner
+ */
+public class ExceptionDialog extends JDialog
+{
+  /**
+   * OK action.
+   */
+  private final class OKAction extends AbstractAction
+  {
+    /**
+     * Default constructor.
+     */
+    private OKAction ()
+    {
+      putValue(NAME, UIManager.getDefaults().getString("OptionPane.okButtonText"));
+    }
+
+    /**
+     * Receives notification that an action event has occurred.
+     *
+     * @param event the action event.
+     */
+    public void actionPerformed (final ActionEvent event)
+    {
+      setVisible(false);
+    }
+  }
+
+  /**
+   * Details action.
+   */
+  private final class DetailsAction extends AbstractAction
+  {
+    /**
+     * Default constructor.
+     */
+    private DetailsAction ()
+    {
+      putValue(NAME, ">>");
+    }
+
+    /**
+     * Receives notification that an action event has occurred.
+     *
+     * @param event the action event.
+     */
+    public void actionPerformed (final ActionEvent event)
+    {
+      setScrollerVisible(!(isScrollerVisible()));
+      if (isScrollerVisible())
+      {
+        putValue(NAME, "<<");
+      }
+      else
+      {
+        putValue(NAME, ">>");
+      }
+      adjustSize();
+    }
+  }
+
+  /**
+   * A UI component for displaying the stack trace.
+   */
+  private final JTextArea backtraceArea;
+
+  /**
+   * A UI component for displaying the message.
+   */
+  private final JLabel messageLabel;
+
+  /**
+   * The exception.
+   */
+  private Exception currentEx;
+
+  /**
+   * An action associated with the 'Details' button.
+   */
+  private DetailsAction detailsAction;
+
+  /**
+   * A scroll pane.
+   */
+  private final JScrollPane scroller;
+
+  /**
+   * A filler panel.
+   */
+  private final JPanel filler;
+
+  /**
+   * The default dialog.
+   */
+  private static ExceptionDialog defaultDialog;
+
+  /**
+   * Creates a new ExceptionDialog.
+   */
+  public ExceptionDialog ()
+  {
+    setModal(true);
+    detailsAction = new DetailsAction();
+
+    messageLabel = new JLabel();
+    backtraceArea = new JTextArea();
+
+    scroller = new JScrollPane(backtraceArea);
+    scroller.setVisible(false);
+
+    final JPanel detailPane = new JPanel();
+    detailPane.setLayout(new GridBagLayout());
+    GridBagConstraints gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.CENTER;
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.weightx = 0;
+    gbc.weighty = 0;
+    gbc.gridx = 0;
+    gbc.gridy = 0;
+    final JLabel icon = new JLabel(UIManager.getDefaults().getIcon("OptionPane.errorIcon"));
+    icon.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+    detailPane.add(icon, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.weightx = 1;
+    gbc.weighty = 1;
+    gbc.gridx = 1;
+    gbc.gridy = 0;
+    detailPane.add(messageLabel);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.SOUTH;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 0;
+    gbc.weighty = 0;
+    gbc.gridx = 0;
+    gbc.gridy = 2;
+    gbc.gridwidth = 2;
+    detailPane.add(createButtonPane(), gbc);
+
+    filler = new JPanel();
+    filler.setPreferredSize(new Dimension(0, 0));
+    filler.setBackground(Color.green);
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.NORTH;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.weighty = 5;
+    gbc.gridx = 0;
+    gbc.gridy = 3;
+    gbc.gridwidth = 2;
+    detailPane.add(filler, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.SOUTHWEST;
+    gbc.fill = GridBagConstraints.BOTH;
+    gbc.weightx = 1;
+    gbc.weighty = 5;
+    gbc.gridx = 0;
+    gbc.gridy = 4;
+    gbc.gridwidth = 2;
+    detailPane.add(scroller, gbc);
+
+    setContentPane(detailPane);
+  }
+
+  /**
+   * Adjusts the size of the dialog to fit the with of the contained message and
+   * stacktrace.
+   */
+  public void adjustSize ()
+  {
+    final Dimension scSize = scroller.getPreferredSize();
+    final Dimension cbase = filler.getPreferredSize();
+    cbase.width = Math.max(scSize.width, cbase.width);
+    cbase.height = 0;
+    filler.setMinimumSize(cbase);
+    pack();
+
+  }
+
+  /**
+   * Defines, whether the scroll pane of the exception stack trace area is visible.
+   *
+   * @param b true, if the scroller should be visible, false otherwise.
+   */
+  protected void setScrollerVisible (final boolean b)
+  {
+    scroller.setVisible(b);
+  }
+
+  /**
+   * Checks, whether the scroll pane of the exception stack trace area is visible.
+   *
+   * @return true, if the scroller is visible, false otherwise.
+   */
+  protected boolean isScrollerVisible ()
+  {
+    return scroller.isVisible();
+  }
+
+  /**
+   * Initializes the buttonpane.
+   *
+   * @return a panel containing the 'OK' and 'Details' buttons.
+   */
+  private JPanel createButtonPane ()
+  {
+    final JPanel buttonPane = new JPanel();
+    buttonPane.setLayout(new FlowLayout(2));
+    buttonPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
+    final OKAction okAction = new OKAction();
+
+    final JButton ok = new ActionButton(okAction);
+    final JButton details = new ActionButton(detailsAction);
+
+    buttonPane.add(ok);
+    buttonPane.add(details);
+    return buttonPane;
+  }
+
+  /**
+   * Sets the message for this exception dialog. The message is displayed on the main
+   * page.
+   *
+   * @param mesg the message.
+   */
+  public void setMessage (final String mesg)
+  {
+    messageLabel.setText(mesg);
+  }
+
+  /**
+   * Returns the message for this exception dialog.   The message is displayed on the main
+   * page.
+   *
+   * @return the message.
+   */
+  public String getMessage ()
+  {
+    return messageLabel.getText();
+  }
+
+  /**
+   * Sets the exception for this dialog. If no exception is set, the "Detail" button is
+   * disabled and the stacktrace text cleared. Else the stacktraces text is read into the
+   * detail message area.
+   *
+   * @param e the exception.
+   */
+  public void setException (final Exception e)
+  {
+    currentEx = e;
+    if (e == null)
+    {
+      detailsAction.setEnabled(false);
+      backtraceArea.setText("");
+    }
+    else
+    {
+      backtraceArea.setText(readFromException(e));
+    }
+  }
+
+  /**
+   * Reads the stacktrace text from the exception.
+   *
+   * @param e the exception.
+   * @return the stack trace.
+   */
+  private String readFromException (final Exception e)
+  {
+    String text = "No backtrace available";
+    try
+    {
+      final StringWriter writer = new StringWriter();
+      final PrintWriter pwriter = new PrintWriter(writer);
+      e.printStackTrace(pwriter);
+      text = writer.toString();
+      writer.close();
+    }
+    catch (Exception ex)
+    {
+      DebugLog.log("ExceptionDialog: exception suppressed.");
+    }
+    return text;
+  }
+
+  /**
+   * Returns the exception that was the reason for this dialog to show up.
+   *
+   * @return the exception.
+   */
+  public Exception getException ()
+  {
+    return currentEx;
+  }
+
+  /**
+   * Shows an default dialog with the given message and title and the exceptions
+   * stacktrace in the detail area.
+   *
+   * @param title   the title.
+   * @param message the message.
+   * @param e       the exception.
+   */
+  public static void showExceptionDialog
+          (final String title, final String message, final Exception e)
+  {
+    if (defaultDialog == null)
+    {
+      defaultDialog = new ExceptionDialog();
+    }
+    if (e != null)
+    {
+      DebugLog.log("UserError", e);
+    }
+    defaultDialog.setTitle(title);
+    defaultDialog.setMessage(message);
+    defaultDialog.setException(e);
+    defaultDialog.adjustSize();
+    defaultDialog.setVisible(true);
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ExportActionPlugin.java b/source/org/jfree/report/modules/gui/swing/common/ExportActionPlugin.java
new file mode 100644
index 0000000..3900ba6
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ExportActionPlugin.java
@@ -0,0 +1,51 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExportActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.gui.swing.common;
+
+import org.jfree.report.flow.ReportJob;
+
+/**
+ * An export plug-in is a class that can work with the {@link ExportAction} class to
+ * implement an export function for reports.
+ *
+ * @author Thomas Morgner.
+ */
+public interface ExportActionPlugin extends ActionPlugin
+{
+  /**
+   * Exports a report.
+   *
+   * @param report the report.
+   * @return A boolean.
+   */
+  public boolean performExport (ReportJob job);
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ExportDialog.java b/source/org/jfree/report/modules/gui/swing/common/ExportDialog.java
new file mode 100644
index 0000000..5c8934b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ExportDialog.java
@@ -0,0 +1,47 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExportDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.common.GuiContext;
+
+/**
+ * Although this is no real dialog, this interface is meant to be implemented
+ * by dialogs (or anything else that behaves modal).
+ *
+ * @author Thomas Morgner
+ */
+public interface ExportDialog
+{
+  public boolean performQueryForExport(final ReportJob reportJob,
+                                       final GuiContext guiContext);
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/FormValidator.java b/source/org/jfree/report/modules/gui/swing/common/FormValidator.java
new file mode 100644
index 0000000..c0a491a
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/FormValidator.java
@@ -0,0 +1,200 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FormValidator.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+import javax.swing.JComboBox;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
+
+public abstract class FormValidator
+{
+
+  private class FormTextfieldListener
+          implements DocumentListener, PropertyChangeListener
+  {
+    public FormTextfieldListener ()
+    {
+    }
+
+    /**
+     * This method gets called when a bound property is changed.
+     *
+     * @param evt A PropertyChangeEvent object describing the event source and the
+     *            property that has changed.
+     */
+    public void propertyChange (final PropertyChangeEvent evt)
+    {
+      if (DOCUMENT_PROPERTY_NAME.equals(evt.getPropertyName()))
+      {
+        final Document olddoc = (Document) evt.getOldValue();
+        olddoc.removeDocumentListener(this);
+        final Document newdoc = (Document) evt.getOldValue();
+        newdoc.addDocumentListener(this);
+      }
+    }
+
+    /**
+     * Gives notification that an attribute or set of attributes changed.
+     *
+     * @param e the document event
+     */
+    public void changedUpdate (final DocumentEvent e)
+    {
+      handleValidate();
+    }
+
+    /**
+     * Gives notification that there was an insert into the document.  The range given by
+     * the DocumentEvent bounds the freshly inserted region.
+     *
+     * @param e the document event
+     */
+    public void insertUpdate (final DocumentEvent e)
+    {
+      handleValidate();
+    }
+
+    /**
+     * Gives notification that a portion of the document has been removed.  The range is
+     * given in terms of what the view last saw (that is, before updating sticky
+     * positions).
+     *
+     * @param e the document event
+     */
+    public void removeUpdate (final DocumentEvent e)
+    {
+      handleValidate();
+    }
+  }
+
+  private class FormActionListener implements ActionListener
+  {
+    public FormActionListener ()
+    {
+    }
+
+    /**
+     * Invoked when an action occurs.
+     */
+    public void actionPerformed (final ActionEvent e)
+    {
+      handleValidate();
+    }
+  }
+
+  private class FormItemListener implements ItemListener
+  {
+    public FormItemListener ()
+    {
+    }
+
+    /**
+     * Invoked when an item has been selected or deselected by the user. The code written
+     * for this method performs the operations that need to occur when an item is selected
+     * (or deselected).
+     */
+    public void itemStateChanged (final ItemEvent e)
+    {
+      handleValidate();
+    }
+  }
+
+  private FormTextfieldListener formTextfieldListener;
+  private FormActionListener actionListener;
+  private static final String DOCUMENT_PROPERTY_NAME = "document";
+  private FormItemListener itemListener;
+  private boolean enabled;
+
+  protected FormValidator ()
+  {
+    this.formTextfieldListener = new FormTextfieldListener();
+    this.actionListener = new FormActionListener();
+    this.itemListener = new FormItemListener();
+  }
+
+  public void registerTextField (final JTextComponent textField)
+  {
+    textField.getDocument().addDocumentListener(formTextfieldListener);
+    textField.addPropertyChangeListener(DOCUMENT_PROPERTY_NAME, formTextfieldListener);
+  }
+
+  public void registerButton (final AbstractButton bt)
+  {
+    bt.addActionListener(actionListener);
+  }
+
+  public void registerComboBox (final JComboBox bt)
+  {
+    bt.addItemListener(itemListener);
+  }
+
+  public abstract Action getConfirmAction ();
+
+  protected final void handleValidate ()
+  {
+    final Action confirmAction = getConfirmAction();
+    if (confirmAction == null || enabled == false)
+    {
+      return;
+    }
+
+    if (performValidate() == false)
+    {
+      confirmAction.setEnabled(false);
+    }
+    else
+    {
+      confirmAction.setEnabled(true);
+    }
+  }
+
+  public boolean isEnabled ()
+  {
+    return enabled;
+  }
+
+  public void setEnabled (final boolean enabled)
+  {
+    this.enabled = enabled;
+  }
+
+  public abstract boolean performValidate ();
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/JStatusBar.java b/source/org/jfree/report/modules/gui/swing/common/JStatusBar.java
new file mode 100644
index 0000000..1eec82d
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/JStatusBar.java
@@ -0,0 +1,191 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JStatusBar.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.IllegalComponentStateException;
+import java.util.Locale;
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
+
+import org.jfree.report.modules.gui.common.DefaultIconTheme;
+import org.jfree.report.modules.gui.common.IconTheme;
+
+public class JStatusBar extends JComponent
+{
+  public static final int TYPE_ERROR = 3;
+  public static final int TYPE_WARNING = 2;
+  public static final int TYPE_INFORMATION = 1;
+  public static final int TYPE_NONE = 0;
+
+  private JComponent otherComponents;
+  private JLabel statusHolder;
+  private IconTheme iconTheme;
+  private int statusType;
+
+  public JStatusBar()
+  {
+    this(new DefaultIconTheme());
+  }
+
+  public JStatusBar (final IconTheme theme)
+  {
+    setLayout(new BorderLayout());
+    setBorder(BorderFactory.createMatteBorder
+            (1, 0, 0, 0, UIManager.getDefaults().getColor("controlShadow")));
+    statusHolder = new JLabel(" ");
+    statusHolder.setMinimumSize(new Dimension(0, 20));
+    add(statusHolder, BorderLayout.CENTER);
+
+    otherComponents = new JPanel();
+    add(otherComponents, BorderLayout.EAST);
+    this.iconTheme = theme;
+  }
+
+  protected IconTheme getIconTheme()
+  {
+    return iconTheme;
+  }
+
+  public void setIconTheme(final IconTheme iconTheme)
+  {
+    IconTheme oldTheme = this.iconTheme;
+    this.iconTheme = iconTheme;
+    firePropertyChange("iconTheme", oldTheme, iconTheme);
+
+    if (iconTheme == null)
+    {
+      statusHolder.setIcon(null);
+    }
+    else
+    {
+      updateTypeIcon(getStatusType());
+    }
+  }
+
+  public JComponent getExtensionArea ()
+  {
+    return otherComponents;
+  }
+
+  public int getStatusType()
+  {
+    return statusType;
+  }
+
+  public String getStatusText()
+  {
+    return statusHolder.getText();
+  }
+
+  public void setStatusText (String text)
+  {
+    final String oldText = statusHolder.getText();
+    this.statusHolder.setText(text);
+    firePropertyChange("statusText", oldText, text);
+  }
+
+  public void setStatusType (int type)
+  {
+    int oldType = statusType;
+    this.statusType = type;
+    firePropertyChange("statusType", oldType, type);
+    updateTypeIcon(type);
+  }
+
+  public void setStatus (final int type, final String text)
+  {
+    this.statusType = type;
+    updateTypeIcon(type);
+    statusHolder.setText(text);
+  }
+
+  private void updateTypeIcon(final int type)
+  {
+    if (iconTheme != null)
+    {
+      if (type == TYPE_ERROR)
+      {
+        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.errorIcon");
+        statusHolder.setIcon(res);
+      }
+      else if (type == TYPE_WARNING)
+      {
+        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.warningIcon");
+        statusHolder.setIcon(res);
+      }
+      else if (type == TYPE_INFORMATION)
+      {
+        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.informationIcon");
+        statusHolder.setIcon(res);
+      }
+      else
+      {
+        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.otherIcon");
+        statusHolder.setIcon(res);
+      }
+    }
+  }
+
+  public void clear ()
+  {
+    setStatus(TYPE_NONE, " ");
+  }
+
+  /**
+   * Gets the locale of this component.
+   *
+   * @return this component's locale; if this component does not have a locale,
+   *         the locale of its parent is returned
+   * @throws java.awt.IllegalComponentStateException
+   *          if the <code>Component</code> does not have its own locale and has
+   *          not yet been added to a containment hierarchy such that the locale
+   *          can be determined from the containing parent
+   * @see #setLocale
+   * @since JDK1.1
+   */
+  public Locale getLocale()
+  {
+    try
+    {
+      return super.getLocale();
+    }
+    catch(IllegalComponentStateException ice)
+    {
+      return Locale.getDefault();
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/KeyedComboBoxModel.java b/source/org/jfree/report/modules/gui/swing/common/KeyedComboBoxModel.java
new file mode 100644
index 0000000..dd77ae1
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/KeyedComboBoxModel.java
@@ -0,0 +1,481 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * KeyedComboBoxModel.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.util.ArrayList;
+import javax.swing.ComboBoxModel;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+/**
+ * The KeyedComboBox model allows to define an internal key (the data element)
+ * for every entry in the model.
+ * <p/>
+ * This class is usefull in all cases, where the public text differs from the
+ * internal view on the data. A separation between presentation data and
+ * processing data is a prequesite for localizing combobox entries. This model
+ * does not allow selected elements, which are not in the list of valid
+ * elements.
+ *
+ * @author Thomas Morgner
+ */
+public class KeyedComboBoxModel implements ComboBoxModel
+{
+
+  /**
+   * The internal data carrier to map keys to values and vice versa.
+   */
+  private static class ComboBoxItemPair
+  {
+    /**
+     * The key.
+     */
+    private Object key;
+    /**
+     * The value for the key.
+     */
+    private Object value;
+
+    /**
+     * Creates a new item pair for the given key and value. The value can be
+     * changed later, if needed.
+     *
+     * @param key   the key
+     * @param value the value
+     */
+    public ComboBoxItemPair(final Object key, final Object value)
+    {
+      this.key = key;
+      this.value = value;
+    }
+
+    /**
+     * Returns the key.
+     *
+     * @return the key.
+     */
+    public Object getKey()
+    {
+      return key;
+    }
+
+    /**
+     * Returns the value.
+     *
+     * @return the value for this key.
+     */
+    public Object getValue()
+    {
+      return value;
+    }
+
+    /**
+     * Redefines the value stored for that key.
+     *
+     * @param value the new value.
+     */
+    public void setValue(final Object value)
+    {
+      this.value = value;
+    }
+  }
+
+  /**
+   * The index of the selected item.
+   */
+  private int selectedItemIndex;
+  private Object selectedItemValue;
+  /**
+   * The data (contains ComboBoxItemPairs).
+   */
+  private ArrayList data;
+  /**
+   * The listeners.
+   */
+  private ArrayList listdatalistener;
+  /**
+   * The cached listeners as array.
+   */
+  private transient ListDataListener[] tempListeners;
+  private boolean allowOtherValue;
+
+  /**
+   * Creates a new keyed combobox model.
+   */
+  public KeyedComboBoxModel()
+  {
+    data = new ArrayList();
+    listdatalistener = new ArrayList();
+  }
+
+  /**
+   * Creates a new keyed combobox model for the given keys and values. Keys
+   * and values must have the same number of items.
+   *
+   * @param keys   the keys
+   * @param values the values
+   */
+  public KeyedComboBoxModel(final Object[] keys, final Object[] values)
+  {
+    this();
+    setData(keys, values);
+  }
+
+  /**
+   * Replaces the data in this combobox model. The number of keys must be
+   * equals to the number of values.
+   *
+   * @param keys   the keys
+   * @param values the values
+   */
+  public void setData(final Object[] keys, final Object[] values)
+  {
+    if (values.length != keys.length)
+    {
+      throw new IllegalArgumentException("Values and text must have the same length.");
+    }
+
+    data.clear();
+    data.ensureCapacity(keys.length);
+
+    for (int i = 0; i < values.length; i++)
+    {
+      add(keys[i], values[i]);
+    }
+
+    selectedItemIndex = -1;
+    final ListDataEvent evt = new ListDataEvent
+        (this, ListDataEvent.CONTENTS_CHANGED, 0, data.size() - 1);
+    fireListDataEvent(evt);
+  }
+
+  /**
+   * Notifies all registered list data listener of the given event.
+   *
+   * @param evt the event.
+   */
+  protected synchronized void fireListDataEvent(final ListDataEvent evt)
+  {
+    if (tempListeners == null)
+    {
+      tempListeners = (ListDataListener[]) listdatalistener.toArray
+          (new ListDataListener[listdatalistener.size()]);
+    }
+
+    final ListDataListener[] listeners = tempListeners;
+    for (int i = 0; i < listeners.length; i++)
+    {
+      final ListDataListener l = listeners[i];
+      l.contentsChanged(evt);
+    }
+  }
+
+  /**
+   * Returns the selected item.
+   *
+   * @return The selected item or <code>null</code> if there is no selection
+   */
+  public Object getSelectedItem()
+  {
+    return selectedItemValue;
+  }
+
+  /**
+   * Defines the selected key. If the object is not in the list of values, no
+   * item gets selected.
+   *
+   * @param anItem the new selected item.
+   */
+  public void setSelectedKey(final Object anItem)
+  {
+    if (anItem == null)
+    {
+      selectedItemIndex = -1;
+      selectedItemValue = null;
+    }
+    else
+    {
+      final int newSelectedItem = findDataElementIndex(anItem);
+      if (newSelectedItem == -1)
+      {
+        selectedItemIndex = -1;
+        selectedItemValue = null;
+      }
+      else
+      {
+        selectedItemIndex = newSelectedItem;
+        selectedItemValue = getElementAt(selectedItemIndex);
+      }
+    }
+    fireListDataEvent(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, -1, -1));
+  }
+
+  /**
+   * Set the selected item. The implementation of this  method should notify
+   * all registered <code>ListDataListener</code>s that the contents have
+   * changed.
+   *
+   * @param anItem the list object to select or <code>null</code> to clear the
+   *               selection
+   */
+  public void setSelectedItem(final Object anItem)
+  {
+    if (anItem == null)
+    {
+      selectedItemIndex = -1;
+      selectedItemValue = null;
+    }
+    else
+    {
+      final int newSelectedItem = findElementIndex(anItem);
+      if (newSelectedItem == -1)
+      {
+        if (isAllowOtherValue())
+        {
+          selectedItemIndex = -1;
+          selectedItemValue = anItem;
+        }
+        else
+        {
+          selectedItemIndex = -1;
+          selectedItemValue = null;
+        }
+      }
+      else
+      {
+        selectedItemIndex = newSelectedItem;
+        selectedItemValue = getElementAt(selectedItemIndex);
+      }
+    }
+    fireListDataEvent(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, -1, -1));
+  }
+
+  private boolean isAllowOtherValue()
+  {
+    return allowOtherValue;
+  }
+
+  public void setAllowOtherValue(final boolean allowOtherValue)
+  {
+    this.allowOtherValue = allowOtherValue;
+  }
+
+  /**
+   * Adds a listener to the list that's notified each time a change to the data
+   * model occurs.
+   *
+   * @param l the <code>ListDataListener</code> to be added
+   */
+  public synchronized void addListDataListener(final ListDataListener l)
+  {
+    if (l == null)
+    {
+      throw new NullPointerException();
+    }
+    listdatalistener.add(l);
+    tempListeners = null;
+  }
+
+  /**
+   * Returns the value at the specified index.
+   *
+   * @param index the requested index
+   * @return the value at <code>index</code>
+   */
+  public Object getElementAt(final int index)
+  {
+    if (index >= data.size())
+    {
+      return null;
+    }
+
+    final ComboBoxItemPair datacon = (ComboBoxItemPair) data.get(index);
+    if (datacon == null)
+    {
+      return null;
+    }
+    return datacon.getValue();
+  }
+
+  /**
+   * Returns the key from the given index.
+   *
+   * @param index the index of the key.
+   * @return the the key at the specified index.
+   */
+  public Object getKeyAt(final int index)
+  {
+    if (index >= data.size())
+    {
+      return null;
+    }
+
+    if (index < 0)
+    {
+      return null;
+    }
+
+    final ComboBoxItemPair datacon = (ComboBoxItemPair) data.get(index);
+    if (datacon == null)
+    {
+      return null;
+    }
+    return datacon.getKey();
+  }
+
+  /**
+   * Returns the selected data element or null if none is set.
+   *
+   * @return the selected data element.
+   */
+  public Object getSelectedKey()
+  {
+    return getKeyAt(selectedItemIndex);
+  }
+
+  /**
+   * Returns the length of the list.
+   *
+   * @return the length of the list
+   */
+  public int getSize()
+  {
+    return data.size();
+  }
+
+  /**
+   * Removes a listener from the list that's notified each time a change to
+   * the data model occurs.
+   *
+   * @param l the <code>ListDataListener</code> to be removed
+   */
+  public void removeListDataListener(final ListDataListener l)
+  {
+    listdatalistener.remove(l);
+    tempListeners = null;
+  }
+
+  /**
+   * Searches an element by its data value. This method is called by the
+   * setSelectedItem method and returns the first occurence of the element.
+   *
+   * @param anItem the item
+   * @return the index of the item or -1 if not found.
+   */
+  private int findDataElementIndex(final Object anItem)
+  {
+    if (anItem == null)
+    {
+      throw new NullPointerException("Item to find must not be null");
+    }
+
+    for (int i = 0; i < data.size(); i++)
+    {
+      final ComboBoxItemPair datacon = (ComboBoxItemPair) data.get(i);
+      if (anItem.equals(datacon.getKey()))
+      {
+        return i;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * Tries to find the index of element with the given key. The key must not
+   * be null.
+   *
+   * @param key the key for the element to be searched.
+   * @return the index of the key, or -1 if not found.
+   */
+  public int findElementIndex(final Object key)
+  {
+    if (key == null)
+    {
+      throw new NullPointerException("Item to find must not be null");
+    }
+
+    for (int i = 0; i < data.size(); i++)
+    {
+      final ComboBoxItemPair datacon = (ComboBoxItemPair) data.get(i);
+      if (key.equals(datacon.getValue()))
+      {
+        return i;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * Removes an entry from the model.
+   *
+   * @param key the key
+   */
+  public void removeDataElement(final Object key)
+  {
+    final int idx = findDataElementIndex(key);
+    if (idx == -1)
+    {
+      return;
+    }
+
+    data.remove(idx);
+    final ListDataEvent evt = new ListDataEvent
+        (this, ListDataEvent.INTERVAL_REMOVED, idx, idx);
+    fireListDataEvent(evt);
+  }
+
+  /**
+   * Adds a new entry to the model.
+   *
+   * @param key    the key
+   * @param cbitem the display value.
+   */
+  public void add(final Object key, final Object cbitem)
+  {
+    final ComboBoxItemPair con = new ComboBoxItemPair(key, cbitem);
+    data.add(con);
+    final ListDataEvent evt = new ListDataEvent
+        (this, ListDataEvent.INTERVAL_ADDED, data.size() - 2, data.size() - 2);
+    fireListDataEvent(evt);
+  }
+
+  /**
+   * Removes all entries from the model.
+   */
+  public void clear()
+  {
+    final int size = getSize();
+    data.clear();
+    final ListDataEvent evt = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 0, size - 1);
+    fireListDataEvent(evt);
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ReportProgressBar.java b/source/org/jfree/report/modules/gui/swing/common/ReportProgressBar.java
new file mode 100644
index 0000000..2adfe29
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ReportProgressBar.java
@@ -0,0 +1,166 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportProgressBar.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
+
+import org.jfree.report.event.ReportProgressEvent;
+import org.jfree.report.event.ReportProgressListener;
+import org.jfree.report.modules.gui.common.GuiCommonModule;
+
+public class ReportProgressBar extends JProgressBar
+{
+  private class ScreenUpdateRunnable implements Runnable
+  {
+    private int page;
+    private int activity;
+    private int currentRow;
+
+    public ScreenUpdateRunnable (final int activity,
+                                 final int currentRow,
+                                 final int page)
+    {
+      this.activity = activity;
+      this.currentRow = currentRow;
+      this.page = page;
+    }
+
+    public void run ()
+    {
+      //updatePassMessage(activity, currentRow, page);
+      setValue(currentRow);
+    }
+  }
+
+  private class ReportProgressHandler implements ReportProgressListener
+  {
+    public ReportProgressHandler()
+    {
+    }
+
+    public void reportProcessingStarted(ReportProgressEvent event)
+    {
+      postUpdate(event);
+    }
+
+    public void reportProcessingUpdate(ReportProgressEvent event)
+    {
+      postUpdate(event);
+    }
+
+    public void reportProcessingFinished(ReportProgressEvent event)
+    {
+      postUpdate(event);
+    }
+
+    private void postUpdate (ReportProgressEvent event)
+    {
+      final ScreenUpdateRunnable runnable = new ScreenUpdateRunnable
+              (event.getActivity(), event.getRow(), event.getPage());
+      if (SwingUtilities.isEventDispatchThread())
+      {
+        runnable.run();
+      }
+      else
+      {
+        SwingUtilities.invokeLater(runnable);
+      }
+    }
+  }
+
+  /**
+   * The reuseable message format for the page label.
+   */
+  private MessageFormat pageMessageFormatter;
+  /**
+   * The reuseable message format for the pass label.
+   */
+  private MessageFormat currentRowFormatter;
+  /**
+   * a text which describes the layouting process.
+   */
+  private String layoutText;
+  /**
+   * a text that describes the export phase of the report processing.
+   */
+  private String outputText;
+
+  /**
+   * Localised resources.
+   */
+  private ResourceBundle resources;
+
+  /**
+   * Creates a horizontal progress bar that displays a border but no progress string. The
+   * initial and minimum values are 0, and the maximum is 100.
+   *
+   * @see #setOrientation
+   * @see #setBorderPainted
+   * @see #setStringPainted
+   * @see #setString
+   * @see #setIndeterminate
+   */
+  public ReportProgressBar (Locale locale)
+  {
+    setLocale(locale);
+    initialize();
+  }
+
+  /**
+   * Creates a horizontal progress bar that displays a border but no progress
+   * string. The initial and minimum values are 0, and the maximum is 100.
+   *
+   * @see #setOrientation
+   * @see #setBorderPainted
+   * @see #setStringPainted
+   * @see #setString
+   * @see #setIndeterminate
+   */
+  public ReportProgressBar()
+  {
+    setLocale(Locale.getDefault());
+    initialize();
+  }
+
+  private void initialize()
+  {
+    resources = ResourceBundle.getBundle(GuiCommonModule.RESOURCE_BASE_NAME);
+    pageMessageFormatter = new MessageFormat
+        (resources.getString("progress-dialog.page-label"));
+    currentRowFormatter = new MessageFormat
+        (resources.getString("progress-dialog.current-row-label"));
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/ReportProgressDialog.java b/source/org/jfree/report/modules/gui/swing/common/ReportProgressDialog.java
new file mode 100644
index 0000000..5c840fb
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/ReportProgressDialog.java
@@ -0,0 +1,531 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportProgressDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
+import javax.swing.border.EmptyBorder;
+
+import org.jfree.report.event.ReportProgressEvent;
+import org.jfree.report.event.ReportProgressListener;
+import org.jfree.report.modules.gui.common.GuiCommonModule;
+
+
+/**
+ * A progress monitor dialog component that visualizes the report processing progress. It
+ * will receive update events from the report processors and updates the UI according to
+ * the latest event data.
+ * <p/>
+ * The progress will be computed according to the currently processed table row. This
+ * approach provides relativly accurate data, but assumes that processing all bands
+ * consumes roughly the same time.
+ *
+ * @author Thomas Morgner
+ */
+public class ReportProgressDialog extends JDialog
+{
+  private class ScreenUpdateRunnable implements Runnable
+  {
+    private int page;
+    private int activity;
+    private int currentRow;
+
+    public ScreenUpdateRunnable (final int activity,
+                                 final int currentRow,
+                                 final int page)
+    {
+      this.activity = activity;
+      this.currentRow = currentRow;
+      this.page = page;
+    }
+
+    public void run ()
+    {
+      // todo
+    }
+  }
+
+  private class ReportProgressHandler implements ReportProgressListener
+  {
+    public ReportProgressHandler()
+    {
+    }
+
+    public void reportProcessingStarted(ReportProgressEvent event)
+    {
+      postUpdate(event);
+    }
+
+    public void reportProcessingUpdate(ReportProgressEvent event)
+    {
+      postUpdate(event);
+    }
+
+    public void reportProcessingFinished(ReportProgressEvent event)
+    {
+      postUpdate(event);
+    }
+
+    private void postUpdate (ReportProgressEvent event)
+    {
+      final ScreenUpdateRunnable runnable = new ScreenUpdateRunnable
+              (event.getActivity(), event.getRow(), event.getPage());
+      if (SwingUtilities.isEventDispatchThread())
+      {
+        runnable.run();
+      }
+      else
+      {
+        SwingUtilities.invokeLater(runnable);
+      }
+    }
+  }
+
+  private static class ToFrontHandler extends WindowAdapter
+  {
+    public ToFrontHandler()
+    {
+    }
+
+    /**
+     * Invoked when a window has been opened.
+     */
+    public void windowOpened (final WindowEvent e)
+    {
+      e.getWindow().toFront();
+    }
+  }
+
+  /**
+   * A label that carries the global message that describes the current task.
+   */
+  private JLabel messageCarrier;
+  /**
+   * A label containing the report processing pass count.
+   */
+  private JLabel passCountMessage;
+  /**
+   * A label containing the current page.
+   */
+  private JLabel pageCountMessage;
+  /**
+   * A label containing the currently processed row.
+   */
+  private JLabel rowCountMessage;
+  /**
+   * The progress bar that is used to visualize the progress.
+   */
+  private JProgressBar progressBar;
+  /**
+   * The reuseable message format for the page label.
+   */
+  private MessageFormat pageMessageFormatter;
+  /**
+   * The reuseable message format for the rows label.
+   */
+  private MessageFormat rowsMessageFormatter;
+  /**
+   * The reuseable message format for the pass label.
+   */
+  private MessageFormat passMessageFormatter;
+
+  /**
+   * The last page received.
+   */
+  private int lastPage;
+  /**
+   * The last pass values received.
+   */
+  private int lastPass;
+  /**
+   * The last max-row received.
+   */
+  private int lastMaxRow;
+  /**
+   * the cached value for the max-row value as integer.
+   */
+  private Integer lastMaxRowInteger;  // this values doesnt change much, so reduce GC work
+  /**
+   * a text which describes the layouting process.
+   */
+  private String layoutText;
+  /**
+   * a text that describes the export phase of the report processing.
+   */
+  private String outputText;
+
+
+  /**
+   * Localised resources.
+   */
+  private ResourceBundle resources;
+
+  /**
+   * Creates a non-modal dialog without a title and with the specified Dialog owner.
+   *
+   * @param dialog the owner of the dialog
+   */
+  public ReportProgressDialog (final Dialog dialog)
+  {
+    super(dialog);
+    setLocale(dialog.getLocale());
+    initConstructor();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title and with the specified Frame owner.
+   *
+   * @param frame the owner of the dialog
+   */
+  public ReportProgressDialog (final Frame frame)
+  {
+    super(frame);
+    setLocale(frame.getLocale());
+    initConstructor();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title and without a specified Frame owner.  A
+   * shared, hidden frame will be set as the owner of the Dialog.
+   */
+  public ReportProgressDialog ()
+  {
+    initConstructor();
+  }
+
+  /**
+   * Initializes the dialog (Non-GUI stuff).
+   */
+  private void initConstructor ()
+  {
+    resources = ResourceBundle.getBundle
+        (GuiCommonModule.RESOURCE_BASE_NAME, getLocale());
+    initialize();
+    addWindowListener(new ToFrontHandler());
+
+    setOutputText(resources.getString("progress-dialog.perform-output"));
+    setLayoutText(resources.getString("progress-dialog.prepare-layout"));
+
+    lastPass = -1;
+    lastMaxRow = -1;
+    lastPage = -1;
+  }
+
+  /**
+   * Initializes the GUI components of this dialog.
+   */
+  private void initialize ()
+  {
+    final JPanel contentPane = new JPanel();
+    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+    contentPane.setLayout(new GridBagLayout());
+
+    pageMessageFormatter = new MessageFormat(resources.getString("progress-dialog.page-label"));
+    rowsMessageFormatter = new MessageFormat(resources.getString("progress-dialog.rows-label"));
+    passMessageFormatter = new MessageFormat(resources.getString("progress-dialog.pass-label"));
+
+    messageCarrier = new JLabel(" ");
+    passCountMessage = new JLabel(" ");
+    rowCountMessage = new JLabel(" ");
+    pageCountMessage = new JLabel(" ");
+    progressBar = new JProgressBar();
+
+    GridBagConstraints gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridy = 0;
+    gbc.gridwidth = 2;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.insets = new Insets(3, 1, 5, 1);
+    gbc.ipadx = 200;
+    contentPane.add(messageCarrier, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridy = 1;
+    gbc.gridwidth = 2;
+    gbc.anchor = GridBagConstraints.SOUTHWEST;
+    gbc.insets = new Insets(3, 1, 1, 1);
+    contentPane.add(passCountMessage, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridy = 2;
+    gbc.gridwidth = 2;
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.insets = new Insets(3, 1, 1, 1);
+    contentPane.add(progressBar, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridy = 3;
+    gbc.gridwidth = 1;
+    gbc.weighty = 1;
+    gbc.anchor = GridBagConstraints.NORTHWEST;
+    gbc.insets = new Insets(3, 1, 1, 1);
+    contentPane.add(pageCountMessage, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 1;
+    gbc.gridy = 3;
+    gbc.gridwidth = 1;
+    gbc.anchor = GridBagConstraints.NORTHWEST;
+    gbc.insets = new Insets(3, 10, 1, 1);
+    gbc.weightx = 1;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    contentPane.add(rowCountMessage, gbc);
+
+    setContentPane(contentPane);
+  }
+
+  /**
+   * Returns the current message.
+   *
+   * @return the current global message.
+   */
+  public String getMessage ()
+  {
+    return messageCarrier.getText();
+  }
+
+  /**
+   * Defines the current message.
+   *
+   * @param message the current global message.
+   */
+  public void setMessage (final String message)
+  {
+    messageCarrier.setText(message);
+  }
+
+  /**
+   * Updates the page message label if the current page has changed.
+   *
+   * @param page the new page parameter.
+   */
+  protected void updatePageMessage (final int page)
+  {
+    if (lastPage != page)
+    {
+      final Object[] parameters = new Object[]{new Integer(page)};
+      pageCountMessage.setText(pageMessageFormatter.format(parameters));
+      lastPage = page;
+    }
+  }
+
+  /**
+   * Updates the rows message label if either the rows or maxrows changed.
+   *
+   * @param rows    the currently processed rows.
+   * @param maxRows the maximum number of rows in the report.
+   */
+  protected void updateRowsMessage (final int rows, final int maxRows)
+  {
+    if (maxRows != lastMaxRow)
+    {
+      lastMaxRowInteger = new Integer(maxRows);
+      lastMaxRow = maxRows;
+    }
+    final Object[] parameters = new Object[]{
+      new Integer(rows),
+      lastMaxRowInteger
+    };
+    rowCountMessage.setText(rowsMessageFormatter.format(parameters));
+  }
+
+  /**
+   * Updates the pass message label if either the pass or prepare state changed. The pass
+   * reflects the current processing level, one level for every function dependency
+   * level.
+   *
+   * @param pass    the current reporting pass.
+   * @param prepare true, if the current run is a prepare run, false otherwise.
+   */
+  protected void updatePassMessage (final int pass, final boolean prepare)
+  {
+    if (lastPass != pass)
+    {
+      lastPass = pass;
+      if (pass >= 0)
+      {
+        final Object[] parameters = new Object[]{new Integer(pass)};
+        passCountMessage.setText(passMessageFormatter.format(parameters));
+      }
+      else
+      {
+        final String message;
+        if (prepare)
+        {
+          message = getLayoutText();
+        }
+        else
+        {
+          message = getOutputText();
+        }
+        passCountMessage.setText(message);
+      }
+    }
+  }
+
+  /**
+   * Returns the current pass message component.
+   *
+   * @return the pass message component.
+   */
+  protected final JLabel getPassCountMessage ()
+  {
+    return passCountMessage;
+  }
+
+  /**
+   * Returns the current pagecount message component.
+   *
+   * @return the page message component.
+   */
+  protected final JLabel getPageCountMessage ()
+  {
+    return pageCountMessage;
+  }
+
+  /**
+   * Returns the current row message component.
+   *
+   * @return the row message component.
+   */
+  protected final JLabel getRowCountMessage ()
+  {
+    return rowCountMessage;
+  }
+
+  /**
+   * Returns the current pass message component.
+   *
+   * @return the pass message component.
+   */
+  protected final MessageFormat getPageMessageFormatter ()
+  {
+    return pageMessageFormatter;
+  }
+
+  /**
+   * Returns the current pass message component.
+   *
+   * @return the pass message component.
+   */
+  protected final MessageFormat getRowsMessageFormatter ()
+  {
+    return rowsMessageFormatter;
+  }
+
+  /**
+   * Returns the current pass message component.
+   *
+   * @return the pass message component.
+   */
+  protected final MessageFormat getPassMessageFormatter ()
+  {
+    return passMessageFormatter;
+  }
+
+  /**
+   * Returns the output text message. This text describes the export phases of the report
+   * processing.
+   *
+   * @return the output phase description.
+   */
+  public String getOutputText ()
+  {
+    return outputText;
+  }
+
+  /**
+   * Defines the output text message. This text describes the export phases of the report
+   * processing.
+   *
+   * @param outputText the output message.
+   */
+  public void setOutputText (final String outputText)
+  {
+    if (outputText == null)
+    {
+      throw new NullPointerException("OutputText must not be null.");
+    }
+    this.outputText = outputText;
+  }
+
+  /**
+   * Returns the layout text. This text describes the prepare phases of the report
+   * processing.
+   *
+   * @return the layout text.
+   */
+  public String getLayoutText ()
+  {
+    return layoutText;
+  }
+
+  /**
+   * Defines the layout text message. This text describes the prepare phases of the report
+   * processing.
+   *
+   * @param layoutText the layout message.
+   */
+  public void setLayoutText (final String layoutText)
+  {
+    if (layoutText == null)
+    {
+      throw new NullPointerException("LayoutText must not be null.");
+    }
+    this.layoutText = layoutText;
+  }
+
+  protected boolean isSameMaxRow (int row)
+  {
+    return lastMaxRow == row;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/SwingCommonModule.java b/source/org/jfree/report/modules/gui/swing/common/SwingCommonModule.java
new file mode 100644
index 0000000..130cdd7
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/SwingCommonModule.java
@@ -0,0 +1,69 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SwingCommonModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 17.11.2006, 14:40:24
+ *
+ * @author Thomas Morgner
+ */
+public class SwingCommonModule extends AbstractModule
+{
+  public static final String BUNDLE_NAME =
+      "org.jfree.report.modules.gui.swing.common.resources";
+  public static final String LARGE_ICON_PROPERTY = "Icon24";
+
+  public SwingCommonModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/SwingGuiContext.java b/source/org/jfree/report/modules/gui/swing/common/SwingGuiContext.java
new file mode 100644
index 0000000..62fd880
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/SwingGuiContext.java
@@ -0,0 +1,46 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SwingGuiContext.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Window;
+
+import org.jfree.report.modules.gui.common.GuiContext;
+
+/**
+ * Creation-Date: 16.11.2006, 17:11:37
+ *
+ * @author Thomas Morgner
+ */
+public interface SwingGuiContext extends GuiContext
+{
+  public Window getWindow();
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/SwingUtil.java b/source/org/jfree/report/modules/gui/swing/common/SwingUtil.java
new file mode 100644
index 0000000..0274e2b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/SwingUtil.java
@@ -0,0 +1,204 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SwingUtil.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Component;
+import java.awt.Window;
+import java.awt.Point;
+import java.awt.GraphicsEnvironment;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.Rectangle;
+import java.awt.Dialog;
+import java.awt.Container;
+import java.lang.reflect.Method;
+
+/**
+ * Creation-Date: 20.11.2006, 22:42:21
+ *
+ * @author Thomas Morgner
+ */
+public class SwingUtil
+{
+  private SwingUtil()
+  {
+  }
+
+
+  /**
+   * Computes the center point of the current screen device. If this method is called on JDK 1.4, Xinerama-aware results
+   * are returned. (See Sun-Bug-ID 4463949 for details).
+   *
+   * @return the center point of the current screen.
+   */
+  public static Point getCenterPoint()
+  {
+    final GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
+    try
+    {
+      final Method method = GraphicsEnvironment.class.getMethod("getCenterPoint", (Class[]) null);
+      return (Point) method.invoke(localGraphicsEnvironment, (Object[]) null);
+    }
+    catch (Exception e)
+    {
+      // ignore ... will fail if this is not a JDK 1.4 ..
+    }
+
+    final Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
+    return new Point(s.width / 2, s.height / 2);
+  }
+
+  /**
+   * Computes the maximum bounds of the current screen device. If this method is called on JDK 1.4, Xinerama-aware
+   * results are returned. (See Sun-Bug-ID 4463949 for details).
+   *
+   * @return the maximum bounds of the current screen.
+   */
+  public static Rectangle getMaximumWindowBounds()
+  {
+    final GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
+    try
+    {
+      final Method method = GraphicsEnvironment.class.getMethod("getMaximumWindowBounds", (Class[]) null);
+      return (Rectangle) method.invoke(localGraphicsEnvironment, (Object[]) null);
+    }
+    catch (Exception e)
+    {
+      // ignore ... will fail if this is not a JDK 1.4 ..
+    }
+
+    final Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
+    return new Rectangle(0, 0, s.width, s.height);
+  }
+
+  /**
+   * Positions the specified frame in the middle of the screen.
+   *
+   * @param frame the frame to be centered on the screen.
+   */
+  public static void centerFrameOnScreen(final Window frame)
+  {
+    positionFrameOnScreen(frame, 0.5, 0.5);
+  }
+
+  /**
+   * Positions the specified frame at a relative position in the screen, where 50% is considered to be the center of the
+   * screen.
+   *
+   * @param frame             the frame.
+   * @param horizontalPercent the relative horizontal position of the frame (0.0 to 1.0, where 0.5 is the center of the
+   *                          screen).
+   * @param verticalPercent   the relative vertical position of the frame (0.0 to 1.0, where 0.5 is the center of the
+   *                          screen).
+   */
+  public static void positionFrameOnScreen(final Window frame,
+                                           final double horizontalPercent,
+                                           final double verticalPercent)
+  {
+
+    final Rectangle s = getMaximumWindowBounds();
+    final Dimension f = frame.getSize();
+    final int w = Math.max(s.width - f.width, 0);
+    final int h = Math.max(s.height - f.height, 0);
+    final int x = (int) (horizontalPercent * w) + s.x;
+    final int y = (int) (verticalPercent * h) + s.y;
+    frame.setBounds(x, y, f.width, f.height);
+
+  }
+
+  /**
+   * Positions the specified frame at a random location on the screen while ensuring that the entire frame is visible
+   * (provided that the frame is smaller than the screen).
+   *
+   * @param frame the frame.
+   */
+  public static void positionFrameRandomly(final Window frame)
+  {
+    positionFrameOnScreen(frame, Math.random(), Math.random());
+  }
+
+  /**
+   * Positions the specified dialog within its parent.
+   *
+   * @param dialog the dialog to be positioned on the screen.
+   */
+  public static void centerDialogInParent(final Dialog dialog)
+  {
+    positionDialogRelativeToParent(dialog, 0.5, 0.5);
+  }
+
+  /**
+   * Positions the specified dialog at a position relative to its parent.
+   *
+   * @param dialog            the dialog to be positioned.
+   * @param horizontalPercent the relative location.
+   * @param verticalPercent   the relative location.
+   */
+  public static void positionDialogRelativeToParent(final Dialog dialog,
+                                                    final double horizontalPercent,
+                                                    final double verticalPercent)
+  {
+    final Dimension d = dialog.getSize();
+    final Container parent = dialog.getParent();
+    final Dimension p = parent.getSize();
+
+    final int baseX = parent.getX() - d.width;
+    final int baseY = parent.getY() - d.height;
+    final int w = d.width + p.width;
+    final int h = d.height + p.height;
+    int x = baseX + (int) (horizontalPercent * w);
+    int y = baseY + (int) (verticalPercent * h);
+
+    // make sure the dialog fits completely on the screen...
+    final Rectangle s = getMaximumWindowBounds();
+    x = Math.min(x, (s.width - d.width));
+    x = Math.max(x, 0);
+    y = Math.min(y, (s.height - d.height));
+    y = Math.max(y, 0);
+
+    dialog.setBounds(x + s.x, y + s.y, d.width, d.height);
+
+  }
+
+  public static Window getWindowAncestor(Component component)
+  {
+    while (component instanceof Window == false)
+    {
+      if (component == null)
+      {
+        return null;
+      }
+      component = component.getParent();
+    }
+    return (Window) component;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/WindowSizeLimiter.java b/source/org/jfree/report/modules/gui/swing/common/WindowSizeLimiter.java
new file mode 100644
index 0000000..b79cbb8
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/WindowSizeLimiter.java
@@ -0,0 +1,91 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: WindowSizeLimiter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+
+/**
+ * A small helper class to limit the maximum size of an element to the elements maximum
+ * size. If the element is resized, the defined maximum size is enforced on the element.
+ *
+ * @author Thomas Morgner
+ */
+public class WindowSizeLimiter extends ComponentAdapter
+{
+  /**
+   * The current source.
+   */
+  private Object currentSource;
+
+  /**
+   * Default-Constructor.
+   */
+  public WindowSizeLimiter()
+  {
+
+  }
+
+  /**
+   * Invoked when the component's size changes.
+   *
+   * @param e the event.
+   */
+  public void componentResized (final ComponentEvent e)
+  {
+    if (e.getSource() == currentSource)
+    {
+      return;
+    }
+
+    if (e.getSource() instanceof Component)
+    {
+      currentSource = e.getSource();
+      final Component c = (Component) e.getSource();
+      final Dimension d = c.getMaximumSize();
+      final Dimension s = c.getSize();
+      if (s.width > d.width)
+      {
+        s.width = d.width;
+      }
+      if (s.height > d.height)
+      {
+        s.height = d.height;
+      }
+      c.setSize(s);
+      currentSource = null;
+    }
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/action/AbstractActionDowngrade.java b/source/org/jfree/report/modules/gui/swing/common/action/AbstractActionDowngrade.java
new file mode 100644
index 0000000..28a9d53
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/action/AbstractActionDowngrade.java
@@ -0,0 +1,65 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * AbstractActionDowngrade.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common.action;
+
+import javax.swing.AbstractAction;
+
+import org.jfree.report.modules.gui.swing.common.action.ActionDowngrade;
+
+/**
+ * A class that allows Action features introduced in JDK 1.3 to be used with JDK 1.2.2, by
+ * defining the two new constants introduced by Sun in JDK 1.3.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractActionDowngrade extends AbstractAction implements ActionDowngrade {
+    // kills a compile error for JDK's >= 1.3
+    // ambiguous reference error ...
+    /**
+     * The key used for storing a <code>KeyStroke</code> to be used as the
+     * accelerator for the action.
+     */
+    public static final String ACCELERATOR_KEY = ActionDowngrade.ACCELERATOR_KEY;
+
+    /**
+     * The key used for storing an int key code to be used as the mnemonic
+     * for the action.
+     */
+    public static final String MNEMONIC_KEY = ActionDowngrade.MNEMONIC_KEY;
+
+    /**
+     * Creates a new action with a default (transparent) icon.
+     */
+    protected AbstractActionDowngrade() {
+        // nothing required
+    }
+    
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/action/AbstractFileSelectionAction.java b/source/org/jfree/report/modules/gui/swing/common/action/AbstractFileSelectionAction.java
new file mode 100644
index 0000000..fd97b9c
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/action/AbstractFileSelectionAction.java
@@ -0,0 +1,136 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * AbstractFileSelectionAction.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+package org.jfree.report.modules.gui.swing.common.action;
+
+import java.awt.Component;
+import java.io.File;
+import javax.swing.JFileChooser;
+
+import org.pentaho.reporting.libraries.base.util.FilesystemFilter;
+import org.pentaho.reporting.libraries.base.util.StringUtils;
+import org.jfree.report.modules.gui.swing.common.action.AbstractActionDowngrade;
+
+/**
+ * A base class for all file operations. This implementation provides all methods
+ * to let the user select a file.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class AbstractFileSelectionAction extends AbstractActionDowngrade
+{
+    /**
+     * The FileChooser that is used to perform the selection.
+     */
+    private JFileChooser fileChooser;
+    /**
+     * The (optional) parent component.
+     */
+    private Component parent;
+
+    /**
+     * Creates a new FileSelectionAction with the given optional parent component
+     * as parent for the file chooser dialog.
+     *
+     * @param parent the parent
+     */
+    public AbstractFileSelectionAction(final Component parent) {
+        this.parent = parent;
+    }
+
+    /**
+     * Returns the file extension that should be used for the operation.
+     *
+     * @return the file extension.
+     */
+    protected abstract String getFileExtension();
+
+    /**
+     * Returns a descriptive text describing the file extension.
+     *
+     * @return the file description.
+     */
+    protected abstract String getFileDescription();
+
+    /**
+     * Returns the working directory that should be used when initializing
+     * the FileChooser.
+     *
+     * @return the working directory.
+     */
+    protected File getCurrentDirectory() {
+        return new File(".");
+    }
+
+    /**
+     * Selects a file to use as target for the operation.
+     *
+     * @param selectedFile    the selected file.
+     * @param dialogType  the dialog type.
+     * @param appendExtension true, if the file extension should be added if
+     *                        necessary, false if the unmodified filename should be used.
+     * 
+     * @return the selected and approved file or null, if the user canceled
+     *         the operation
+     */
+    protected File performSelectFile(final File selectedFile,
+                                     final int dialogType,
+                                     final boolean appendExtension) {
+        if (this.fileChooser == null) {
+            this.fileChooser = createFileChooser();
+        }
+
+        this.fileChooser.setSelectedFile(selectedFile);
+        this.fileChooser.setDialogType(dialogType);
+        final int option = this.fileChooser.showDialog(this.parent, null);
+        if (option == JFileChooser.APPROVE_OPTION) {
+            final File selFile = this.fileChooser.getSelectedFile();
+            String selFileName = selFile.getAbsolutePath();
+            if (StringUtils.endsWithIgnoreCase(selFileName, getFileExtension()) == false) {
+                selFileName = selFileName + getFileExtension();
+            }
+            return new File(selFileName);
+        }
+        return null;
+    }
+
+    /**
+     * Creates the file chooser.
+     *
+     * @return the initialized file chooser.
+     */
+    protected JFileChooser createFileChooser() {
+        final JFileChooser fc = new JFileChooser();
+        fc.addChoosableFileFilter(new FilesystemFilter(getFileExtension(), getFileDescription()));
+        fc.setMultiSelectionEnabled(false);
+        fc.setCurrentDirectory(getCurrentDirectory());
+        return fc;
+    }
+    
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/action/ActionButton.java b/source/org/jfree/report/modules/gui/swing/common/action/ActionButton.java
new file mode 100644
index 0000000..81e5c55
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/action/ActionButton.java
@@ -0,0 +1,296 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * ActionButton.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common.action;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.KeyStroke;
+import javax.swing.JComponent;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.report.modules.gui.swing.common.action.ActionDowngrade;
+
+/**
+ * The ActionButton is used to connect an Action and its properties to a Button. This functionality is already
+ * implemented in JDK 1.3 but needed for JDK 1.2.2 compatibility.
+ *
+ * @author Thomas Morgner
+ */
+public class ActionButton extends JButton
+{
+  private static final Log logger = LogFactory.getLog(ActionButton.class);
+
+  /**
+   * The action.
+   */
+  private Action action;
+
+  /**
+   * The property change handler.
+   */
+  private ActionEnablePropertyChangeHandler propertyChangeHandler;
+
+  /**
+   * Helperclass to handle the property change event raised by the action. Changed properties in the action will
+   * affect the button.
+   */
+  private class ActionEnablePropertyChangeHandler implements PropertyChangeListener
+  {
+
+    /**
+     * Default constructor.
+     */
+    public ActionEnablePropertyChangeHandler()
+    {
+    }
+
+    /**
+     * Receives notification of a property change event.
+     *
+     * @param event the property change event.
+     */
+    public void propertyChange(final PropertyChangeEvent event)
+    {
+      try
+      {
+        if ("enabled".equals(event.getPropertyName()))
+        {
+          setEnabled(getAction().isEnabled());
+        }
+        else if (event.getPropertyName().equals(Action.SMALL_ICON))
+        {
+          setIcon((Icon) getAction().getValue(Action.SMALL_ICON));
+        }
+        else if (event.getPropertyName().equals(Action.NAME))
+        {
+          setText((String) getAction().getValue
+              (Action.NAME));
+        }
+        else if (event.getPropertyName().equals(Action.SHORT_DESCRIPTION))
+        {
+          ActionButton.this.setToolTipText((String)
+              getAction().getValue(Action.SHORT_DESCRIPTION));
+        }
+
+        final Action ac = getAction();
+        if (event.getPropertyName().equals(ActionDowngrade.ACCELERATOR_KEY))
+        {
+          final KeyStroke oldVal = (KeyStroke) event.getOldValue();
+          if (oldVal != null)
+          {
+            unregisterKeyboardAction(oldVal);
+          }
+          final Object o = ac.getValue(ActionDowngrade.ACCELERATOR_KEY);
+          if (o instanceof KeyStroke)
+          {
+            final KeyStroke k = (KeyStroke) o;
+            registerKeyboardAction(ac, k, JComponent.WHEN_IN_FOCUSED_WINDOW);
+          }
+        }
+        else if (event.getPropertyName().equals(ActionDowngrade.MNEMONIC_KEY))
+        {
+          final Object o = ac.getValue(ActionDowngrade.MNEMONIC_KEY);
+          if (o != null)
+          {
+            if (o instanceof Character)
+            {
+              final Character c = (Character) o;
+              setMnemonic(c.charValue());
+            }
+            else if (o instanceof Integer)
+            {
+              final Integer c = (Integer) o;
+              setMnemonic(c.intValue());
+            }
+          }
+        }
+      }
+      catch (Exception e)
+      {
+        ActionButton.logger.warn("Error on PropertyChange in ActionButton: ", e);
+      }
+    }
+  }
+
+  /**
+   * Creates a Button without any text and without an assigned Action.
+   */
+  public ActionButton()
+  {
+    super();
+  }
+
+  /**
+   * Creates a Button and set the given text as label.
+   *
+   * @param text the label for the new button.
+   */
+  public ActionButton(final String text)
+  {
+    super(text);
+  }
+
+  /**
+   * Creates an ActionButton and sets the given text and icon on the button.
+   *
+   * @param text the label for the new button.
+   * @param icon the icon for the button.
+   */
+  public ActionButton(final String text, final Icon icon)
+  {
+    super(text, icon);
+  }
+
+
+  /**
+   * Creates an ActionButton and sets the given icon on the button.
+   *
+   * @param icon the icon for the button.
+   */
+  public ActionButton(final Icon icon)
+  {
+    super(icon);
+  }
+
+  /**
+   * Nreates an ActionButton and assigns the given action with the button.
+   *
+   * @param action the action.
+   */
+  public ActionButton(final Action action)
+  {
+    setAction(action);
+  }
+
+  /**
+   * Returns the assigned action or null if no action has been assigned.
+   *
+   * @return the action (possibly null).
+   */
+  public Action getAction()
+  {
+    return this.action;
+  }
+
+
+  /**
+   * Returns and initializes the PropertyChangehandler for this ActionButton. The PropertyChangeHandler monitors the
+   * action and updates the button if necessary.
+   *
+   * @return the property change handler.
+   */
+  private ActionEnablePropertyChangeHandler getPropertyChangeHandler()
+  {
+    if (this.propertyChangeHandler == null)
+    {
+      this.propertyChangeHandler = new ActionEnablePropertyChangeHandler();
+    }
+    return this.propertyChangeHandler;
+  }
+
+  /**
+   * Enables and disables this button and if an action is assigned to this button the propertychange is forwarded to
+   * the assigned action.
+   *
+   * @param b the new enable-state of this button
+   */
+  public void setEnabled(final boolean b)
+  {
+    super.setEnabled(b);
+    if (getAction() != null)
+    {
+      getAction().setEnabled(b);
+    }
+  }
+
+  /**
+   * Assigns the given action to this button. The properties of the action will be assigned to the button. If an
+   * previous action was set, the old action is unregistered.
+   * <p/>
+   * <ul> <li>NAME - specifies the button text <li>SMALL_ICON - specifies the buttons icon <li>MNEMONIC_KEY -
+   * specifies the buttons mnemonic key <li>ACCELERATOR_KEY - specifies the buttons accelerator </ul>
+   *
+   * @param newAction the new action
+   */
+  public void setAction(final Action newAction)
+  {
+    final Action oldAction = getAction();
+    if (oldAction != null)
+    {
+      removeActionListener(oldAction);
+      oldAction.removePropertyChangeListener(getPropertyChangeHandler());
+
+      final Object o = oldAction.getValue(ActionDowngrade.ACCELERATOR_KEY);
+      if (o instanceof KeyStroke)
+      {
+        final KeyStroke k = (KeyStroke) o;
+        unregisterKeyboardAction(k);
+      }
+    }
+    this.action = newAction;
+    if (this.action != null)
+    {
+      addActionListener(newAction);
+      newAction.addPropertyChangeListener(getPropertyChangeHandler());
+
+      setText((String) (newAction.getValue(Action.NAME)));
+      setToolTipText((String) (newAction.getValue(Action.SHORT_DESCRIPTION)));
+      setIcon((Icon) newAction.getValue(Action.SMALL_ICON));
+      setEnabled(this.action.isEnabled());
+
+      Object o = newAction.getValue(ActionDowngrade.MNEMONIC_KEY);
+      if (o != null)
+      {
+        if (o instanceof Character)
+        {
+          final Character c = (Character) o;
+          setMnemonic(c.charValue());
+        }
+        else if (o instanceof Integer)
+        {
+          final Integer c = (Integer) o;
+          setMnemonic(c.intValue());
+        }
+      }
+      o = newAction.getValue(ActionDowngrade.ACCELERATOR_KEY);
+      if (o instanceof KeyStroke)
+      {
+        final KeyStroke k = (KeyStroke) o;
+        registerKeyboardAction(newAction, k, JComponent.WHEN_IN_FOCUSED_WINDOW);
+      }
+    }
+  }
+}
+
diff --git a/source/org/jfree/report/modules/gui/swing/common/action/ActionDowngrade.java b/source/org/jfree/report/modules/gui/swing/common/action/ActionDowngrade.java
new file mode 100644
index 0000000..219d0c0
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/action/ActionDowngrade.java
@@ -0,0 +1,54 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * ActionDowngrade.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common.action;
+
+import javax.swing.Action;
+
+/**
+ * Defines the 2 new constants introduced by Sun in version 1.3 of the J2SDK.
+ *
+ * @author Thomas Morgner
+ */
+public interface ActionDowngrade extends Action {
+
+    /**
+     * The key used for storing a <code>KeyStroke</code> to be used as the
+     * accelerator for the action.
+     */
+    public static final String ACCELERATOR_KEY = "AcceleratorKey";
+
+    /**
+     * The key used for storing an int key code to be used as the mnemonic
+     * for the action.
+     */
+    public static final String MNEMONIC_KEY = "MnemonicKey";
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/action/ActionMenuItem.java b/source/org/jfree/report/modules/gui/swing/common/action/ActionMenuItem.java
new file mode 100644
index 0000000..3b032fe
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/action/ActionMenuItem.java
@@ -0,0 +1,293 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * ActionMenuItem.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common.action;
+
+import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JMenuItem;
+import javax.swing.KeyStroke;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.report.modules.gui.swing.common.action.ActionDowngrade;
+
+/**
+ * The ActionMenuItem is used to connect an Action and its properties to an
+ * MenuItem.
+ * <p/>
+ * This functionality is already implemented in JDK 1.3 but needed for JDK 1.2.2
+ * compatibility.
+ *
+ * @author Thomas Morgner
+ */
+public class ActionMenuItem extends JMenuItem
+{
+  private static final Log logger = LogFactory.getLog(ActionMenuItem.class);
+
+  /** The action. */
+  private Action action;
+
+  /** The property change handler. */
+  private ActionEnablePropertyChangeHandler propertyChangeHandler;
+
+  /**
+   * Helperclass to handle the property change event raised by the action.
+   * Changed properties in the action will affect the button.
+   */
+  private class ActionEnablePropertyChangeHandler
+          implements PropertyChangeListener
+  {
+    public ActionEnablePropertyChangeHandler()
+    {
+    }
+
+    /**
+     * Receives notification of a property change event.
+     *
+     * @param event the property change event.
+     */
+    public void propertyChange(final PropertyChangeEvent event)
+    {
+      try
+      {
+        if ("enabled".equals(event.getPropertyName()))
+        {
+          setEnabled(getAction().isEnabled());
+        }
+        else if (event.getPropertyName().equals(Action.SMALL_ICON))
+        {
+          setIcon((Icon) getAction().getValue(Action.SMALL_ICON));
+        }
+        else if (event.getPropertyName().equals(Action.NAME))
+        {
+          setText((String) getAction().getValue(Action.NAME));
+        }
+        else if (event.getPropertyName().equals(Action.SHORT_DESCRIPTION))
+        {
+          ActionMenuItem.this.setToolTipText((String)
+                  getAction().getValue(Action.SHORT_DESCRIPTION));
+        }
+
+        final Action ac = getAction();
+        if (event.getPropertyName().equals(ActionDowngrade.ACCELERATOR_KEY))
+        {
+          setAccelerator((KeyStroke) ac.getValue(ActionDowngrade.ACCELERATOR_KEY));
+        }
+        else if (event.getPropertyName().equals(ActionDowngrade.MNEMONIC_KEY))
+        {
+          final Object o = ac.getValue(ActionDowngrade.MNEMONIC_KEY);
+          if (o != null)
+          {
+            if (o instanceof Character)
+            {
+              final Character c = (Character) o;
+              setMnemonic(c.charValue());
+            }
+            else if (o instanceof Integer)
+            {
+              final Integer c = (Integer) o;
+              setMnemonic(c.intValue());
+            }
+          }
+          else
+          {
+            setMnemonic(KeyEvent.VK_UNDEFINED);
+          }
+        }
+      }
+      catch (Exception e)
+      {
+        ActionMenuItem.logger.warn("Error on PropertyChange in ActionButton: ", e);
+      }
+    }
+  }
+
+  /** Default constructor. */
+  public ActionMenuItem()
+  {
+    // nothing required
+  }
+
+  /**
+   * Creates a menu item with the specified icon.
+   *
+   * @param icon the icon.
+   */
+  public ActionMenuItem(final Icon icon)
+  {
+    super(icon);
+  }
+
+  /**
+   * Creates a menu item with the specified label.
+   *
+   * @param text the label.
+   */
+  public ActionMenuItem(final String text)
+  {
+    super(text);
+  }
+
+  /**
+   * Creates a menu item with the specified label and icon.
+   *
+   * @param text the label.
+   * @param icon the icon.
+   */
+  public ActionMenuItem(final String text, final Icon icon)
+  {
+    super(text, icon);
+  }
+
+  /**
+   * Creates a new menu item with the specified label and mnemonic.
+   *
+   * @param text the label.
+   * @param i    the mnemonic.
+   */
+  public ActionMenuItem(final String text, final int i)
+  {
+    super(text, i);
+  }
+
+  /**
+   * Creates a new menu item based on the specified action.
+   *
+   * @param action the action.
+   */
+  public ActionMenuItem(final Action action)
+  {
+    setAction(action);
+  }
+
+  /**
+   * Returns the assigned action or null if no action has been assigned.
+   *
+   * @return the action.
+   */
+  public Action getAction()
+  {
+    return this.action;
+  }
+
+  /**
+   * Returns and initializes the PropertyChangehandler for this ActionMenuItem.
+   * The PropertyChangeHandler monitors the action and updates the menuitem if
+   * necessary.
+   *
+   * @return the property change handler.
+   */
+  private ActionEnablePropertyChangeHandler getPropertyChangeHandler()
+  {
+    if (this.propertyChangeHandler == null)
+    {
+      this.propertyChangeHandler = new ActionEnablePropertyChangeHandler();
+    }
+    return this.propertyChangeHandler;
+  }
+
+  /**
+   * Enables and disables this button and if an action is assigned to this
+   * menuitem the propertychange is forwarded to the assigned action.
+   *
+   * @param b the new enable-state of this menuitem
+   */
+  public void setEnabled(final boolean b)
+  {
+    super.setEnabled(b);
+    if (getAction() != null)
+    {
+      getAction().setEnabled(b);
+    }
+  }
+
+  /**
+   * Assigns the given action to this menuitem. The properties of the action
+   * will be assigned to the menuitem. If an previous action was set, the old
+   * action is unregistered.
+   * <p/>
+   * <ul> <li>NAME - specifies the menuitem text <li>SMALL_ICON - specifies the
+   * menuitems icon <li>MNEMONIC_KEY - specifies the menuitems mnemonic key
+   * <li>ACCELERATOR_KEY - specifies the menuitems accelerator </ul>
+   *
+   * @param newAction the new action
+   */
+  public void setAction(final Action newAction)
+  {
+    final Action oldAction = getAction();
+    if (oldAction != null)
+    {
+      removeActionListener(oldAction);
+      oldAction.removePropertyChangeListener(getPropertyChangeHandler());
+      setAccelerator(null);
+    }
+    this.action = newAction;
+    if (this.action != null)
+    {
+      addActionListener(newAction);
+      newAction.addPropertyChangeListener(getPropertyChangeHandler());
+
+      setText((String) (newAction.getValue(Action.NAME)));
+      setToolTipText((String) (newAction.getValue(Action.SHORT_DESCRIPTION)));
+      setIcon((Icon) newAction.getValue(Action.SMALL_ICON));
+      setEnabled(this.action.isEnabled());
+
+      Object o = newAction.getValue(ActionDowngrade.MNEMONIC_KEY);
+      if (o != null)
+      {
+        if (o instanceof Character)
+        {
+          final Character c = (Character) o;
+          setMnemonic(c.charValue());
+        }
+        else if (o instanceof Integer)
+        {
+          final Integer c = (Integer) o;
+          setMnemonic(c.intValue());
+        }
+      }
+      else
+      {
+        setMnemonic(KeyEvent.VK_UNDEFINED);
+      }
+
+
+      o = newAction.getValue(ActionDowngrade.ACCELERATOR_KEY);
+      if (o instanceof KeyStroke)
+      {
+        setAccelerator((KeyStroke) o);
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/action/ActionRadioButton.java b/source/org/jfree/report/modules/gui/swing/common/action/ActionRadioButton.java
new file mode 100644
index 0000000..710b4b0
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/action/ActionRadioButton.java
@@ -0,0 +1,293 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * ActionRadioButton.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common.action;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JRadioButton;
+import javax.swing.KeyStroke;
+import javax.swing.JComponent;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.report.modules.gui.swing.common.action.ActionDowngrade;
+
+/**
+ * The ActionRadioButton is used to connect an Action and its properties to a JRadioButton.
+ * This functionality is already implemented in JDK 1.3 but needed for JDK 1.2.2 compatibility.
+ *
+ * @author Thomas Morgner
+ */
+public class ActionRadioButton extends JRadioButton
+{
+  private static final Log logger = LogFactory.getLog(ActionRadioButton.class);
+
+  /** The action. */
+  private Action action;
+
+  /** The property change handler. */
+  private ActionEnablePropertyChangeHandler propertyChangeHandler;
+
+  /**
+   * Helperclass to handle the property change event raised by the action. Changed properties in
+   * the action will affect the button.
+   */
+  private class ActionEnablePropertyChangeHandler implements PropertyChangeListener
+  {
+    private ActionEnablePropertyChangeHandler()
+    {
+    }
+
+    /**
+     * Receives notification of a property change event.
+     *
+     * @param event  the property change event.
+     */
+    public void propertyChange(final PropertyChangeEvent event)
+    {
+      try
+      {
+        if ("enabled".equals(event.getPropertyName()))
+        {
+          setEnabled(getAction().isEnabled());
+        }
+        else if (event.getPropertyName().equals(Action.SMALL_ICON))
+        {
+          setIcon((Icon) getAction().getValue(Action.SMALL_ICON));
+        }
+        else if (event.getPropertyName().equals(Action.NAME))
+        {
+          setText((String) getAction().getValue
+              (Action.NAME));
+        }
+        else if (event.getPropertyName().equals(Action.SHORT_DESCRIPTION))
+        {
+          ActionRadioButton.this.setToolTipText((String)
+              getAction().getValue(Action.SHORT_DESCRIPTION));
+        }
+
+        final Action ac = getAction();
+        if (event.getPropertyName().equals(ActionDowngrade.ACCELERATOR_KEY))
+        {
+          final KeyStroke oldVal = (KeyStroke) event.getOldValue();
+          if (oldVal != null)
+          {
+            unregisterKeyboardAction
+                (oldVal);
+          }
+          final Object o = ac.getValue(ActionDowngrade.ACCELERATOR_KEY);
+          if (o instanceof KeyStroke)
+          {
+            final KeyStroke k = (KeyStroke) o;
+            registerKeyboardAction(ac, k, JComponent.WHEN_IN_FOCUSED_WINDOW);
+          }
+        }
+        else if (event.getPropertyName().equals(ActionDowngrade.MNEMONIC_KEY))
+        {
+          final Object o = ac.getValue(ActionDowngrade.MNEMONIC_KEY);
+          if (o != null)
+          {
+            if (o instanceof Character)
+            {
+              final Character c = (Character) o;
+              setMnemonic(c.charValue());
+            }
+            else if (o instanceof Integer)
+            {
+              final Integer c = (Integer) o;
+              setMnemonic(c.intValue());
+            }
+          }
+        }
+      }
+      catch (Exception e)
+      {
+        ActionRadioButton.logger.warn("Error on PropertyChange in ActionButton: ", e);
+      }
+    }
+  }
+
+  /**
+   * Creates a Button without any text and without an assigned Action.
+   */
+  public ActionRadioButton()
+  {
+    super();
+  }
+
+  /**
+   * Creates a Button and set the given text as label.
+   *
+   * @param text  the label for the new button.
+   */
+  public ActionRadioButton(final String text)
+  {
+    super(text);
+  }
+
+  /**
+   * Creates an ActionButton and sets the given text and icon on the button.
+   *
+   * @param text  the label for the new button.
+   * @param icon  the icon for the button.
+   */
+  public ActionRadioButton(final String text, final Icon icon)
+  {
+    super(text, icon);
+  }
+
+
+  /**
+   * Creates an ActionButton and sets the given icon on the button.
+   *
+   * @param icon  the icon for the button.
+   */
+  public ActionRadioButton(final Icon icon)
+  {
+    super(icon);
+  }
+
+  /**
+   * Nreates an ActionButton and assigns the given action with the button.
+   *
+   * @param action  the action.
+   */
+  public ActionRadioButton(final Action action)
+  {
+    setAction(action);
+  }
+
+  /**
+   * Returns the assigned action or null if no action has been assigned.
+   *
+   * @return the action (possibly null).
+   */
+  public Action getAction()
+  {
+    return this.action;
+  }
+
+
+  /**
+   * Returns and initializes the PropertyChangehandler for this ActionButton.
+   * The PropertyChangeHandler monitors the action and updates the button if necessary.
+   *
+   * @return the property change handler.
+   */
+  private ActionEnablePropertyChangeHandler getPropertyChangeHandler()
+  {
+    if (this.propertyChangeHandler == null)
+    {
+        this.propertyChangeHandler = new ActionEnablePropertyChangeHandler();
+    }
+    return this.propertyChangeHandler;
+  }
+
+  /**
+   * Enables and disables this button and if an action is assigned to this button the
+   * propertychange is forwarded to the assigned action.
+   *
+   * @param b the new enable-state of this button
+   */
+  public void setEnabled(final boolean b)
+  {
+    super.setEnabled(b);
+    if (getAction() != null)
+    {
+      getAction().setEnabled(b);
+    }
+  }
+
+  /**
+   * Assigns the given action to this button. The properties of the action will be assigned to
+   * the button. If an previous action was set, the old action is unregistered.
+   * <p>
+   * <ul>
+   * <li>NAME - specifies the button text
+   * <li>SMALL_ICON - specifies the buttons icon
+   * <li>MNEMONIC_KEY - specifies the buttons mnemonic key
+   * <li>ACCELERATOR_KEY - specifies the buttons accelerator
+   * </ul>
+   *
+   * @param newAction the new action
+   */
+  public void setAction(final Action newAction)
+  {
+    final Action oldAction = getAction();
+    if (oldAction != null)
+    {
+      removeActionListener(oldAction);
+      oldAction.removePropertyChangeListener(getPropertyChangeHandler());
+
+      final Object o = oldAction.getValue(ActionDowngrade.ACCELERATOR_KEY);
+      if (o instanceof KeyStroke)
+      {
+        final KeyStroke k = (KeyStroke) o;
+        unregisterKeyboardAction(k);
+      }
+    }
+    this.action = newAction;
+    if (this.action != null)
+    {
+      addActionListener(newAction);
+      newAction.addPropertyChangeListener(getPropertyChangeHandler());
+
+      setText((String) (newAction.getValue(Action.NAME)));
+      setToolTipText((String) (newAction.getValue(Action.SHORT_DESCRIPTION)));
+      setIcon((Icon) newAction.getValue(Action.SMALL_ICON));
+      setEnabled(this.action.isEnabled());
+
+      Object o = newAction.getValue(ActionDowngrade.MNEMONIC_KEY);
+      if (o != null)
+      {
+        if (o instanceof Character)
+        {
+          final Character c = (Character) o;
+          setMnemonic(c.charValue());
+        }
+        else if (o instanceof Integer)
+        {
+          final Integer c = (Integer) o;
+          setMnemonic(c.intValue());
+        }
+      }
+      o = newAction.getValue(ActionDowngrade.ACCELERATOR_KEY);
+      if (o instanceof KeyStroke)
+      {
+        final KeyStroke k = (KeyStroke) o;
+        registerKeyboardAction(newAction, k, JComponent.WHEN_IN_FOCUSED_WINDOW);
+      }
+    }
+  }
+}
+
diff --git a/source/org/jfree/report/modules/gui/swing/common/action/DowngradeActionMap.java b/source/org/jfree/report/modules/gui/swing/common/action/DowngradeActionMap.java
new file mode 100644
index 0000000..f2da7a2
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/action/DowngradeActionMap.java
@@ -0,0 +1,182 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * DowngradeActionMap.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.common.action;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import javax.swing.Action;
+
+/**
+ * An actionmap, which is JDK 1.2.2 compatible.
+ * <p>
+ * This implementation does not implement the ActionMap interface of
+ * JDK 1.3 or higher to maintain the compatibility with JDK 1.2 which
+ * does not know this interface.
+ * <p>
+ * The usage is still the same.
+ *
+ * @author Thomas Morger
+ */
+public class DowngradeActionMap {
+
+    /** A map containing the key to action mapping. */
+    private final HashMap actionMap;
+  
+    /** A list containing the actionkeys in their order of addition. */
+    private final ArrayList actionList;
+  
+    /** The parent of this action map. */
+    private DowngradeActionMap parent;
+
+    /**
+     * Default Constructor. Creates a new empty map.
+     */
+    public DowngradeActionMap() {
+        this.actionMap = new HashMap();
+        this.actionList = new ArrayList();
+    }
+
+    /**
+     * Sets this <code>ActionMap</code>'s parent.
+     *
+     * @param map  the <code>ActionMap</code> that is the parent of this one
+     */
+    public void setParent(final DowngradeActionMap map) {
+        this.parent = map;
+    }
+
+    /**
+     * Returns this <code>ActionMap</code>'s parent.
+     *
+     * @return the <code>ActionMap</code> that is the parent of this one,
+     *         or null if this <code>ActionMap</code> has no parent
+     */
+    public DowngradeActionMap getParent() {
+        return this.parent;
+    }
+
+    /**
+     * Adds a binding for <code>key</code> to <code>action</code>.
+     * If <code>action</code> is null, this removes the current binding
+     * for <code>key</code>.
+     * <p>In most instances, <code>key</code> will be
+     * <code>action.getValue(NAME)</code>.
+     *
+     * @param key the key for the action.
+     * @param action the action to be added.
+     */
+    public void put(final Object key, final Action action) {
+        if (action == null) {
+            remove(key);
+        }
+        else {
+           if (this.actionMap.containsKey(key)) {
+               remove(key);
+           }
+           this.actionMap.put(key, action);
+           this.actionList.add (key);
+        }
+    }
+
+    /**
+     * Returns the binding for <code>key</code>, messaging the
+     * parent <code>ActionMap</code> if the binding is not locally defined.
+     *
+     * @param key the key to be queried.
+     * @return the action for this key, or null if there is no such action.
+     */
+    public Action get(final Object key) {
+        final Action retval = (Action) this.actionMap.get(key);
+        if (retval != null) {
+            return retval;
+        }
+        if (this.parent != null) {
+            return this.parent.get(key);
+        }
+        return null;
+    }
+
+    /**
+     * Removes the binding for <code>key</code> from this <code>ActionMap</code>.
+     *
+     * @param key the key to be removed.
+     */
+    public void remove(final Object key) {
+        this.actionMap.remove(key);
+        this.actionList.remove(key);
+    }
+
+    /**
+     * Removes all the mappings from this <code>ActionMap</code>.
+     */
+    public void clear() {
+        this.actionMap.clear();
+        this.actionList.clear();
+    }
+
+    /**
+     * Returns the <code>Action</code> names that are bound in this <code>ActionMap</code>.
+     *
+     * @return the keys which are directly bound to this map.
+     */
+    public Object[] keys() {
+        return this.actionList.toArray();
+    }
+
+    /**
+     * Returns the number of bindings.
+     *
+     * @return the number of entries in this map.
+     */
+    public int size() {
+        return this.actionMap.size();
+    }
+
+    /**
+     * Returns an array of the keys defined in this <code>ActionMap</code> and
+     * its parent. This method differs from <code>keys()</code> in that
+     * this method includes the keys defined in the parent.
+     *
+     * @return all keys of this map and all parents.
+     */
+    public Object[] allKeys() {
+        if (this.parent == null) {
+            return keys();
+        }
+        final Object[] parentKeys = this.parent.allKeys();
+        final Object[] key = keys();
+        final Object[] retval = new Object[parentKeys.length + key.length];
+        System.arraycopy(key, 0, retval, 0, key.length);
+        System.arraycopy(retval, 0, retval, key.length, retval.length);
+        return retval;
+    }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/encoding-names.properties b/source/org/jfree/report/modules/gui/swing/common/encoding-names.properties
new file mode 100644
index 0000000..318498b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/encoding-names.properties
@@ -0,0 +1,138 @@
+#Encoding names
+#Mon Nov 13 19:50:25 CET 2006
+MacRomania=Macintosh Romania
+Cp737=PC Greek
+MS950=Windows Traditional Chinese
+EUC-TW=CNS 11643 (Plane 1-3), EUC encoding, Traditional Chinese
+MacSymbol=Macintosh Symbol
+Cp33722=IBM-eucJP - Japanese (superset of 5050)
+Cp437=MS-DOS United States, Australia, New Zealand, South Africa
+Cp1006=IBM AIX Parkistan (Urdu)
+MS949=Windows Korean
+MacDingbat=Macintosh Dingbat
+Cp922=IBM Estonia (AIX, DOS)
+MacIceland=Macintosh Iceland
+Cp921=IBM Lativa, Lithuania (AIX, DOS)
+Cp297=IBM France
+KOI8-R=KOI8-R, Russian
+GB2312=GB2312, EUC encoding, Simplified Chinese
+Cp037=USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia
+ISO-2022-KR=ISO 2022 KR, Korean
+Cp1258=Windows Vietnamese
+Cp1257=Windows Baltic
+Cp1256=Windows Arabic
+Cp1255=Windows Hebrew
+Cp1254=Windows Turkish
+MacUkraine=Macintosh Ukraine
+Cp1253=Windows Greek
+Cp1252=Windows Latin-1
+Cp918=IBM Pakistan (Urdu)
+Cp1251=Windows Russian (Cyrillic)
+Cp1250=Windows Eastern Europe
+Cp424=IBM Hebrew
+Big5-HKSCS=Big5 with Hong Kong extensions, Traditional Chinese
+MacArabic=Macintosh Arabic
+Big5_Solaris=Big5 with seven additional Hanzi ideograph character mappings
+Cp420=IBM Arabic
+EUC_CN=GB2312, EUC encoding, Simplified Chinese
+MS936=Windows Simplified Chinese
+MS932=Windows Japanese
+MacThai=Macintosh Thai
+Cp970=AIX Korean
+Cp875=IBM Greek
+Cp874=IBM Thai
+ISO-8859-15=Latin alphabet No. 9, 'Euro' enabled
+ISO-8859-13=Latin alphabet No. 7
+Cp871=IBM Iceland
+Cp870=IBM Multilingual Latin-2
+Cp285=IBM United Kingdom, Ireland
+Cp775=PC Baltik
+Cp284=IBM Catalan/Spain, Spanish Latin America
+UTF-8=8 Bit UCS Transformation Format
+ISCII91=ISCII encoding of Indic scripts
+Cp280=IBM Italy
+ISO-2022-JP=JIS X 0201, 0208, in ISO 2002 form, Japanese
+Cp1149=IBM Iceland (with Euro)
+Cp1148=IBM EBCDIC 500V1 (with Euro)
+Cp1147=IBM France (with Euro)
+Cp1146=IBM United Kingdom, Ireland (with Euro)
+Big5=Big5, Traditional Chinese
+Cp1145=IBM Catalan/Spain, Spanish Latin America (with Euro)
+Cp1144=IBM Italy (Euro enabled)
+Cp1143=IBM Finland, Sweden (Euro enabled)
+Cp1142=IBM Denmark, Norway (Euro enabled)
+MacCroatian=Macintosh Croatian
+Cp1141=IBM Austria, Germany (Euro enabled)
+Cp1140=USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia (with Euro)
+Cp1046=IBM Arabic Windows
+Cp964=AIX Chinese (Taiwan)
+Cp869=IBM Modern Greek
+Cp868=MS-DOS Pakistan
+Cp866=MS-DOS Russian
+Cp865=MS-DOS Nordic
+MacTurkish=Macintosh Turkish
+Cp864=PC Arabic
+Cp863=MS-DOS Canadian French
+Cp278=IBM Finland, Sweden
+Cp277=IBM Denmark, Norway
+Cp862=PC Hebrew
+Cp861=MS-DOS Icelandic
+Cp860=MS-DOS Portuguese
+Cp273=IBM Austria, Germany
+SJIS=Shift-JIS, Japanese
+ASCII=American Standard Code for Information Interchange
+UTF-16=16 Bit UCS Transformation Format
+ISO-2022-CN-GB=GB2312 in ISO 2022 CN form, Simplified Chinese
+Cp500=EBCDIC 500V1
+MacGreek=Macintosh Greek
+ISO-8859-9=Latin alphabet No. 5
+ISO-8859-8=Latin/Hebrew Alphabet
+ISO-8859-7=Latin/Greek Alphabet
+MacCyrillic=Macintosh Cyrillic
+ISO-8859-6=Latin/Arabic Alphabet
+ISO-8859-5=Latin/Cyrillic Alphabet
+ISO-8859-4=Latin alphabet No. 4
+ISO-2022-CN-CNS=CNS 11643 in ISO 2022 CN form, Traditional Chinese
+ISO-8859-3=Latin alphabet No. 3
+ISO-8859-2=Latin alphabet No. 2
+Cp1098=IBM Iran (Farsi)/Persian (PC)
+Cp943C=Variant of Cp943\: IBM OS/2 Japanese, superset of Cp932 and Shift-JIS
+ISO-8859-1=Latin alphabet No. 1
+Cp1097=IBM Iran (Farsi)/Persian
+Cp858=MS-DOS Latin-1 with Euro character
+Cp857=IBM Turkish
+Cp950=PC Chinese (Hong Kong, Taiwan)
+Cp856=IBM Hebrew
+GBK=GBK, Simplified Chinese
+Cp855=IBM Cyrillic
+Cp949C=Variant of Cp949\: PC Korean
+Cp852=MS-DOS Latin 2
+Cp850=MS-DOS Latin-1
+MS874=Windows Thai
+EUC-JP=JISX 0201, 0208 and 0212, EUC encoding Japanese
+Cp1383=IBM AIX People's Republic of Chine (PRC)
+Cp1381=IBM OS/2, DOS People's Republic of Chine (PRC)
+MacCentralEurope=Macintosh Latin-2
+Cp1124=IBM AIX Ukraine
+Cp1123=IBM Ukraine
+Cp949=PC Korean
+Cp1122=IBM Estonia
+Cp948=IBM OS/2 Chinese (Taiwan) superset of Cp938
+Cp1026=IBM Latin-5, Turkey
+Cp1025=IBM Multilingual Cyrillic\: Bulgaria, Bosnia, Herzegovinia, Macedonia (FYR)
+Cp943=IBM OS/2 Japanese, superset of Cp932 and Shift-JIS
+Cp942C=Variant of Cp942\: IBM OS/2 Japanese, superset of Cp932
+EUC-JP-LINUX=JISX 0201, 0208, EUC encoding Japanese
+Cp942=IBM OS/2 Japanese, superset of Cp932
+GB18030=Simplified Chinese, PRC standard
+MacRoman=Macintosh Roman
+MacHebrew=Macintosh Hebrew
+TIS-620=TIS 620, Thai
+Cp939=Japanese Latin Kanji mixed with 4370 UDC, superset of 5035
+Cp1112=IBM Lativa, Lithuania
+Cp937=Traditional Chinsese Hostmixed with 6204 UDC, superset of 5033
+Cp935=Simplified Chinese mixed with 1880 UDC, superset of 5031
+Cp933=Korean mixed with 1880 UDC, superset of 5029
+Cp838=IBM Thailand extended SBCS
+Cp930=Japanese Katakana-Kanji mixed with 4370 UDC, superset of 5026
+EUC_KR=KS C 5601, EUC encoding, Korean
diff --git a/source/org/jfree/report/modules/gui/swing/common/jfreereport-encodings.properties b/source/org/jfree/report/modules/gui/swing/common/jfreereport-encodings.properties
new file mode 100644
index 0000000..daa5666
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/jfreereport-encodings.properties
@@ -0,0 +1,297 @@
+#
+# Basic Encodings, available in all JDKs
+#
+
+# American Standard Code for Information Interchange
+#
+ASCII=true
+# Windows Latin-1
+#
+Cp1252=true
+#
+# Latin alphabet No. 1
+ISO-8859-1=true
+#
+# Latin alphabet No. 9, 'Euro' enabled
+ISO-8859-15=true
+#
+# 8 Bit UCS Transformation Format
+UTF-8=true
+#
+# 16 Bit UCS Transformation Format
+UTF-16=true
+#
+# missing: UTF-16BE, UTF-16LE are no base need in EndUser environments
+UTF-16BE=false
+UTF-16LE=false
+
+#
+# extended encoding set, contained in lib/charsets.jar
+# (International JDK only)
+#
+
+#Windows Eastern Europe
+Cp1250=true
+#Windows Russian (Cyrillic)
+Cp1251=true
+#Windows Greek
+Cp1253=true
+#Windows Turkish
+Cp1254=true
+#Windows Hebrew
+Cp1255=true
+#Windows Arabic
+Cp1256=true
+#Windows Baltic
+Cp1257=true
+#Windows Vietnamese
+Cp1258=true
+# Latin alphabet No. 2
+ISO-8859-2=true
+#Latin alphabet No. 3
+ISO-8859-3=true
+#Latin alphabet No. 4
+ISO-8859-4=true
+#Latin/Cyrillic Alphabet
+ISO-8859-5=true
+#Latin/Arabic Alphabet
+ISO-8859-6=true
+#Latin/Greek Alphabet
+ISO-8859-7=true
+#Latin/Hebrew Alphabet
+ISO-8859-8=true
+#Latin alphabet No. 5
+ISO-8859-9=true
+#Latin alphabet No. 7
+ISO-8859-13=true
+#Windows Japanese
+MS932=true
+# JISX 0201, 0208 and 0212, EUC encoding Japanese
+EUC-JP=true
+# JISX 0201, 0208, EUC encoding Japanese
+EUC-JP-LINUX=true
+# Shift-JIS, Japanese
+SJIS=true
+# JIS X 0201, 0208, in ISO 2002 form, Japanese
+ISO-2022-JP=true
+# Windows Simplified Chinese
+MS936=true
+# Simplified Chinese, PRC standard
+GB18030=true
+# GB2312, EUC encoding, Simplified Chinese
+EUC_CN=true
+# GB2312, EUC encoding, Simplified Chinese
+GB2312=true
+# GBK, Simplified Chinese
+GBK=true
+# ISCII encoding of Indic scripts
+ISCII91=true
+# GB2312 in ISO 2022 CN form, Simplified Chinese
+ISO-2022-CN-GB=true
+# Windows Korean
+MS949=true
+# KS C 5601, EUC encoding, Korean
+EUC_KR=true
+# ISO 2022 KR, Korean
+ISO-2022-KR=true
+# Windows Traditional Chinese
+MS950=true
+# CNS 11643 (Plane 1-3), EUC encoding, Traditional Chinese
+EUC-TW=true
+# CNS 11643 in ISO 2022 CN form, Traditional Chinese
+ISO-2022-CN-CNS=true
+# Big5, Traditional Chinese
+Big5=true
+# Big5 with Hong Kong extensions, Traditional Chinese
+Big5-HKSCS=true
+# TIS 620, Thai
+TIS-620=true
+# KOI8-R, Russian
+KOI8-R=true
+
+#
+# extended encoding set, contained in lib/charsets.jar
+#
+
+# Big5 with seven additional Hanzi ideograph character mappings
+Big5_Solaris=true
+# USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia
+Cp037=true
+# IBM Austria, Germany
+Cp273=true
+# IBM Denmark, Norway
+Cp277=true
+# IBM Finland, Sweden
+Cp278=true
+# IBM Italy
+Cp280=true
+# IBM Catalan/Spain, Spanish Latin America
+Cp284=true
+# IBM United Kingdom, Ireland
+Cp285=true
+# IBM France
+Cp297=true
+# IBM Arabic
+Cp420=true
+# IBM Hebrew
+Cp424=true
+# MS-DOS United States, Australia, New Zealand, South Africa
+Cp437=true
+# EBCDIC 500V1
+Cp500=true
+# PC Greek
+Cp737=true
+# PC Baltik
+Cp775=true
+# IBM Thailand extended SBCS
+Cp838=true
+# MS-DOS Latin-1
+Cp850=true
+# MS-DOS Latin 2
+Cp852=true
+# IBM Cyrillic
+Cp855=true
+# IBM Hebrew
+Cp856=true
+# IBM Turkish
+Cp857=true
+# MS-DOS Latin-1 with Euro character
+Cp858=true
+# MS-DOS Portuguese
+Cp860=true
+# MS-DOS Icelandic
+Cp861=true
+# PC Hebrew
+Cp862=true
+# MS-DOS Canadian French
+Cp863=true
+# PC Arabic
+Cp864=true
+# MS-DOS Nordic
+Cp865=true
+# MS-DOS Russian
+Cp866=true
+# MS-DOS Pakistan
+Cp868=true
+# IBM Modern Greek
+Cp869=true
+# IBM Multilingual Latin-2
+Cp870=true
+# IBM Iceland
+Cp871=true
+# IBM Thai
+Cp874=true
+# IBM Greek
+Cp875=true
+# IBM Pakistan (Urdu)
+Cp918=true
+# IBM Lativa, Lithuania (AIX, DOS)
+Cp921=true
+# IBM Estonia (AIX, DOS)
+Cp922=true
+# Japanese Katakana-Kanji mixed with 4370 UDC, superset of 5026
+Cp930=true
+# Korean mixed with 1880 UDC, superset of 5029
+Cp933=true
+# Simplified Chinese mixed with 1880 UDC, superset of 5031
+Cp935=true
+# Traditional Chinsese Hostmixed with 6204 UDC, superset of 5033
+Cp937=true
+# Japanese Latin Kanji mixed with 4370 UDC, superset of 5035
+Cp939=true
+# IBM OS/2 Japanese, superset of Cp932
+Cp942=true
+# Variant of Cp942: IBM OS/2 Japanese, superset of Cp932
+Cp942C=true
+# IBM OS/2 Japanese, superset of Cp932 and Shift-JIS
+Cp943=true
+# Variant of Cp943: IBM OS/2 Japanese, superset of Cp932 and Shift-JIS
+Cp943C=true
+# IBM OS/2 Chinese (Taiwan) superset of Cp938
+Cp948=true
+# PC Korean
+Cp949=true
+# Variant of Cp949: PC Korean
+Cp949C=true
+# PC Chinese (Hong Kong, Taiwan)
+Cp950=true
+# AIX Chinese (Taiwan)
+Cp964=true
+# AIX Korean
+Cp970=true
+# IBM AIX Parkistan (Urdu)
+Cp1006=true
+# IBM Multilingual Cyrillic: Bulgaria, Bosnia, Herzegovinia, Macedonia (FYR)
+Cp1025=true
+# IBM Latin-5, Turkey
+Cp1026=true
+# IBM Arabic Windows
+Cp1046=true
+# IBM Iran (Farsi)/Persian
+Cp1097=true
+# IBM Iran (Farsi)/Persian (PC)
+Cp1098=true
+# IBM Lativa, Lithuania
+Cp1112=true
+# IBM Estonia
+Cp1122=true
+# IBM Ukraine
+Cp1123=true
+# IBM AIX Ukraine
+Cp1124=true
+# USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia (with Euro)
+Cp1140=true
+# IBM Austria, Germany (Euro enabled)
+Cp1141=true
+# IBM Denmark, Norway (Euro enabled)
+Cp1142=true
+# IBM Finland, Sweden (Euro enabled)
+Cp1143=true
+# IBM Italy (Euro enabled)
+Cp1144=true
+# IBM Catalan/Spain, Spanish Latin America (with Euro)
+Cp1145=true
+# IBM United Kingdom, Ireland (with Euro)
+Cp1146=true
+# IBM France (with Euro)
+Cp1147=true
+# IBM EBCDIC 500V1 (with Euro)
+Cp1148=true
+# IBM Iceland (with Euro)
+Cp1149=true
+# IBM OS/2, DOS People's Republic of Chine (PRC)
+Cp1381=true
+# IBM AIX People's Republic of Chine (PRC)
+Cp1383=true
+# IBM-eucJP - Japanese (superset of 5050)
+Cp33722=true
+# Windows Thai
+MS874=true
+# Macintosh Arabic
+MacArabic=true
+# Macintosh Latin-2
+MacCentralEurope=true
+# Macintosh Croatian
+MacCroatian=true
+# Macintosh Cyrillic
+MacCyrillic=true
+# Macintosh Dingbat
+MacDingbat=true
+# Macintosh Greek
+MacGreek=true
+# Macintosh Hebrew
+MacHebrew=true
+# Macintosh Iceland
+MacIceland=true
+# Macintosh Roman
+MacRoman=true
+# Macintosh Romania
+MacRomania=true
+# Macintosh Symbol
+MacSymbol=true
+# Macintosh Thai
+MacThai=true
+# Macintosh Turkish
+MacTurkish=true
+# Macintosh Ukraine
+MacUkraine=true
diff --git a/source/org/jfree/report/modules/gui/swing/common/localization/ActionLocaleUpdateHandler.java b/source/org/jfree/report/modules/gui/swing/common/localization/ActionLocaleUpdateHandler.java
new file mode 100644
index 0000000..9bc4909
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/localization/ActionLocaleUpdateHandler.java
@@ -0,0 +1,67 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ActionLocaleUpdateHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common.localization;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
+
+/**
+ * Creation-Date: 30.11.2006, 13:04:07
+ *
+ * @author Thomas Morgner
+ */
+public class ActionLocaleUpdateHandler implements PropertyChangeListener
+{
+  private LocalizedAction target;
+
+  public ActionLocaleUpdateHandler(final LocalizedAction target)
+  {
+    this.target = target;
+  }
+
+  /**
+   * This method gets called when a bound property is changed.
+   *
+   * @param evt A PropertyChangeEvent object describing the event source and the
+   *            property that has changed.
+   */
+
+  public void propertyChange(PropertyChangeEvent evt)
+  {
+    final Object newValue = evt.getNewValue();
+    if (newValue instanceof Locale)
+    {
+      target.update((Locale) newValue);
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/localization/JLabelLocaleUpdateHandler.java b/source/org/jfree/report/modules/gui/swing/common/localization/JLabelLocaleUpdateHandler.java
new file mode 100644
index 0000000..3724bfc
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/localization/JLabelLocaleUpdateHandler.java
@@ -0,0 +1,89 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JLabelLocaleUpdateHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common.localization;
+
+import java.awt.IllegalComponentStateException;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import javax.swing.JLabel;
+
+/**
+ * Creation-Date: 30.11.2006, 13:04:07
+ *
+ * @author Thomas Morgner
+ */
+public class JLabelLocaleUpdateHandler implements PropertyChangeListener
+{
+  private String resourceBundleName;
+  private String resourceKey;
+  private JLabel target;
+
+  public JLabelLocaleUpdateHandler(final JLabel target,
+                                   final String resourceBundleName,
+                                   final String resourceKey)
+  {
+    this.target = target;
+    this.resourceBundleName = resourceBundleName;
+    this.resourceKey = resourceKey;
+  }
+
+  /**
+   * This method gets called when a bound property is changed.
+   *
+   * @param evt A PropertyChangeEvent object describing the event source and the
+   *            property that has changed.
+   */
+
+  public void propertyChange(PropertyChangeEvent evt)
+  {
+    try
+    {
+      final Locale locale = target.getLocale();
+      final ResourceBundle bundle =
+          ResourceBundle.getBundle(resourceBundleName, locale);
+      final String string = bundle.getString(resourceKey);
+      target.setText(string);
+    }
+    catch(IllegalComponentStateException ice)
+    {
+      target.setText("!ERROR: No Parent: " + resourceKey);
+    }
+    catch(MissingResourceException mre)
+    {
+      target.setText("!ERROR: MissingResource: " + resourceKey);
+    }
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/localization/LocaleUpdateHandler.java b/source/org/jfree/report/modules/gui/swing/common/localization/LocaleUpdateHandler.java
new file mode 100644
index 0000000..2bdce78
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/localization/LocaleUpdateHandler.java
@@ -0,0 +1,70 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LocaleUpdateHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common.localization;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
+import javax.swing.JComponent;
+
+/**
+ * Copies the locale from one central point (usually the dialog) to all
+ * listeners.
+ *
+ * @author Thomas Morgner
+ */
+public class LocaleUpdateHandler implements PropertyChangeListener
+{
+  private JComponent localizedComponent;
+
+  public LocaleUpdateHandler(JComponent localizedComponent)
+  {
+    this.localizedComponent = localizedComponent;
+  }
+
+  /**
+   * This method gets called when a bound property is changed.
+   *
+   * @param evt A PropertyChangeEvent object describing the event source and the
+   *            property that has changed.
+   */
+
+  public void propertyChange(PropertyChangeEvent evt)
+  {
+    final Object newValue = evt.getNewValue();
+    if (newValue instanceof Locale == false)
+    {
+      return;
+    }
+    localizedComponent.setLocale((Locale) newValue);
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/localization/LocalizedAction.java b/source/org/jfree/report/modules/gui/swing/common/localization/LocalizedAction.java
new file mode 100644
index 0000000..457557b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/localization/LocalizedAction.java
@@ -0,0 +1,45 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LocalizedAction.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common.localization;
+
+import java.util.Locale;
+import javax.swing.Action;
+
+/**
+ * Creation-Date: 30.11.2006, 13:09:37
+ *
+ * @author Thomas Morgner
+ */
+public interface LocalizedAction extends Action
+{
+  public void update (Locale locale);
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/localization/LocalizedComponent.java b/source/org/jfree/report/modules/gui/swing/common/localization/LocalizedComponent.java
new file mode 100644
index 0000000..fd9b628
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/localization/LocalizedComponent.java
@@ -0,0 +1,44 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LocalizedComponent.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.common.localization;
+
+import java.util.Locale;
+
+/**
+ * Creation-Date: 30.11.2006, 12:57:44
+ *
+ * @author Thomas Morgner
+ */
+public interface LocalizedComponent
+{
+  public void updateLocale (Locale locale);
+}
diff --git a/source/org/jfree/report/modules/gui/swing/common/module.properties b/source/org/jfree/report/modules/gui/swing/common/module.properties
new file mode 100644
index 0000000..f312502
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/module.properties
@@ -0,0 +1,13 @@
+module-info:
+  name: gui-swing-common
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Common Swing-GUI functionality
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.gui.common.GuiCommonModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
diff --git a/source/org/jfree/report/modules/gui/swing/common/resources.properties b/source/org/jfree/report/modules/gui/swing/common/resources.properties
new file mode 100644
index 0000000..3d52ab2
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/common/resources.properties
@@ -0,0 +1,97 @@
+
+########################################################################
+# Translations of the Swing-resources
+AbstractButton.clickText=click
+
+AbstractDocument.additionText=addition
+AbstractDocument.deletionText=deletion
+AbstractDocument.redoText=Redo
+AbstractDocument.styleChangeText=style change
+AbstractDocument.undoText=Undo
+
+AbstractUndoableEdit.redoText=Redo
+AbstractUndoableEdit.undoText=Undo
+
+ColorChooser.cancelText=Cancel
+ColorChooser.hsbBlueText=B
+ColorChooser.hsbBrightnessText=B
+ColorChooser.hsbGreenText=G
+ColorChooser.hsbHueText=H
+ColorChooser.hsbNameText=HSB
+ColorChooser.hsbRedText=R
+ColorChooser.hsbSaturationText=S
+ColorChooser.okText=OK
+ColorChooser.previewText=Preview
+ColorChooser.resetText=Reset
+ColorChooser.rgbBlueMnemonic=VK_B
+ColorChooser.rgbBlueText=Blue
+ColorChooser.rgbGreenMnemonic=VK_G
+ColorChooser.rgbGreenText=Green
+ColorChooser.rgbNameText=RGB
+ColorChooser.rgbRedMnemonic=VK_R
+ColorChooser.rgbRedText=Red
+ColorChooser.sampleText=Sample Text  Sample Text
+ColorChooser.swatchesNameText=Swatches
+ColorChooser.swatchesRecentText=Recent\:
+
+FileChooser.acceptAllFileFilterText=All Files (*.*)
+FileChooser.cancelButtonMnemonic=VK_C
+FileChooser.cancelButtonText=Cancel
+FileChooser.cancelButtonToolTipText=Abort file chooser dialog
+FileChooser.detailsViewButtonAccessibleName=Details
+FileChooser.detailsViewButtonToolTipText=Details
+FileChooser.directoryDescriptionText=Directory
+FileChooser.fileDescriptionText=Generic File
+FileChooser.fileNameLabelMnemonic=VK_N
+FileChooser.fileNameLabelText=File name\:
+FileChooser.filesOfTypeLabelMnemonic=VK_T
+FileChooser.filesOfTypeLabelText=Files of type\:
+FileChooser.helpButtonMnemonic=VK_H
+FileChooser.helpButtonText=Help
+FileChooser.helpButtonToolTipText=FileChooser help
+FileChooser.homeFolderAccessibleName=Home
+FileChooser.homeFolderToolTipText=Home
+FileChooser.listViewButtonAccessibleName=List
+FileChooser.listViewButtonToolTipText=List
+FileChooser.lookInLabelMnemonic=VK_I
+FileChooser.lookInLabelText=Look in\:
+FileChooser.newFolderAccessibleName=New Folder
+FileChooser.newFolderErrorSeparator=\:
+FileChooser.newFolderErrorText=Error creating new folder
+FileChooser.newFolderToolTipText=Create New Folder
+FileChooser.openButtonMnemonic=VK_O
+FileChooser.openButtonText=Open
+FileChooser.openButtonToolTipText=Open selected file
+FileChooser.openDialogTitleText=Open
+FileChooser.other.newFolder=New Folder
+FileChooser.other.newFolder.subsequent=New folder. {0}
+FileChooser.saveButtonMnemonic=VK_S
+FileChooser.saveButtonText=Save
+FileChooser.saveButtonToolTipText=Save selected file
+FileChooser.saveDialogTitleText=Save
+FileChooser.upFolderAccessibleName=Up
+FileChooser.upFolderToolTipText=Up One Level
+FileChooser.updateButtonMnemonic=VK_U
+FileChooser.updateButtonText=Update
+FileChooser.updateButtonToolTipText=Update directory listing
+FileChooser.win32.newFolder=New Folder
+FileChooser.win32.newFolder.subsequent=New folder. ({0})
+
+FormView.resetButtonText=Reset
+FormView.submitButtonText=Submit Query
+
+InternalFrameTitlePane.closeButtonAccessibleName=Close
+InternalFrameTitlePane.iconifyButtonAccessibleName=Iconify
+InternalFrameTitlePane.maximizeButtonAccessibleName=Maximize
+
+OptionPane.cancelButtonText=Cancel
+OptionPane.noButtonText=No
+OptionPane.okButtonText=OK
+OptionPane.titleText=Choose an option
+OptionPane.yesButtonText=Yes
+
+ProgressMonitor.progressText=Progress...
+
+SplitPane.rightButtonText=right button
+SplitPane.leftButtonText=left button
+
diff --git a/source/org/jfree/report/modules/gui/swing/excel/module.properties b/source/org/jfree/report/modules/gui/swing/excel/module.properties
new file mode 100644
index 0000000..22e9301
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/excel/module.properties
@@ -0,0 +1,17 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: gui-swing-excel
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Excel export GUI for Swing
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.gui.swing.common.SwingCommonModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
diff --git a/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportActionPlugin.java b/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportActionPlugin.java
new file mode 100644
index 0000000..d7f29c1
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportActionPlugin.java
@@ -0,0 +1,161 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: HtmlFileExportActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.html;
+
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.ReportConfigurationException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.swing.common.AbstractExportActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 30.11.2006, 12:19:00
+ *
+ * @author Thomas Morgner
+ */
+public class HtmlFileExportActionPlugin extends AbstractExportActionPlugin
+{
+  private ResourceBundleSupport resources;
+  private static final String EXPORT_DIALOG_KEY = "org.jfree.report.modules.gui.swing.html.file.ExportDialog";
+
+  public HtmlFileExportActionPlugin()
+  {
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.html.export.file.";
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingHtmlModule.BUNDLE_NAME);
+    return true;
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.export-to-html.file.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.export-to-html.file.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+//    final Locale locale = getContext().getLocale();
+//    return getIconTheme().getSmallIcon(locale, "action.export-to-html.small-icon");
+    return null;
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+//    final Locale locale = getContext().getLocale();
+//    return getIconTheme().getLargeIcon(locale, "action.export-to-html.icon");
+    return null;
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getOptionalKeyStroke("action.export-to-html.file.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic("action.export-to-html.file.mnemonic");
+  }
+
+  /**
+   * Exports a report.
+   *
+   * @param job the report.
+   * @return A boolean.
+   */
+  public boolean performExport(ReportJob job)
+  {
+    if (performShowExportDialog(job, EXPORT_DIALOG_KEY) == false)
+    {
+      return false;
+    }
+
+    try
+    {
+      final HtmlFileExportTask task = new HtmlFileExportTask(job);
+      Thread worker = new Thread(task);
+      setStatusText("Started Job");
+      worker.start();
+      return true;
+    }
+    catch (ReportConfigurationException e)
+    {
+      setStatusText("Failed to configure the export task.");
+      return false;
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportDialog.java b/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportDialog.java
new file mode 100644
index 0000000..f8213f7
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportDialog.java
@@ -0,0 +1,532 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: HtmlFileExportDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.html;
+
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.common.DefaultIconTheme;
+import org.jfree.report.modules.gui.common.GuiContext;
+import org.jfree.report.modules.gui.swing.common.AbstractExportDialog;
+import org.jfree.report.modules.gui.swing.common.JStatusBar;
+import org.jfree.report.modules.gui.swing.common.action.ActionButton;
+import org.jfree.report.modules.gui.swing.common.localization.JLabelLocaleUpdateHandler;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+import org.pentaho.reporting.libraries.base.config.DefaultConfiguration;
+import org.pentaho.reporting.libraries.base.util.FilesystemFilter;
+import org.pentaho.reporting.libraries.base.util.StringUtils;
+
+/**
+ * A dialog that is used to perform the printing of a report into an HTML file.
+ */
+public class HtmlFileExportDialog extends AbstractExportDialog
+{
+  private static final String HTML_FILE_EXTENSION = ".html";
+  private static final String HTM_FILE_EXTENSION = ".htm";
+
+  /**
+   * An action to select the export target file.
+   */
+  private class ActionSelectTargetFile extends AbstractAction
+  {
+    /**
+     * Default constructor.
+     */
+    public ActionSelectTargetFile(final ResourceBundle resources)
+    {
+      putValue(Action.NAME, resources.getString("htmlexportdialog.select"));
+    }
+
+    /**
+     * Receives notification that the action has occurred.
+     *
+     * @param e the action event.
+     */
+    public void actionPerformed(final ActionEvent e)
+    {
+      performSelectFile();
+    }
+
+  }
+
+  private JTextField filenameField;
+  private JFileChooser fileChooserHtml;
+  private JTextField dataDirField;
+  private JStatusBar statusBar;
+
+  private JRadioButton rbPageableExport;
+  private JRadioButton rbStreamExport;
+  private JRadioButton rbFlowExport;
+
+  /**
+   * Creates a non-modal dialog without a title and without a specified
+   * <code>Frame</code> owner.  A shared, hidden frame will be set as the owner
+   * of the dialog.
+   */
+  public HtmlFileExportDialog()
+  {
+    initializeComponents();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Frame</code> as its owner.  If <code>owner</code> is
+   * <code>null</code>, a shared, hidden frame will be set as the owner of the
+   * dialog.
+   *
+   * @param owner the <code>Frame</code> from which the dialog is displayed
+   */
+  public HtmlFileExportDialog(final Frame owner)
+  {
+    super(owner);
+    initializeComponents();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Dialog</code> as its owner.
+   *
+   * @param owner the non-null <code>Dialog</code> from which the dialog is
+   *              displayed
+   */
+  public HtmlFileExportDialog(final Dialog owner)
+  {
+    super(owner);
+    initializeComponents();
+  }
+
+  public String getFilename()
+  {
+    return filenameField.getText();
+  }
+
+  public void setFilename(final String filename)
+  {
+    this.filenameField.setText(filename);
+  }
+
+  private void initializeComponents()
+  {
+    JPanel contentPane = new JPanel();
+    contentPane.setLayout(new GridBagLayout());
+
+    filenameField = new JTextField();
+    filenameField.setColumns(60);
+    dataDirField = new JTextField();
+    dataDirField.setColumns(60);
+    statusBar = new JStatusBar(new DefaultIconTheme());
+
+    rbStreamExport = new JRadioButton(getResources().getString
+        ("htmlexportdialog.stream-export"));
+    rbStreamExport.setSelected(true);
+    rbFlowExport = new JRadioButton(getResources().getString
+        ("htmlexportdialog.flow-export"));
+    rbPageableExport = new JRadioButton(getResources().getString
+        ("htmlexportdialog.pageable-export"));
+
+    final ButtonGroup bgExport = new ButtonGroup();
+    bgExport.add(rbStreamExport);
+    bgExport.add(rbFlowExport);
+    bgExport.add(rbPageableExport);
+
+
+    final JPanel exportTypeSelectionPanel = new JPanel();
+    exportTypeSelectionPanel.setLayout(new GridLayout(3, 1, 5, 5));
+    exportTypeSelectionPanel.add(rbStreamExport);
+    exportTypeSelectionPanel.add(rbFlowExport);
+    exportTypeSelectionPanel.add(rbPageableExport);
+
+    JLabel targetLabel =
+        new JLabel(getResources().getString("htmlexportdialog.filename"));
+    addPropertyChangeListener("locale", new JLabelLocaleUpdateHandler(targetLabel,
+        SwingHtmlModule.BUNDLE_NAME, "htmlexportdialog.filename"));
+
+    JLabel dataLabel =
+        new JLabel(getResources().getString("htmlexportdialog.datafilename"));
+    addPropertyChangeListener("locale", new JLabelLocaleUpdateHandler(dataLabel,
+        SwingHtmlModule.BUNDLE_NAME, "htmlexportdialog.datafilename"));
+
+    final JLabel exportMethodLabel =
+        new JLabel(getResources().getString("htmlexportdialog.exportMethod"));
+    addPropertyChangeListener("locale", new JLabelLocaleUpdateHandler(exportMethodLabel,
+        SwingHtmlModule.BUNDLE_NAME, "htmlexportdialog.exportMethod"));
+
+    GridBagConstraints gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 0;
+    gbc.gridy = 0;
+    gbc.insets = new Insets(1, 1, 1, 5);
+    contentPane.add(targetLabel, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 0;
+    gbc.gridy = 1;
+    gbc.insets = new Insets(1, 1, 1, 5);
+    contentPane.add(dataLabel, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 1;
+    gbc.gridy = 0;
+    gbc.gridwidth = 1;
+    gbc.weightx = 1;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    contentPane.add(filenameField, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 2;
+    gbc.gridy = 0;
+    final ActionSelectTargetFile selectTargetAction =
+        new ActionSelectTargetFile(getResources());
+    contentPane.add(new ActionButton(selectTargetAction), gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 1;
+    gbc.gridy = 1;
+    gbc.gridwidth = 1;
+    gbc.weightx = 1;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    contentPane.add(dataDirField, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 0;
+    gbc.gridy = 2;
+    contentPane.add(exportMethodLabel, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 1;
+    gbc.gridy = 2;
+    gbc.gridwidth = 1;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    contentPane.add(exportTypeSelectionPanel, gbc);
+
+
+    final JButton btnCancel = new ActionButton(getCancelAction());
+    final JButton btnConfirm = new ActionButton(getConfirmAction());
+
+    final JPanel buttonPanel = new JPanel();
+    buttonPanel.setLayout(new GridLayout());
+    buttonPanel.add(btnConfirm);
+    buttonPanel.add(btnCancel);
+    btnConfirm.setDefaultCapable(true);
+    buttonPanel.registerKeyboardAction(getConfirmAction(),
+        KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.anchor = GridBagConstraints.EAST;
+    gbc.weightx = 1;
+    gbc.gridx = 0;
+    gbc.gridwidth = 3;
+    gbc.gridy = 15;
+    gbc.insets = new Insets(10, 0, 10, 0);
+    contentPane.add(buttonPanel, gbc);
+
+
+    final JPanel contentWithStatus = new JPanel();
+    contentWithStatus.setLayout(new BorderLayout());
+    contentWithStatus.add(contentPane, BorderLayout.CENTER);
+    contentWithStatus.add(statusBar, BorderLayout.SOUTH);
+
+    setContentPane(contentWithStatus);
+
+
+    getFormValidator().registerTextField(dataDirField);
+    getFormValidator().registerTextField(filenameField);
+  }
+
+
+  public JStatusBar getStatusBar()
+  {
+    return statusBar;
+  }
+
+  protected boolean performValidate()
+  {
+    getStatusBar().clear();
+
+    final String filename = getFilename();
+    if (filename.trim().length() == 0)
+    {
+      getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+              getResources().getString("htmlexportdialog.targetIsEmpty"));
+      return false;
+    }
+    final File f = new File(filename);
+    if (f.exists())
+    {
+      if (f.isFile() == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("htmlexportdialog.targetIsNoFile"));
+        return false;
+      }
+      if (f.canWrite() == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("htmlexportdialog.targetIsNotWritable"));
+        return false;
+      }
+
+      final String message = MessageFormat.format(getResources().getString
+              ("htmlexportdialog.targetExistsWarning"),
+              new Object[]{filename});
+      getStatusBar().setStatus(JStatusBar.TYPE_WARNING, message);
+    }
+
+
+    final String text = dataDirField.getText();
+    if (text.length() > 0)
+    {
+      final File dataDir = new File(text).getAbsoluteFile();
+      if (dataDir.exists())
+      {
+        // dataDirectory does exist ... if no directory : fail
+        if (dataDir.isDirectory() == false)
+        {
+          getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                  getResources().getString("htmlexportdialog.targetDataDirIsNoDirectory"));
+          return false;
+        }
+      }
+    }
+
+    return true;
+  }
+
+
+  protected boolean performConfirm ()
+  {
+    final String filename = getFilename();
+    final File f = new File(filename).getAbsoluteFile();
+    if (f.exists())
+    {
+      final String key1 = "htmlexportdialog.targetOverwriteConfirmation";
+      final String key2 = "htmlexportdialog.targetOverwriteTitle";
+      if (JOptionPane.showConfirmDialog(this,
+              MessageFormat.format(getResources().getString(key1),
+                      new Object[]{getFilename()}),
+              getResources().getString(key2),
+              JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)
+              == JOptionPane.NO_OPTION)
+      {
+        return false;
+      }
+    }
+
+    final String text = dataDirField.getText();
+    if (text.length() > 0)
+    {
+      final File dataDir = createDataDir(f.getParentFile(), text);
+      if (dataDir.exists() == false)
+      {
+        final String dataDirKey1 = "htmlexportdialog.targetCreateDataDirConfirmation";
+        final String dataDirKey2 = "htmlexportdialog.targetCreateDataDirTitle";
+        if (JOptionPane.showConfirmDialog(this,
+                MessageFormat.format(getResources().getString(dataDirKey1),
+                        new Object[]{text}),
+                getResources().getString(dataDirKey2),
+                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)
+                == JOptionPane.NO_OPTION)
+        {
+          return false;
+        }
+      }
+    }
+    return true;
+  }
+
+  private File createDataDir(final File targetFile, final String dataDirectory)
+  {
+    File dataDirFile = new File(dataDirectory);
+    if (dataDirFile.isAbsolute())
+    {
+      return dataDirFile;
+    }
+
+    return new File (targetFile.getParentFile(), dataDirectory);
+  }
+
+  protected void initializeFromJob(ReportJob job, final GuiContext guiContext)
+  {
+    statusBar.setIconTheme(guiContext.getIconTheme());
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.common.html.file.";
+  }
+
+  protected Configuration grabDialogContents(boolean full)
+  {
+    ModifiableConfiguration conf = new DefaultConfiguration();
+    if (full)
+    {
+      conf.setConfigProperty
+          ("org.jfree.report.modules.gui.common.html.file.TargetFileName", filenameField.getText());
+      conf.setConfigProperty
+          ("org.jfree.report.modules.gui.common.html.file.DataDirectory", dataDirField.getText());
+    }
+    conf.setConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.ExportMethod", getExportMethod());
+
+    return conf;
+  }
+
+  protected void setDialogContents(Configuration properties)
+  {
+    filenameField.setText(properties.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.TargetFileName", ""));
+    dataDirField.setText(properties.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.DataDirectory", ""));
+    setExportMethod(properties.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.ExportMethod", ""));
+  }
+
+  protected String getConfigurationSuffix()
+  {
+    return "_htmlexport_file";
+  }
+
+  public String getExportMethod()
+  {
+    if (rbPageableExport.isSelected())
+    {
+      return "pageable";
+    }
+    if (rbFlowExport.isSelected())
+    {
+      return "flow";
+    }
+    return "stream";
+  }
+
+  public void setExportMethod (String method)
+  {
+    if ("pageable".equals(method))
+    {
+      rbPageableExport.setSelected(true);
+    }
+    else if ("flow".equals(method))
+    {
+      rbFlowExport.setSelected(true);
+    }
+    else
+    {
+      rbStreamExport.setSelected(true);
+    }
+  }
+
+  public void clear()
+  {
+    filenameField.setText("");
+    dataDirField.setText("");
+    rbStreamExport.setSelected(true);
+  }
+
+  protected String getResourceBaseName()
+  {
+    return SwingHtmlModule.BUNDLE_NAME;
+  }
+
+
+  /**
+   * Selects a file to use as target for the report processing.
+   */
+  protected void performSelectFile()
+  {
+    final File file = new File(getFilename());
+
+    if (fileChooserHtml == null)
+    {
+      fileChooserHtml = new JFileChooser();
+      fileChooserHtml.addChoosableFileFilter
+          (new FilesystemFilter(new String[]{HTML_FILE_EXTENSION, HTM_FILE_EXTENSION},
+              getResources().getString("htmlexportdialog.html-documents"), true));
+      fileChooserHtml.setMultiSelectionEnabled(false);
+    }
+
+    fileChooserHtml.setCurrentDirectory(file);
+    fileChooserHtml.setSelectedFile(file);
+    final int option = fileChooserHtml.showSaveDialog(this);
+    if (option == JFileChooser.APPROVE_OPTION)
+    {
+      final File selFile = fileChooserHtml.getSelectedFile();
+      String selFileName = selFile.getAbsolutePath();
+
+      // Test if ends on html
+      if (StringUtils.endsWithIgnoreCase(selFileName, HTML_FILE_EXTENSION) == false)
+      {
+        selFileName = selFileName + HTML_FILE_EXTENSION;
+      }
+      setFilename(selFileName);
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportTask.java b/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportTask.java
new file mode 100644
index 0000000..ad09760
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/HtmlFileExportTask.java
@@ -0,0 +1,173 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: HtmlFileExportTask.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.html;
+
+import java.io.File;
+
+import org.jfree.layouting.modules.output.html.FileSystemURLRewriter;
+import org.jfree.layouting.modules.output.html.FlowHtmlOutputProcessor;
+import org.jfree.layouting.modules.output.html.HtmlOutputProcessor;
+import org.jfree.layouting.modules.output.html.HtmlPrinter;
+import org.jfree.layouting.modules.output.html.PageableHtmlOutputProcessor;
+import org.jfree.layouting.modules.output.html.StreamingHtmlOutputProcessor;
+import org.jfree.report.ReportConfigurationException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.streaming.StreamingReportProcessor;
+import org.pentaho.reporting.libraries.base.util.IOUtils;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.repository.file.FileRepository;
+import org.pentaho.reporting.libraries.repository.ContentLocation;
+import org.pentaho.reporting.libraries.repository.DefaultNameGenerator;
+
+/**
+ * Creation-Date: 02.12.2006, 14:15:14
+ *
+ * @author Thomas Morgner
+ */
+public class HtmlFileExportTask implements Runnable
+{
+  private ReportJob job;
+  private File dataDirectory;
+  private File targetDirectory;
+  private String exportMethod;
+  private String suffix;
+  private String filename;
+  private String encoding;
+
+  public HtmlFileExportTask(final ReportJob job)
+      throws ReportConfigurationException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+    this.job = job;
+
+    final Configuration config = job.getConfiguration();
+    final String dataDirectoryName = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.DataDirectory");
+    final String targetFileName = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.TargetFileName");
+    exportMethod = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.ExportMethod");
+    encoding = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.file.Encoding", "ASCII");
+
+    final File targetFile = new File(targetFileName);
+    targetDirectory = targetFile.getParentFile();
+
+    dataDirectory = new File(targetFile, dataDirectoryName);
+    if (dataDirectory.isDirectory() == false)
+    {
+      throw new ReportConfigurationException("DataDirectory is invalid: " + dataDirectory);
+    }
+
+    suffix = IOUtils.getInstance().getFileExtension(targetFile.getName());
+    filename = IOUtils.getInstance().stripFileExtension(targetFile.getName());
+
+    if (targetFile.exists())
+    {
+      // lets try to delete it ..
+      if (targetFile.delete() == false)
+      {
+        throw new ReportConfigurationException
+            ("Target-File exists, but cannot be removed.");
+      }
+    }
+  }
+
+  /**
+   * When an object implementing interface <code>Runnable</code> is used to
+   * create a thread, starting the thread causes the object's <code>run</code>
+   * method to be called in that separately executing thread.
+   * <p/>
+   * The general contract of the method <code>run</code> is that it may take any
+   * action whatsoever.
+   *
+   * @see Thread#run()
+   */
+  public void run()
+  {
+    try
+    {
+      final FileRepository targetRepository = new FileRepository(targetDirectory);
+      final ContentLocation targetRoot = targetRepository.getRoot();
+
+      final FileRepository dataRepository = new FileRepository(dataDirectory);
+      final ContentLocation dataRoot = dataRepository.getRoot();
+
+      final StreamingReportProcessor sp = new StreamingReportProcessor();
+      final HtmlOutputProcessor outputProcessor = createOutputProcessor();
+      final HtmlPrinter printer = outputProcessor.getPrinter();
+      printer.setContentWriter(targetRoot,
+          new DefaultNameGenerator(targetRoot, filename, suffix));
+      printer.setDataWriter(dataRoot, new DefaultNameGenerator(dataRoot, "content"));
+      printer.setEncoding(encoding);
+      printer.setUrlRewriter(new FileSystemURLRewriter());
+      sp.setOutputProcessor(outputProcessor);
+      sp.processReport(job);
+    }
+    catch(Exception e)
+    {
+      DebugLog.log("File-Export failed. ", e);
+    }
+    finally{
+      try
+      {
+        job.close();
+        job = null;
+      }
+      catch(Exception e)
+      {
+        // ignore ..
+      }
+    }
+  }
+
+  protected HtmlOutputProcessor createOutputProcessor()
+  {
+    if ("pageable".equals(exportMethod))
+    {
+      return new PageableHtmlOutputProcessor(job.getConfiguration());
+    }
+    else if ("flow".equals(exportMethod))
+    {
+      return new FlowHtmlOutputProcessor(job.getConfiguration());
+    }
+    else
+    {
+      return new StreamingHtmlOutputProcessor(job.getConfiguration());
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportActionPlugin.java b/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportActionPlugin.java
new file mode 100644
index 0000000..31b9287
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportActionPlugin.java
@@ -0,0 +1,159 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: HtmlZipExportActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.html;
+
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.ReportConfigurationException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.swing.common.AbstractExportActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 30.11.2006, 12:19:00
+ *
+ * @author Thomas Morgner
+ */
+public class HtmlZipExportActionPlugin extends AbstractExportActionPlugin
+{
+  private static final String EXPORT_DIALOG_KEY = "org.jfree.report.modules.gui.swing.html.zip.ExportDialog";
+  private ResourceBundleSupport resources;
+
+  public HtmlZipExportActionPlugin()
+  {
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.html.export.zip.";
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingHtmlModule.BUNDLE_NAME);
+    return true;
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.export-to-html.zip.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.export-to-html.zip.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getOptionalKeyStroke("action.export-to-html.zip.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic("action.export-to-html.zip.mnemonic");
+  }
+
+
+  /**
+   * Exports a report.
+   *
+   * @param job the report.
+   * @return A boolean.
+   */
+  public boolean performExport(ReportJob job)
+  {
+    if (performShowExportDialog(job, EXPORT_DIALOG_KEY) == false)
+    {
+      return false;
+    }
+
+    try
+    {
+      final HtmlZipExportTask task = new HtmlZipExportTask(job);
+      Thread worker = new Thread(task);
+      setStatusText("Started Job");
+      worker.start();
+      return true;
+    }
+    catch (ReportConfigurationException e)
+    {
+      setStatusText("Failed to configure the export task.");
+      return false;
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportDialog.java b/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportDialog.java
new file mode 100644
index 0000000..9caf59e
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportDialog.java
@@ -0,0 +1,498 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: HtmlZipExportDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.html;
+
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.common.DefaultIconTheme;
+import org.jfree.report.modules.gui.common.GuiContext;
+import org.jfree.report.modules.gui.swing.common.AbstractExportDialog;
+import org.jfree.report.modules.gui.swing.common.JStatusBar;
+import org.jfree.report.modules.gui.swing.common.action.ActionButton;
+import org.jfree.report.modules.gui.swing.common.localization.JLabelLocaleUpdateHandler;
+import org.pentaho.reporting.libraries.base.util.IOUtils;
+import org.pentaho.reporting.libraries.base.util.StringUtils;
+import org.pentaho.reporting.libraries.base.util.FilesystemFilter;
+import org.pentaho.reporting.libraries.base.config.DefaultConfiguration;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * A dialog that is used to perform the printing of a report into an HTML file.
+ */
+public class HtmlZipExportDialog extends AbstractExportDialog
+{
+  private static final String ZIP_FILE_EXTENSION = ".zip";
+
+  /**
+   * An action to select the export target file.
+   */
+  private class ActionSelectTargetFile extends AbstractAction
+  {
+    /**
+     * Default constructor.
+     */
+    public ActionSelectTargetFile (final ResourceBundle resources)
+    {
+      putValue(Action.NAME, resources.getString("htmlexportdialog.select"));
+    }
+
+    /**
+     * Receives notification that the action has occurred.
+     *
+     * @param e the action event.
+     */
+    public void actionPerformed (final ActionEvent e)
+    {
+      performSelectFile();
+    }
+
+  }
+
+  private JTextField filenameField;
+  private JFileChooser fileChooserHtml;
+  private JTextField dataDirField;
+  private JStatusBar statusBar;
+  private JRadioButton rbPageableExport;
+  private JRadioButton rbStreamExport;
+  private JRadioButton rbFlowExport;
+
+
+  /**
+   * Creates a non-modal dialog without a title and without a specified
+   * <code>Frame</code> owner.  A shared, hidden frame will be set as the owner
+   * of the dialog.
+   */
+  public HtmlZipExportDialog()
+  {
+    initializeComponents();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Frame</code> as its owner.  If <code>owner</code> is
+   * <code>null</code>, a shared, hidden frame will be set as the owner of the
+   * dialog.
+   *
+   * @param owner the <code>Frame</code> from which the dialog is displayed
+   */
+  public HtmlZipExportDialog(final Frame owner)
+  {
+    super(owner);
+    initializeComponents();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Dialog</code> as its owner.
+   *
+   * @param owner the non-null <code>Dialog</code> from which the dialog is
+   *              displayed
+   */
+  public HtmlZipExportDialog(final Dialog owner)
+  {
+    super(owner);
+    initializeComponents();
+  }
+
+  public String getFilename()
+  {
+    return filenameField.getText();
+  }
+
+  public void setFilename(final String filename)
+  {
+    this.filenameField.setText(filename);
+  }
+
+  private void initializeComponents ()
+  {
+    final JPanel contentPane = new JPanel();
+    contentPane.setLayout(new GridBagLayout());
+
+    filenameField = new JTextField();
+    dataDirField = new JTextField();
+    statusBar = new JStatusBar(new DefaultIconTheme());
+
+    final JLabel targetLabel = new JLabel();
+    addPropertyChangeListener(new JLabelLocaleUpdateHandler(targetLabel,
+        SwingHtmlModule.BUNDLE_NAME, "htmlexportdialog.filename"));
+
+    final JLabel dataLabel = new JLabel();
+    addPropertyChangeListener(new JLabelLocaleUpdateHandler(dataLabel,
+        SwingHtmlModule.BUNDLE_NAME, "htmlexportdialog.datafilename"));
+
+    final JLabel exportMethodLabel =
+        new JLabel(getResources().getString("htmlexportdialog.exportMethod"));
+    addPropertyChangeListener("locale", new JLabelLocaleUpdateHandler(exportMethodLabel,
+        SwingHtmlModule.BUNDLE_NAME, "htmlexportdialog.exportMethod"));
+
+
+    rbStreamExport = new JRadioButton(getResources().getString
+        ("htmlexportdialog.stream-export"));
+    rbStreamExport.setSelected(true);
+    rbFlowExport = new JRadioButton(getResources().getString
+        ("htmlexportdialog.flow-export"));
+    rbPageableExport = new JRadioButton(getResources().getString
+        ("htmlexportdialog.pageable-export"));
+
+    final ButtonGroup bgExport = new ButtonGroup();
+    bgExport.add(rbStreamExport);
+    bgExport.add(rbFlowExport);
+    bgExport.add(rbPageableExport);
+
+    final JPanel exportTypeSelectionPanel = new JPanel();
+    exportTypeSelectionPanel.setLayout(new GridLayout(3, 1, 5, 5));
+    exportTypeSelectionPanel.add(rbStreamExport);
+    exportTypeSelectionPanel.add(rbFlowExport);
+    exportTypeSelectionPanel.add(rbPageableExport);
+
+    GridBagConstraints gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 0;
+    gbc.gridy = 0;
+    gbc.insets = new Insets(1, 1, 1, 5);
+    contentPane.add(targetLabel, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 0;
+    gbc.gridy = 1;
+    gbc.insets = new Insets(1, 1, 1, 5);
+    contentPane.add(dataLabel, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 1;
+    gbc.gridy = 0;
+    gbc.gridwidth = 1;
+    gbc.weightx = 1;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    contentPane.add(filenameField, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 2;
+    gbc.gridy = 0;
+    final HtmlZipExportDialog.ActionSelectTargetFile selectTargetAction =
+        new HtmlZipExportDialog.ActionSelectTargetFile(getResources());
+    contentPane.add(new ActionButton(selectTargetAction), gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 1;
+    gbc.gridy = 1;
+    gbc.gridwidth = 1;
+    gbc.weightx = 1;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    contentPane.add(dataDirField, gbc);
+
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 0;
+    gbc.gridy = 2;
+    contentPane.add(exportMethodLabel, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.gridx = 1;
+    gbc.gridy = 2;
+    gbc.gridwidth = 1;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    contentPane.add(exportTypeSelectionPanel, gbc);
+
+
+    final JButton btnCancel = new ActionButton(getCancelAction());
+    final JButton btnConfirm = new ActionButton(getConfirmAction());
+
+    final JPanel buttonPanel = new JPanel();
+    buttonPanel.setLayout(new GridLayout());
+    buttonPanel.add(btnConfirm);
+    buttonPanel.add(btnCancel);
+    btnConfirm.setDefaultCapable(true);
+    buttonPanel.registerKeyboardAction(getConfirmAction(),
+        KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.anchor = GridBagConstraints.EAST;
+    gbc.weightx = 1;
+    gbc.gridx = 0;
+    gbc.gridwidth = 3;
+    gbc.gridy = 15;
+    gbc.insets = new Insets(10, 0, 10, 0);
+    contentPane.add(buttonPanel, gbc);
+
+
+    final JPanel contentWithStatus = new JPanel();
+    contentWithStatus.setLayout(new BorderLayout());
+    contentWithStatus.add(contentPane, BorderLayout.CENTER);
+    contentWithStatus.add(statusBar, BorderLayout.SOUTH);
+
+    setContentPane(contentWithStatus);
+
+    getFormValidator().registerTextField(dataDirField);
+    getFormValidator().registerTextField(filenameField);
+  }
+
+
+  public JStatusBar getStatusBar()
+  {
+    return statusBar;
+  }
+
+  protected boolean performValidate()
+  {
+    getStatusBar().clear();
+
+    final String filename = getFilename();
+    if (filename.trim().length() == 0)
+    {
+      getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+              getResources().getString("htmlexportdialog.targetIsEmpty"));
+      return false;
+    }
+    final File f = new File(filename);
+    if (f.exists())
+    {
+      if (f.isFile() == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("htmlexportdialog.targetIsNoFile"));
+        return false;
+      }
+      if (f.canWrite() == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("htmlexportdialog.targetIsNotWritable"));
+        return false;
+      }
+
+      final String message = MessageFormat.format(getResources().getString
+              ("htmlexportdialog.targetExistsWarning"),
+              new Object[]{filename});
+      getStatusBar().setStatus(JStatusBar.TYPE_WARNING, message);
+    }
+
+    try
+    {
+      final File dataDir = new File(dataDirField.getText());
+      final File baseDir = new File("");
+
+      if (IOUtils.getInstance().isSubDirectory(baseDir, dataDir) == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("htmlexportdialog.targetPathIsAbsolute"));
+        return false;
+      }
+    }
+    catch (Exception e)
+    {
+      getStatusBar().setStatus(JStatusBar.TYPE_ERROR, "error.validationfailed");
+      return false;
+    }
+
+    return true;
+  }
+
+  protected boolean performConfirm()
+  {
+    final String filename = getFilename();
+    final File f = new File(filename).getAbsoluteFile();
+    if (f.exists())
+    {
+      final String key1 = "htmlexportdialog.targetOverwriteConfirmation";
+      final String key2 = "htmlexportdialog.targetOverwriteTitle";
+      if (JOptionPane.showConfirmDialog(this,
+              MessageFormat.format(getResources().getString(key1),
+                      new Object[]{getFilename()}),
+              getResources().getString(key2),
+              JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)
+              == JOptionPane.NO_OPTION)
+      {
+        return false;
+      }
+    }
+
+    return true;
+  }
+
+  protected void initializeFromJob(ReportJob job, final GuiContext guiContext)
+  {
+    statusBar.setIconTheme(guiContext.getIconTheme());
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.common.html.zip.";
+  }
+
+  protected Configuration grabDialogContents(boolean full)
+  {
+    ModifiableConfiguration conf = new DefaultConfiguration();
+    if (full)
+    {
+      conf.setConfigProperty
+          ("org.jfree.report.modules.gui.common.html.zip.TargetFileName", filenameField.getText());
+      conf.setConfigProperty
+          ("org.jfree.report.modules.gui.common.html.zip.DataDirectory", dataDirField.getText());
+    }
+    conf.setConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.ExportMethod", getExportMethod());
+
+    return conf;
+  }
+
+  protected void setDialogContents(Configuration properties)
+  {
+    filenameField.setText(properties.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.TargetFileName", ""));
+    dataDirField.setText(properties.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.DataDirectory", ""));
+    setExportMethod(properties.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.ExportMethod", ""));
+  }
+
+
+  protected String getConfigurationSuffix ()
+  {
+    return "_htmlexport_file";
+  }
+
+  public String getExportMethod()
+  {
+    if (rbPageableExport.isSelected())
+    {
+      return "pageable";
+    }
+    if (rbFlowExport.isSelected())
+    {
+      return "flow";
+    }
+    return "stream";
+  }
+
+  public void setExportMethod (String method)
+  {
+    if ("pageable".equals(method))
+    {
+      rbPageableExport.setSelected(true);
+    }
+    else if ("flow".equals(method))
+    {
+      rbFlowExport.setSelected(true);
+    }
+    else
+    {
+      rbStreamExport.setSelected(true);
+    }
+  }
+
+  public void clear()
+  {
+    filenameField.setText("");
+    dataDirField.setText("");
+    rbStreamExport.setSelected(true);
+  }
+
+  protected String getResourceBaseName()
+  {
+    return SwingHtmlModule.BUNDLE_NAME;
+  }
+
+  /**
+   * Selects a file to use as target for the report processing.
+   */
+  protected void performSelectFile ()
+  {
+    final File file = new File(getFilename());
+
+    if (fileChooserHtml == null)
+    {
+      fileChooserHtml = new JFileChooser();
+      fileChooserHtml.addChoosableFileFilter
+              (new FilesystemFilter(new String[]{HtmlZipExportDialog.ZIP_FILE_EXTENSION},
+                      getResources().getString("htmlexportdialog.zip-archives"), true));
+      fileChooserHtml.setMultiSelectionEnabled(false);
+    }
+
+    fileChooserHtml.setCurrentDirectory(file);
+    fileChooserHtml.setSelectedFile(file);
+    final int option = fileChooserHtml.showSaveDialog(this);
+    if (option == JFileChooser.APPROVE_OPTION)
+    {
+      final File selFile = fileChooserHtml.getSelectedFile();
+      String selFileName = selFile.getAbsolutePath();
+
+      // Test if ends on html
+      if (StringUtils.endsWithIgnoreCase(selFileName, HtmlZipExportDialog.ZIP_FILE_EXTENSION) == false)
+      {
+        selFileName = selFileName + HtmlZipExportDialog.ZIP_FILE_EXTENSION;
+      }
+      setFilename(selFileName);
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportTask.java b/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportTask.java
new file mode 100644
index 0000000..c8a143b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/HtmlZipExportTask.java
@@ -0,0 +1,180 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: HtmlZipExportTask.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.html;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
+import org.jfree.layouting.modules.output.html.FlowHtmlOutputProcessor;
+import org.jfree.layouting.modules.output.html.HtmlOutputProcessor;
+import org.jfree.layouting.modules.output.html.HtmlPrinter;
+import org.jfree.layouting.modules.output.html.PageableHtmlOutputProcessor;
+import org.jfree.layouting.modules.output.html.StreamingHtmlOutputProcessor;
+import org.jfree.report.ReportConfigurationException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.streaming.StreamingReportProcessor;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.IOUtils;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.pentaho.reporting.libraries.repository.zipwriter.ZipRepository;
+import org.pentaho.reporting.libraries.repository.ContentLocation;
+import org.pentaho.reporting.libraries.repository.RepositoryUtilities;
+import org.pentaho.reporting.libraries.repository.DefaultNameGenerator;
+
+/**
+ * Creation-Date: 02.12.2006, 14:15:14
+ *
+ * @author Thomas Morgner
+ */
+public class HtmlZipExportTask implements Runnable
+{
+  private ReportJob job;
+  private String dataDirectory;
+  private String exportMethod;
+  private String filename;
+  private File targetFile;
+  private String encoding;
+
+  public HtmlZipExportTask(final ReportJob job)
+      throws ReportConfigurationException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+    this.job = job;
+
+    final Configuration config = job.getConfiguration();
+    dataDirectory = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.DataDirectory");
+    final String targetFileName = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.TargetFileName");
+    exportMethod = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.ExportMethod");
+    encoding = config.getConfigProperty
+        ("org.jfree.report.modules.gui.common.html.zip.Encoding", "ASCII");
+
+    targetFile = new File(targetFileName);
+    filename = IOUtils.getInstance().stripFileExtension(targetFile.getName());
+
+    if (targetFile.exists())
+    {
+      // lets try to delete it ..
+      if (targetFile.delete() == false)
+      {
+        throw new ReportConfigurationException
+            ("Target-File exists, but cannot be removed.");
+      }
+    }
+  }
+
+  /**
+   * When an object implementing interface <code>Runnable</code> is used to
+   * create a thread, starting the thread causes the object's <code>run</code>
+   * method to be called in that separately executing thread.
+   * <p/>
+   * The general contract of the method <code>run</code> is that it may take any
+   * action whatsoever.
+   *
+   * @see Thread#run()
+   */
+  public void run()
+  {
+    OutputStream fout = null;
+    try
+    {
+      fout = new BufferedOutputStream(new FileOutputStream(targetFile));
+      final ZipRepository zipRepository = new ZipRepository(fout);
+      final ContentLocation root = zipRepository.getRoot();
+      final ContentLocation data = RepositoryUtilities.createLocation
+          (zipRepository, RepositoryUtilities.split(dataDirectory, "/"));
+      final StreamingReportProcessor sp = new StreamingReportProcessor();
+
+      final HtmlOutputProcessor outputProcessor = createOutputProcessor();
+      final HtmlPrinter printer = outputProcessor.getPrinter();
+
+      printer.setContentWriter(root, new DefaultNameGenerator(root, filename));
+      printer.setDataWriter(data, new DefaultNameGenerator(data, "content"));
+      printer.setEncoding(encoding);
+
+      sp.setOutputProcessor(outputProcessor);
+      sp.processReport(job);
+    }
+    catch(Exception e)
+    {
+      DebugLog.log("ZIP-Export failed. ", e);
+    }
+    finally
+    {
+      try
+      {
+        job.close();
+        job = null;
+      }
+      catch(Exception e)
+      {
+        // ignore ..
+      }
+
+      if (fout != null)
+      {
+        try
+        {
+          fout.close();
+        }
+        catch(Exception e)
+        {
+          // ignored ..
+        }
+      }
+
+    }
+  }
+
+  protected HtmlOutputProcessor createOutputProcessor()
+  {
+    if ("pageable".equals(exportMethod))
+    {
+      return new PageableHtmlOutputProcessor(job.getConfiguration());
+    }
+    else if ("flow".equals(exportMethod))
+    {
+      return new FlowHtmlOutputProcessor(job.getConfiguration());
+    }
+    else
+    {
+      return new StreamingHtmlOutputProcessor(job.getConfiguration());
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/html/SwingHtmlModule.java b/source/org/jfree/report/modules/gui/swing/html/SwingHtmlModule.java
new file mode 100644
index 0000000..540521e
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/SwingHtmlModule.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SwingHtmlModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.html;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 30.11.2006, 12:16:09
+ *
+ * @author Thomas Morgner
+ */
+public class SwingHtmlModule extends AbstractModule
+{
+  public static final String BUNDLE_NAME =
+      "org.jfree.report.modules.gui.swing.html.resources";
+
+  public SwingHtmlModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/html/configuration.properties b/source/org/jfree/report/modules/gui/swing/html/configuration.properties
new file mode 100644
index 0000000..e82d814
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/configuration.properties
@@ -0,0 +1,50 @@
+#
+# Printing for JDK 1.2
+# The global role 'print' is assigned to that action type.
+org.jfree.report.modules.gui.swing.category.export.html.enabled=true
+org.jfree.report.modules.gui.swing.category.export.html.position=2000
+org.jfree.report.modules.gui.swing.category.export.html.resource-base=org.jfree.report.modules.gui.swing.html.resources
+org.jfree.report.modules.gui.swing.category.export.html.resource-prefix=category.export.html.
+
+org.jfree.report.modules.gui.swing.actions.export.html.file=org.jfree.report.modules.gui.swing.html.HtmlFileExportActionPlugin
+org.jfree.report.modules.gui.swing.actions.export.html.zip=org.jfree.report.modules.gui.swing.html.HtmlZipExportActionPlugin
+
+org.jfree.report.modules.gui.swing.html.export.file.add-to-menu=true
+org.jfree.report.modules.gui.swing.html.export.file.add-to-toolbar=false
+org.jfree.report.modules.gui.swing.html.export.file.role-preference=0
+org.jfree.report.modules.gui.swing.html.export.file.role=export-html-file
+org.jfree.report.modules.gui.swing.html.export.file.menu-order=1000
+org.jfree.report.modules.gui.swing.html.export.file.toolbar-order=1000
+org.jfree.report.modules.gui.swing.html.export.file.separated=false
+
+org.jfree.report.modules.gui.swing.html.export.zip.add-to-menu=true
+org.jfree.report.modules.gui.swing.html.export.zip.add-to-toolbar=false
+org.jfree.report.modules.gui.swing.html.export.zip.role-preference=0
+org.jfree.report.modules.gui.swing.html.export.zip.role=export-html-zip
+org.jfree.report.modules.gui.swing.html.export.zip.menu-order=2000
+org.jfree.report.modules.gui.swing.html.export.zip.toolbar-order=2000
+org.jfree.report.modules.gui.swing.html.export.zip.separated=false
+
+org.jfree.report.modules.gui.swing.html.file.ExportDialog=org.jfree.report.modules.gui.swing.html.HtmlFileExportDialog
+org.jfree.report.modules.gui.swing.html.zip.ExportDialog=org.jfree.report.modules.gui.swing.html.HtmlZipExportDialog
+
+
+# I wont list them all here.
+# http://dublincore.org/documents/dces/
+org.jfree.report.modules.gui.common.html.meta.Title=
+org.jfree.report.modules.gui.common.html.meta.Author=
+org.jfree.report.modules.gui.common.html.meta.Keywords=
+org.jfree.report.modules.gui.common.html.meta.Descriptions=
+
+
+# The export parameters for File-HTML exports ..
+#
+# Defines the default export method to be used when doing file exports
+org.jfree.report.modules.gui.common.html.file.ExportMethod=
+org.jfree.report.modules.gui.common.html.file.DataDirectory=
+org.jfree.report.modules.gui.common.html.file.TargetFileName=
+
+
+org.jfree.report.modules.gui.common.html.zip.DataDirectory=
+org.jfree.report.modules.gui.common.html.zip.TargetFileName=
+org.jfree.report.modules.gui.common.html.zip.ExportMethod=
diff --git a/source/org/jfree/report/modules/gui/swing/html/module.properties b/source/org/jfree/report/modules/gui/swing/html/module.properties
new file mode 100644
index 0000000..7e20d93
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/module.properties
@@ -0,0 +1,17 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: gui-swing-html
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: HTML export GUI for Swing
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.gui.swing.common.SwingCommonModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
diff --git a/source/org/jfree/report/modules/gui/swing/html/resources.properties b/source/org/jfree/report/modules/gui/swing/html/resources.properties
new file mode 100644
index 0000000..021d9f8
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/html/resources.properties
@@ -0,0 +1,74 @@
+category.export.html.name=HTML
+category.export.html.mnemonic=
+category.export.html.description=
+
+
+action.export-to-html.file.description=Saves the report as HTML files
+action.export-to-html.file.mnemonic=VK_H
+action.export-to-html.file.name=HTML text...
+action.export-to-html.file.accelerator=
+
+action.export-to-html.zip.description=Saves the report as Zip-Archive containing the HTML files
+action.export-to-html.zip.mnemonic=VK_Z
+action.export-to-html.zip.name=ZIPped HTML text...
+action.export-to-html.zip.accelerator=
+
+htmlexportdialog.exportMethod=Export method
+htmlexportdialog.zip-archives=ZIP archives
+htmlexportdialog.html-documents=HTML documents
+
+htmlexportdialog.cancel=Cancel
+htmlexportdialog.confirm=Confirm
+
+htmlexportdialog.datafilename=Data Directory
+htmlexportdialog.filename=Target
+
+htmlexportdialog.stream-export=Everything in one file
+htmlexportdialog.flow-export=One file per manual break
+htmlexportdialog.pageable-export=Page-by-Page
+
+htmlexportdialog.select=Select
+htmlexportdialog.edit-meta-data=Edit Meta-Data
+
+htmlexportdialog.targetIsEmpty=Please specify a filename for the Html file.
+htmlexportdialog.targetIsNoFile=The selected target is no ordinary file.
+htmlexportdialog.targetIsNotWritable=The selected file is not writable.
+htmlexportdialog.targetExistsWarning=The file ''{0}'' exists. Overwrite it?
+htmlexportdialog.targetDataDirIsNoDirectory=The specified data directory is not valid.
+
+htmlexportdialog.targetOverwriteConfirmation=The file ''{0}'' exists. Overwrite it?
+htmlexportdialog.targetOverwriteTitle=Overwrite file?
+htmlexportdialog.targetCreateDataDirConfirmation=The specified data directory does not exist.\nShall the missing subdirectories be created?
+htmlexportdialog.targetCreateDataDirTitle=Create data directory?
+htmlexportdialog.targetPathIsAbsolute=The specified target path denotes an absolute directory.\nPlease enter a data directory within the ZIP file.
+
+##
+#htmlexportdialog.copy-external-references=Copy external references
+#htmlexportdialog.dialogtitle=Export Report into an Html-File ...
+#htmlexportdialog.directory-export=Directory export
+#htmlexportdialog.encoding=Encoding
+#htmlexportdialog.errorTitle=Error
+#htmlexportdialog.filename=Filename
+#htmlexportdialog.generate-html4=Generate HTML 4.0 output
+#htmlexportdialog.generate-xhtml=Generate XHTML 1.0 output
+#htmlexportdialog.html-documents=HTML documents
+#htmlexportdialog.selectDirFile=Select File
+#htmlexportdialog.selectStreamFile=Select File
+#htmlexportdialog.selectZipFile=Select File
+#htmlexportdialog.stream-export=File stream export
+#htmlexportdialog.strict-layout=Perform strict table layouting on export.
+#htmlexportdialog.targetCreateDataDirConfirmation=The specified data directory does not exist.\nShall the missing subdirectories be created?
+#htmlexportdialog.targetCreateDataDirTitle=Create data directory?
+#htmlexportdialog.targetDataDirIsNoDirectory=The specified data directory is not valid.
+#htmlexportdialog.targetIsNoFile=The selected target is no ordinary file.
+#htmlexportdialog.targetIsNotWritable=The selected file is not writable.
+#htmlexportdialog.targetOverwriteConfirmation=The file ''{0}'' exists. Overwrite it?
+#htmlexportdialog.targetExistsWarning=The file ''{0}'' exists. Overwrite it?
+#htmlexportdialog.targetOverwriteTitle=Overwrite file?
+#htmlexportdialog.targetPathIsAbsolute=The specified target path denotes an absolute directory.\nPlease enter a data directory within the ZIP file.
+#htmlexportdialog.title=Title
+#htmlexportdialog.warningTitle=Warning
+#htmlexportdialog.zip-export=ZIP file export
+#htmlexportdialog.author=Author
+#htmlexportdialog.exportFormat=Export format
+#
diff --git a/source/org/jfree/report/modules/gui/swing/pdf/PdfExportActionPlugin.java b/source/org/jfree/report/modules/gui/swing/pdf/PdfExportActionPlugin.java
new file mode 100644
index 0000000..850f87a
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/pdf/PdfExportActionPlugin.java
@@ -0,0 +1,158 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PdfExportActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.pdf;
+
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.ReportConfigurationException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.swing.common.AbstractExportActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 02.12.2006, 15:27:01
+ *
+ * @author Thomas Morgner
+ */
+public class PdfExportActionPlugin extends AbstractExportActionPlugin
+{
+  private ResourceBundleSupport resources;
+  private static final String EXPORT_DIALOG_KEY =
+      "org.jfree.report.modules.gui.swing.pdf.ExportDialog";
+
+  public PdfExportActionPlugin()
+  {
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.pdf.export.";
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPdfModule.BUNDLE_NAME);
+    return true;
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.export-to-pdf.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.export-to-pdf.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getOptionalKeyStroke("action.export-to-pdf.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic("action.export-to-pdf.mnemonic");
+  }
+
+  /**
+   * Exports a report.
+   *
+   * @param job the report.
+   * @return A boolean.
+   */
+  public boolean performExport(ReportJob job)
+  {
+    if (performShowExportDialog(job, EXPORT_DIALOG_KEY) == false)
+    {
+      return false;
+    }
+
+    try
+    {
+      final PdfExportTask task = new PdfExportTask(job);
+      Thread worker = new Thread(task);
+      setStatusText("Started Job");
+      worker.start();
+      return true;
+    }
+    catch (ReportConfigurationException e)
+    {
+      setStatusText("Failed to configure the export task.");
+      return false;
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/pdf/PdfExportDialog.java b/source/org/jfree/report/modules/gui/swing/pdf/PdfExportDialog.java
new file mode 100644
index 0000000..5894752
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/pdf/PdfExportDialog.java
@@ -0,0 +1,946 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PdfExportDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.pdf;
+
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+
+import org.jfree.layouting.modules.output.pdf.PdfOutputModule;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.common.GuiContext;
+import org.jfree.report.modules.gui.swing.common.AbstractExportDialog;
+import org.jfree.report.modules.gui.swing.common.EncodingComboBoxModel;
+import org.jfree.report.modules.gui.swing.common.JStatusBar;
+import org.jfree.report.modules.gui.swing.common.action.ActionButton;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.config.DefaultConfiguration;
+import org.pentaho.reporting.libraries.base.util.FilesystemFilter;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+import org.pentaho.reporting.libraries.fonts.encoding.EncodingRegistry;
+
+/**
+ * Creation-Date: 02.12.2006, 15:27:30
+ *
+ * @author Thomas Morgner
+ */
+public class PdfExportDialog extends AbstractExportDialog
+{
+  /** Useful constant. */
+  private static final int CBMODEL_NOPRINTING = 0;
+
+  /** Useful constant. */
+  private static final int CBMODEL_DEGRADED = 1;
+
+  /** Useful constant. */
+  private static final int CBMODEL_FULL = 2;
+
+  /**
+   * Internal action class to enable/disable the Security-Settings panel.
+   * Without encryption a pdf file cannot have any security settings enabled.
+   */
+  private class ActionSecuritySelection extends AbstractAction
+  {
+    /** Default constructor. */
+    protected ActionSecuritySelection()
+    {
+    }
+
+    /**
+     * Receives notification that the action has occurred.
+     *
+     * @param e the action event.
+     */
+    public void actionPerformed(final ActionEvent e)
+    {
+      updateSecurityPanelEnabled();
+    }
+  }
+
+  /** Internal action class to select a target file. */
+  private class ActionSelectFile extends AbstractAction
+  {
+    /** Default constructor. */
+    protected ActionSelectFile(final ResourceBundle resources)
+    {
+      putValue(Action.NAME, resources.getString("pdfsavedialog.selectFile"));
+    }
+
+    /**
+     * Receives notification that the action has occurred.
+     *
+     * @param e the action event.
+     */
+    public void actionPerformed(final ActionEvent e)
+    {
+      performSelectFile();
+    }
+  }
+
+  /** Security (none) radio button. */
+  private JRadioButton rbSecurityNone;
+
+  /** Security (40 bit) radio button. */
+  private JRadioButton rbSecurity40Bit;
+
+  /** Security (128 bit) radio button. */
+  private JRadioButton rbSecurity128Bit;
+
+  /** User password text field. */
+  private JTextField txUserPassword;
+
+  /** Owner password text field. */
+  private JTextField txOwnerPassword;
+
+  /** Confirm user password text field. */
+  private JTextField txConfUserPassword;
+
+  /** Confirm ownder password text field. */
+  private JTextField txConfOwnerPassword;
+
+  /** Allow copy check box. */
+  private JCheckBox cxAllowCopy;
+
+  /** Allow screen readers check box. */
+  private JCheckBox cxAllowScreenReaders;
+
+  /** Allow printing check box. */
+  private JComboBox cbAllowPrinting;
+
+  /** Allow assembly check box. */
+  private JCheckBox cxAllowAssembly;
+
+  /** Allow modify contents check box. */
+  private JCheckBox cxAllowModifyContents;
+
+  /** Allow modify annotations check box. */
+  private JCheckBox cxAllowModifyAnnotations;
+
+  /** Allow fill in check box. */
+  private JCheckBox cxAllowFillIn;
+
+  /** A model for the available encodings. */
+  private EncodingComboBoxModel encodingModel;
+
+  /** A file chooser. */
+  private JFileChooser fileChooser;
+  private static final String PDF_FILE_EXTENSION = ".pdf";
+  private JStatusBar statusBar;
+  private JTextField txFilename;
+  private DefaultComboBoxModel printingModel;
+
+  /**
+   * Creates a non-modal dialog without a title and without a specified
+   * <code>Frame</code> owner.  A shared, hidden frame will be set as the owner
+   * of the dialog.
+   */
+  public PdfExportDialog()
+  {
+    initializeComponents();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Frame</code> as its owner.  If <code>owner</code> is
+   * <code>null</code>, a shared, hidden frame will be set as the owner of the
+   * dialog.
+   *
+   * @param owner the <code>Frame</code> from which the dialog is displayed
+   */
+  public PdfExportDialog(final Frame owner)
+  {
+    super(owner);
+    initializeComponents();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Dialog</code> as its owner.
+   *
+   * @param owner the non-null <code>Dialog</code> from which the dialog is
+   *              displayed
+   */
+  public PdfExportDialog(final Dialog owner)
+  {
+    super(owner);
+    initializeComponents();
+  }
+
+  private void initializeComponents ()
+  {
+    final JPanel mainPanel = new JPanel();
+    mainPanel.setLayout(new GridBagLayout());
+    mainPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
+
+    final JLabel lblFileName = new JLabel(getResources().getString("pdfsavedialog.filename"));
+    final JLabel lblEncoding = new JLabel(getResources().getString("pdfsavedialog.encoding"));
+
+    final JButton btnSelect = new ActionButton(new ActionSelectFile(getResources()));
+    txFilename = new JTextField();
+    statusBar = new JStatusBar();
+
+    encodingModel = EncodingComboBoxModel.createDefaultModel(Locale.getDefault());
+    encodingModel.addEncodingUnchecked("Identity-H", "PDF-Unicode encoding");
+    encodingModel.addEncodingUnchecked("Identity-V", "PDF-Unicode encoding");
+    encodingModel.sort();
+
+    final JComboBox cbEncoding = new JComboBox(encodingModel);
+
+    GridBagConstraints gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridy = 0;
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.insets = new Insets(3, 1, 1, 1);
+    mainPanel.add(lblFileName, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.gridx = 1;
+    gbc.gridy = 0;
+    gbc.ipadx = 120;
+    gbc.insets = new Insets(3, 1, 1, 1);
+    mainPanel.add(txFilename, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.NORTHWEST;
+    gbc.gridx = 2;
+    gbc.gridy = 0;
+    mainPanel.add(btnSelect, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 0;
+    gbc.gridy = 1;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    mainPanel.add(lblEncoding, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.gridx = 1;
+    gbc.gridy = 1;
+    gbc.ipadx = 120;
+    gbc.insets = new Insets(1, 1, 1, 1);
+    mainPanel.add(cbEncoding, gbc);
+
+    final JButton btnCancel = new ActionButton(getCancelAction());
+    final JButton btnConfirm = new ActionButton(getConfirmAction());
+    final JPanel buttonPanel = new JPanel();
+    buttonPanel.setLayout(new GridLayout(1, 2, 5, 5));
+    buttonPanel.add(btnConfirm);
+    buttonPanel.add(btnCancel);
+    btnConfirm.setDefaultCapable(true);
+    getRootPane().setDefaultButton(btnConfirm);
+    buttonPanel.registerKeyboardAction(getConfirmAction(),
+            KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+    final JPanel buttonCarrier = new JPanel();
+    buttonCarrier.setLayout(new FlowLayout(FlowLayout.RIGHT));
+    buttonCarrier.add(buttonPanel);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.NONE;
+    gbc.anchor = GridBagConstraints.EAST;
+    gbc.weightx = 1;
+    gbc.gridx = 0;
+    gbc.gridwidth = 3;
+    gbc.gridy = 6;
+    gbc.insets = new Insets(10, 0, 0, 0);
+
+    final JPanel mainPaneCarrier = new JPanel();
+    mainPaneCarrier.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
+    mainPaneCarrier.setLayout(new BorderLayout());
+    mainPaneCarrier.add(mainPanel, BorderLayout.NORTH);
+
+    final JPanel securityPaneCarrier = new JPanel();
+    securityPaneCarrier.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
+    securityPaneCarrier.setLayout(new BorderLayout());
+    securityPaneCarrier.add(createSecurityPanel(), BorderLayout.NORTH);
+
+    final JTabbedPane tabbedPane = new JTabbedPane();
+    tabbedPane.add("Export-Settings", mainPaneCarrier);
+    tabbedPane.add("Security", securityPaneCarrier);
+
+    final JPanel contentPane = new JPanel();
+    contentPane.setLayout(new BorderLayout());
+    contentPane.add(tabbedPane, BorderLayout.CENTER);
+    contentPane.add(buttonCarrier, BorderLayout.SOUTH);
+
+    final JPanel contentWithStatus = new JPanel();
+    contentWithStatus.setLayout(new BorderLayout());
+    contentWithStatus.add(contentPane, BorderLayout.CENTER);
+    contentWithStatus.add(getStatusBar(), BorderLayout.SOUTH);
+
+    setContentPane(contentWithStatus);
+
+    getFormValidator().registerTextField(txFilename);
+    getFormValidator().registerTextField(txConfOwnerPassword);
+    getFormValidator().registerTextField(txConfUserPassword);
+    getFormValidator().registerTextField(txUserPassword);
+    getFormValidator().registerTextField(txOwnerPassword);
+
+  }
+
+
+  public JStatusBar getStatusBar()
+  {
+    return statusBar;
+  }
+
+  protected boolean performConfirm()
+  {
+    final String filename = txFilename.getText();
+    final File f = new File(filename);
+    if (f.exists())
+    {
+      final String key1 = "pdfsavedialog.targetOverwriteConfirmation";
+      final String key2 = "pdfsavedialog.targetOverwriteTitle";
+      if (JOptionPane.showConfirmDialog(this,
+              MessageFormat.format(getResources().getString(key1),
+                      new Object[]{txFilename.getText()}),
+              getResources().getString(key2),
+              JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)
+              == JOptionPane.NO_OPTION)
+      {
+        return false;
+      }
+    }
+
+    if (getEncryptionValue().equals(PdfOutputModule.SECURITY_ENCRYPTION_128BIT)
+            || getEncryptionValue().equals(
+            PdfOutputModule.SECURITY_ENCRYPTION_40BIT))
+    {
+      if (txOwnerPassword.getText().trim().length() == 0)
+      {
+        if (JOptionPane.showConfirmDialog(this,
+                getResources().getString("pdfsavedialog.ownerpasswordEmpty"),
+                getResources().getString("pdfsavedialog.warningTitle"),
+                JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)
+                == JOptionPane.NO_OPTION)
+        {
+          return false;
+        }
+      }
+    }
+    return true;
+  }
+
+  protected boolean performValidate()
+  {
+    getStatusBar().clear();
+
+    final String filename = txFilename.getText();
+    if (filename.trim().length() == 0)
+    {
+      getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+              getResources().getString("pdfsavedialog.targetIsEmpty"));
+      return false;
+    }
+    final File f = new File(filename);
+    if (f.exists())
+    {
+      if (f.isFile() == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("pdfsavedialog.targetIsNoFile"));
+        return false;
+      }
+      if (f.canWrite() == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("pdfsavedialog.targetIsNotWritable"));
+        return false;
+      }
+
+      final String message = MessageFormat.format(getResources().getString
+              ("pdfsavedialog.targetOverwriteWarning"),
+              new Object[]{filename});
+      getStatusBar().setStatus(JStatusBar.TYPE_WARNING, message);
+    }
+
+    if (getEncryptionValue().equals(PdfOutputModule.SECURITY_ENCRYPTION_128BIT)
+            || getEncryptionValue().equals(
+            PdfOutputModule.SECURITY_ENCRYPTION_40BIT))
+    {
+      if (txUserPassword.getText().equals(
+              txConfUserPassword.getText()) == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("pdfsavedialog.userpasswordNoMatch"));
+        return false;
+      }
+      if (txOwnerPassword.getText().equals(
+              txConfOwnerPassword.getText()) == false)
+      {
+        getStatusBar().setStatus(JStatusBar.TYPE_ERROR,
+                getResources().getString("pdfsavedialog.ownerpasswordNoMatch"));
+        return false;
+      }
+    }
+
+    return true;
+  }
+
+  protected void initializeFromJob(final ReportJob job, final GuiContext guiContext)
+  {
+    statusBar.setIconTheme(guiContext.getIconTheme());
+
+//    encodingModel = EncodingComboBoxModel.createDefaultModel(Locale.getDefault());
+//    encodingModel.addEncodingUnchecked("Identity-H", "PDF-Unicode encoding");
+//    encodingModel.addEncodingUnchecked("Identity-V", "PDF-Unicode encoding");
+//    encodingModel.sort();
+//    cbEncoding.setModel(encodingModel);
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.common.pdf.";
+  }
+
+  /**
+   * Returns a new (and not connected to the default config from the job)
+   * configuration containing all properties from the dialog.
+   *
+   * @param full
+   */
+  protected Configuration grabDialogContents(final boolean full)
+  {
+    final DefaultConfiguration config = new DefaultConfiguration();
+
+    final String prefix = getConfigurationPrefix();
+    config.setConfigProperty(prefix + "TargetFileName", txFilename.getText());
+    config.setConfigProperty(prefix + "Encoding", encodingModel.getSelectedEncoding());
+    config.getConfigProperty(prefix + "security.PrintLevel", getPrintLevel());
+    config.getConfigProperty(prefix + "security.Encryption", getEncryptionValue());
+
+
+    config.getConfigProperty(prefix + "security.UserPassword", txUserPassword.getText());
+    config.getConfigProperty(prefix + "security.OwnerPassword", txOwnerPassword.getText());
+
+    config.setConfigProperty(prefix + "security.AllowAssembly",
+        String.valueOf(cxAllowAssembly.isSelected()));
+    config.setConfigProperty(prefix + "security.AllowCopy",
+        String.valueOf(cxAllowCopy.isSelected()));
+    config.setConfigProperty(prefix + "security.AllowFillIn",
+        String.valueOf(cxAllowFillIn.isSelected()));
+    config.setConfigProperty(prefix + "security.AllowModifyAnnotations",
+        String.valueOf(cxAllowModifyAnnotations.isSelected()));
+    config.setConfigProperty(prefix + "security.AllowModifyContents",
+        String.valueOf(cxAllowModifyContents.isSelected()));
+    config.setConfigProperty(prefix + "security.AllowScreenReaders",
+        String.valueOf(cxAllowScreenReaders.isSelected()));
+    return config;
+  }
+
+  protected void setDialogContents(final Configuration config)
+  {
+    final String prefix = getConfigurationPrefix();
+    txFilename.setText(config.getConfigProperty(prefix + "TargetFileName"));
+    final String encoding = config.getConfigProperty(prefix + "Encoding");
+    if (encoding != null && encoding.length() > 0)
+    {
+      encodingModel.setSelectedEncoding(encoding);
+    }
+    setPrintLevel(config.getConfigProperty(prefix + "security.PrintLevel"));
+    setEncryptionValue(config.getConfigProperty(prefix + "security.Encryption"));
+
+    txUserPassword.setText(config.getConfigProperty(prefix + "security.UserPassword"));
+    txOwnerPassword.setText(config.getConfigProperty(prefix + "security.OwnerPassword"));
+    txConfUserPassword.setText(config.getConfigProperty(prefix + "security.UserPassword"));
+    txConfOwnerPassword.setText(config.getConfigProperty(prefix + "security.OwnerPassword"));
+
+    cxAllowAssembly.setSelected("true".equals
+        (config.getConfigProperty(prefix + "security.AllowAssembly")));
+    cxAllowCopy.setSelected("true".equals
+        (config.getConfigProperty(prefix + "security.AllowCopy")));
+    cxAllowFillIn.setSelected("true".equals
+        (config.getConfigProperty(prefix + "security.AllowFillIn")));
+    cxAllowModifyAnnotations.setSelected("true".equals
+        (config.getConfigProperty(prefix + "security.AllowModifyAnnotations")));
+    cxAllowModifyContents.setSelected("true".equals
+        (config.getConfigProperty(prefix + "security.AllowModifyContents")));
+    cxAllowScreenReaders.setSelected("true".equals
+        (config.getConfigProperty(prefix + "security.AllowScreenReaders")));
+  }
+
+  protected String getConfigurationSuffix()
+  {
+    return "_pdf_export";
+  }
+
+  public void clear()
+  {
+    txConfOwnerPassword.setText("");
+    txConfUserPassword.setText("");
+    txFilename.setText("");
+    txOwnerPassword.setText("");
+    txUserPassword.setText("");
+
+    cxAllowAssembly.setSelected(false);
+    cxAllowCopy.setSelected(false);
+    cbAllowPrinting.setSelectedIndex(CBMODEL_NOPRINTING);
+    cxAllowFillIn.setSelected(false);
+    cxAllowModifyAnnotations.setSelected(false);
+    cxAllowModifyContents.setSelected(false);
+    cxAllowScreenReaders.setSelected(false);
+
+    rbSecurityNone.setSelected(true);
+    updateSecurityPanelEnabled();
+
+    final String plattformDefaultEncoding = EncodingRegistry.getPlatformDefaultEncoding();
+    encodingModel.setSelectedEncoding(plattformDefaultEncoding);
+  }
+
+  protected String getResourceBaseName()
+  {
+    return SwingPdfModule.BUNDLE_NAME;
+  }
+
+
+  /**
+   * Updates the security panel state. If no encryption is selected, all
+   * security setting components will be disabled.
+   */
+  protected void updateSecurityPanelEnabled()
+  {
+    final boolean b = (rbSecurityNone.isSelected() == false);
+    txUserPassword.setEnabled(b);
+    txOwnerPassword.setEnabled(b);
+    txConfOwnerPassword.setEnabled(b);
+    txConfUserPassword.setEnabled(b);
+    cxAllowAssembly.setEnabled(b);
+    cxAllowCopy.setEnabled(b);
+    cbAllowPrinting.setEnabled(b);
+    cxAllowFillIn.setEnabled(b);
+    cxAllowModifyAnnotations.setEnabled(b);
+    cxAllowModifyContents.setEnabled(b);
+    cxAllowScreenReaders.setEnabled(b);
+  }
+
+  /** Initializes the class member components of the security panel. */
+  private void createSecurityPanelComponents()
+  {
+    txUserPassword = new JPasswordField();
+    txConfUserPassword = new JPasswordField();
+    txOwnerPassword = new JPasswordField();
+    txConfOwnerPassword = new JPasswordField();
+
+    cxAllowCopy = new JCheckBox(getResources().getString(
+            "pdfsavedialog.allowCopy"));
+    cbAllowPrinting = new JComboBox(getPrintingComboBoxModel());
+    cxAllowScreenReaders =
+            new JCheckBox(getResources().getString(
+                    "pdfsavedialog.allowScreenreader"));
+
+    cxAllowAssembly = new JCheckBox(getResources().getString(
+            "pdfsavedialog.allowAssembly"));
+    cxAllowModifyContents =
+            new JCheckBox(getResources().getString(
+                    "pdfsavedialog.allowModifyContents"));
+    cxAllowModifyAnnotations =
+            new JCheckBox(getResources().getString(
+                    "pdfsavedialog.allowModifyAnnotations"));
+    cxAllowFillIn = new JCheckBox(getResources().getString(
+            "pdfsavedialog.allowFillIn"));
+
+  }
+
+  /**
+   * Creates a panel for the security settings.
+   *
+   * @return The panel.
+   */
+  private JPanel createSecurityPanel()
+  {
+    final JPanel securityPanel = new JPanel();
+    securityPanel.setLayout(new GridBagLayout());
+
+    createSecurityPanelComponents();
+
+    final JLabel lblUserPass = new JLabel(getResources().getString(
+            "pdfsavedialog.userpassword"));
+    final JLabel lblUserPassConfirm =
+            new JLabel(getResources().getString(
+                    "pdfsavedialog.userpasswordconfirm"));
+    final JLabel lblOwnerPass =
+            new JLabel(getResources().getString("pdfsavedialog.ownerpassword"));
+    final JLabel lblOwnerPassConfirm =
+            new JLabel(getResources().getString(
+                    "pdfsavedialog.ownerpasswordconfirm"));
+    final JLabel lbAllowPrinting =
+            new JLabel(getResources().getString("pdfsavedialog.allowPrinting"));
+
+    GridBagConstraints gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.gridx = 0;
+    gbc.gridwidth = 4;
+    gbc.gridy = 0;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(createSecurityConfigPanel(), gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 0;
+    gbc.gridy = 1;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(lblUserPass, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.gridx = 1;
+    gbc.gridy = 1;
+    gbc.ipadx = 120;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(txUserPassword, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 0;
+    gbc.gridy = 2;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(lblOwnerPass, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.gridx = 1;
+    gbc.gridy = 2;
+    gbc.ipadx = 120;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(txOwnerPassword, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 2;
+    gbc.gridy = 1;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(lblUserPassConfirm, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.gridx = 3;
+    gbc.gridy = 1;
+    gbc.ipadx = 120;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(txConfUserPassword, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.anchor = GridBagConstraints.WEST;
+    gbc.gridx = 2;
+    gbc.gridy = 2;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(lblOwnerPassConfirm, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 1;
+    gbc.gridx = 3;
+    gbc.gridy = 2;
+    gbc.ipadx = 120;
+    gbc.insets = new Insets(5, 5, 5, 5);
+    securityPanel.add(txConfOwnerPassword, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridwidth = 2;
+    gbc.gridy = 3;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(cxAllowCopy, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridwidth = 2;
+    gbc.gridy = 4;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(cxAllowScreenReaders, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridwidth = 2;
+    gbc.gridy = 5;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(cxAllowFillIn, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 2;
+    gbc.gridwidth = 2;
+    gbc.gridy = 3;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(cxAllowAssembly, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 2;
+    gbc.gridwidth = 2;
+    gbc.gridy = 4;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(cxAllowModifyContents, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 2;
+    gbc.gridwidth = 2;
+    gbc.gridy = 5;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(cxAllowModifyAnnotations, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 0;
+    gbc.gridwidth = 1;
+    gbc.gridy = 6;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(lbAllowPrinting, gbc);
+
+    gbc = new GridBagConstraints();
+    gbc.gridx = 1;
+    gbc.gridwidth = 3;
+    gbc.gridy = 6;
+    gbc.anchor = GridBagConstraints.WEST;
+    securityPanel.add(cbAllowPrinting, gbc);
+
+    return securityPanel;
+  }
+
+  /**
+   * Creates the security config panel. This panel is used to select the level
+   * of the PDF security.
+   *
+   * @return the created security config panel.
+   */
+  private JPanel createSecurityConfigPanel()
+  {
+    rbSecurityNone = new JRadioButton(getResources().getString(
+            "pdfsavedialog.securityNone"));
+    rbSecurity40Bit = new JRadioButton(getResources().getString(
+            "pdfsavedialog.security40bit"));
+    rbSecurity128Bit = new JRadioButton(getResources().getString(
+            "pdfsavedialog.security128bit"));
+
+    final Action securitySelectAction = new ActionSecuritySelection();
+    rbSecurityNone.addActionListener(securitySelectAction);
+    rbSecurity40Bit.addActionListener(securitySelectAction);
+    rbSecurity128Bit.addActionListener(securitySelectAction);
+
+    rbSecurity128Bit.setSelected(true);
+
+    final JPanel pnlSecurityConfig = new JPanel();
+    pnlSecurityConfig.setLayout(new GridLayout());
+    pnlSecurityConfig.add(rbSecurityNone);
+    pnlSecurityConfig.add(rbSecurity40Bit);
+    pnlSecurityConfig.add(rbSecurity128Bit);
+
+    final ButtonGroup btGrpSecurity = new ButtonGroup();
+    btGrpSecurity.add(rbSecurity128Bit);
+    btGrpSecurity.add(rbSecurity40Bit);
+    btGrpSecurity.add(rbSecurityNone);
+
+    return pnlSecurityConfig;
+  }
+
+  /**
+   * Gets and initializes the the combobox model for the security setting
+   * "allowPrinting".
+   *
+   * @return the combobox model containing the different values for the
+   *         allowPrinting option.
+   */
+  private DefaultComboBoxModel getPrintingComboBoxModel()
+  {
+    if (printingModel == null)
+    {
+      final Object[] data = {
+              getResources().getString("pdfsavedialog.option.noprinting"),
+              getResources().getString("pdfsavedialog.option.degradedprinting"),
+              getResources().getString("pdfsavedialog.option.fullprinting")
+      };
+      printingModel = new DefaultComboBoxModel(data);
+    }
+    return printingModel;
+  }
+
+
+  /** selects a file to use as target for the report processing. */
+  protected void performSelectFile()
+  {
+    // lazy initialize ... the file chooser is one of the hot spots here ...
+    if (fileChooser == null)
+    {
+      fileChooser = new JFileChooser();
+      final FilesystemFilter filter = new FilesystemFilter(PDF_FILE_EXTENSION,
+              "PDF Documents");
+      fileChooser.addChoosableFileFilter(filter);
+      fileChooser.setMultiSelectionEnabled(false);
+    }
+
+    final File file = new File(txFilename.getText());
+    fileChooser.setCurrentDirectory(file);
+    fileChooser.setSelectedFile(file);
+    final int option = fileChooser.showSaveDialog(this);
+    if (option == JFileChooser.APPROVE_OPTION)
+    {
+      final File selFile = fileChooser.getSelectedFile();
+      String selFileName = selFile.getAbsolutePath();
+
+      // Test if ends of pdf
+      if (selFileName.toLowerCase().endsWith(PDF_FILE_EXTENSION) == false)
+      {
+        selFileName = selFileName + PDF_FILE_EXTENSION;
+      }
+      txFilename.setText(selFileName);
+    }
+  }
+
+  /**
+   * Defines whether the user is allowed to print the file.  If this right is
+   * granted, the user is also able to print a degraded version of the file,
+   * regardless of the <code>allowDegradedPrinting</code< property. If you
+   * disabled printing but enabled degraded printing, then the user is able to
+   * print a low-quality version of the document.
+   *
+   */
+  public void setPrintLevel(final String printLevel)
+  {
+    if ("full".equals(printLevel))
+    {
+      this.cbAllowPrinting.setSelectedIndex(CBMODEL_FULL);
+    }
+    else if ("degraded".equals(printLevel))
+    {
+        this.cbAllowPrinting.setSelectedIndex(CBMODEL_DEGRADED);
+    }
+    else
+    {
+      this.cbAllowPrinting.setSelectedIndex(CBMODEL_NOPRINTING);
+    }
+  }
+
+  public String getPrintLevel ()
+  {
+    if (cbAllowPrinting.getSelectedIndex() == CBMODEL_FULL)
+    {
+      return "full";
+    }
+    if (cbAllowPrinting.getSelectedIndex() == CBMODEL_DEGRADED)
+    {
+      return "degraded";
+    }
+    return "none";
+  }
+
+
+  /**
+   * Queries the currently selected encryption. If an encryption is selected
+   * this method returns either Boolean.TRUE or Boolean.FALSE, when no
+   * encryption is set, <code>null</code> is returned. If no encryption is set,
+   * the security properties have no defined state.
+   *
+   * @return the selection state for the encryption. If no encryption is set,
+   *         this method returns null, if 40-bit encryption is set, the method
+   *         returns Boolean.FALSE and on 128-Bit-encryption, Boolean.TRUE is
+   *         returned.
+   */
+  public String getEncryptionValue()
+  {
+    if (rbSecurity40Bit.isSelected())
+    {
+      return PdfOutputModule.SECURITY_ENCRYPTION_40BIT;
+    }
+    if (rbSecurity128Bit.isSelected())
+    {
+      return PdfOutputModule.SECURITY_ENCRYPTION_128BIT;
+    }
+    return PdfOutputModule.SECURITY_ENCRYPTION_NONE;
+  }
+
+  /**
+   * Defines the currently selected encryption.
+   *
+   * @param b the new encryption state, one of null, Boolean.TRUE or
+   *          Boolean.FALSE
+   */
+  public void setEncryptionValue(final String b)
+  {
+    if (b != null)
+    {
+      if (b.equals(PdfOutputModule.SECURITY_ENCRYPTION_128BIT))
+      {
+        rbSecurity128Bit.setSelected(true);
+        updateSecurityPanelEnabled();
+        return;
+      }
+      else if (b.equals(PdfOutputModule.SECURITY_ENCRYPTION_40BIT))
+      {
+        rbSecurity40Bit.setSelected(true);
+        updateSecurityPanelEnabled();
+        return;
+      }
+      else if (b.equals(PdfOutputModule.SECURITY_ENCRYPTION_NONE) == false)
+      {
+        DebugLog.log("Invalid encryption value entered. " + b);
+      }
+    }
+    rbSecurityNone.setSelected(true);
+    updateSecurityPanelEnabled();
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/pdf/PdfExportTask.java b/source/org/jfree/report/modules/gui/swing/pdf/PdfExportTask.java
new file mode 100644
index 0000000..9734d71
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/pdf/PdfExportTask.java
@@ -0,0 +1,117 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PdfExportTask.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.pdf;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+
+import org.jfree.layouting.modules.output.pdf.PdfOutputProcessor;
+import org.jfree.report.ReportConfigurationException;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.streaming.StreamingReportProcessor;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 02.12.2006, 15:34:17
+ *
+ * @author Thomas Morgner
+ */
+public class PdfExportTask implements Runnable
+{
+  private ReportJob job;
+  private File targetFile;
+
+  public PdfExportTask(final ReportJob job)
+      throws ReportConfigurationException
+  {
+    if (job == null)
+    {
+      throw new NullPointerException();
+    }
+    this.job = job;
+    final Configuration config = job.getConfiguration();
+    final String targetFileName = config.getConfigProperty("org.jfree.report.modules.gui.common.pdf.TargetFileName");
+
+    targetFile = new File(targetFileName);
+    if (targetFile.exists())
+    {
+      if (targetFile.delete())
+      {
+        throw new ReportConfigurationException("Target-File exists, but cannot be removed.");
+      }
+    }
+  }
+
+  /**
+   * When an object implementing interface <code>Runnable</code> is used to
+   * create a thread, starting the thread causes the object's <code>run</code>
+   * method to be called in that separately executing thread.
+   * <p/>
+   * The general contract of the method <code>run</code> is that it may take any
+   * action whatsoever.
+   *
+   * @see Thread#run()
+   */
+  public void run()
+  {
+    try
+    {
+      final FileOutputStream fout = new FileOutputStream(targetFile);
+      final StreamingReportProcessor sp = new StreamingReportProcessor();
+      final PdfOutputProcessor outputProcessor = new PdfOutputProcessor(job.getConfiguration(), fout);
+      sp.setOutputProcessor(outputProcessor);
+      sp.processReport(job);
+
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+    finally
+    {
+      try
+      {
+        job.close();
+        job = null;
+      }
+      catch(Exception e)
+      {
+        // ignore ..
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/pdf/SwingPdfModule.java b/source/org/jfree/report/modules/gui/swing/pdf/SwingPdfModule.java
new file mode 100644
index 0000000..57ffd70
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/pdf/SwingPdfModule.java
@@ -0,0 +1,69 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SwingPdfModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.pdf;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 02.12.2006, 15:27:58
+ *
+ * @author Thomas Morgner
+ */
+public class SwingPdfModule extends AbstractModule
+{
+  public static final String BUNDLE_NAME =
+      "org.jfree.report.modules.gui.swing.pdf.resources";
+
+
+  public SwingPdfModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/pdf/configuration.properties b/source/org/jfree/report/modules/gui/swing/pdf/configuration.properties
new file mode 100644
index 0000000..57c7464
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/pdf/configuration.properties
@@ -0,0 +1,106 @@
+org.jfree.report.modules.gui.swing.actions.export.pdf=org.jfree.report.modules.gui.swing.pdf.PdfExportActionPlugin
+
+org.jfree.report.modules.gui.swing.pdf.export.add-to-menu=true
+org.jfree.report.modules.gui.swing.pdf.export.add-to-toolbar=false
+org.jfree.report.modules.gui.swing.pdf.export.role-preference=0
+org.jfree.report.modules.gui.swing.pdf.export.role=export-pdf
+org.jfree.report.modules.gui.swing.pdf.export.menu-order=0
+org.jfree.report.modules.gui.swing.pdf.export.toolbar-order=0
+org.jfree.report.modules.gui.swing.pdf.export.separated=false
+
+org.jfree.report.modules.gui.swing.pdf.ExportDialog=org.jfree.report.modules.gui.swing.pdf.PdfExportDialog
+
+
+#
+# The author string of the document.
+#org.jfree.report.modules.gui.commom.pdf.meta.Author=
+
+#
+# The title of the document.
+#org.jfree.report.modules.gui.commom.pdf.meta.Title=
+
+
+## LibLayout specific properties ..
+#
+# The default font-encoding for the OutputTarget.
+# Can be changed with PDFOutputTarget.setFontEncoding for the specific
+# instance if needed.
+org.jfree.layouting.modules.output.pdf.Encoding=Cp1252
+
+#
+# Defines whether to embed fonts in the generated PDF. This will result in larger PDF
+# files, but makes sure that all characters are displayed properly.
+#
+org.jfree.layouting.modules.output.pdf.EmbedFonts=true
+#
+# The PDF Version that should be created. Valid values are "1.2", "1.3",
+# "1.4" or "1.5"
+org.jfree.layouting.modules.output.pdf.Version=1.4
+
+
+org.jfree.layouting.modules.output.pdf.TargetFileName=
+
+###########################################################################################
+### PDF Security flags are only used with security enabled and a password set #############
+###########################################################################################
+
+#
+# Defines, whether the PDF Security setting allows copying of the document's
+# contents by default
+org.jfree.layouting.modules.output.pdf.security.AllowCopy=false
+
+#
+# Defines, whether the PDF Security setting allows printing of the document's
+# contents by default. (Allowed values: none, degraded, full)
+org.jfree.layouting.modules.output.pdf.security.PrintLevel=none
+
+#
+# Defines, whether the PDF Security setting allows modifying of the document
+# by default
+org.jfree.layouting.modules.output.pdf.security.AllowModifyContents=false
+
+#
+# Defines, whether the PDF Security setting allows document annotations by
+# default
+org.jfree.layouting.modules.output.pdf.security.AllowModifyAnnotations=false
+
+#
+# Defines, whether the PDF Security setting allows the fill-in of document
+# forms (inputfields etc).
+org.jfree.layouting.modules.output.pdf.security.AllowFillIn=false
+
+#
+# Defines, whether the PDF Security setting allows access for screenreaders
+# by default. Although this could make it easier to grab the contents your
+# PDF document, enabling this property will allow blind people to access your
+# content. It is usually a good idea to always enable this property.
+org.jfree.layouting.modules.output.pdf.security.AllowScreenReaders=false
+
+#
+# Defines, whether the PDF Security setting allows reassmebly of the document
+# by default.
+org.jfree.layouting.modules.output.pdf.security.AllowAssembly=false
+
+#
+# Defines whether the PDF file should be encrypted by default. Set this to
+# "none" "40bit" or "128bit". Access restrictions have no effect if the document
+# is not encrypted, and not all security settings are active on 40-Bit encryption.
+org.jfree.layouting.modules.output.pdf.security.Encryption=none
+
+####################################################################################
+# Warning: Specifying passwords in the property file can introduce a security
+# risk. Do not use these settings on the client side or in unprotected
+# (world-readable) server environments. In these cases use other means of
+# defining the password.
+
+#
+# The default user password for the document.
+# Users are able to access the document within the defined security restrictions.
+#org.jfree.layouting.modules.output.pdf.security.UserPassword=
+
+#
+# The default owner password for the document.
+# The owner has all perfmissions on the document and will be able to
+# change the security settings.
+#org.jfree.layouting.modules.output.pdf.security.OwnerPassword=
+
diff --git a/source/org/jfree/report/modules/gui/swing/pdf/module.properties b/source/org/jfree/report/modules/gui/swing/pdf/module.properties
new file mode 100644
index 0000000..0f4d1f8
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/pdf/module.properties
@@ -0,0 +1,17 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: gui-swing-pdf
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: PDF export GUI for Swing
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.gui.swing.common.SwingCommonModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
diff --git a/source/org/jfree/report/modules/gui/swing/pdf/resources.properties b/source/org/jfree/report/modules/gui/swing/pdf/resources.properties
new file mode 100644
index 0000000..bad121e
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/pdf/resources.properties
@@ -0,0 +1,46 @@
+action.export-to-pdf.description=Export the report into PDF format
+action.export-to-pdf.mnemonic=VK_P
+action.export-to-pdf.name=PDF...
+action.export-to-pdf.accelerator=VK_S
+
+
+pdfsavedialog.allowCopy=Allow Copy
+pdfsavedialog.allowDegradedPrinting=Allow Degraded Printing
+pdfsavedialog.allowFillIn=Allow Fill In of Formulardata
+pdfsavedialog.allowModifyAnnotations=Allow Modification Of Annotations
+pdfsavedialog.allowModifyContents=Allow Modifications of Contents
+pdfsavedialog.allowPrinting=Allow Printing
+pdfsavedialog.allowScreenreader=Allow Usage Of Screenreaders
+pdfsavedialog.author=Author
+pdfsavedialog.cancel=Cancel
+pdfsavedialog.confirm=Confirm
+pdfsavedialog.dialogtitle=Saving Report into a PDF-File ...
+pdfsavedialog.encoding=Encoding
+pdfsavedialog.errorTitle=Error
+pdfsavedialog.filename=Filename
+pdfsavedialog.option.degradedprinting=Low quality printing
+pdfsavedialog.option.fullprinting=Printing allowed
+pdfsavedialog.option.noprinting=No printing
+pdfsavedialog.ownerpassword=Owner Password
+pdfsavedialog.ownerpasswordEmpty=The owner-password is empty. Users may be able to change security constraints. Continue anyway?
+pdfsavedialog.ownerpasswordNoMatch=The owner-passwords do not match.
+pdfsavedialog.ownerpasswordconfirm=Confirm
+pdfsavedialog.security=Security Settings and Encryption
+pdfsavedialog.security128bit=Encrypt with 128 bit keys
+pdfsavedialog.security40bit=Encrypt with 40 bit keys
+pdfsavedialog.securityNone=No Security
+pdfsavedialog.selectFile=Select File
+pdfsavedialog.targetIsEmpty=Please specify a filename for the pdf file.
+pdfsavedialog.targetIsNoFile=The selected target is no ordinary file.
+pdfsavedialog.targetIsNotWritable=The selected file is not writable.
+pdfsavedialog.targetOverwriteWarning=The file ''{0}'' exists. Overwrite it?
+pdfsavedialog.targetOverwriteConfirmation=The file ''{0}'' exists. Overwrite it?
+pdfsavedialog.targetOverwriteTitle=Overwrite file?
+pdfsavedialog.title=Title
+pdfsavedialog.userpassword=User Password
+pdfsavedialog.userpasswordNoMatch=The user-passwords do not match.
+pdfsavedialog.userpasswordconfirm=Confirm
+pdfsavedialog.warningTitle=Warning
+pdfsavedialog.allowAssembly=Allow (Re-)assembly
+
+file.save.pdfdescription=PDF documents
diff --git a/source/org/jfree/report/modules/gui/swing/preview/ActionCategory.java b/source/org/jfree/report/modules/gui/swing/preview/ActionCategory.java
new file mode 100644
index 0000000..683a8a7
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/ActionCategory.java
@@ -0,0 +1,204 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ActionCategory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 01.12.2006, 18:49:32
+ *
+ * @author Thomas Morgner
+ */
+public class ActionCategory implements Comparable
+{
+  private String resourceBase;
+  private String resourcePrefix;
+  private int position;
+  private ResourceBundleSupport resources;
+  private String name;
+
+  public ActionCategory()
+  {
+    name = "";
+  }
+
+  public void initialize(SwingGuiContext context)
+  {
+    resources = new ResourceBundleSupport
+        (context.getLocale(), resourceBase);
+  }
+
+  public String getResourceBase()
+  {
+    return resourceBase;
+  }
+
+  public void setResourceBase(final String resourceBase)
+  {
+    this.resourceBase = resourceBase;
+  }
+
+  public String getResourcePrefix()
+  {
+    return resourcePrefix;
+  }
+
+  public void setResourcePrefix(final String resourcePrefix)
+  {
+    this.resourcePrefix = resourcePrefix;
+  }
+
+  public int getPosition()
+  {
+    return position;
+  }
+
+  public void setPosition(final int position)
+  {
+    this.position = position;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setName(final String name)
+  {
+    if (name == null)
+    {
+      throw new NullPointerException();
+    }
+    this.name = name;
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString(resourcePrefix + "name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString(resourcePrefix + "description");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic(resourcePrefix + "mnemonic");
+  }
+
+  public boolean equals(final Object o)
+  {
+    if (this == o)
+    {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass())
+    {
+      return false;
+    }
+
+    final ActionCategory that = (ActionCategory) o;
+
+    if (position != that.position)
+    {
+      return false;
+    }
+    if (!name.equals(that.name))
+    {
+      return false;
+    }
+
+    return true;
+  }
+
+  public int hashCode()
+  {
+    int result;
+    result = position;
+    result = 29 * result + name.hashCode();
+    return result;
+  }
+
+  /**
+   * Compares this object with the specified object for order.  Returns a
+   * negative integer, zero, or a positive integer as this object is less than,
+   * equal to, or greater than the specified object.<p>
+   * <p/>
+   *
+   * @param o the Object to be compared.
+   * @return a negative integer, zero, or a positive integer as this object is
+   *         less than, equal to, or greater than the specified object.
+   * @throws ClassCastException if the specified object's type prevents it from
+   *                            being compared to this Object.
+   */
+  public int compareTo(final Object o)
+  {
+    ActionCategory other = (ActionCategory) o;
+    if (position < other.position)
+    {
+      return -1;
+    }
+    if (position > other.position)
+    {
+      return 1;
+    }
+    return name.compareTo(other.name);
+  }
+
+  public String toString()
+  {
+    return "ActionCategory{" +
+        "name='" + name + '\'' +
+        ", position=" + position +
+        ", resourceBase='" + resourceBase + '\'' +
+        ", resourcePrefix='" + resourcePrefix + '\'' +
+        ", resources=" + resources +
+        '}';
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/CategoryTreeItem.java b/source/org/jfree/report/modules/gui/swing/preview/CategoryTreeItem.java
new file mode 100644
index 0000000..3a366dc
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/CategoryTreeItem.java
@@ -0,0 +1,120 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CategoryTreeItem.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import java.util.ArrayList;
+
+/**
+ * Creation-Date: 01.12.2006, 20:01:32
+ *
+ * @author Thomas Morgner
+ */
+public class CategoryTreeItem implements Comparable
+{
+  private CategoryTreeItem parent;
+  private ActionCategory category;
+  private ArrayList childs;
+  private String name;
+
+  public CategoryTreeItem(final ActionCategory category)
+  {
+    this.category = category;
+    this.name = category.getName();
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public CategoryTreeItem getParent()
+  {
+    return parent;
+  }
+
+  public void setParent(final CategoryTreeItem parent)
+  {
+    this.parent = parent;
+  }
+
+  public ActionCategory getCategory()
+  {
+    return category;
+  }
+
+  public void add(final CategoryTreeItem item)
+  {
+    if (childs == null)
+    {
+      childs = new ArrayList();
+    }
+    childs.add(item);
+  }
+
+  public CategoryTreeItem[] getChilds()
+  {
+    if (childs == null)
+    {
+      return new CategoryTreeItem[0];
+    }
+    return (CategoryTreeItem[]) childs.toArray(new CategoryTreeItem[childs.size()]);
+  }
+
+  /**
+   * Compares this object with the specified object for order.  Returns a
+   * negative integer, zero, or a positive integer as this object is less than,
+   * equal to, or greater than the specified object.<p>
+   * <p/>
+   *
+   * @param o the Object to be compared.
+   * @return a negative integer, zero, or a positive integer as this object is
+   *         less than, equal to, or greater than the specified object.
+   * @throws ClassCastException if the specified object's type prevents it from
+   *                            being compared to this Object.
+   */
+  public int compareTo(final Object o)
+  {
+    CategoryTreeItem other = (CategoryTreeItem) o;
+    final int position = category.getPosition();
+    final int otherPosition = other.getCategory().getPosition();
+    if (position < otherPosition)
+    {
+      return -1;
+    }
+    if (position > otherPosition)
+    {
+      return 1;
+    }
+    return name.compareTo(other.name);
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/DefaultReportController.java b/source/org/jfree/report/modules/gui/swing/preview/DefaultReportController.java
new file mode 100644
index 0000000..20c9851
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/DefaultReportController.java
@@ -0,0 +1,97 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DefaultReportController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.gui.swing.preview;
+
+import java.awt.BorderLayout;
+import javax.swing.JComponent;
+import javax.swing.JMenu;
+import javax.swing.JPanel;
+
+public class DefaultReportController extends JPanel implements ReportController
+{
+  /**
+   * Creates a new <code>JPanel</code> with a double buffer and a flow layout.
+   */
+  public DefaultReportController ()
+  {
+  }
+
+  /**
+   * Returns the graphical representation of the controler. This component will be added
+   * between the menu bar and the toolbar.
+   * <p/>
+   * Changes to this property are not detected automaticly, you have to call
+   * "refreshControler" whenever you want to display a completly new control panel.
+   *
+   * @return the controler component.
+   */
+  public JComponent getControlPanel ()
+  {
+    return this;
+  }
+
+  /**
+   * The default implementation has no menus.
+   *
+   * @return an empty array.
+   */
+  public JMenu[] getMenus ()
+  {
+    return new JMenu[0];
+  }
+
+  /**
+   * Returns the location for the report controler, one of BorderLayout.NORTH,
+   * BorderLayout.SOUTH, BorderLayout.EAST or BorderLayout.WEST.
+   *
+   * @return the location;
+   */
+  public String getControllerLocation ()
+  {
+    return BorderLayout.NORTH;
+  }
+
+  /**
+   * Defines, whether the controler component is placed between the report pane and the
+   * toolbar.
+   *
+   * @return true, if this is a inne component.
+   */
+  public boolean isInnerComponent ()
+  {
+    return false;
+  }
+
+  public void initialize(PreviewPane pane)
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/PageBackgroundDrawable.java b/source/org/jfree/report/modules/gui/swing/preview/PageBackgroundDrawable.java
new file mode 100644
index 0000000..4a9d2da
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/PageBackgroundDrawable.java
@@ -0,0 +1,193 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PageBackgroundDrawable.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.awt.print.PageFormat;
+import javax.swing.UIManager;
+
+import org.jfree.layouting.modules.output.graphics.PageDrawable;
+
+/**
+ * Creation-Date: 17.11.2006, 20:31:36
+ *
+ * @author Thomas Morgner
+ */
+public class PageBackgroundDrawable 
+{
+  private PageDrawable backend;
+  private boolean borderPainted;
+  private float shadowSize;
+  private double zoom;
+
+  public PageBackgroundDrawable()
+  {
+    this.shadowSize = 6;
+    this.borderPainted = false;
+    this.zoom = 1;
+  }
+
+  public PageDrawable getBackend()
+  {
+    return backend;
+  }
+
+  public void setBackend(final PageDrawable backend)
+  {
+    this.backend = backend;
+  }
+
+  public boolean isBorderPainted()
+  {
+    return borderPainted;
+  }
+
+  public void setBorderPainted(final boolean borderPainted)
+  {
+    this.borderPainted = borderPainted;
+  }
+
+  public double getZoom()
+  {
+    return zoom;
+  }
+
+  public void setZoom(final double zoom)
+  {
+    this.zoom = zoom;
+  }
+
+  public Dimension getPreferredSize()
+  {
+    if (backend == null)
+    {
+      return new Dimension(0, 0);
+    }
+    final Dimension preferredSize = backend.getPreferredSize();
+
+    return new Dimension
+        ((int) ((preferredSize.width + shadowSize) * zoom),
+            (int) ((preferredSize.height + shadowSize) * zoom));
+  }
+
+  public boolean isPreserveAspectRatio()
+  {
+    return true;
+  }
+
+  public float getShadowSize()
+  {
+    return shadowSize;
+  }
+
+  public void setShadowSize(final float shadowSize)
+  {
+    this.shadowSize = shadowSize;
+  }
+
+  /**
+   * Draws the object.
+   *
+   * @param g2   the graphics device.
+   * @param area the area inside which the object should be drawn.
+   */
+  public void draw(Graphics2D g2, Rectangle2D area)
+  {
+    if (backend == null)
+    {
+      return;
+    }
+
+    final PageFormat pageFormat = backend.getPageFormat();
+    final float outerW = (float) pageFormat.getWidth();
+    final float outerH = (float) pageFormat.getHeight();
+
+    final float innerX = (float) pageFormat.getImageableX();
+    final float innerY = (float) pageFormat.getImageableY();
+    final float innerW = (float) pageFormat.getImageableWidth();
+    final float innerH = (float) pageFormat.getImageableHeight();
+
+    //double paperBorder = paperBorderPixel * zoomFactor;
+
+    /** Prepare background **/
+    g2.transform(AffineTransform.getScaleInstance(getZoom(), getZoom()));
+    g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+
+    /** Prepare background **/
+    Rectangle2D pageArea =
+        new Rectangle2D.Float(0, 0, outerW, outerH);
+
+    g2.setPaint(Color.white);
+    g2.fill(pageArea);
+
+
+    Graphics2D g22 = (Graphics2D) g2.create();
+    backend.draw(g22, new Rectangle2D.Double
+        (0, 0, pageFormat.getImageableWidth(), pageFormat.getImageableHeight()));
+    g22.dispose();
+
+    /**
+     * The border around the printable area is painted when the corresponding property is
+     * set to true.
+     */
+    final Rectangle2D printingArea = new Rectangle2D.Float(innerX, innerY, innerW, innerH);
+
+    /** Paint Page Shadow */
+    final Rectangle2D southborder = new Rectangle2D.Float
+        (getShadowSize(), outerH,
+            outerW, getShadowSize());
+
+    g2.setPaint(UIManager.getColor("controlShadow"));
+
+    g2.fill(southborder);
+
+    final Rectangle2D eastborder = new Rectangle2D.Float
+        (outerW, getShadowSize(),getShadowSize(), outerH);
+
+    g2.fill(eastborder);
+    final Rectangle2D transPageArea = new Rectangle2D.Float(0, 0, outerW, outerH);
+
+    g2.setPaint(Color.black);
+    g2.draw(transPageArea);
+    if (isBorderPainted())
+    {
+      g2.setPaint(Color.gray);
+      g2.draw(printingArea);
+    }
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/PreviewApplet.java b/source/org/jfree/report/modules/gui/swing/preview/PreviewApplet.java
new file mode 100644
index 0000000..c815ea4
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/PreviewApplet.java
@@ -0,0 +1,43 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PreviewApplet.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import javax.swing.JApplet;
+
+/**
+ * Creation-Date: 11.11.2006, 19:35:22
+ *
+ * @author Thomas Morgner
+ */
+public class PreviewApplet extends JApplet
+{
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/PreviewDialog.java b/source/org/jfree/report/modules/gui/swing/preview/PreviewDialog.java
new file mode 100644
index 0000000..8c5fce6
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/PreviewDialog.java
@@ -0,0 +1,318 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PreviewDialog.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.BoxLayout;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JPanel;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.common.IconTheme;
+import org.jfree.report.modules.gui.swing.common.JStatusBar;
+import org.jfree.report.modules.gui.swing.common.ReportProgressBar;
+
+/**
+ * Creation-Date: 11.11.2006, 19:35:16
+ *
+ * @author Thomas Morgner
+ */
+public class PreviewDialog extends JDialog
+{
+  private class PreviewPanePropertyChangeHandler
+      implements PropertyChangeListener
+  {
+    public PreviewPanePropertyChangeHandler()
+    {
+    }
+
+    /**
+     * This method gets called when a bound property is changed.
+     *
+     * @param evt A PropertyChangeEvent object describing the event source and
+     *            the property that has changed.
+     */
+
+    public void propertyChange(PropertyChangeEvent evt)
+    {
+      final String propertyName = evt.getPropertyName();
+      if (PreviewPane.MENU_PROPERTY.equals(propertyName))
+      {
+        // Update the menu
+        final JMenu[] menus = previewPane.getMenu();
+        if (menus != null && menus.length > 0)
+        {
+          final JMenuBar menuBar = new JMenuBar();
+          for (int i = 0; i < menus.length; i++)
+          {
+            final JMenu menu = menus[i];
+            menuBar.add(menu);
+          }
+          setJMenuBar(menuBar);
+        }
+        else
+        {
+          setJMenuBar(null);
+        }
+        return;
+      }
+
+      if (PreviewPane.TITLE_PROPERTY.equals(propertyName))
+      {
+        setTitle(previewPane.getTitle());
+        return;
+      }
+
+      if (PreviewPane.STATUS_TEXT_PROPERTY.equals(propertyName) ||
+          PreviewPane.STATUS_TYPE_PROPERTY.equals(propertyName))
+      {
+        statusBar.setStatus(previewPane.getStatusType(),
+            previewPane.getStatusText());
+        return;
+      }
+
+      if (PreviewPane.ICON_THEME_PROPERTY.equals(propertyName))
+      {
+        statusBar.setIconTheme(previewPane.getIconTheme());
+        return;
+      }
+
+      if (PreviewPane.PAGINATING_PROPERTY.equals(propertyName))
+      {
+        if (Boolean.TRUE.equals(evt.getNewValue()))
+        {
+          progressBar.setVisible(true);
+          pageLabel.setVisible(false);
+          statusBar.setStatus(JStatusBar.TYPE_INFORMATION, "Paginating ...");
+        }
+        else
+        {
+          progressBar.setVisible(false);
+          pageLabel.setVisible(true);
+          statusBar.setStatus(JStatusBar.TYPE_NONE, "");
+        }
+        progressBar.revalidate();
+        return;
+      }
+
+      if (PreviewPane.PAGE_NUMBER_PROPERTY.equals(propertyName) ||
+          PreviewPane.NUMBER_OF_PAGES_PROPERTY.equals(propertyName))
+      {
+        pageLabel.setText(previewPane.getPageNumber() + "/" + previewPane.getNumberOfPages());
+        return;
+      }
+
+      if (PreviewPane.CLOSED_PROPERTY.equals(propertyName))
+      {
+        if (previewPane.isClosed())
+        {
+          setVisible(false);
+          dispose();
+        }
+        else
+        {
+          setVisible(true);
+        }
+      }
+    }
+  }
+
+  private PreviewPane previewPane;
+  private JStatusBar statusBar;
+  private ReportProgressBar progressBar;
+  private JLabel pageLabel;
+
+  /**
+   * Creates a non-modal dialog without a title and without a specified
+   * <code>Frame</code> owner.  A shared, hidden frame will be set as the owner
+   * of the dialog.
+   * <p/>
+   * This constructor sets the component's locale property to the value returned
+   * by <code>JComponent.getDefaultLocale</code>.
+   *
+   * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless()
+   *                                    returns true.
+   * @see java.awt.GraphicsEnvironment#isHeadless
+   * @see javax.swing.JComponent#getDefaultLocale
+   */
+  public PreviewDialog()
+  {
+    init();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Frame</code> as its owner.  If <code>owner</code> is
+   * <code>null</code>, a shared, hidden frame will be set as the owner of the
+   * dialog.
+   * <p/>
+   * This constructor sets the component's locale property to the value returned
+   * by <code>JComponent.getDefaultLocale</code>.
+   *
+   * @param owner the <code>Frame</code> from which the dialog is displayed
+   * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless()
+   *                                    returns true.
+   * @see java.awt.GraphicsEnvironment#isHeadless
+   * @see javax.swing.JComponent#getDefaultLocale
+   */
+  public PreviewDialog(Frame owner)
+  {
+    super(owner);
+    init();
+  }
+
+  /**
+   * Creates a modal or non-modal dialog without a title and with the specified
+   * owner <code>Frame</code>.  If <code>owner</code> is <code>null</code>, a
+   * shared, hidden frame will be set as the owner of the dialog.
+   * <p/>
+   * This constructor sets the component's locale property to the value returned
+   * by <code>JComponent.getDefaultLocale</code>.
+   *
+   * @param owner the <code>Frame</code> from which the dialog is displayed
+   * @param modal true for a modal dialog, false for one that allows others
+   *              windows to be active at the same time
+   * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless()
+   *                                    returns true.
+   * @see java.awt.GraphicsEnvironment#isHeadless
+   * @see javax.swing.JComponent#getDefaultLocale
+   */
+  public PreviewDialog(Frame owner, boolean modal)
+  {
+    super(owner, modal);
+    init();
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specified
+   * <code>Dialog</code> as its owner.
+   * <p/>
+   * This constructor sets the component's locale property to the value returned
+   * by <code>JComponent.getDefaultLocale</code>.
+   *
+   * @param owner the non-null <code>Dialog</code> from which the dialog is
+   *              displayed
+   * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless()
+   *                                    returns true.
+   * @see java.awt.GraphicsEnvironment#isHeadless
+   * @see javax.swing.JComponent#getDefaultLocale
+   */
+  public PreviewDialog(Dialog owner)
+  {
+    super(owner);
+    init();
+  }
+
+  /**
+   * Creates a modal or non-modal dialog without a title and with the specified
+   * owner dialog.
+   * <p/>
+   * This constructor sets the component's locale property to the value returned
+   * by <code>JComponent.getDefaultLocale</code>.
+   *
+   * @param owner the non-null <code>Dialog</code> from which the dialog is
+   *              displayed
+   * @param modal true for a modal dialog, false for one that allows other
+   *              windows to be active at the same time
+   * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless()
+   *                                    returns true.
+   * @see java.awt.GraphicsEnvironment#isHeadless
+   * @see javax.swing.JComponent#getDefaultLocale
+   */
+  public PreviewDialog(Dialog owner, boolean modal)
+  {
+    super(owner, modal);
+    init();
+  }
+
+  protected void init()
+  {
+    previewPane = new PreviewPane();
+    statusBar = new JStatusBar(previewPane.getIconTheme());
+    progressBar = new ReportProgressBar();
+    progressBar.setVisible(false);
+
+    pageLabel = new JLabel();
+
+    previewPane.addPropertyChangeListener(new PreviewPanePropertyChangeHandler());
+
+    final JComponent extensionArea = statusBar.getExtensionArea();
+    extensionArea.setLayout(new BoxLayout(extensionArea, BoxLayout.X_AXIS));
+    extensionArea.add(progressBar);
+    extensionArea.add(pageLabel);
+
+    JComponent contentPane = new JPanel();
+    contentPane.setLayout(new BorderLayout());
+    contentPane.add(previewPane, BorderLayout.CENTER);
+    contentPane.add(statusBar, BorderLayout.SOUTH);
+    setContentPane(contentPane);
+  }
+
+  public ReportController getReportController()
+  {
+    return previewPane.getReportController();
+  }
+
+  public void setReportController(final ReportController reportController)
+  {
+    previewPane.setReportController(reportController);
+  }
+
+  public IconTheme getIconTheme()
+  {
+    return previewPane.getIconTheme();
+  }
+
+  public void setIconTheme(final IconTheme theme)
+  {
+    previewPane.setIconTheme(theme);
+  }
+
+  public ReportJob getReportJob()
+  {
+    return previewPane.getReportJob();
+  }
+
+  public void setReportJob(final ReportJob reportJob)
+  {
+    previewPane.setReportJob(reportJob);
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/PreviewFrame.java b/source/org/jfree/report/modules/gui/swing/preview/PreviewFrame.java
new file mode 100644
index 0000000..9efb841
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/PreviewFrame.java
@@ -0,0 +1,231 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PreviewFrame.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import java.awt.BorderLayout;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.BoxLayout;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JPanel;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.common.IconTheme;
+import org.jfree.report.modules.gui.swing.common.JStatusBar;
+import org.jfree.report.modules.gui.swing.common.ReportProgressBar;
+
+/**
+ * Creation-Date: 11.11.2006, 19:35:09
+ *
+ * @author Thomas Morgner
+ */
+public class PreviewFrame extends JFrame
+{
+  private class PreviewPanePropertyChangeHandler
+      implements PropertyChangeListener
+  {
+
+    public PreviewPanePropertyChangeHandler()
+    {
+    }
+
+    /**
+     * This method gets called when a bound property is changed.
+     *
+     * @param evt A PropertyChangeEvent object describing the event source and
+     *            the property that has changed.
+     */
+
+    public void propertyChange(PropertyChangeEvent evt)
+    {
+      final String propertyName = evt.getPropertyName();
+      if (PreviewPane.MENU_PROPERTY.equals(propertyName))
+      {
+        // Update the menu
+        final JMenu[] menus = previewPane.getMenu();
+        if (menus != null && menus.length > 0)
+        {
+          final JMenuBar menuBar = new JMenuBar();
+          for (int i = 0; i < menus.length; i++)
+          {
+            final JMenu menu = menus[i];
+            menuBar.add(menu);
+          }
+          setJMenuBar(menuBar);
+        }
+        else
+        {
+          setJMenuBar(null);
+        }
+        return;
+      }
+
+      if (PreviewPane.TITLE_PROPERTY.equals(propertyName))
+      {
+        setTitle(previewPane.getTitle());
+        return;
+      }
+
+      if (PreviewPane.STATUS_TEXT_PROPERTY.equals(propertyName) ||
+          PreviewPane.STATUS_TYPE_PROPERTY.equals(propertyName))
+      {
+        statusBar.setStatus(previewPane.getStatusType(),
+            previewPane.getStatusText());
+        return;
+      }
+
+      if (PreviewPane.ICON_THEME_PROPERTY.equals(propertyName))
+      {
+        statusBar.setIconTheme(previewPane.getIconTheme());
+        return;
+      }
+
+      if (PreviewPane.PAGINATING_PROPERTY.equals(propertyName))
+      {
+        if (Boolean.TRUE.equals(evt.getNewValue()))
+        {
+          progressBar.setVisible(true);
+          pageLabel.setVisible(false);
+        }
+        else
+        {
+          progressBar.setVisible(false);
+          pageLabel.setVisible(true);
+        }
+        progressBar.revalidate();
+        return;
+      }
+
+
+      if (PreviewPane.PAGE_NUMBER_PROPERTY.equals(propertyName) ||
+          PreviewPane.NUMBER_OF_PAGES_PROPERTY.equals(propertyName))
+      {
+        pageLabel.setText(previewPane.getPageNumber() + "/" + previewPane.getNumberOfPages());
+        return;
+      }
+
+      if (PreviewPane.CLOSED_PROPERTY.equals(propertyName))
+      {
+        if (previewPane.isClosed())
+        {
+          setVisible(false);
+          dispose();
+        }
+        else
+        {
+          setVisible(true);
+        }
+      }
+    }
+  }
+
+  private PreviewPane previewPane;
+  private JStatusBar statusBar;
+  private ReportProgressBar progressBar;
+  private JLabel pageLabel;
+
+  /**
+   * Creates a non-modal dialog without a title and without a specified
+   * <code>Frame</code> owner.  A shared, hidden frame will be set as the owner
+   * of the dialog.
+   * <p/>
+   * This constructor sets the component's locale property to the value returned
+   * by <code>JComponent.getDefaultLocale</code>.
+   *
+   * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless()
+   *                                    returns true.
+   * @see java.awt.GraphicsEnvironment#isHeadless
+   * @see javax.swing.JComponent#getDefaultLocale
+   */
+  public PreviewFrame()
+  {
+    init();
+  }
+
+  protected void init()
+  {
+    previewPane = new PreviewPane();
+    statusBar = new JStatusBar(previewPane.getIconTheme());
+
+    progressBar = new ReportProgressBar();
+    progressBar.setVisible(false);
+
+    pageLabel = new JLabel();
+    previewPane.addPropertyChangeListener(new PreviewPanePropertyChangeHandler());
+
+    final JComponent extensionArea = statusBar.getExtensionArea();
+    extensionArea.setLayout(new BoxLayout(extensionArea, BoxLayout.X_AXIS));
+    extensionArea.add(progressBar);
+    extensionArea.add(pageLabel);
+
+    JComponent contentPane = new JPanel();
+    contentPane.setLayout(new BorderLayout());
+    contentPane.add(previewPane, BorderLayout.CENTER);
+    contentPane.add(statusBar, BorderLayout.SOUTH);
+    setContentPane(contentPane);
+  }
+
+  public ReportController getReportController()
+  {
+    return previewPane.getReportController();
+  }
+
+  public void setReportController(final ReportController reportController)
+  {
+    previewPane.setReportController(reportController);
+  }
+
+  public IconTheme getIconTheme()
+  {
+    return previewPane.getIconTheme();
+  }
+
+  public void setIconTheme(final IconTheme theme)
+  {
+    previewPane.setIconTheme(theme);
+  }
+
+  public ReportJob getReportJob()
+  {
+    return previewPane.getReportJob();
+  }
+
+  public void setReportJob(final ReportJob reportJob)
+  {
+    previewPane.setReportJob(reportJob);
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/PreviewPane.java b/source/org/jfree/report/modules/gui/swing/preview/PreviewPane.java
new file mode 100644
index 0000000..770f4ad
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/PreviewPane.java
@@ -0,0 +1,960 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PreviewPane.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Window;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JMenu;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JToolBar;
+import javax.swing.SwingUtilities;
+
+import org.jfree.layouting.modules.output.graphics.PageDrawable;
+import org.jfree.layouting.modules.output.graphics.DrawablePanel;
+import org.jfree.report.JFreeReportBoot;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportStructureRoot;
+import org.jfree.report.modules.gui.common.IconTheme;
+import org.jfree.report.modules.gui.swing.common.ActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.common.SwingUtil;
+import org.jfree.report.modules.gui.swing.common.KeyedComboBoxModel;
+import org.jfree.report.modules.gui.swing.common.CenterLayout;
+import org.jfree.report.modules.gui.swing.printing.PrintReportProcessor;
+import org.jfree.report.util.Worker;
+import org.jfree.report.util.TextUtilities;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * Creation-Date: 11.11.2006, 19:36:13
+ *
+ * @author Thomas Morgner
+ */
+public class PreviewPane extends JPanel
+{
+  private class PreviewGuiContext implements SwingGuiContext
+  {
+    public PreviewGuiContext()
+    {
+    }
+
+    public Window getWindow()
+    {
+      return SwingUtil.getWindowAncestor(PreviewPane.this);
+    }
+
+    public Locale getLocale()
+    {
+      ReportJob report = getReportJob();
+      if (report != null)
+      {
+        return report.getReportStructureRoot().getLocale();
+      }
+      return Locale.getDefault();
+    }
+
+    public IconTheme getIconTheme()
+    {
+      return PreviewPane.this.getIconTheme();
+    }
+
+    public Configuration getConfiguration()
+    {
+      ReportJob report = getReportJob();
+      if (report != null)
+      {
+        return report.getConfiguration();
+      }
+      return JFreeReportBoot.getInstance().getGlobalConfig();
+    }
+  }
+
+  private class RepaginationRunnable implements Runnable
+  {
+    private PrintReportProcessor processor;
+
+    public RepaginationRunnable(PrintReportProcessor processor)
+    {
+      this.processor = processor;
+    }
+
+    /**
+     * When an object implementing interface <code>Runnable</code> is used to
+     * create a thread, starting the thread causes the object's <code>run</code>
+     * method to be called in that separately executing thread.
+     * <p/>
+     * The general contract of the method <code>run</code> is that it may take
+     * any action whatsoever.
+     *
+     * @see Thread#run()
+     */
+    public void run()
+    {
+      final UpdatePaginatingPropertyHandler startPaginationNotify =
+          new UpdatePaginatingPropertyHandler(processor, true, 0);
+      if (SwingUtilities.isEventDispatchThread())
+      {
+        startPaginationNotify.run();
+      }
+      else
+      {
+        SwingUtilities.invokeLater(startPaginationNotify);
+      }
+
+      // Perform the pagination ..
+      final int pageCount = processor.getNumberOfPages();
+
+      final UpdatePaginatingPropertyHandler endPaginationNotify =
+          new UpdatePaginatingPropertyHandler(processor, false, pageCount);
+      if (SwingUtilities.isEventDispatchThread())
+      {
+        endPaginationNotify.run();
+      }
+      else
+      {
+        SwingUtilities.invokeLater(endPaginationNotify);
+      }
+
+    }
+  }
+
+  private class UpdatePaginatingPropertyHandler implements Runnable
+  {
+    private boolean paginating;
+    private int pageCount;
+    private PrintReportProcessor processor;
+
+    public UpdatePaginatingPropertyHandler(final PrintReportProcessor processor,
+                                           final boolean paginating,
+                                           final int pageCount)
+    {
+      this.processor = processor;
+      this.paginating = paginating;
+      this.pageCount = pageCount;
+    }
+
+    /**
+     * When an object implementing interface <code>Runnable</code> is used to
+     * create a thread, starting the thread causes the object's <code>run</code>
+     * method to be called in that separately executing thread.
+     * <p/>
+     * The general contract of the method <code>run</code> is that it may take
+     * any action whatsoever.
+     *
+     * @see Thread#run()
+     */
+    public void run()
+    {
+      if (processor != getPrintReportProcessor())
+      {
+        return;
+      }
+
+      if (paginating == false)
+      {
+        setNumberOfPages(pageCount);
+        if (getPageNumber() < 1)
+        {
+          setPageNumber(1);
+        }
+        else if (getPageNumber() > pageCount)
+        {
+          setPageNumber(pageCount);
+        }
+      }
+      setPaginating(paginating);
+    }
+  }
+
+  private class PreviewUpdateHandler implements PropertyChangeListener
+  {
+    public PreviewUpdateHandler()
+    {
+    }
+
+    public void propertyChange(PropertyChangeEvent evt)
+    {
+      final String propertyName = evt.getPropertyName();
+      if (PAGINATING_PROPERTY.equals(propertyName))
+      {
+        if (isPaginating())
+        {
+          drawablePanel.setDrawableAsRawObject(getPaginatingDrawable());
+        }
+        else
+        {
+          updateVisiblePage(getPageNumber());
+        }
+      }
+      else if (REPORT_JOB_PROPERTY.equals(propertyName))
+      {
+        if (getReportJob() == null)
+        {
+          drawablePanel.setDrawableAsRawObject(getNoReportDrawable());
+        }
+        // else the paginating property will be fired anyway ..
+      }
+      else if (PAGE_NUMBER_PROPERTY.equals(propertyName))
+      {
+        if (isPaginating())
+        {
+          return;
+        }
+
+        updateVisiblePage(getPageNumber());
+      }
+    }
+  }
+
+  private class UpdateZoomHandler implements PropertyChangeListener
+  {
+    public UpdateZoomHandler()
+    {
+    }
+
+    /**
+     * This method gets called when a bound property is changed.
+     *
+     * @param evt A PropertyChangeEvent object describing the event source and
+     *            the property that has changed.
+     */
+
+    public void propertyChange(PropertyChangeEvent evt)
+    {
+      if ("zoom".equals(evt.getPropertyName()) == false)
+      {
+        return;
+      }
+
+      final double zoom = getZoom();
+      pageDrawable.setZoom(zoom);
+      zoomModel.setSelectedKey(new Double(zoom));
+      if (zoomModel.getSelectedKey() == null)
+      {
+        zoomModel.setSelectedItem(formatZoomText(zoom));
+      }
+      drawablePanel.revalidate();
+    }
+  }
+
+  private static final double ZOOM_FACTORS[] = {
+      0.5, 0.75, 1, 1.20, 1.50, 2.00
+  };
+  private static final int DEFAULT_ZOOM_INDEX = 2;
+  public static final String PAGE_NUMBER_PROPERTY = "pageNumber";
+  public static final String NUMBER_OF_PAGES_PROPERTY = "numberOfPages";
+  public static final String STATUS_TEXT_PROPERTY = "statusText";
+  public static final String STATUS_TYPE_PROPERTY = "statusType";
+  public static final String REPORT_CONTROLLER_PROPERTY = "reportController";
+  public static final String REPORT_JOB_PROPERTY = "reportJob";
+  public static final String ZOOM_PROPERTY = "zoom";
+  public static final String CLOSED_PROPERTY = "closed";
+  public static final String PAGINATING_PROPERTY = "paginating";
+  public static final String ICON_THEME_PROPERTY = "iconTheme";
+  public static final String TITLE_PROPERTY = "title";
+  public static final String MENU_PROPERTY = "menu";
+
+  private Object paginatingDrawable;
+  private Object noReportDrawable;
+  private PageBackgroundDrawable pageDrawable;
+
+  private DrawablePanel drawablePanel;
+  private ReportController reportController;
+  private JMenu[] menus;
+  private JToolBar toolBar;
+  private String statusText;
+  private String title;
+  private int statusType;
+  private boolean closed;
+  private ReportJob reportJob;
+
+  private int numberOfPages;
+  private int pageNumber;
+  private SwingGuiContext swingGuiContext;
+  private IconTheme iconTheme;
+  private double zoom;
+  private boolean paginating;
+
+  private PrintReportProcessor printReportProcessor;
+
+
+  private Worker paginationWorker;
+  private JPanel innerReportControllerHolder;
+  private JPanel toolbarHolder;
+  private JPanel outerReportControllerHolder;
+  private boolean reportControllerInner;
+  private String reportControllerLocation;
+  private JComponent reportControllerComponent;
+  private KeyedComboBoxModel zoomModel;
+
+
+  /**
+   * Creates a new <code>JPanel</code> with a double buffer and a flow layout.
+   */
+  public PreviewPane()
+  {
+    this.menus = new JMenu[0];
+    setLayout(new BorderLayout());
+
+    zoomModel = new KeyedComboBoxModel();
+    zoomModel.setAllowOtherValue(true);
+    zoom = ZOOM_FACTORS[DEFAULT_ZOOM_INDEX];
+
+    pageDrawable = new PageBackgroundDrawable();
+
+    drawablePanel = new DrawablePanel();
+    drawablePanel.setOpaque(false);
+    drawablePanel.setBackground(Color.green);
+
+    swingGuiContext = new PreviewGuiContext();
+
+    final JPanel reportPaneHolder = new JPanel(new CenterLayout());
+    reportPaneHolder.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+    reportPaneHolder.add(drawablePanel);
+
+    final JScrollPane s1 = new JScrollPane(reportPaneHolder);
+    s1.getVerticalScrollBar().setUnitIncrement(20);
+
+    innerReportControllerHolder = new JPanel();
+    innerReportControllerHolder.setLayout(new BorderLayout());
+    innerReportControllerHolder.add(s1, BorderLayout.CENTER);
+
+    toolbarHolder = new JPanel();
+    toolbarHolder.setLayout(new BorderLayout());
+    toolbarHolder.add(innerReportControllerHolder, BorderLayout.CENTER);
+
+    outerReportControllerHolder = new JPanel();
+    outerReportControllerHolder.setLayout(new BorderLayout());
+    outerReportControllerHolder.add(toolbarHolder, BorderLayout.CENTER);
+
+    add(outerReportControllerHolder, BorderLayout.CENTER);
+
+    addPropertyChangeListener(new PreviewUpdateHandler());
+    addPropertyChangeListener("zoom", new UpdateZoomHandler());
+  }
+
+  public synchronized PrintReportProcessor getPrintReportProcessor()
+  {
+    return printReportProcessor;
+  }
+
+  protected synchronized void setPrintReportProcessor(final PrintReportProcessor printReportProcessor)
+  {
+    this.printReportProcessor = printReportProcessor;
+  }
+
+  public JMenu[] getMenu()
+  {
+    return menus;
+  }
+
+  protected void setMenu(final JMenu[] menus)
+  {
+    if (menus == null)
+    {
+      throw new NullPointerException();
+    }
+    final JMenu[] oldmenu = this.menus;
+    this.menus = (JMenu[]) menus.clone();
+    firePropertyChange(MENU_PROPERTY, oldmenu, this.menus);
+  }
+
+  public JToolBar getToolBar()
+  {
+    return toolBar;
+  }
+
+  public String getStatusText()
+  {
+    return statusText;
+  }
+
+  public void setStatusText(final String statusText)
+  {
+    String oldStatus = this.statusText;
+    this.statusText = statusText;
+
+    firePropertyChange(STATUS_TEXT_PROPERTY, oldStatus, statusText);
+  }
+
+  public int getStatusType()
+  {
+    return statusType;
+  }
+
+  public void setStatusType(final int statusType)
+  {
+    int oldType = this.statusType;
+    this.statusType = statusType;
+
+    firePropertyChange(STATUS_TYPE_PROPERTY, oldType, statusType);
+  }
+
+  public ReportController getReportController()
+  {
+    return reportController;
+  }
+
+  public void setReportController(final ReportController reportController)
+  {
+    ReportController oldController = this.reportController;
+    this.reportController = reportController;
+    firePropertyChange(REPORT_CONTROLLER_PROPERTY, oldController, reportController);
+
+    // Now add the controller to the GUI ..
+    refreshReportController(reportController);
+  }
+
+  public void refreshReportController(final ReportController newReportController)
+  {
+    if (newReportController != null)
+    {
+      final JComponent rcp = newReportController.getControlPanel();
+      // if either the controller component or its position (inner vs outer)
+      // and border-position has changed, then refresh ..
+      if (reportControllerComponent != rcp ||
+          reportControllerInner != newReportController.isInnerComponent() ||
+          ObjectUtilities.equal(reportControllerLocation,
+              newReportController.getControllerLocation()))
+      {
+        if (reportControllerComponent != null)
+        {
+          outerReportControllerHolder.remove(reportControllerComponent);
+          innerReportControllerHolder.remove(reportControllerComponent);
+        }
+        final String sanLocation = sanitizeLocation(
+            newReportController.getControllerLocation());
+        final boolean innerComponent = newReportController.isInnerComponent();
+        if (rcp != null)
+        {
+          if (innerComponent)
+          {
+            innerReportControllerHolder.add(rcp, sanLocation);
+          }
+          else
+          {
+            outerReportControllerHolder.add(rcp, sanLocation);
+          }
+        }
+        reportControllerComponent = rcp;
+        reportControllerLocation = sanLocation;
+        reportControllerInner = innerComponent;
+      }
+    }
+    else
+    {
+      if (reportControllerComponent != null)
+      {
+        outerReportControllerHolder.remove(reportControllerComponent);
+        innerReportControllerHolder.remove(reportControllerComponent);
+      }
+      reportControllerComponent = null;
+    }
+  }
+
+
+  private String sanitizeLocation(final String location)
+  {
+    if (BorderLayout.NORTH.equals(location))
+    {
+      return BorderLayout.NORTH;
+    }
+    if (BorderLayout.SOUTH.equals(location))
+    {
+      return BorderLayout.SOUTH;
+    }
+    if (BorderLayout.WEST.equals(location))
+    {
+      return BorderLayout.WEST;
+    }
+    if (BorderLayout.EAST.equals(location))
+    {
+      return BorderLayout.EAST;
+    }
+    return BorderLayout.NORTH;
+  }
+
+  public ReportJob getReportJob()
+  {
+    return reportJob;
+  }
+
+  public void setReportJob(final ReportJob reportJob)
+  {
+    ReportJob oldJob = this.reportJob;
+    this.reportJob = reportJob;
+
+    firePropertyChange(REPORT_JOB_PROPERTY, oldJob, reportJob);
+    if (reportJob == null)
+    {
+      initializeWithoutJob();
+    }
+    else
+    {
+      initializeFromReport();
+    }
+  }
+
+  public double getZoom()
+  {
+    return zoom;
+  }
+
+  public void setZoom(final double zoom)
+  {
+    double oldZoom = this.zoom;
+    this.zoom = zoom;
+    firePropertyChange(ZOOM_PROPERTY, oldZoom, zoom);
+  }
+
+  public boolean isClosed()
+  {
+    return closed;
+  }
+
+  public void setClosed(final boolean closed)
+  {
+    boolean oldClosed = this.closed;
+    this.closed = closed;
+    firePropertyChange(CLOSED_PROPERTY, oldClosed, closed);
+    if (closed)
+    {
+      prepareShutdown();
+    }
+  }
+
+  private void prepareShutdown()
+  {
+    synchronized (this)
+    {
+      if (paginationWorker != null)
+      {
+        synchronized (paginationWorker)
+        {
+          paginationWorker.finish();
+        }
+        paginationWorker = null;
+      }
+      if (printReportProcessor != null)
+      {
+        printReportProcessor.close();
+        printReportProcessor = null;
+      }
+      closeToolbar();
+    }
+  }
+
+  private int getUserDefinedCategoryPosition()
+  {
+    return TextUtilities.parseInt
+        (swingGuiContext.getConfiguration().getConfigProperty
+            ("org.jfree.report.modules.gui.swing.user-defined-category.position"), 15000);
+  }
+
+
+  public Locale getLocale()
+  {
+    ReportStructureRoot report = getReportJob().getReportStructureRoot();
+    if (report != null)
+    {
+      return report.getLocale();
+    }
+    return super.getLocale();
+  }
+
+  public int getNumberOfPages()
+  {
+    return numberOfPages;
+  }
+
+  public void setNumberOfPages(final int numberOfPages)
+  {
+    final int oldPageNumber = this.numberOfPages;
+    this.numberOfPages = numberOfPages;
+    firePropertyChange(NUMBER_OF_PAGES_PROPERTY, oldPageNumber, numberOfPages);
+  }
+
+  public int getPageNumber()
+  {
+    return pageNumber;
+  }
+
+  public void setPageNumber(final int pageNumber)
+  {
+    final int oldPageNumber = this.pageNumber;
+    this.pageNumber = pageNumber;
+    firePropertyChange(PAGE_NUMBER_PROPERTY, oldPageNumber, pageNumber);
+  }
+
+  public IconTheme getIconTheme()
+  {
+    return iconTheme;
+  }
+
+  protected void setIconTheme(IconTheme theme)
+  {
+    IconTheme oldTheme = this.iconTheme;
+    this.iconTheme = theme;
+    firePropertyChange(ICON_THEME_PROPERTY, oldTheme, theme);
+  }
+
+  protected void initializeFromReport()
+  {
+    setIconTheme(PreviewPaneUtilities.createIconTheme(reportJob.getConfiguration()));
+
+    zoomModel.clear();
+    for (int i = 0; i < ZOOM_FACTORS.length; i++)
+    {
+      zoomModel.add(new Double(ZOOM_FACTORS[i]), formatZoomText(ZOOM_FACTORS[i]));
+    }
+    zoom = ZOOM_FACTORS[DEFAULT_ZOOM_INDEX];
+    zoomModel.setSelectedKey(new Double(ZOOM_FACTORS[DEFAULT_ZOOM_INDEX]));
+
+    HashMap actions = PreviewPaneUtilities.loadActions(swingGuiContext);
+    buildMenu(actions);
+
+
+    if (toolBar != null)
+    {
+      toolbarHolder.remove(toolBar);
+    }
+    toolBar = buildToolbar(actions);
+    if (toolBar != null)
+    {
+      toolbarHolder.add(toolBar, BorderLayout.NORTH);
+    }
+
+    startPagination();
+  }
+
+  private JToolBar buildToolbar(final HashMap actions)
+  {
+    JToolBar toolBar = new JToolBar();
+    toolBar.setFloatable(false);
+
+    final ActionCategory[] cats = (ActionCategory[])
+        actions.keySet().toArray(new ActionCategory[actions.size()]);
+    Arrays.sort(cats);
+
+    for (int i = 0; i < cats.length; i++)
+    {
+      final ActionCategory cat = cats[i];
+      final ActionPlugin[] plugins = (ActionPlugin[]) actions.get(cat);
+      PreviewPaneUtilities.addActionsToToolBar(toolBar, plugins, this);
+    }
+
+    return toolBar;
+  }
+
+  private void closeToolbar()
+  {
+    if (toolBar.getParent() != toolbarHolder)
+    {
+      // ha!, we detected that the toolbar is floating ...
+      // Log.debug (currentToolbar.getParent());
+      final Window w = SwingUtilities.windowForComponent(toolBar);
+      if (w != null)
+      {
+        w.setVisible(false);
+        w.dispose();
+      }
+    }
+    toolBar.setVisible(false);
+  }
+
+  public SwingGuiContext getSwingGuiContext()
+  {
+    return swingGuiContext;
+  }
+
+  public KeyedComboBoxModel getZoomModel()
+  {
+    return zoomModel;
+  }
+
+  private String formatZoomText(final double zoom)
+  {
+    final NumberFormat numberFormat =
+        NumberFormat.getPercentInstance(swingGuiContext.getLocale());
+    return (numberFormat.format(zoom));
+  }
+
+
+  private void buildMenu(final HashMap actions)
+  {
+    final HashMap menus = new HashMap();
+    final int userPos = getUserDefinedCategoryPosition();
+
+    final ActionCategory[] categories = new ActionCategory[actions.size()];
+    boolean insertedUserDefinedActions = false;
+    int catCount = 0;
+    final Iterator iterator = actions.entrySet().iterator();
+    while (iterator.hasNext())
+    {
+      final Map.Entry entry = (Map.Entry) iterator.next();
+      final ActionCategory cat = (ActionCategory) entry.getKey();
+      categories[catCount] = cat;
+      catCount += 1;
+      final ActionPlugin[] plugins = (ActionPlugin[]) entry.getValue();
+
+      if (insertedUserDefinedActions == false && cat.getPosition() > userPos)
+      {
+        ReportController controller = getReportController();
+        if (controller != null)
+        {
+          controller.initialize(this);
+          final JMenu[] controlerMenus = controller.getMenus();
+          for (int i = 0; i < controlerMenus.length; i++)
+          {
+            final ActionCategory userCategory = new ActionCategory();
+            userCategory.setName("X-User-Category-" + i);
+            userCategory.setPosition(userPos + i);
+            menus.put(userCategory, controlerMenus[i]);
+          }
+        }
+
+        insertedUserDefinedActions = true;
+      }
+
+      final JMenu menu = PreviewPaneUtilities.createMenu(cat);
+      int count = PreviewPaneUtilities.buildMenu(menu, plugins, this);
+      menus.put(cat, menu);
+    }
+
+    final CategoryTreeItem[] categoryTreeItems =
+        PreviewPaneUtilities.buildMenuTree(categories);
+
+    ArrayList menuList = new ArrayList();
+    for (int i = 0; i < categoryTreeItems.length; i++)
+    {
+      final CategoryTreeItem item = categoryTreeItems[i];
+      final JMenu menu = (JMenu) menus.get(item.getCategory());
+      // now connect all menus ..
+      final CategoryTreeItem[] childs = item.getChilds();
+      Arrays.sort(childs);
+      for (int j = 0; j < childs.length; j++)
+      {
+        CategoryTreeItem child = childs[j];
+        final JMenu childMenu = (JMenu) menus.get(child.getCategory());
+        if (childMenu != null)
+        {
+          menu.add(childMenu);
+        }
+      }
+
+      if (item.getParent() == null)
+      {
+        menuList.add(item);
+      }
+    }
+
+    Collections.sort(menuList);
+    ArrayList retval = new ArrayList();
+    for (int i = 0; i < menuList.size(); i++)
+    {
+      final CategoryTreeItem item = (CategoryTreeItem) menuList.get(i);
+      JMenu menu = (JMenu) menus.get(item.getCategory());
+      if (menu.getItemCount() > 0)
+      {
+        retval.add(menu);
+      }
+    }
+
+    setMenu((JMenu[]) retval.toArray(new JMenu[retval.size()]));
+  }
+
+//  private JMenu createViewMenu(ActionCategory cat)
+//  {
+//    JMenu zoom = new JMenu("Zoom");
+//    zoom.add(new ActionMenuItem(new ZoomOutAction(this)));
+//    zoom.add(new ActionMenuItem(new ZoomInAction(this)));
+//    zoom.addSeparator();
+//
+//    for (int i = 0; i < ZOOM_FACTORS.length; i++)
+//    {
+//      double factor = ZOOM_FACTORS[i];
+//      zoom.add(new ActionMenuItem(new ZoomAction(factor, this)));
+//    }
+//
+//    zoom.addSeparator();
+//    zoom.add(new ActionMenuItem(new ZoomCustomAction(this)));
+//
+//    JMenu menu = new JMenu("View");
+//    menu.add(zoom);
+//    menu.addSeparator();
+//    menu.add(new ActionMenuItem("Paginated"));
+//    menu.add(new ActionMenuItem("Flow"));
+//    return menu;
+//  }
+
+  protected void initializeWithoutJob()
+  {
+    final Configuration globalConfig =
+        JFreeReportBoot.getInstance().getGlobalConfig();
+    setIconTheme(PreviewPaneUtilities.createIconTheme(globalConfig));
+
+    zoomModel.clear();
+    for (int i = 0; i < ZOOM_FACTORS.length; i++)
+    {
+      zoomModel.add(new Double(ZOOM_FACTORS[i]), formatZoomText(ZOOM_FACTORS[i]));
+    }
+    zoom = ZOOM_FACTORS[DEFAULT_ZOOM_INDEX];
+    zoomModel.setSelectedKey(new Double(ZOOM_FACTORS[DEFAULT_ZOOM_INDEX]));
+
+    HashMap actions = PreviewPaneUtilities.loadActions(swingGuiContext);
+    buildMenu(actions);
+    if (toolBar != null)
+    {
+      toolbarHolder.remove(toolBar);
+    }
+    toolBar = buildToolbar(actions);
+    if (toolBar != null)
+    {
+      toolbarHolder.add(toolBar, BorderLayout.NORTH);
+    }
+
+  }
+
+  public String getTitle()
+  {
+    return title;
+  }
+
+  public void setTitle(final String title)
+  {
+    String oldTitle = this.title;
+    this.title = title;
+    firePropertyChange(TITLE_PROPERTY, oldTitle, title);
+  }
+
+  public double[] getZoomFactors()
+  {
+    return (double[]) ZOOM_FACTORS.clone();
+  }
+
+  public boolean isPaginating()
+  {
+    return paginating;
+  }
+
+  public void setPaginating(final boolean paginating)
+  {
+    boolean oldPaginating = this.paginating;
+    this.paginating = paginating;
+    firePropertyChange(PAGINATING_PROPERTY, oldPaginating, paginating);
+  }
+
+  private synchronized void startPagination()
+  {
+    if (paginationWorker != null)
+    {
+      // make sure that old pagination handler does not run longer than
+      // necessary..
+      synchronized(paginationWorker)
+      {
+        paginationWorker.finish();
+      }
+      paginationWorker = null;
+    }
+
+    if (printReportProcessor != null)
+    {
+      printReportProcessor.close();
+      printReportProcessor = null;
+    }
+
+    final ReportJob reportJob = getReportJob();
+    printReportProcessor = new PrintReportProcessor(reportJob.derive());
+
+    paginationWorker = new Worker();
+    paginationWorker.setWorkload
+        (new RepaginationRunnable(printReportProcessor));
+  }
+
+  public Object getNoReportDrawable()
+  {
+    return noReportDrawable;
+  }
+
+  public void setNoReportDrawable(final Object noReportDrawable)
+  {
+    this.noReportDrawable = noReportDrawable;
+  }
+
+  public Object getPaginatingDrawable()
+  {
+    return paginatingDrawable;
+  }
+
+  public void setPaginatingDrawable(final Object paginatingDrawable)
+  {
+    this.paginatingDrawable = paginatingDrawable;
+  }
+
+  protected void updateVisiblePage(int pageNumber)
+  {
+    //
+    if (printReportProcessor == null)
+    {
+      throw new IllegalStateException();
+    }
+
+    // todo: This can be very expensive - so we better move this off the event-dispatcher
+    final int pageIndex = getPageNumber() - 1;
+    if (pageIndex < 0 || pageIndex >= printReportProcessor.getNumberOfPages())
+    {
+      drawablePanel.setDrawable(null);
+      pageDrawable.setBackend(null);
+    }
+    else
+    {
+      final PageDrawable drawable = printReportProcessor.getPageDrawable(pageIndex);
+      this.pageDrawable.setBackend(drawable);
+      this.drawablePanel.setDrawableAsRawObject(pageDrawable);
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/PreviewPaneUtilities.java b/source/org/jfree/report/modules/gui/swing/preview/PreviewPaneUtilities.java
new file mode 100644
index 0000000..915e82f
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/PreviewPaneUtilities.java
@@ -0,0 +1,546 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PreviewPaneUtilities.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JMenu;
+import javax.swing.JPanel;
+import javax.swing.JToolBar;
+
+import org.jfree.report.modules.gui.common.DefaultIconTheme;
+import org.jfree.report.modules.gui.common.IconTheme;
+import org.jfree.report.modules.gui.swing.common.ActionFactory;
+import org.jfree.report.modules.gui.swing.common.ActionPlugin;
+import org.jfree.report.modules.gui.swing.common.ActionPluginMenuComparator;
+import org.jfree.report.modules.gui.swing.common.DefaultActionFactory;
+import org.jfree.report.modules.gui.swing.common.ExportActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingCommonModule;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.common.KeyedComboBoxModel;
+import org.jfree.report.modules.gui.swing.common.action.ActionMenuItem;
+import org.jfree.report.modules.gui.swing.common.action.ActionButton;
+import org.jfree.report.modules.gui.swing.preview.actions.ControlAction;
+import org.jfree.report.modules.gui.swing.preview.actions.ControlActionPlugin;
+import org.jfree.report.modules.gui.swing.preview.actions.ExportAction;
+import org.jfree.report.modules.gui.swing.preview.actions.ZoomAction;
+import org.jfree.report.modules.gui.swing.preview.actions.ZoomListActionPlugin;
+import org.jfree.report.util.TextUtilities;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * Creation-Date: 17.11.2006, 15:06:51
+ *
+ * @author Thomas Morgner
+ */
+public class PreviewPaneUtilities
+{
+  /**
+   * A zoom select action.
+   */
+  private static class ZoomSelectAction extends AbstractAction
+  {
+    private KeyedComboBoxModel source;
+    private PreviewPane pane;
+
+    /**
+     * Creates a new action.
+     */
+    public ZoomSelectAction(KeyedComboBoxModel source,
+                            PreviewPane pane)
+    {
+      this.source = source;
+      this.pane = pane;
+    }
+
+    /**
+     * Invoked when an action occurs.
+     *
+     * @param e the event.
+     */
+    public void actionPerformed(final ActionEvent e)
+    {
+      final Double selected = (Double) source.getSelectedKey();
+      if (selected != null)
+      {
+        pane.setZoom(selected.doubleValue());
+      }
+    }
+  }
+
+  private static final String ICON_THEME_CONFIG_KEY = "org.jfree.report.modules.gui.common.IconTheme";
+  private static final String ACTION_FACTORY_CONFIG_KEY = "org.jfree.report.modules.gui.swing.preview.ActionFactory";
+  private static final String CATEGORY_PREFIX = "org.jfree.report.modules.gui.swing.category.";
+
+  private PreviewPaneUtilities()
+  {
+  }
+
+  public static JMenu createMenu(ActionCategory cat)
+  {
+    JMenu menu = new JMenu();
+    menu.setText(cat.getDisplayName());
+    final Integer mnemonicKey = cat.getMnemonicKey();
+    if (mnemonicKey != null)
+    {
+      menu.setMnemonic(mnemonicKey.intValue());
+    }
+    final String toolTip = cat.getShortDescription();
+    if (toolTip != null && toolTip.length() > 0)
+    {
+      menu.setToolTipText(toolTip);
+    }
+    return menu;
+  }
+
+
+  public static int buildMenu(JMenu menu,
+                              ActionPlugin[] actions,
+                              PreviewPane pane)
+  {
+    if (actions.length == 0)
+    {
+      return 0;
+    }
+
+    Arrays.sort(actions, new ActionPluginMenuComparator());
+    boolean separatorPending = false;
+    int count = 0;
+    for (int i = 0; i < actions.length; i++)
+    {
+      ActionPlugin actionPlugin = actions[i];
+      if (actionPlugin.isAddToMenu() == false)
+      {
+        continue;
+      }
+
+      if (count > 0 && separatorPending)
+      {
+        menu.addSeparator();
+        separatorPending = false;
+      }
+
+      if (actionPlugin instanceof ExportActionPlugin)
+      {
+        final ExportActionPlugin exportPlugin = (ExportActionPlugin) actionPlugin;
+        final ExportAction action = new ExportAction(exportPlugin, pane);
+        menu.add(new ActionMenuItem(action));
+        count += 1;
+      }
+      else if (actionPlugin instanceof ControlActionPlugin)
+      {
+        final ControlActionPlugin controlPlugin = (ControlActionPlugin) actionPlugin;
+        final ControlAction action = new ControlAction(controlPlugin, pane);
+        menu.add(new ActionMenuItem(action));
+        count += 1;
+      }
+      else if (actionPlugin instanceof ZoomListActionPlugin)
+      {
+        buildViewMenu(menu, pane);
+      }
+
+      if (actionPlugin.isSeparated())
+      {
+        separatorPending = true;
+      }
+
+    }
+    return count;
+  }
+
+  private static void buildViewMenu(JMenu zoom, PreviewPane pane)
+  {
+    final double[] zoomFactors = pane.getZoomFactors();
+    for (int i = 0; i < zoomFactors.length; i++)
+    {
+      double factor = zoomFactors[i];
+      zoom.add(new ActionMenuItem(new ZoomAction(factor, pane)));
+    }
+  }
+
+  public static void addActionsToToolBar(final JToolBar toolBar,
+                                         final ActionPlugin[] reportActions,
+                                         final PreviewPane pane)
+  {
+    if (reportActions == null)
+    {
+      return;
+    }
+
+    boolean separatorPending = false;
+    int count = 0;
+
+    for (int i = 0; i < reportActions.length; i++)
+    {
+      ActionPlugin actionPlugin = reportActions[i];
+      if (actionPlugin.isAddToToolbar() == false)
+      {
+        continue;
+      }
+
+      if (count > 0 && separatorPending)
+      {
+        toolBar.addSeparator();
+        separatorPending = false;
+      }
+
+      if (actionPlugin instanceof ExportActionPlugin)
+      {
+        final ExportActionPlugin exportPlugin = (ExportActionPlugin) actionPlugin;
+        final ExportAction action = new ExportAction(exportPlugin, pane);
+        toolBar.add(createButton(action, pane.getSwingGuiContext()));
+        count += 1;
+      }
+      else if (actionPlugin instanceof ControlActionPlugin)
+      {
+        final ControlActionPlugin controlPlugin = (ControlActionPlugin) actionPlugin;
+        final ControlAction action = new ControlAction(controlPlugin, pane);
+        toolBar.add(createButton(action, pane.getSwingGuiContext()));
+        count += 1;
+      }
+      else if (actionPlugin instanceof ZoomListActionPlugin)
+      {
+        final JPanel zoomPane = new JPanel();
+        zoomPane.setLayout(new FlowLayout(FlowLayout.LEFT));
+        zoomPane.add(createZoomSelector(pane));
+        toolBar.add(zoomPane);
+        count += 1;
+      }
+
+      if (actionPlugin.isSeparated())
+      {
+        separatorPending = true;
+      }
+    }
+  }
+
+
+  private static JComboBox createZoomSelector(PreviewPane pane)
+  {
+    final JComboBox zoomSelect = new JComboBox(pane.getZoomModel());
+    zoomSelect.addActionListener(new ZoomSelectAction(pane.getZoomModel(), pane));
+    zoomSelect.setAlignmentX(Component.RIGHT_ALIGNMENT);
+    return zoomSelect;
+  }
+
+  /**
+   * Creates a button using the given action properties for the button's
+   * initialisation.
+   *
+   * @param action the action used to set up the button.
+   * @return a button based on the supplied action.
+   */
+  private static JButton createButton(final Action action,
+                                      final SwingGuiContext swingGuiContext)
+  {
+    final JButton button = new ActionButton(action);
+    boolean needText = true;
+    if (isLargeButtonsEnabled(swingGuiContext))
+    {
+      final Icon icon = (Icon) action.getValue(SwingCommonModule.LARGE_ICON_PROPERTY);
+      if (icon != null && (icon.getIconHeight() > 1 && icon.getIconHeight() > 1))
+      {
+        button.setIcon(icon);
+        needText = false;
+      }
+    }
+    else
+    {
+      final Icon icon = (Icon) action.getValue(Action.SMALL_ICON);
+      if (icon != null && (icon.getIconHeight() > 1 && icon.getIconHeight() > 1))
+      {
+        button.setIcon(icon);
+        needText = false;
+      }
+    }
+
+    if (needText)
+    {
+      final Object value = action.getValue(Action.NAME);
+      if (value != null)
+      {
+        button.setText(String.valueOf(value));
+      }
+    }
+    else
+    {
+      button.setText(null);
+      button.setMargin(new Insets(0, 0, 0, 0));
+    }
+
+    return button;
+  }
+
+  private static boolean isLargeButtonsEnabled(SwingGuiContext swingGuiContext)
+  {
+    final Configuration configuration = swingGuiContext.getConfiguration();
+    if ("true".equals(configuration.getConfigProperty
+        ("org.jfree.report.modules.gui.swing.preview.LargeIcons")))
+    {
+      return true;
+    }
+    return false;
+  }
+
+
+  public static double getNextZoomOut(final double zoom,
+                                      final double[] zoomFactors)
+  {
+    if (zoom <= zoomFactors[0])
+    {
+      return (zoom * 2.0) / 3.0;
+    }
+
+    final double largestZoom = zoomFactors[zoomFactors.length - 1];
+    if (zoom > largestZoom)
+    {
+      double linear = (zoom * 2.0) / 3.0;
+      if (linear < largestZoom)
+      {
+        return largestZoom;
+      }
+      return linear;
+    }
+
+    for (int i = zoomFactors.length - 1; i >= 0; i--)
+    {
+      double factor = zoomFactors[i];
+      if (factor < zoom)
+      {
+        return factor;
+      }
+    }
+
+    return (zoom * 2.0) / 3.0;
+  }
+
+  public static double getNextZoomIn(final double zoom,
+                                     final double[] zoomFactors)
+  {
+    final double largestZoom = zoomFactors[zoomFactors.length - 1];
+    if (zoom >= largestZoom)
+    {
+      return (zoom * 1.5);
+    }
+
+    final double smallestZoom = zoomFactors[0];
+    if (zoom < smallestZoom)
+    {
+      double linear = (zoom * 1.5);
+      if (linear > smallestZoom)
+      {
+        return smallestZoom;
+      }
+      return linear;
+    }
+
+    for (int i = 0; i < zoomFactors.length; i++)
+    {
+      double factor = zoomFactors[i];
+      if (factor > zoom)
+      {
+        return factor;
+      }
+    }
+    return (zoom * 1.5);
+  }
+
+
+  public static IconTheme createIconTheme(Configuration config)
+  {
+    String themeClass = config.getConfigProperty(ICON_THEME_CONFIG_KEY);
+    Object maybeTheme = ObjectUtilities.loadAndInstantiate(themeClass, PreviewPane.class, IconTheme.class);
+    IconTheme iconTheme;
+    if (maybeTheme != null)
+    {
+      iconTheme = (IconTheme) maybeTheme;
+    }
+    else
+    {
+      iconTheme = new DefaultIconTheme();
+    }
+    iconTheme.initialize(config);
+    return iconTheme;
+  }
+
+  public static ActionFactory createActionFactory(Configuration config)
+  {
+    final String factoryClass = config.getConfigProperty(ACTION_FACTORY_CONFIG_KEY);
+    Object maybeFactory = ObjectUtilities.loadAndInstantiate
+        (factoryClass, PreviewPane.class, ActionFactory.class);
+    ActionFactory actionFactory;
+    if (maybeFactory != null)
+    {
+      actionFactory = (ActionFactory) maybeFactory;
+    }
+    else
+    {
+      actionFactory = new DefaultActionFactory();
+    }
+    return actionFactory;
+  }
+
+  public static CategoryTreeItem[] buildMenuTree(final ActionCategory[] categories)
+  {
+    final CategoryTreeItem[] tree = new CategoryTreeItem[categories.length];
+    for (int i = 0; i < categories.length; i++)
+    {
+      ActionCategory category = categories[i];
+      tree[i] = new CategoryTreeItem(category);
+    }
+
+    for (int j = 0; j < tree.length; j++)
+    {
+      final CategoryTreeItem item = tree[j];
+      final String itemName = item.getName();
+      int parentWeight = 0;
+      CategoryTreeItem parent = null;
+      // now for each item, find the best parent item.
+      for (int k = 0; k < tree.length; k++)
+      {
+        if (k == j)
+        {
+          // never add yourself ..
+          continue;
+        }
+        CategoryTreeItem treeItem = tree[k];
+        final String parentName = treeItem.getName();
+        if (itemName.startsWith(parentName) == false)
+        {
+          continue;
+        }
+        if (parentName.length() > parentWeight)
+        {
+          parent = treeItem;
+          parentWeight = parentName.length();
+        }
+      }
+
+      item.setParent(parent);
+    }
+
+    for (int j = 0; j < tree.length; j++)
+    {
+      final CategoryTreeItem item = tree[j];
+      final CategoryTreeItem parent = item.getParent();
+      if (parent != null)
+      {
+        parent.add(item);
+      }
+    }
+    return tree;
+  }
+
+  public static HashMap loadActions(SwingGuiContext swingGuiContext)
+  {
+    HashMap actions = new HashMap();
+
+    final Configuration configuration = swingGuiContext.getConfiguration();
+    final ActionCategory[] categories = loadCategories(swingGuiContext);
+    final ActionFactory factory = PreviewPaneUtilities.createActionFactory(configuration);
+
+    for (int i = 0; i < categories.length; i++)
+    {
+      final ActionCategory category = categories[i];
+      actions.put(category,
+          factory.getActions(swingGuiContext, category.getName()));
+    }
+    return actions;
+  }
+
+
+  public static ActionCategory[] loadCategories(SwingGuiContext swingGuiContext)
+  {
+    final ArrayList categories = new ArrayList();
+    final Configuration configuration = swingGuiContext.getConfiguration();
+    final Iterator keys = configuration.findPropertyKeys(CATEGORY_PREFIX);
+    while (keys.hasNext())
+    {
+      final String enableKey = (String) keys.next();
+      if (enableKey.endsWith(".enabled") == false)
+      {
+        continue;
+      }
+
+      if ("true".equals(configuration.getConfigProperty(enableKey)) == false)
+      {
+        continue;
+      }
+
+      final String base = enableKey.substring(0, enableKey.length() - ".enabled".length());
+      if (base.length() == 0)
+      {
+        continue;
+      }
+
+      final String categoryKey = base.substring(CATEGORY_PREFIX.length());
+      final String className = configuration.getConfigProperty(base + ".class");
+      ActionCategory actionCategory;
+      if (className == null)
+      {
+        actionCategory = new ActionCategory();
+      }
+      else
+      {
+        actionCategory = (ActionCategory) ObjectUtilities.loadAndInstantiate
+            (className, PreviewPane.class, ActionCategory.class);
+        if (actionCategory == null)
+        {
+          actionCategory = new ActionCategory();
+        }
+      }
+
+      final String positionText = configuration.getConfigProperty(base + ".position");
+      actionCategory.setPosition(TextUtilities.parseInt(positionText, 0));
+      actionCategory.setName(categoryKey);
+      actionCategory.setResourceBase(configuration.getConfigProperty(base + ".resource-base"));
+      actionCategory.setResourcePrefix(configuration.getConfigProperty(base + ".resource-prefix"));
+      actionCategory.initialize(swingGuiContext);
+      categories.add(actionCategory);
+    }
+
+    return (ActionCategory[]) categories.toArray
+        (new ActionCategory[categories.size()]);
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/ReportController.java b/source/org/jfree/report/modules/gui/swing/preview/ReportController.java
new file mode 100644
index 0000000..32a3f9b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/ReportController.java
@@ -0,0 +1,92 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.gui.swing.preview;
+
+import javax.swing.JComponent;
+import javax.swing.JMenu;
+
+/**
+ * A report controler. This provides some means of configuring the
+ * preview components.
+ * <p>
+ * The controler should use the propertyChange events provided by
+ * the PreviewProxyBase and the ReportPane to update its state.
+ * <p>
+ * To force a new repagination, use the <code>refresh</code> method of
+ * the PreviewProxyBase.
+ *
+ * @author Thomas Morgner
+ */
+public interface ReportController
+{
+  /**
+   * Returns the graphical representation of the controler.
+   * This component will be added between the menu bar and
+   * the toolbar.
+   * <p>
+   * Changes to this property are not detected automaticly,
+   * you have to call "refreshController" whenever you want to
+   * display a completly new control panel.
+   *
+   * @return the controler component.
+   */
+  public JComponent getControlPanel();
+
+  /**
+   * Returns the menus that should be inserted into the menubar.
+   * <p>
+   * Changes to this property are not detected automaticly,
+   * you have to call "refreshControler" whenever the contents
+   * of the menu array changed.
+   *
+   * @return the menus as array, never null.
+   */
+  public JMenu[] getMenus();
+
+  /**
+   * Defines, whether the controler component is placed between
+   * the preview pane and the toolbar.
+   *
+   * @return true, if this is a inner component.
+   */
+  public boolean isInnerComponent ();
+
+  /**
+   * Returns the location for the report controler, one of
+   * BorderLayout.NORTH, BorderLayout.SOUTH, BorderLayout.EAST
+   * or BorderLayout.WEST.
+   *
+   * @return the location;
+   */
+  public String getControllerLocation ();
+
+  public void initialize (PreviewPane pane);
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/SwingPreviewModule.java b/source/org/jfree/report/modules/gui/swing/preview/SwingPreviewModule.java
new file mode 100644
index 0000000..8536730
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/SwingPreviewModule.java
@@ -0,0 +1,68 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SwingPreviewModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * Creation-Date: 16.11.2006, 18:59:43
+ *
+ * @author Thomas Morgner
+ */
+public class SwingPreviewModule extends AbstractModule
+{
+  public static final String BUNDLE_NAME =
+      "org.jfree.report.modules.gui.swing.preview.resources";
+
+  public SwingPreviewModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/about/AboutDialog.java b/source/org/jfree/report/modules/gui/swing/preview/about/AboutDialog.java
new file mode 100644
index 0000000..27bd342
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/about/AboutDialog.java
@@ -0,0 +1,312 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * AboutDialog.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.about;
+
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.util.ResourceBundle;
+import javax.swing.BorderFactory;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+
+import org.pentaho.reporting.libraries.base.versioning.Licenses;
+import org.pentaho.reporting.libraries.base.versioning.ProjectInformation;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+
+/**
+ * A dialog that displays information about the demonstration application.
+ *
+ * @author David Gilbert
+ */
+public class AboutDialog extends JDialog
+{
+
+  /**
+   * The preferred size for the frame.
+   */
+  public static final Dimension PREFERRED_SIZE = new Dimension(560, 360);
+
+  /**
+   * The default border for the panels in the tabbed pane.
+   */
+  public static final Border STANDARD_BORDER = BorderFactory.createEmptyBorder(5, 5, 5, 5);
+
+  /**
+   * Localised resources.
+   */
+  private ResourceBundle resources;
+
+  /**
+   * The application name.
+   */
+  private String application;
+
+  /**
+   * The application version.
+   */
+  private String version;
+
+  /**
+   * The copyright string.
+   */
+  private String copyright;
+
+  /**
+   * Other info about the application.
+   */
+  private String info;
+
+  /**
+   * The licence.
+   */
+  private String licence;
+
+  /**
+   * Constructs an about frame.
+   *
+   * @param title   the frame title.
+   * @param project information about the project.
+   */
+  public AboutDialog(final String title, final ProjectInformation project)
+  {
+
+    init(title, project);
+
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specifed <code>Frame</code> as its owner.
+   *
+   * @param owner the <code>Frame</code> from which the dialog is displayed
+   */
+  public AboutDialog(final Frame owner,
+                     final String title,
+                     final ProjectInformation project)
+  {
+    super(owner);
+    init(title, project);
+  }
+
+  /**
+   * Creates a non-modal dialog without a title with the specifed <code>Dialog</code> as its owner.
+   *
+   * @param owner the <code>Dialog</code> from which the dialog is displayed
+   */
+  public AboutDialog(final Dialog owner,
+                     final String title,
+                     final ProjectInformation project)
+  {
+    super(owner);
+    init(title, project);
+  }
+
+  /**
+   * Constructs an 'About' frame.
+   *
+   * @param title       the frame title.
+   * @param libraries   a list of libraries.
+   */
+  private void init(final String title,
+                    final ProjectInformation libraries)
+  {
+
+    setTitle(title);
+
+    this.application = libraries.getName();
+    this.version = libraries.getVersion();
+    this.copyright = libraries.getCopyright();
+    this.info = libraries.getInfo();
+    if ("GPL".equalsIgnoreCase(libraries.getLicenseName()))
+    {
+      this.licence = Licenses.getInstance().getGPL();
+    }
+    else if ("LGPL".equalsIgnoreCase(libraries.getLicenseName()))
+    {
+      this.licence = Licenses.getInstance().getLGPL();
+    }
+    else
+    {
+      this.licence = libraries.getLicenseName();
+    }
+
+    this.resources = ResourceBundle.getBundle(SwingPreviewModule.BUNDLE_NAME);
+
+    final JPanel content = new JPanel(new BorderLayout());
+    content.setBorder(AboutDialog.STANDARD_BORDER);
+
+    final JTabbedPane tabs = createTabs(libraries);
+    content.add(tabs);
+    setContentPane(content);
+
+    pack();
+
+  }
+
+  /**
+   * Returns the preferred size for the about frame.
+   *
+   * @return the preferred size.
+   */
+  public Dimension getPreferredSize()
+  {
+    return AboutDialog.PREFERRED_SIZE;
+  }
+
+  /**
+   * Creates a tabbed pane containing an about panel and a system properties panel.
+   *
+   * @return a tabbed pane.
+   */
+  private JTabbedPane createTabs(final ProjectInformation info)
+  {
+
+    final JTabbedPane tabs = new JTabbedPane();
+
+    final JPanel aboutPanel = createAboutPanel(info);
+    aboutPanel.setBorder(AboutDialog.STANDARD_BORDER);
+    final String aboutTab = this.resources.getString("about-frame.tab.about");
+    tabs.add(aboutTab, aboutPanel);
+
+    final JPanel systemPanel = new SystemPropertiesPanel();
+    systemPanel.setBorder(AboutDialog.STANDARD_BORDER);
+    final String systemTab = this.resources.getString("about-frame.tab.system");
+    tabs.add(systemTab, systemPanel);
+
+    return tabs;
+
+  }
+
+  /**
+   * Creates a panel showing information about the application, including the name, version, copyright notice, URL for
+   * further information, and a list of contributors.
+   *
+   * @return a panel.
+   */
+  private JPanel createAboutPanel(final ProjectInformation info)
+  {
+
+    final JPanel about = new JPanel(new BorderLayout());
+
+    final JPanel details = createAboutTab();
+
+    boolean includetabs = false;
+    final JTabbedPane tabs = new JTabbedPane();
+
+    if (this.licence != null)
+    {
+      final JPanel licencePanel = createLicencePanel();
+      licencePanel.setBorder(AboutDialog.STANDARD_BORDER);
+      final String licenceTab = this.resources.getString("about-frame.tab.licence");
+      tabs.add(licenceTab, licencePanel);
+      includetabs = true;
+    }
+
+    if (info != null)
+    {
+      final JPanel librariesPanel = new LibraryPanel(info);
+      librariesPanel.setBorder(AboutDialog.STANDARD_BORDER);
+      final String librariesTab = this.resources.getString("about-frame.tab.libraries");
+      tabs.add(librariesTab, librariesPanel);
+      includetabs = true;
+    }
+
+    about.add(details, BorderLayout.NORTH);
+    if (includetabs)
+    {
+      about.add(tabs);
+    }
+
+    return about;
+
+  }
+
+  private JPanel createAboutTab()
+  {
+    final JPanel textPanel = new JPanel(new GridLayout(4, 1, 0, 4));
+
+    final JPanel appPanel = new JPanel();
+    final JLabel appLabel = new JLabel(application);
+    appLabel.setHorizontalTextPosition(SwingConstants.CENTER);
+    appPanel.add(appLabel);
+
+    final JPanel verPanel = new JPanel();
+    final JLabel verLabel = new JLabel(version);
+    verLabel.setHorizontalTextPosition(SwingConstants.CENTER);
+    verPanel.add(verLabel);
+
+    final JPanel copyrightPanel = new JPanel();
+    final JLabel copyrightLabel = new JLabel(copyright);
+    copyrightLabel.setHorizontalTextPosition(SwingConstants.CENTER);
+    copyrightPanel.add(copyrightLabel);
+
+    final JPanel infoPanel = new JPanel();
+    final JLabel infoLabel = new JLabel(info);
+    infoLabel.setHorizontalTextPosition(SwingConstants.CENTER);
+    infoPanel.add(infoLabel);
+
+    textPanel.add(appPanel);
+    textPanel.add(verPanel);
+    textPanel.add(copyrightPanel);
+    textPanel.add(infoPanel);
+
+    return textPanel;
+  }
+
+  /**
+   * Creates a panel showing the licence.
+   *
+   * @return a panel.
+   */
+  private JPanel createLicencePanel()
+  {
+
+    final JPanel licencePanel = new JPanel(new BorderLayout());
+    final JTextArea area = new JTextArea(this.licence);
+    area.setLineWrap(true);
+    area.setWrapStyleWord(true);
+    area.setCaretPosition(0);
+    area.setEditable(false);
+    licencePanel.add(new JScrollPane(area));
+    return licencePanel;
+
+  }
+
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/about/LibraryPanel.java b/source/org/jfree/report/modules/gui/swing/preview/about/LibraryPanel.java
new file mode 100644
index 0000000..1ce4554
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/about/LibraryPanel.java
@@ -0,0 +1,139 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * LibraryPanel.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.about;
+
+import java.awt.BorderLayout;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableModel;
+
+import org.pentaho.reporting.libraries.base.versioning.DependencyInformation;
+import org.pentaho.reporting.libraries.base.versioning.ProjectInformation;
+
+/**
+ * A panel containing a table that lists the libraries used in a project.
+ * <p/>
+ * Used in the AboutFrame class.
+ *
+ * @author David Gilbert
+ */
+public class LibraryPanel extends JPanel
+{
+
+  /**
+   * The table.
+   */
+  private JTable table;
+
+  /**
+   * Constructs a LibraryPanel.
+   *
+   * @param libraries a list of libraries (represented by Library objects).
+   */
+  public LibraryPanel(final List libraries)
+  {
+
+    setLayout(new BorderLayout());
+
+    final String[] names = new String[]{"Name", "Version", "License", "Info"};
+    final DefaultTableModel model = new DefaultTableModel(names, libraries.size());
+    for (int i = 0; i < libraries.size(); i++)
+    {
+      final DependencyInformation depInfo = (DependencyInformation) libraries.get(i);
+      model.setValueAt(depInfo.getName(), i, 0);
+      model.setValueAt(depInfo.getVersion(), i, 1);
+      model.setValueAt(depInfo.getLicenseName(), i, 2);
+      model.setValueAt(depInfo.getInfo(), i, 3);
+    }
+
+    this.table = new JTable(model);
+    add(new JScrollPane(this.table));
+
+  }
+
+  public LibraryPanel(final ProjectInformation projectInfo)
+  {
+    this(LibraryPanel.getLibraries(projectInfo));
+  }
+
+  private static List getLibraries(final ProjectInformation info)
+  {
+    if (info == null)
+    {
+      return new ArrayList();
+    }
+    final ArrayList libs = new ArrayList();
+    LibraryPanel.collectLibraries(info, libs);
+    return libs;
+  }
+
+  private static void collectLibraries(final ProjectInformation info,
+                                       final List list)
+  {
+    DependencyInformation[] libs = info.getLibraries();
+    for (int i = 0; i < libs.length; i++)
+    {
+      final DependencyInformation lib = libs[i];
+      if (list.contains(lib) == false)
+      {
+        // prevent duplicates, they look ugly ..
+        list.add(lib);
+        if (lib instanceof ProjectInformation)
+        {
+          LibraryPanel.collectLibraries((ProjectInformation) lib, list);
+        }
+      }
+    }
+
+    libs = info.getOptionalLibraries();
+    for (int i = 0; i < libs.length; i++)
+    {
+      final DependencyInformation lib = libs[i];
+      if (list.contains(lib) == false)
+      {
+        // prevent duplicates, they look ugly ..
+        list.add(lib);
+        if (lib instanceof ProjectInformation)
+        {
+          LibraryPanel.collectLibraries((ProjectInformation) lib, list);
+        }
+      }
+    }
+  }
+
+  protected JTable getTable()
+  {
+    return table;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/about/SystemPropertiesPanel.java b/source/org/jfree/report/modules/gui/swing/preview/about/SystemPropertiesPanel.java
new file mode 100644
index 0000000..d725699
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/about/SystemPropertiesPanel.java
@@ -0,0 +1,255 @@
+/**
+ * =========================================================
+ * Pentaho-Reporting-Classic : a free Java reporting library
+ * =========================================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * SystemPropertiesPanel.java
+ * ------------
+ * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.about;
+
+import java.awt.BorderLayout;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.TreeMap;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.KeyStroke;
+import javax.swing.ListSelectionModel;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+/**
+ * A panel containing a table of system properties.
+ *
+ * @author David Gilbert
+ */
+public class SystemPropertiesPanel extends JPanel
+{
+
+  /**
+   * The table that displays the system properties.
+   */
+  private JTable table;
+
+  /**
+   * Allows for a popup menu for copying.
+   */
+  private JPopupMenu copyPopupMenu;
+
+  /**
+   * A copy menu item.
+   */
+  private JMenuItem copyMenuItem;
+
+  /**
+   * A popup listener.
+   */
+  private PopupListener copyPopupListener;
+
+  /**
+   * Constructs a new panel.
+   */
+  public SystemPropertiesPanel()
+  {
+
+    final String baseName = "org.jfree.ui.about.resources.AboutResources";
+    final ResourceBundle resources = ResourceBundle.getBundle(baseName);
+
+    setLayout(new BorderLayout());
+    this.table = SystemPropertiesPanel.createSystemPropertiesTable();
+    add(new JScrollPane(this.table));
+
+    // Add a popup menu to copy to the clipboard...
+    this.copyPopupMenu = new JPopupMenu();
+
+    final String label = resources.getString("system-properties-panel.popup-menu.copy");
+    final KeyStroke accelerator = (KeyStroke)
+        resources.getObject("system-properties-panel.popup-menu.copy.accelerator");
+    this.copyMenuItem = new JMenuItem(label);
+    this.copyMenuItem.setAccelerator(accelerator);
+    this.copyMenuItem.getAccessibleContext().setAccessibleDescription(label);
+    this.copyMenuItem.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(final ActionEvent e)
+      {
+        copySystemPropertiesToClipboard();
+      }
+    });
+    this.copyPopupMenu.add(this.copyMenuItem);
+
+    // add popup Listener to the table
+    this.copyPopupListener = new PopupListener();
+    this.table.addMouseListener(this.copyPopupListener);
+
+  }
+
+  /**
+   * Creates and returns a JTable containing all the system properties.  This method returns a table that is configured
+   * so that the user can sort the properties by clicking on the table header.
+   *
+   * @return a system properties table.
+   */
+  public static JTable createSystemPropertiesTable()
+  {
+
+    final String[] colnames = new String[]{"Property-Name", "Value"};
+    final Properties sysProps = System.getProperties();
+
+    final TreeMap data = new TreeMap(sysProps);
+    final Map.Entry[] entries = (Map.Entry[]) data.entrySet().toArray(new Map.Entry[data.size()]);
+    final DefaultTableModel properties = new DefaultTableModel(colnames, entries.length);
+    for (int i = 0; i < entries.length; i++)
+    {
+      final Map.Entry entry = entries[i];
+      properties.setValueAt(entry.getKey(), i, 0);
+      properties.setValueAt(entry.getValue(), i, 1);
+    }
+
+    final JTable table = new JTable(properties);
+    final TableColumnModel model = table.getColumnModel();
+    TableColumn column = model.getColumn(0);
+    column.setPreferredWidth(200);
+    column = model.getColumn(1);
+    column.setPreferredWidth(350);
+
+    table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
+    return table;
+
+  }
+
+  /**
+   * Copies the selected cells in the table to the clipboard, in tab-delimited format.
+   */
+  public void copySystemPropertiesToClipboard()
+  {
+
+    final StringBuffer buffer = new StringBuffer();
+    final ListSelectionModel selection = this.table.getSelectionModel();
+    final int firstRow = selection.getMinSelectionIndex();
+    final int lastRow = selection.getMaxSelectionIndex();
+    if ((firstRow != -1) && (lastRow != -1))
+    {
+      for (int r = firstRow; r <= lastRow; r++)
+      {
+        for (int c = 0; c < this.table.getColumnCount(); c++)
+        {
+          buffer.append(this.table.getValueAt(r, c));
+          if (c != 2)
+          {
+            buffer.append('\t');
+          }
+        }
+        buffer.append('\n');
+      }
+    }
+    final StringSelection ss = new StringSelection(buffer.toString());
+    final Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
+    cb.setContents(ss, ss);
+
+  }
+
+
+  /**
+   * Returns the copy popup menu.
+   *
+   * @return Returns the copyPopupMenu.
+   */
+  protected final JPopupMenu getCopyPopupMenu()
+  {
+    return copyPopupMenu;
+  }
+
+  /**
+   * Returns the table containing the system properties.
+   *
+   * @return Returns the table.
+   */
+  protected final JTable getTable()
+  {
+    return table;
+  }
+
+  /**
+   * A popup listener.
+   */
+  private class PopupListener extends MouseAdapter
+  {
+
+    /**
+     * Default constructor.
+     */
+    public PopupListener()
+    {
+    }
+
+    /**
+     * Mouse pressed event.
+     *
+     * @param e the event.
+     */
+    public void mousePressed(final MouseEvent e)
+    {
+      maybeShowPopup(e);
+    }
+
+    /**
+     * Mouse released event.
+     *
+     * @param e the event.
+     */
+    public void mouseReleased(final MouseEvent e)
+    {
+      maybeShowPopup(e);
+    }
+
+    /**
+     * Event handler.
+     *
+     * @param e the event.
+     */
+    private void maybeShowPopup(final MouseEvent e)
+    {
+      if (e.isPopupTrigger())
+      {
+        getCopyPopupMenu().show(getTable(), e.getX(), e.getY());
+      }
+    }
+  }
+
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/AboutActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/AboutActionPlugin.java
new file mode 100644
index 0000000..df1b3d5
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/AboutActionPlugin.java
@@ -0,0 +1,171 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AboutActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Window;
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.common.SwingUtil;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.jfree.report.modules.gui.swing.preview.about.AboutDialog;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 16:34:55
+ *
+ * @author Thomas Morgner
+ */
+public class AboutActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+  private AboutDialog aboutFrame;
+
+  public AboutActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.about.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.about.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.about.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.about.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.about.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getMnemonic("action.about.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    if (aboutFrame == null)
+    {
+      final String title = getDisplayName();
+      // look where we have been added ...
+      Window w = SwingUtil.getWindowAncestor(reportPane);
+      if (w instanceof Frame)
+      {
+        aboutFrame = new AboutDialog
+                ((Frame) w, title, JFreeReportInfo.getInstance());
+      }
+      else if (w instanceof Dialog)
+      {
+        aboutFrame = new AboutDialog
+                ((Dialog) w, title, JFreeReportInfo.getInstance());
+      }
+      else
+      {
+        aboutFrame = new AboutDialog
+                (title, JFreeReportInfo.getInstance());
+      }
+      aboutFrame.pack();
+      SwingUtil.centerFrameOnScreen(aboutFrame);
+    }
+
+    aboutFrame.setVisible(true);
+    aboutFrame.requestFocus();
+    return true;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ControlAction.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ControlAction.java
new file mode 100644
index 0000000..9a4d379
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ControlAction.java
@@ -0,0 +1,76 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ControlAction.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.awt.event.ActionEvent;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.jfree.report.modules.gui.swing.common.SwingCommonModule;
+import org.jfree.report.modules.gui.swing.common.action.ActionDowngrade;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+
+/**
+ * Creation-Date: 16.11.2006, 17:52:48
+ *
+ * @author Thomas Morgner
+ */
+public class ControlAction extends AbstractAction
+{
+  private ControlActionPlugin actionPlugin;
+  private PreviewPane previewPane;
+
+  /**
+   * Defines an <code>Action</code> object with a default description string and
+   * default icon.
+   */
+  public ControlAction(final ControlActionPlugin actionPlugin,
+                       final PreviewPane previewPane)
+  {
+    this.actionPlugin = actionPlugin;
+    this.previewPane = previewPane;
+    putValue(Action.NAME, actionPlugin.getDisplayName());
+    putValue(Action.SHORT_DESCRIPTION, actionPlugin.getShortDescription());
+    putValue(ActionDowngrade.ACCELERATOR_KEY, actionPlugin.getAcceleratorKey());
+    putValue(ActionDowngrade.MNEMONIC_KEY, actionPlugin.getMnemonicKey());
+    putValue(Action.SMALL_ICON, actionPlugin.getSmallIcon());
+    putValue(SwingCommonModule.LARGE_ICON_PROPERTY, actionPlugin.getLargeIcon());
+  }
+
+  /**
+   * Invoked when an action occurs.
+   */
+  public void actionPerformed(ActionEvent e)
+  {
+    actionPlugin.configure(previewPane);
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ControlActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ControlActionPlugin.java
new file mode 100644
index 0000000..73f8228
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ControlActionPlugin.java
@@ -0,0 +1,45 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ControlActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import org.jfree.report.modules.gui.swing.common.ActionPlugin;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+
+/**
+ * Creation-Date: 16.11.2006, 15:47:20
+ *
+ * @author Thomas Morgner
+ */
+public interface ControlActionPlugin extends ActionPlugin
+{
+  public boolean configure (PreviewPane pane);
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ExitActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ExitActionPlugin.java
new file mode 100644
index 0000000..fb1464b
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ExitActionPlugin.java
@@ -0,0 +1,139 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExitActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 16:34:55
+ *
+ * @author Thomas Morgner
+ */
+public class ExitActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public ExitActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.close.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.close.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.close.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.close.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.close.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getOptionalKeyStroke("action.close.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic("action.close.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    reportPane.setClosed(true);
+    return true;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ExportAction.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ExportAction.java
new file mode 100644
index 0000000..943c1f6
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ExportAction.java
@@ -0,0 +1,85 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ExportAction.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.awt.event.ActionEvent;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.swing.common.ExportActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingCommonModule;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.common.action.ActionDowngrade;
+
+/**
+ * Creation-Date: 16.11.2006, 17:52:48
+ *
+ * @author Thomas Morgner
+ */
+public class ExportAction extends AbstractAction
+{
+  private ExportActionPlugin actionPlugin;
+  private PreviewPane previewPane;
+
+  /**
+   * Defines an <code>Action</code> object with a default description string and
+   * default icon.
+   */
+  public ExportAction(ExportActionPlugin actionPlugin,
+                      PreviewPane previewPane)
+  {
+    this.actionPlugin = actionPlugin;
+    this.previewPane = previewPane;
+    putValue(Action.NAME, actionPlugin.getDisplayName());
+    putValue(Action.SHORT_DESCRIPTION, actionPlugin.getShortDescription());
+    putValue(ActionDowngrade.ACCELERATOR_KEY, actionPlugin.getAcceleratorKey());
+    putValue(ActionDowngrade.MNEMONIC_KEY, actionPlugin.getMnemonicKey());
+    putValue(Action.SMALL_ICON, actionPlugin.getSmallIcon());
+    putValue(SwingCommonModule.LARGE_ICON_PROPERTY, actionPlugin.getLargeIcon());
+  }
+
+  /**
+   * Invoked when an action occurs.
+   */
+  public void actionPerformed(ActionEvent e)
+  {
+    final ReportJob reportJob = previewPane.getReportJob();
+    if (reportJob == null)
+    {
+      return;
+    }
+
+    final ReportJob job = reportJob.derive();
+    actionPlugin.performExport(job);
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/GoToActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToActionPlugin.java
new file mode 100644
index 0000000..18734dd
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToActionPlugin.java
@@ -0,0 +1,161 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GoToActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.JOptionPane;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 16.11.2006, 16:34:55
+ *
+ * @author Thomas Morgner
+ */
+public class GoToActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public GoToActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.go-to.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.gotopage.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.gotopage.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.gotopage.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.gotopage.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getKeyStroke("action.gotopage.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getMnemonic("action.gotopage.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    final String result = JOptionPane.showInputDialog(getContext().getWindow(),
+            resources.getString("dialog.gotopage.title"),
+            resources.getString("dialog.gotopage.message"),
+            JOptionPane.OK_CANCEL_OPTION);
+    if (result == null)
+    {
+      return false;
+    }
+    try
+    {
+      final int page = Integer.parseInt(result);
+
+      if (page > 0 && page <= reportPane.getNumberOfPages())
+      {
+        reportPane.setPageNumber(page);
+      }
+    }
+    catch (Exception ex)
+    {
+      DebugLog.log("DefaultGotoAction: swallowed an exception");
+    }
+    return false;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/GoToFirstPageActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToFirstPageActionPlugin.java
new file mode 100644
index 0000000..6d34d95
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToFirstPageActionPlugin.java
@@ -0,0 +1,139 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GoToFirstPageActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 16:34:55
+ *
+ * @author Thomas Morgner
+ */
+public class GoToFirstPageActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public GoToFirstPageActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.go-to-first.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.firstpage.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.firstpage.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.firstpage.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.firstpage.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getKeyStroke("action.firstpage.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getMnemonic("action.firstpage.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    reportPane.setPageNumber(1);
+    return true;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/GoToLastPageActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToLastPageActionPlugin.java
new file mode 100644
index 0000000..35ed380
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToLastPageActionPlugin.java
@@ -0,0 +1,139 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GoToLastPageActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 16:34:55
+ *
+ * @author Thomas Morgner
+ */
+public class GoToLastPageActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public GoToLastPageActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.go-to-last.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.lastpage.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.lastpage.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.lastpage.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.lastpage.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getKeyStroke("action.lastpage.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getMnemonic("action.lastpage.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    reportPane.setPageNumber(reportPane.getNumberOfPages());
+    return true;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/GoToNextPageActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToNextPageActionPlugin.java
new file mode 100644
index 0000000..379d488
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToNextPageActionPlugin.java
@@ -0,0 +1,140 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GoToNextPageActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 16:34:55
+ *
+ * @author Thomas Morgner
+ */
+public class GoToNextPageActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public GoToNextPageActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.go-to-next.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.forward.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.forward.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.forward.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.forward.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getKeyStroke("action.forward.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getMnemonic("action.forward.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    reportPane.setPageNumber(Math.min
+        (reportPane.getNumberOfPages(), reportPane.getPageNumber() + 1));
+    return true;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/GoToPreviousPageActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToPreviousPageActionPlugin.java
new file mode 100644
index 0000000..fb62ac3
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/GoToPreviousPageActionPlugin.java
@@ -0,0 +1,139 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GoToPreviousPageActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 16:34:55
+ *
+ * @author Thomas Morgner
+ */
+public class GoToPreviousPageActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public GoToPreviousPageActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.go-to-previous.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.back.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.back.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.back.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.back.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getKeyStroke("action.back.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getMnemonic("action.back.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    reportPane.setPageNumber(Math.max (1, reportPane.getPageNumber() - 1));
+    return true;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomAction.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomAction.java
new file mode 100644
index 0000000..6adc219
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomAction.java
@@ -0,0 +1,77 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ZoomAction.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.awt.event.ActionEvent;
+import java.text.NumberFormat;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.jfree.report.modules.gui.swing.common.SwingCommonModule;
+import org.jfree.report.modules.gui.swing.common.action.ActionDowngrade;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.util.ImageUtils;
+
+/**
+ * Creation-Date: 16.11.2006, 18:51:18
+ *
+ * @author Thomas Morgner
+ */
+public class ZoomAction extends AbstractAction
+{
+  private double zoom;
+  private PreviewPane previewPane;
+
+  /**
+   * Defines an <code>Action</code> object with a default description string and
+   * default icon.
+   */
+  public ZoomAction(final double zoom, final PreviewPane previewPane)
+  {
+    this.zoom = zoom;
+    this.previewPane = previewPane;
+
+    this.putValue(Action.NAME, NumberFormat.getPercentInstance
+        (previewPane.getLocale()).format(zoom));
+    this.putValue(ActionDowngrade.SMALL_ICON,
+            ImageUtils.createTransparentIcon(16, 16));
+    this.putValue(SwingCommonModule.LARGE_ICON_PROPERTY, ImageUtils.createTransparentIcon(24, 24));
+  }
+
+  /**
+   * Invoked when an action occurs.
+   */
+  public void actionPerformed(ActionEvent e)
+  {
+    previewPane.setZoom(zoom);
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomCustomActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomCustomActionPlugin.java
new file mode 100644
index 0000000..195e7bc
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomCustomActionPlugin.java
@@ -0,0 +1,167 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ZoomCustomActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.awt.Window;
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.JOptionPane;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 16.11.2006, 18:52:30
+ *
+ * @author Thomas Morgner
+ */
+public class ZoomCustomActionPlugin  extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public ZoomCustomActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.zoom-custom.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.zoomCustom.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.zoomCustom.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.zoomCustom.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.zoomCustom.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getOptionalKeyStroke("action.zoomCustom.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic("action.zoomCustom.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    Window window = SwingUtilities.windowForComponent(reportPane);
+    final String result = JOptionPane.showInputDialog(window,
+            resources.getString("dialog.zoom.title"),
+            resources.getString("dialog.zoom.message"),
+            JOptionPane.OK_CANCEL_OPTION);
+    if (result == null)
+    {
+      return false;
+    }
+    try
+    {
+      final double zoom = Double.parseDouble(result);
+
+      if (zoom > 0 && zoom <= 4000)
+      {
+        reportPane.setZoom(zoom / 100.0);
+        return true;
+      }
+
+    }
+    catch (Exception ex)
+    {
+      DebugLog.log("ZoomAction: swallowed an exception");
+    }
+    return false;
+  }
+
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomInActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomInActionPlugin.java
new file mode 100644
index 0000000..89767d8
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomInActionPlugin.java
@@ -0,0 +1,145 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ZoomInActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.PreviewPaneUtilities;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 18:52:30
+ *
+ * @author Thomas Morgner
+ */
+public class ZoomInActionPlugin extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public ZoomInActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.zoom-in.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.zoomIn.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.zoomIn.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.zoomIn.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.zoomIn.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getOptionalKeyStroke("action.zoomIn.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic("action.zoomIn.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    final double nextZoomIn = PreviewPaneUtilities.getNextZoomIn
+        (reportPane.getZoom(), reportPane.getZoomFactors());
+    if (nextZoomIn == 0)
+    {
+      return false;
+    }
+    reportPane.setZoom(nextZoomIn);
+    return true;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomListActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomListActionPlugin.java
new file mode 100644
index 0000000..dd80c31
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomListActionPlugin.java
@@ -0,0 +1,128 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ZoomListActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 18:52:30
+ *
+ * @author Thomas Morgner
+ */
+public class ZoomListActionPlugin  extends AbstractActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public ZoomListActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.zoom-list.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return null;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomOutActionPlugin.java b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomOutActionPlugin.java
new file mode 100644
index 0000000..4d99bf4
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/actions/ZoomOutActionPlugin.java
@@ -0,0 +1,146 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ZoomOutActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.preview.actions;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.jfree.report.modules.gui.swing.preview.PreviewPane;
+import org.jfree.report.modules.gui.swing.preview.PreviewPaneUtilities;
+import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 18:52:30
+ *
+ * @author Thomas Morgner
+ */
+public class ZoomOutActionPlugin  extends AbstractActionPlugin
+    implements ControlActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public ZoomOutActionPlugin()
+  {
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPreviewModule.BUNDLE_NAME);
+    return true;
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.preview.zoom-out.";
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.zoomOut.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.zoomOut.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.zoomOut.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.zoomOut.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getOptionalKeyStroke("action.zoomOut.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getOptionalMnemonic("action.zoomOut.mnemonic");
+  }
+
+  public boolean configure(PreviewPane reportPane)
+  {
+    final double nextZoomOut = PreviewPaneUtilities.getNextZoomOut
+        (reportPane.getZoom(), reportPane.getZoomFactors());
+    if (nextZoomOut == 0)
+    {
+      return false;
+    }
+    reportPane.setZoom(nextZoomOut);
+    return true;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/preview/configuration.properties b/source/org/jfree/report/modules/gui/swing/preview/configuration.properties
new file mode 100644
index 0000000..d7cd5ba
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/configuration.properties
@@ -0,0 +1,131 @@
+# Config is simple (as usual)
+
+org.jfree.report.modules.gui.swing.preview.ActionFactory=org.jfree.report.modules.gui.swing.preview.DefaultActionFactory
+
+# Actions are organized by 'prefix'.'category'.'id'
+# Actions are organized by 'prefix'.'category'[.'subcategory']*.'id'
+# hardcoded-Prefix: 'org.jfree.report.modules.gui.swing.actions.'
+# The id must be unique (to be in compliance to the properties), but is not used elsewhere.
+
+org.jfree.report.modules.gui.swing.category.report.enabled=true
+org.jfree.report.modules.gui.swing.category.report.position=1000
+org.jfree.report.modules.gui.swing.category.report.resource-base=org.jfree.report.modules.gui.swing.preview.resources
+org.jfree.report.modules.gui.swing.category.report.resource-prefix=category.report.
+
+org.jfree.report.modules.gui.swing.category.export.enabled=true
+org.jfree.report.modules.gui.swing.category.export.position=2000
+org.jfree.report.modules.gui.swing.category.export.resource-base=org.jfree.report.modules.gui.swing.preview.resources
+org.jfree.report.modules.gui.swing.category.export.resource-prefix=category.export.
+
+org.jfree.report.modules.gui.swing.category.go-to.enabled=true
+org.jfree.report.modules.gui.swing.category.go-to.position=3000
+org.jfree.report.modules.gui.swing.category.go-to.resource-base=org.jfree.report.modules.gui.swing.preview.resources
+org.jfree.report.modules.gui.swing.category.go-to.resource-prefix=category.go-to.
+
+org.jfree.report.modules.gui.swing.category.help.enabled=true
+org.jfree.report.modules.gui.swing.category.help.position=20000
+org.jfree.report.modules.gui.swing.category.help.resource-base=org.jfree.report.modules.gui.swing.preview.resources
+org.jfree.report.modules.gui.swing.category.help.resource-prefix=category.help.
+
+org.jfree.report.modules.gui.swing.category.view.enabled=true
+org.jfree.report.modules.gui.swing.category.view.position=10000
+org.jfree.report.modules.gui.swing.category.view.resource-base=org.jfree.report.modules.gui.swing.preview.resources
+org.jfree.report.modules.gui.swing.category.view.resource-prefix=category.view.
+
+org.jfree.report.modules.gui.swing.user-defined-category.position=15000
+org.jfree.report.modules.gui.swing.preview.EnableToolBarZoom=true
+org.jfree.report.modules.gui.swing.preview.LargeIcons=true
+
+org.jfree.report.modules.gui.swing.actions.report.go-to=org.jfree.report.modules.gui.swing.preview.actions.GoToActionPlugin
+org.jfree.report.modules.gui.swing.actions.report.go-to-first=org.jfree.report.modules.gui.swing.preview.actions.GoToFirstPageActionPlugin
+org.jfree.report.modules.gui.swing.actions.report.go-to-last=org.jfree.report.modules.gui.swing.preview.actions.GoToLastPageActionPlugin
+org.jfree.report.modules.gui.swing.actions.report.go-to-next=org.jfree.report.modules.gui.swing.preview.actions.GoToNextPageActionPlugin
+org.jfree.report.modules.gui.swing.actions.report.go-to-previous=org.jfree.report.modules.gui.swing.preview.actions.GoToPreviousPageActionPlugin
+org.jfree.report.modules.gui.swing.actions.report.close=org.jfree.report.modules.gui.swing.preview.actions.ExitActionPlugin
+org.jfree.report.modules.gui.swing.actions.help.about=org.jfree.report.modules.gui.swing.preview.actions.AboutActionPlugin
+org.jfree.report.modules.gui.swing.actions.view.zoom-in=org.jfree.report.modules.gui.swing.preview.actions.ZoomInActionPlugin
+org.jfree.report.modules.gui.swing.actions.view.zoom-out=org.jfree.report.modules.gui.swing.preview.actions.ZoomOutActionPlugin
+org.jfree.report.modules.gui.swing.actions.view.zoom-list=org.jfree.report.modules.gui.swing.preview.actions.ZoomListActionPlugin
+org.jfree.report.modules.gui.swing.actions.view.zoom-custom=org.jfree.report.modules.gui.swing.preview.actions.ZoomCustomActionPlugin
+
+org.jfree.report.modules.gui.swing.preview.go-to.add-to-menu=true
+org.jfree.report.modules.gui.swing.preview.go-to.add-to-toolbar=false
+org.jfree.report.modules.gui.swing.preview.go-to.role-preference=0
+org.jfree.report.modules.gui.swing.preview.go-to.role=go-to
+org.jfree.report.modules.gui.swing.preview.go-to.menu-order=0
+org.jfree.report.modules.gui.swing.preview.go-to.toolbar-order=0
+
+org.jfree.report.modules.gui.swing.preview.go-to-first.add-to-menu=false
+org.jfree.report.modules.gui.swing.preview.go-to-first.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.preview.go-to-first.role-preference=0
+org.jfree.report.modules.gui.swing.preview.go-to-first.role=go-to-first
+org.jfree.report.modules.gui.swing.preview.go-to-first.menu-order=1000
+org.jfree.report.modules.gui.swing.preview.go-to-first.toolbar-order=1000
+
+org.jfree.report.modules.gui.swing.preview.go-to-previous.add-to-menu=false
+org.jfree.report.modules.gui.swing.preview.go-to-previous.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.preview.go-to-previous.role-preference=0
+org.jfree.report.modules.gui.swing.preview.go-to-previous.role=go-to-previous
+org.jfree.report.modules.gui.swing.preview.go-to-previous.menu-order=2000
+org.jfree.report.modules.gui.swing.preview.go-to-previous.toolbar-order=2000
+
+org.jfree.report.modules.gui.swing.preview.go-to-next.add-to-menu=false
+org.jfree.report.modules.gui.swing.preview.go-to-next.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.preview.go-to-next.role-preference=0
+org.jfree.report.modules.gui.swing.preview.go-to-next.role=go-to-next
+org.jfree.report.modules.gui.swing.preview.go-to-next.menu-order=3000
+org.jfree.report.modules.gui.swing.preview.go-to-next.toolbar-order=3000
+
+org.jfree.report.modules.gui.swing.preview.go-to-last.add-to-menu=false
+org.jfree.report.modules.gui.swing.preview.go-to-last.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.preview.go-to-last.role-preference=0
+org.jfree.report.modules.gui.swing.preview.go-to-last.role=go-to-last
+org.jfree.report.modules.gui.swing.preview.go-to-last.menu-order=4000
+org.jfree.report.modules.gui.swing.preview.go-to-last.toolbar-order=4000
+
+org.jfree.report.modules.gui.swing.preview.about.add-to-menu=true
+org.jfree.report.modules.gui.swing.preview.about.add-to-toolbar=false
+org.jfree.report.modules.gui.swing.preview.about.role-preference=0
+org.jfree.report.modules.gui.swing.preview.about.role=about
+org.jfree.report.modules.gui.swing.preview.about.menu-order=0
+org.jfree.report.modules.gui.swing.preview.about.toolbar-order=100000
+
+org.jfree.report.modules.gui.swing.preview.close.add-to-menu=true
+org.jfree.report.modules.gui.swing.preview.close.add-to-toolbar=false
+org.jfree.report.modules.gui.swing.preview.close.role-preference=0
+org.jfree.report.modules.gui.swing.preview.close.role=exit
+org.jfree.report.modules.gui.swing.preview.close.menu-order=0
+org.jfree.report.modules.gui.swing.preview.close.toolbar-order=0
+
+org.jfree.report.modules.gui.swing.preview.zoom-in.add-to-menu=true
+org.jfree.report.modules.gui.swing.preview.zoom-in.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.preview.zoom-in.role-preference=0
+org.jfree.report.modules.gui.swing.preview.zoom-in.role=zoom-in
+org.jfree.report.modules.gui.swing.preview.zoom-in.menu-order=1000
+org.jfree.report.modules.gui.swing.preview.zoom-in.toolbar-order=30000
+org.jfree.report.modules.gui.swing.preview.zoom-in.separated=false
+
+org.jfree.report.modules.gui.swing.preview.zoom-out.add-to-menu=true
+org.jfree.report.modules.gui.swing.preview.zoom-out.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.preview.zoom-out.role-preference=0
+org.jfree.report.modules.gui.swing.preview.zoom-out.role=zoom-out
+org.jfree.report.modules.gui.swing.preview.zoom-out.menu-order=2000
+org.jfree.report.modules.gui.swing.preview.zoom-out.toolbar-order=31000
+org.jfree.report.modules.gui.swing.preview.zoom-out.separated=true
+
+org.jfree.report.modules.gui.swing.preview.zoom-list.add-to-menu=true
+org.jfree.report.modules.gui.swing.preview.zoom-list.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.preview.zoom-list.role-preference=0
+org.jfree.report.modules.gui.swing.preview.zoom-list.role=zoom-list
+org.jfree.report.modules.gui.swing.preview.zoom-list.menu-order=3000
+org.jfree.report.modules.gui.swing.preview.zoom-list.toolbar-order=32000
+org.jfree.report.modules.gui.swing.preview.zoom-list.separated=true
+
+org.jfree.report.modules.gui.swing.preview.zoom-custom.add-to-menu=true
+org.jfree.report.modules.gui.swing.preview.zoom-custom.add-to-toolbar=false
+org.jfree.report.modules.gui.swing.preview.zoom-custom.role-preference=0
+org.jfree.report.modules.gui.swing.preview.zoom-custom.role=zoom-custom
+org.jfree.report.modules.gui.swing.preview.zoom-custom.menu-order=5000
+org.jfree.report.modules.gui.swing.preview.zoom-custom.toolbar-order=33000
+org.jfree.report.modules.gui.swing.preview.zoom-custom.separated=true
+
diff --git a/source/org/jfree/report/modules/gui/swing/preview/module.properties b/source/org/jfree/report/modules/gui/swing/preview/module.properties
new file mode 100644
index 0000000..2a226c4
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/module.properties
@@ -0,0 +1,17 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: gui-swing-preview
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Swing Print-Preview
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.gui.swing.common.SwingCommonModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
diff --git a/source/org/jfree/report/modules/gui/swing/preview/resources.properties b/source/org/jfree/report/modules/gui/swing/preview/resources.properties
new file mode 100644
index 0000000..0c6b8a6
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/preview/resources.properties
@@ -0,0 +1,107 @@
+category.report.name=Report
+category.report.mnemonic=
+category.report.description=
+
+category.go-to.name=Go To
+category.go-to.mnemonic=
+category.go-to.description=
+
+category.view.name=View
+category.view.mnemonic=
+category.view.description=
+
+category.help.name=Help
+category.help.mnemonic=
+category.help.description=
+
+category.export.name=Export
+category.export.mnemonic=
+category.export.description=
+
+
+action.back.description=Switch to the previous page
+action.back.mnemonic=VK_PAGE_UP
+action.back.name=Back
+action.back.accelerator=VK_PAGE_UP
+
+action.firstpage.accelerator=VK_HOME
+action.firstpage.description=Switch to the first page
+action.firstpage.mnemonic=VK_HOME
+action.firstpage.name=Home
+
+action.forward.description=Switch to the next page
+action.forward.mnemonic=VK_PAGE_DOWN
+action.forward.name=Forward
+action.forward.accelerator=VK_PAGE_DOWN
+
+action.gotopage.description=View a page directly
+action.gotopage.mnemonic=VK_G
+action.gotopage.name=Go to page ...
+action.gotopage.accelerator=VK_G
+
+action.lastpage.description=Switch to the last page
+action.lastpage.mnemonic=VK_END
+action.lastpage.name=End
+action.lastpage.accelerator=VK_END
+
+action.zoomIn.description=Increase zoom
+action.zoomIn.mnemonic=VK_PLUS
+action.zoomIn.name=Zoom In
+action.zoomIn.accelerator=VK_PLUS
+
+action.zoomOut.description=Decrease Zoom
+action.zoomOut.mnemonic=VK_MINUS
+action.zoomOut.name=Zoom Out
+action.zoomOut.accelerator=VK_MINUS
+
+action.zoomCustom.description=Userdefined zoom factor..
+action.zoomCustom.mnemonic=
+action.zoomCustom.name=Userdefined ..
+action.zoomCustom.accelerator=
+
+dialog.gotopage.title=Go to page
+dialog.gotopage.message=Enter a page number
+
+dialog.zoom.title=Zoom ..
+dialog.zoom.message=Enter a Zoom
+
+action.about.mnemonic=VK_A
+action.about.name=About...
+action.about.description=Information about the application
+
+action.close.description=Close print preview window
+action.close.mnemonic=VK_C
+action.close.name=Close
+action.close.accelerator=VK_X
+
+
+about-frame.tab.about=About
+about-frame.tab.system=System
+about-frame.tab.contributors=Developers
+about-frame.tab.licence=Licence
+about-frame.tab.libraries=Libraries
+
+contributors-table.column.name=Name:
+contributors-table.column.contact=Contact:
+
+libraries-table.column.name=Name:
+libraries-table.column.version=Version:
+libraries-table.column.licence=Licence:
+libraries-table.column.info=Other Information:
+
+system-frame.title=System Properties
+system-frame.button.close=Close
+system-frame.button.close.mnemonic=VK_C
+system-frame.menu.file=File
+system-frame.menu.file.mnemonic=VK_F
+system-frame.menu.file.close=Close
+system-frame.menu.file.close.mnemonic=VK_C
+system-frame.menu.edit=Edit
+system-frame.menu.edit.mnemonic=VK_E
+system-frame.menu.edit.copy=Copy
+system-frame.menu.edit.copy.mnemonic=VK_C
+
+system-properties-table.column.name=Property Name:
+system-properties-table.column.value=Value:
+system-properties-panel.popup-menu.copy=Copy
+system-properties-panel.popup-menu.copy.accelerator=VK_C
diff --git a/source/org/jfree/report/modules/gui/swing/printing/DrawablePrintable.java b/source/org/jfree/report/modules/gui/swing/printing/DrawablePrintable.java
new file mode 100644
index 0000000..f02e0e2
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/DrawablePrintable.java
@@ -0,0 +1,93 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DrawablePrintable.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.printing;
+
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+
+import org.jfree.layouting.modules.output.graphics.PageDrawable;
+
+/**
+ * Creation-Date: 15.11.2006, 22:14:09
+ *
+ * @author Thomas Morgner
+ */
+public class DrawablePrintable implements Printable
+{
+  private PageDrawable drawable;
+
+  public DrawablePrintable(final PageDrawable drawable)
+  {
+    this.drawable = drawable;
+  }
+
+  /**
+   * Prints the page at the specified index into the specified {@link
+   * java.awt.Graphics} context in the specified format.  A
+   * <code>PrinterJob</code> calls the <code>Printable</code> interface to
+   * request that a page be rendered into the context specified by
+   * <code>graphics</code>.  The format of the page to be drawn is specified by
+   * <code>pageFormat</code>.  The zero based index of the requested page is
+   * specified by <code>pageIndex</code>. If the requested page does not exist
+   * then this method returns NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned.
+   * The <code>Graphics</code> class or subclass implements the {@link
+   * java.awt.print.PrinterGraphics} interface to provide additional
+   * information.  If the <code>Printable</code> object aborts the print job
+   * then it throws a {@link java.awt.print.PrinterException}.
+   *
+   * @param graphics   the context into which the page is drawn
+   * @param pageFormat the size and orientation of the page being drawn
+   * @param pageIndex  the zero based index of the page to be drawn
+   * @return PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if
+   *         <code>pageIndex</code> specifies a non-existent page.
+   * @throws java.awt.print.PrinterException
+   *          thrown when the print job is terminated.
+   */
+  public int print(final Graphics graphics, final PageFormat pageFormat, final int pageIndex)
+      throws PrinterException
+  {
+    if (drawable == null)
+    {
+      return Printable.NO_SUCH_PAGE;
+    }
+
+    final Graphics2D g2 = (Graphics2D) graphics;
+    final Rectangle2D bounds = new Rectangle2D.Double
+        (0,0, pageFormat.getImageableWidth(), pageFormat.getImageableHeight());
+    drawable.draw(g2, bounds);
+    return Printable.PAGE_EXISTS;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/printing/PrintActionPlugin.java b/source/org/jfree/report/modules/gui/swing/printing/PrintActionPlugin.java
new file mode 100644
index 0000000..ce9403f
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/PrintActionPlugin.java
@@ -0,0 +1,147 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrintActionPlugin.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.printing;
+
+import java.util.Locale;
+import javax.swing.Icon;
+import javax.swing.KeyStroke;
+
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin;
+import org.jfree.report.modules.gui.swing.common.ExportActionPlugin;
+import org.jfree.report.modules.gui.swing.common.SwingGuiContext;
+import org.pentaho.reporting.libraries.base.util.ResourceBundleSupport;
+
+/**
+ * Creation-Date: 16.11.2006, 16:31:23
+ *
+ * @author Thomas Morgner
+ */
+public class PrintActionPlugin extends AbstractActionPlugin
+    implements ExportActionPlugin
+{
+  private ResourceBundleSupport resources;
+
+  public PrintActionPlugin()
+  {
+  }
+
+  protected String getConfigurationPrefix()
+  {
+    return "org.jfree.report.modules.gui.swing.printing.print.";
+  }
+
+  public boolean initialize(SwingGuiContext context)
+  {
+    super.initialize(context);
+    resources = new ResourceBundleSupport(context.getLocale(),
+        SwingPrintingModule.BUNDLE_NAME);
+    return true;
+  }
+
+  /**
+   * Returns the display name for the export action.
+   *
+   * @return The display name.
+   */
+  public String getDisplayName()
+  {
+    return resources.getString("action.print.name");
+  }
+
+  /**
+   * Returns the short description for the export action.
+   *
+   * @return The short description.
+   */
+  public String getShortDescription()
+  {
+    return resources.getString("action.print.description");
+  }
+
+  /**
+   * Returns the small icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getSmallIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getSmallIcon(locale, "action.print.small-icon");
+  }
+
+  /**
+   * Returns the large icon for the export action.
+   *
+   * @return The icon.
+   */
+  public Icon getLargeIcon()
+  {
+    final Locale locale = getContext().getLocale();
+    return getIconTheme().getLargeIcon(locale, "action.print.icon");
+  }
+
+  /**
+   * Returns the accelerator key for the export action.
+   *
+   * @return The accelerator key.
+   */
+  public KeyStroke getAcceleratorKey()
+  {
+    return resources.getKeyStroke("action.print.accelerator");
+  }
+
+  /**
+   * Returns the mnemonic key code.
+   *
+   * @return The code.
+   */
+  public Integer getMnemonicKey()
+  {
+    return resources.getMnemonic("action.print.mnemonic");
+  }
+
+  /**
+   * Exports a report.
+   *
+   * @param job the report.
+   * @return A boolean.
+   */
+  public boolean performExport(final ReportJob job)
+  {
+    final PrintTask task = new PrintTask(job);
+    final Thread worker = new Thread(task);
+    setStatusText("Started Job");
+    worker.start();
+    return true;
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/printing/PrintReportProcessor.java b/source/org/jfree/report/modules/gui/swing/printing/PrintReportProcessor.java
new file mode 100644
index 0000000..930e8a4
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/PrintReportProcessor.java
@@ -0,0 +1,333 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrintReportProcessor.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.printing;
+
+import java.awt.print.PageFormat;
+import java.awt.print.Pageable;
+import java.awt.print.Printable;
+
+import org.jfree.layouting.StateException;
+import org.jfree.layouting.modules.output.graphics.GraphicsOutputProcessor;
+import org.jfree.layouting.modules.output.graphics.PageDrawable;
+import org.jfree.layouting.modules.output.graphics.QueryPhysicalPageInterceptor;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactory;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.flow.LibLayoutReportTarget;
+import org.jfree.report.flow.ReportJob;
+import org.jfree.report.flow.ReportTargetState;
+import org.jfree.report.flow.layoutprocessor.LayoutController;
+import org.jfree.report.flow.paginating.PageState;
+import org.jfree.report.flow.paginating.PaginatingReportProcessor;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * A paginating report processor that outputs to Pageables.
+ *
+ * @author Thomas Morgner
+ */
+public class PrintReportProcessor extends PaginatingReportProcessor
+    implements Pageable
+{
+  private ReportJob job;
+  private Throwable error;
+
+  public PrintReportProcessor(final ReportJob job)
+  {
+    super(new GraphicsOutputProcessor(job.getConfiguration()));
+    this.job = job;
+
+    synchronized(job)
+    {
+      final ReportDataFactory dataFactory = job.getDataFactory();
+      if (dataFactory != null)
+      {
+        dataFactory.open();
+      }
+    }
+  }
+
+  protected GraphicsOutputProcessor getGraphicsProcessor()
+  {
+    return (GraphicsOutputProcessor) getOutputProcessor();
+  }
+
+  public boolean isError()
+  {
+    return error != null;
+  }
+
+  protected ReportJob getJob()
+  {
+    return job;
+  }
+
+  public void close()
+  {
+    getJob().close();
+  }
+
+  protected PageDrawable processPage(int page)
+      throws ReportDataFactoryException,
+      DataSourceException, ReportProcessingException, StateException
+  {
+    final ReportJob job = getJob();
+    synchronized (job)
+    {
+      // set up the scene
+      final PageState state = getPhysicalPageState(page);
+
+      final ReportTargetState targetState = state.getTargetState();
+      final GraphicsOutputProcessor outputProcessor = getGraphicsProcessor();
+      outputProcessor.setPageCursor(state.getPageCursor());
+      final QueryPhysicalPageInterceptor interceptor =
+          new QueryPhysicalPageInterceptor(outputProcessor.getPhysicalPage(page));
+      outputProcessor.setInterceptor(interceptor);
+
+      final LibLayoutReportTarget target =
+          (LibLayoutReportTarget) targetState.restore(outputProcessor);
+
+      LayoutController position = state.getLayoutController();
+
+      // we have the data and we have our position inside the report.
+      // lets generate something ...
+      while (position.isAdvanceable())
+      {
+        position = position.advance(target);
+        target.commit();
+
+        while (position.isAdvanceable() == false &&
+               position.getParent() != null)
+        {
+          final LayoutController parent = position.getParent();
+          position = parent.join(position.getFlowController());
+        }
+
+        if (interceptor.isMoreContentNeeded() == false)
+        {
+          outputProcessor.setInterceptor(null);
+          return interceptor.getDrawable();
+        }
+
+      }
+
+      outputProcessor.setInterceptor(null);
+      return interceptor.getDrawable();
+    }
+  }
+
+  /**
+   * Returns the number of pages in the set. To enable advanced printing
+   * features, it is recommended that <code>Pageable</code> implementations
+   * return the true number of pages rather than the UNKNOWN_NUMBER_OF_PAGES
+   * constant.
+   *
+   * @return the number of pages in this <code>Pageable</code>.
+   */
+  public synchronized int getNumberOfPages()
+  {
+    if (isError())
+    {
+      return 0;
+    }
+
+    if (isPaginated() == false)
+    {
+      try
+      {
+        prepareReportProcessing(getJob());
+      }
+      catch (Exception e)
+      {
+        DebugLog.log("PrintReportProcessor: ", e);
+        error = e;
+        return 0;
+      }
+    }
+    DebugLog.log("After pagination, we have " +
+        getGraphicsProcessor().getPhysicalPageCount() + " physical pages.");
+    return getGraphicsProcessor().getPhysicalPageCount();
+  }
+
+  public boolean paginate()
+  {
+    if (isError())
+    {
+      return false;
+    }
+
+    if (isPaginated() == false)
+    {
+      try
+      {
+        prepareReportProcessing(getJob());
+        return true;
+      }
+      catch (Exception e)
+      {
+        error = e;
+        return false;
+      }
+    }
+    return true;
+  }
+
+  /**
+   * Returns the <code>PageFormat</code> of the page specified by
+   * <code>pageIndex</code>.
+   *
+   * @param pageIndex the zero based index of the page whose <code>PageFormat</code>
+   *                  is being requested
+   * @return the <code>PageFormat</code> describing the size and orientation.
+   * @throws IndexOutOfBoundsException if the <code>Pageable</code> does not
+   *                                   contain the requested page.
+   */
+  public synchronized PageFormat getPageFormat(final int pageIndex)
+      throws IndexOutOfBoundsException
+  {
+    if (isError())
+    {
+      return null;
+    }
+
+    if (isPaginated() == false)
+    {
+      try
+      {
+        prepareReportProcessing(getJob());
+      }
+      catch (Exception e)
+      {
+        error = e;
+        return null;
+      }
+    }
+
+    try
+    {
+      final PageDrawable pageDrawable = processPage(pageIndex);
+      return pageDrawable.getPageFormat();
+    }
+    catch (Exception e)
+    {
+      throw new IllegalStateException("Unable to return a valid pageformat.");
+    }
+  }
+
+  /**
+   * Returns the <code>Printable</code> instance responsible for rendering the
+   * page specified by <code>pageIndex</code>.
+   *
+   * @param pageIndex the zero based index of the page whose <code>Printable</code>
+   *                  is being requested
+   * @return the <code>Printable</code> that renders the page.
+   * @throws IndexOutOfBoundsException if the <code>Pageable</code> does not
+   *                                   contain the requested page.
+   */
+  public synchronized Printable getPrintable(final int pageIndex)
+      throws IndexOutOfBoundsException
+  {
+    if (isError())
+    {
+      return null;
+    }
+
+    if (isPaginated() == false)
+    {
+      try
+      {
+        prepareReportProcessing(getJob());
+      }
+      catch (Exception e)
+      {
+        error = e;
+        return null;
+      }
+    }
+
+    try
+    {
+      final PageDrawable pageDrawable = processPage(pageIndex);
+      return new DrawablePrintable(pageDrawable);
+    }
+    catch (Exception e)
+    {
+      throw new IllegalStateException("Unable to return a valid pageformat.");
+    }
+  }
+
+  public PageDrawable getPageDrawable(final int pageIndex)
+  {
+    if (isError())
+    {
+      return null;
+    }
+
+    if (isPaginated() == false)
+    {
+      try
+      {
+        prepareReportProcessing(getJob());
+      }
+      catch (Exception e)
+      {
+        error = e;
+        return null;
+      }
+    }
+
+    try
+    {
+      return processPage(pageIndex);
+    }
+    catch (Exception e)
+    {
+      error = e;
+      DebugLog.log("Failed to process the page", e);
+      throw new IllegalStateException("Unable to return a valid pageformat.");
+    }
+  }
+
+  /**
+   * Throws an unsupported operation exception. Printing is controlled by a
+   * framework which calls this pageable class for each page. Therefore,
+   * printing has to be invoked from outside.
+   *
+   * @param job
+   * @throws UnsupportedOperationException
+   */
+  public final void processReport(final ReportJob job)
+  {
+    throw new UnsupportedOperationException("Printing is a passive process.");
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/printing/PrintTask.java b/source/org/jfree/report/modules/gui/swing/printing/PrintTask.java
new file mode 100644
index 0000000..077c453
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/PrintTask.java
@@ -0,0 +1,74 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrintTask.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.printing;
+
+import java.awt.print.PrinterException;
+
+import org.jfree.report.flow.ReportJob;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: Dec 3, 2006, 3:23:22 PM
+ *
+ * @author Thomas Morgner
+ */
+public class PrintTask implements Runnable
+{
+  private ReportJob job;
+
+  public PrintTask(ReportJob job)
+  {
+    this.job = job;
+  }
+
+  /**
+   * When an object implementing interface <code>Runnable</code> is used to
+   * create a thread, starting the thread causes the object's <code>run</code>
+   * method to be called in that separately executing thread.
+   * <p/>
+   * The general contract of the method <code>run</code> is that it may take any
+   * action whatsoever.
+   *
+   * @see Thread#run()
+   */
+  public void run()
+  {
+    try
+    {
+      PrinterUtility.print(job);
+    }
+    catch (PrinterException e)
+    {
+      DebugLog.log ("Failed to print", e);
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/printing/PrinterUtility.java b/source/org/jfree/report/modules/gui/swing/printing/PrinterUtility.java
new file mode 100644
index 0000000..2db0d05
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/PrinterUtility.java
@@ -0,0 +1,128 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrinterUtility.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.printing;
+
+import java.awt.print.PageFormat;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import org.jfree.report.flow.ReportJob;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creation-Date: 03.12.2006, 15:01:24
+ *
+ * @author Thomas Morgner
+ */
+public class PrinterUtility
+{
+  public static final String PRINTER_JOB_NAME_KEY =
+      "org.jfree.report.modules.gui.common.print.JobName";
+  public static final String NUMBER_COPIES_KEY =
+      "org.jfree.report.modules.gui.common.print.NumberOfCopies";
+
+  private PrinterUtility()
+  {
+  }
+
+  public static void printDirectly(final ReportJob report)
+      throws PrinterException
+  {
+    final Configuration reportConfiguration = report.getConfiguration();
+    final String jobName = reportConfiguration.getConfigProperty
+        (PRINTER_JOB_NAME_KEY, "JFreeReport");
+
+    final PrinterJob printerJob = PrinterJob.getPrinterJob();
+    printerJob.setJobName(jobName);
+    printerJob.setPageable(new PrintReportProcessor(report));
+    printerJob.setCopies(getNumberOfCopies(reportConfiguration));
+
+    // this tries to resolve at least some of the pain ..
+//    final PageFormat pageFormat = report.getPageFormat();
+//    if (pageFormat != null)
+//    {
+//      report.setPageFormat(printerJob.validatePage(pageFormat));
+//    }
+//    else
+//    {
+//      report.setPageFormat(printerJob.defaultPage());
+//    }
+    printerJob.print();
+  }
+
+  public static boolean print(final ReportJob report)
+      throws PrinterException
+  {
+    final Configuration reportConfiguration = report.getConfiguration();
+    final String jobName = reportConfiguration.getConfigProperty
+        (PRINTER_JOB_NAME_KEY, "JFreeReport");
+
+    final PrintReportProcessor document = new PrintReportProcessor(report);
+
+    final PrinterJob printerJob = PrinterJob.getPrinterJob();
+//    final PageFormat pageFormat = report.getPageFormat();
+//    if (pageFormat != null)
+//    {
+//      report.setPageFormat(printerJob.validatePage(pageFormat));
+//    }
+//    else
+//    {
+//      report.setPageFormat(printerJob.defaultPage());
+//    }
+
+    printerJob.setJobName(jobName);
+    printerJob.setPageable(document);
+    printerJob.setCopies(getNumberOfCopies(reportConfiguration));
+    if (printerJob.printDialog())
+    {
+      printerJob.print();
+      return true;
+    }
+    return false;
+  }
+
+  public static int getNumberOfCopies(final Configuration configuration)
+  {
+    try
+    {
+      return Math.max(1, Integer.parseInt
+          (configuration.getConfigProperty(NUMBER_COPIES_KEY, "1")));
+    }
+    catch (Exception e)
+    {
+      DebugLog.log("PrintUtil: Number of copies declared for the report is invalid");
+      return 1;
+    }
+  }
+
+}
diff --git a/source/org/jfree/report/modules/gui/swing/printing/SwingPrintingModule.java b/source/org/jfree/report/modules/gui/swing/printing/SwingPrintingModule.java
new file mode 100644
index 0000000..6fce57c
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/SwingPrintingModule.java
@@ -0,0 +1,67 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SwingPrintingModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.gui.swing.printing;
+
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+
+/**
+ * Creation-Date: 17.11.2006, 14:46:24
+ *
+ * @author Thomas Morgner
+ */
+public class SwingPrintingModule extends AbstractModule
+{
+  public static final String BUNDLE_NAME =
+      "org.jfree.report.modules.gui.swing.printing.resources";
+
+  public SwingPrintingModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/gui/swing/printing/configuration.properties b/source/org/jfree/report/modules/gui/swing/printing/configuration.properties
new file mode 100644
index 0000000..3a89818
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/configuration.properties
@@ -0,0 +1,13 @@
+#
+# Printing for JDK 1.2
+# The global role 'print' is assigned to that action type.
+org.jfree.report.modules.gui.swing.actions.report.print12=org.jfree.report.modules.gui.swing.printing.PrintActionPlugin
+
+org.jfree.report.modules.gui.swing.printing.print.add-to-menu=true
+org.jfree.report.modules.gui.swing.printing.print.add-to-toolbar=true
+org.jfree.report.modules.gui.swing.printing.print.role-preference=0
+org.jfree.report.modules.gui.swing.printing.print.role=print
+org.jfree.report.modules.gui.swing.printing.print.menu-order=0
+org.jfree.report.modules.gui.swing.printing.print.toolbar-order=0
+org.jfree.report.modules.gui.swing.printing.print.separated=true
+
diff --git a/source/org/jfree/report/modules/gui/swing/printing/module.properties b/source/org/jfree/report/modules/gui/swing/printing/module.properties
new file mode 100644
index 0000000..7e15ae0
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/module.properties
@@ -0,0 +1,17 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: gui-swing-printing
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Swing Printinging using the JDK 1.2.2 functionality
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.gui.swing.common.SwingCommonModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
diff --git a/source/org/jfree/report/modules/gui/swing/printing/resources.properties b/source/org/jfree/report/modules/gui/swing/printing/resources.properties
new file mode 100644
index 0000000..5432426
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/printing/resources.properties
@@ -0,0 +1,10 @@
+action.print.accelerator=VK_P
+action.print.description=Print report
+action.print.mnemonic=VK_P
+action.print.name=Print...
+
+error.printfailed.title=Error on printing
+error.printfailed.message=Error on printing the report\: {0}
+
+printing-export.progressdialog.title=Printing the report ...
+printing-export.progressdialog.message=The report will now be printed ...
diff --git a/source/org/jfree/report/modules/gui/swing/rtf/module.properties b/source/org/jfree/report/modules/gui/swing/rtf/module.properties
new file mode 100644
index 0000000..21709bd
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/swing/rtf/module.properties
@@ -0,0 +1,17 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: gui-swing-rtf
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: RTF export GUI for Swing
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.modules.gui.swing.common.SwingCommonModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
diff --git a/source/org/jfree/report/modules/gui/themes/default/About16.gif b/source/org/jfree/report/modules/gui/themes/default/About16.gif
new file mode 100644
index 0000000..04da95e
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/About16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/About24.gif b/source/org/jfree/report/modules/gui/themes/default/About24.gif
new file mode 100644
index 0000000..9e11689
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/About24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Back16.gif b/source/org/jfree/report/modules/gui/themes/default/Back16.gif
new file mode 100644
index 0000000..f8147f8
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Back16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Back24.gif b/source/org/jfree/report/modules/gui/themes/default/Back24.gif
new file mode 100644
index 0000000..787518c
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Back24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/BlueCircle.gif b/source/org/jfree/report/modules/gui/themes/default/BlueCircle.gif
new file mode 100644
index 0000000..034b18b
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/BlueCircle.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/EmptyIcon.gif b/source/org/jfree/report/modules/gui/themes/default/EmptyIcon.gif
new file mode 100644
index 0000000..d6e9b01
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/EmptyIcon.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/FirstPage16.gif b/source/org/jfree/report/modules/gui/themes/default/FirstPage16.gif
new file mode 100644
index 0000000..a49198c
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/FirstPage16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/FirstPage24.gif b/source/org/jfree/report/modules/gui/themes/default/FirstPage24.gif
new file mode 100644
index 0000000..f5daf19
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/FirstPage24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Forward16.gif b/source/org/jfree/report/modules/gui/themes/default/Forward16.gif
new file mode 100644
index 0000000..c88d1ce
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Forward16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Forward24.gif b/source/org/jfree/report/modules/gui/themes/default/Forward24.gif
new file mode 100644
index 0000000..1936fd4
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Forward24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/GreenCircle.gif b/source/org/jfree/report/modules/gui/themes/default/GreenCircle.gif
new file mode 100644
index 0000000..d87a121
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/GreenCircle.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Information16.gif b/source/org/jfree/report/modules/gui/themes/default/Information16.gif
new file mode 100644
index 0000000..00862f6
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Information16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Information24.gif b/source/org/jfree/report/modules/gui/themes/default/Information24.gif
new file mode 100644
index 0000000..16cb3de
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Information24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/LastPage16.gif b/source/org/jfree/report/modules/gui/themes/default/LastPage16.gif
new file mode 100644
index 0000000..99df866
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/LastPage16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/LastPage24.gif b/source/org/jfree/report/modules/gui/themes/default/LastPage24.gif
new file mode 100644
index 0000000..4519566
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/LastPage24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/PageSetup16.gif b/source/org/jfree/report/modules/gui/themes/default/PageSetup16.gif
new file mode 100644
index 0000000..e5fde10
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/PageSetup16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/PageSetup24.gif b/source/org/jfree/report/modules/gui/themes/default/PageSetup24.gif
new file mode 100644
index 0000000..25fad07
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/PageSetup24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Print16.gif b/source/org/jfree/report/modules/gui/themes/default/Print16.gif
new file mode 100644
index 0000000..7eb8299
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Print16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Print24.gif b/source/org/jfree/report/modules/gui/themes/default/Print24.gif
new file mode 100644
index 0000000..e6b4fb1
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Print24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/PrintPreview16.gif b/source/org/jfree/report/modules/gui/themes/default/PrintPreview16.gif
new file mode 100644
index 0000000..c9bd34d
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/PrintPreview16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/PrintPreview24.gif b/source/org/jfree/report/modules/gui/themes/default/PrintPreview24.gif
new file mode 100644
index 0000000..6755cea
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/PrintPreview24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Quit16.gif b/source/org/jfree/report/modules/gui/themes/default/Quit16.gif
new file mode 100644
index 0000000..c7df223
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Quit16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/Quit24.gif b/source/org/jfree/report/modules/gui/themes/default/Quit24.gif
new file mode 100644
index 0000000..a0227de
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/Quit24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/RedCircle.gif b/source/org/jfree/report/modules/gui/themes/default/RedCircle.gif
new file mode 100644
index 0000000..35c2a75
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/RedCircle.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/SaveAs16.gif b/source/org/jfree/report/modules/gui/themes/default/SaveAs16.gif
new file mode 100644
index 0000000..8d3929c
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/SaveAs16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/SaveAs24.gif b/source/org/jfree/report/modules/gui/themes/default/SaveAs24.gif
new file mode 100644
index 0000000..97eb6fa
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/SaveAs24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/YellowCircle.gif b/source/org/jfree/report/modules/gui/themes/default/YellowCircle.gif
new file mode 100644
index 0000000..c5f310e
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/YellowCircle.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/ZoomIn16.gif b/source/org/jfree/report/modules/gui/themes/default/ZoomIn16.gif
new file mode 100644
index 0000000..06a5c48
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/ZoomIn16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/ZoomIn24.gif b/source/org/jfree/report/modules/gui/themes/default/ZoomIn24.gif
new file mode 100644
index 0000000..dbd4477
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/ZoomIn24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/ZoomOut16.gif b/source/org/jfree/report/modules/gui/themes/default/ZoomOut16.gif
new file mode 100644
index 0000000..6349bfc
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/ZoomOut16.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/ZoomOut24.gif b/source/org/jfree/report/modules/gui/themes/default/ZoomOut24.gif
new file mode 100644
index 0000000..259bf9c
Binary files /dev/null and b/source/org/jfree/report/modules/gui/themes/default/ZoomOut24.gif differ
diff --git a/source/org/jfree/report/modules/gui/themes/default/theme.properties b/source/org/jfree/report/modules/gui/themes/default/theme.properties
new file mode 100644
index 0000000..39833f5
--- /dev/null
+++ b/source/org/jfree/report/modules/gui/themes/default/theme.properties
@@ -0,0 +1,68 @@
+#JFreeReport resource bundle. Language <default>
+#Mon Jan 19 18:53:07 CET 2004
+
+action.about.icon=org/jfree/report/modules/gui/themes/default/About24.gif
+action.about.small-icon=org/jfree/report/modules/gui/themes/default/About16.gif
+
+action.back.icon=org/jfree/report/modules/gui/themes/default/Back24.gif
+action.back.small-icon=org/jfree/report/modules/gui/themes/default/Back16.gif
+
+action.close.icon=org/jfree/report/modules/gui/themes/default/Quit24.gif
+action.close.small-icon=org/jfree/report/modules/gui/themes/default/Quit16.gif
+
+action.firstpage.icon=org/jfree/report/modules/gui/themes/default/FirstPage24.gif
+action.firstpage.small-icon=org/jfree/report/modules/gui/themes/default/FirstPage16.gif
+
+action.forward.icon=org/jfree/report/modules/gui/themes/default/Forward24.gif
+action.forward.small-icon=org/jfree/report/modules/gui/themes/default/Forward16.gif
+
+action.lastpage.icon=org/jfree/report/modules/gui/themes/default/LastPage24.gif
+action.lastpage.small-icon=org/jfree/report/modules/gui/themes/default/LastPage16.gif
+
+action.gotopage.icon=org/jfree/report/modules/gui/themes/default/EmptyIcon.gif
+action.gotopage.small-icon=org/jfree/report/modules/gui/themes/default/EmptyIcon.gif
+
+action.zoomIn.icon=org/jfree/report/modules/gui/themes/default/ZoomIn24.gif
+action.zoomIn.small-icon=org/jfree/report/modules/gui/themes/default/ZoomIn16.gif
+
+action.zoomOut.icon=org/jfree/report/modules/gui/themes/default/ZoomOut24.gif
+action.zoomOut.small-icon=org/jfree/report/modules/gui/themes/default/ZoomOut16.gif
+
+action.zoomCustom.icon=org/jfree/report/modules/gui/themes/default/EmptyIcon.gif
+action.zoomCustom.small-icon=org/jfree/report/modules/gui/themes/default/EmptyIcon.gif
+
+statusbar.warningIcon=org/jfree/report/modules/gui/themes/default/YellowCircle.gif
+statusbar.errorIcon=org/jfree/report/modules/gui/themes/default/RedCircle.gif
+statusbar.informationIcon=org/jfree/report/modules/gui/themes/default/BlueCircle.gif
+statusbar.otherIcon=org/jfree/report/modules/gui/themes/default/GreenCircle.gif
+
+#
+# The known export targets.
+#
+action.export-to-excel.icon=org/jfree/report/modules/gui/themes/default/SaveAs24.gif
+action.export-to-excel.small-icon=org/jfree/report/modules/gui/themes/default/SaveAs16.gif
+
+action.export-to-rtf.icon=org/jfree/report/modules/gui/themes/default/SaveAs24.gif
+action.export-to-rtf.small-icon=org/jfree/report/modules/gui/themes/default/SaveAs16.gif
+
+action.page-setup.small-icon=org/jfree/report/modules/gui/themes/default/PageSetup16.gif
+action.page-setup.icon=org/jfree/report/modules/gui/themes/default/PageSetup24.gif
+
+action.print.small-icon=org/jfree/report/modules/gui/themes/default/Print16.gif
+action.print.icon=org/jfree/report/modules/gui/themes/default/Print24.gif
+
+action.print-preview.small-icon=org/jfree/report/modules/gui/themes/default/PrintPreview16.gif
+action.print-preview.icon=org/jfree/report/modules/gui/themes/default/PrintPreview24.gif
+
+action.export-to-plaintext.icon=org/jfree/report/modules/gui/themes/default/SaveAs24.gif
+action.export-to-plaintext.small-icon=org/jfree/report/modules/gui/themes/default/SaveAs16.gif
+
+action.export-to-pdf.icon=org/jfree/report/modules/gui/themes/default/SaveAs24.gif
+action.export-to-pdf.small-icon=org/jfree/report/modules/gui/themes/default/SaveAs16.gif
+
+action.export-to-html.icon=org/jfree/report/modules/gui/themes/default/SaveAs24.gif
+action.export-to-html.small-icon=org/jfree/report/modules/gui/themes/default/SaveAs16.gif
+
+action.export-to-csv.icon=org/jfree/report/modules/gui/themes/default/SaveAs24.gif
+action.export-to-csv.small-icon=org/jfree/report/modules/gui/themes/default/SaveAs16.gif
+
diff --git a/source/org/jfree/report/modules/misc/autotable/AutoTableCellContent.java b/source/org/jfree/report/modules/misc/autotable/AutoTableCellContent.java
new file mode 100644
index 0000000..7217457
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/AutoTableCellContent.java
@@ -0,0 +1,57 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AutoTableCellContent.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.autotable;
+
+import org.jfree.report.structure.Element;
+
+/**
+ * Creation-Date: Dec 9, 2006, 8:23:38 PM
+ *
+ * @author Thomas Morgner
+ */
+public class AutoTableCellContent extends Element
+{
+
+  public AutoTableCellContent()
+  {
+  }
+
+  public String getItem()
+  {
+    final Object attribute = getAttribute(AutoTableModule.AUTOTABLE_NAMESPACE, "item");
+    if (attribute == null)
+    {
+      return null;
+    }
+    return String.valueOf(attribute);
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/autotable/AutoTableElement.java b/source/org/jfree/report/modules/misc/autotable/AutoTableElement.java
new file mode 100644
index 0000000..0b0676a
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/AutoTableElement.java
@@ -0,0 +1,104 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AutoTableElement.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.autotable;
+
+import java.util.ArrayList;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+/**
+ * Creation-Date: Dec 9, 2006, 5:46:48 PM
+ *
+ * @author Thomas Morgner
+ */
+public class AutoTableElement extends Element
+{
+  private ArrayList headerCells;
+  private ArrayList contentCells;
+  private ArrayList footerCells;
+
+  public AutoTableElement()
+  {
+    headerCells = new ArrayList();
+    footerCells = new ArrayList();
+    contentCells = new ArrayList();
+  }
+
+  public void addHeader (Section headerCellElement)
+  {
+    headerCellElement.updateParent(this);
+    headerCells.add(headerCellElement);
+  }
+
+  public void addFooter (Section footerCellElement)
+  {
+    footerCellElement.updateParent(this);
+    footerCells.add(footerCellElement);
+  }
+
+  public void addContent (Section cellElement)
+  {
+    cellElement.updateParent(this);
+    contentCells.add(cellElement);
+  }
+
+  public int getHeaderCount ()
+  {
+    return headerCells.size();
+  }
+
+  public int getFooterCount ()
+  {
+    return footerCells.size();
+  }
+
+  public int getContentCount ()
+  {
+    return contentCells.size();
+  }
+
+  public Section getHeaderCell (int index)
+  {
+    return (Section) headerCells.get(index);
+  }
+
+  public Section getFooterCell (int index)
+  {
+    return (Section) footerCells.get(index);
+  }
+
+  public Section getContentCell (int index)
+  {
+    return (Section) contentCells.get(index);
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/autotable/AutoTableModule.java b/source/org/jfree/report/modules/misc/autotable/AutoTableModule.java
new file mode 100644
index 0000000..bde7f54
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/AutoTableModule.java
@@ -0,0 +1,66 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AutoTableModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.autotable;
+
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+
+/**
+ * Creation-Date: Dec 9, 2006, 5:48:04 PM
+ *
+ * @author Thomas Morgner
+ */
+public class AutoTableModule extends AbstractModule
+{
+  public static final String AUTOTABLE_NAMESPACE = "http://jfreereport.sourceforge.net/namespaces/reports/flow/extension/autotable";
+
+  public AutoTableModule() throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup
+   * operations. This method is called only once in a modules lifetime. If the
+   * initializing cannot be completed, throw a ModuleInitializeException to
+   * indicate the error,. The module will not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize(SubSystem subSystem) throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/autotable/autotable.css b/source/org/jfree/report/modules/misc/autotable/autotable.css
new file mode 100644
index 0000000..9a5f981
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/autotable.css
@@ -0,0 +1,35 @@
+ at namespace url(http://jfreereport.sourceforge.net/namespaces/reports/flow/extension/autotable);
+ at namespace report url(http://jfreereport.sourceforge.net/namespaces/engine);
+
+/**
+ * Declare your styles for these elements here ..
+ */
+
+header-row, footer-row, data-row {
+  display: table-row;
+}
+
+auto-table-header,auto-table-footer, auto-table-cell {
+  display: table-cell;
+}
+
+auto-table-header,auto-table-footer {
+  font-weight: bold;
+  font-size: 120%;
+}
+
+/**
+ * This makes sure that the content is copied from the data-flags collection
+ * into the layouted document flow ..
+ */
+auto-table-content[report|content] {
+  content: attr("report|content");
+  display: inline;
+}
+
+auto-table {
+  display: table;
+  table-layout: auto;
+  width: 100%;
+}
+
diff --git a/source/org/jfree/report/modules/misc/autotable/autotable.xsd b/source/org/jfree/report/modules/misc/autotable/autotable.xsd
new file mode 100644
index 0000000..e168ccb
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/autotable.xsd
@@ -0,0 +1,86 @@
+<xsd:schema version="0.9"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns="http://jfreereport.sourceforge.net/namespaces/reports/flow/extension/autotable"
+            xmlns:report="http://jfreereport.sourceforge.net/namespaces/reports/flow"
+            targetNamespace="http://jfreereport.sourceforge.net/namespaces/reports/flow/extension/autotable">
+  <xsd:annotation>
+    <xsd:documentation>
+      This schema describes the format of the auto-table flow extension.
+    </xsd:documentation>
+  </xsd:annotation>
+
+  <xsd:attribute name="class" type="xsd:string"/>
+  <xsd:attribute name="style" type="xsd:string"/>
+
+  <xsd:attribute name="item" default="text">
+    <xsd:simpleType>
+      <xsd:restriction base="xsd:NMTOKEN">
+        <xsd:enumeration value="name"/>
+        <xsd:enumeration value="value"/>
+      </xsd:restriction>
+    </xsd:simpleType>
+  </xsd:attribute>
+
+  <xsd:element name="auto-table-content">
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:restriction base="xsd:anyType">
+          <xsd:sequence>
+          </xsd:sequence>
+          <xsd:attribute ref="item" use="required"/>
+        </xsd:restriction>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+
+  <xsd:element name="auto-table-header">
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="report:section-type">
+          <xsd:attribute ref="style" use="optional"/>
+          <xsd:attribute ref="class" use="optional"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="auto-table-footer">
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="report:section-type">
+          <xsd:attribute ref="style" use="optional"/>
+          <xsd:attribute ref="class" use="optional"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="auto-table-cell">
+    <xsd:complexType>
+      <xsd:complexContent mixed="true">
+        <xsd:extension base="report:section-type">
+          <xsd:attribute ref="style" use="optional"/>
+          <xsd:attribute ref="class" use="optional"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="auto-table">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="report:element-type">
+          <xsd:sequence>
+            <xsd:element ref="auto-table-header" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element ref="auto-table-cell" minOccurs="1" maxOccurs="unbounded"/>
+            <xsd:element ref="auto-table-footer" minOccurs="0" maxOccurs="unbounded"/>
+          </xsd:sequence>
+          <xsd:attribute ref="style" use="optional"/>
+          <xsd:attribute ref="class" use="optional"/>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+</xsd:schema>
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/misc/autotable/configuration.properties b/source/org/jfree/report/modules/misc/autotable/configuration.properties
new file mode 100644
index 0000000..9bdd1c3
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/configuration.properties
@@ -0,0 +1,25 @@
+#
+# Declare a new namespace for the XML-Parser.
+org.jfree.report.modules.factories.report.node-factories.namespace.flow-autotable=http://jfreereport.sourceforge.net/namespaces/reports/flow/extension/autotable
+
+#
+# Register the XML-Parse-Handler. Elements mentioned here will be handled by
+# the declared handler, all other elements will be treated as sections.
+# (that default is declared in the factory-report-flow configuration).
+org.jfree.report.modules.factories.report.node-factories.tag.flow-autotable.auto-table-content=org.jfree.report.modules.misc.autotable.xml.AutoTableCellContentReadHandler
+org.jfree.report.modules.factories.report.node-factories.tag.flow-autotable.auto-table=org.jfree.report.modules.misc.autotable.xml.AutoTableElementReadHandler
+
+##
+# Register all LayoutController.
+org.jfree.report.flow.structure.org.jfree.report.modules.misc.autotable.AutoTableElement=org.jfree.report.modules.misc.autotable.flow.AutoTableLayoutController
+org.jfree.report.flow.structure.org.jfree.report.modules.misc.autotable.AutoTableCellContent=org.jfree.report.modules.misc.autotable.flow.AutoTableItemLayoutController
+
+#
+# Declare the namespace characteristics for LibLayout. This section tells everyone
+# which attributes hold style-information.
+org.jfree.report.namespaces.xml-flow-autotable.Uri=http://jfreereport.sourceforge.net/namespaces/reports/flow/extension/autotable
+org.jfree.report.namespaces.xml-flow-autotable.Default-Style=res://org/jfree/report/modules/misc/autotable/autotable.css
+org.jfree.report.namespaces.xml-flow-autotable.ClassAttr=class
+org.jfree.report.namespaces.xml-flow-autotable.StyleAttr=style
+org.jfree.report.namespaces.xml-flow-autotable.Prefix=autotable
+
diff --git a/source/org/jfree/report/modules/misc/autotable/flow/AutoTableItemLayoutController.java b/source/org/jfree/report/modules/misc/autotable/flow/AutoTableItemLayoutController.java
new file mode 100644
index 0000000..e59007c
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/flow/AutoTableItemLayoutController.java
@@ -0,0 +1,125 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AutoTableItemLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.autotable.flow;
+
+import org.jfree.report.DataFlags;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.data.ReportDataRow;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.flow.layoutprocessor.ElementLayoutController;
+import org.jfree.report.flow.layoutprocessor.LayoutController;
+import org.jfree.report.modules.misc.autotable.AutoTableCellContent;
+
+/**
+ * Creation-Date: Dec 9, 2006, 8:20:51 PM
+ *
+ * @author Thomas Morgner
+ */
+public class AutoTableItemLayoutController extends ElementLayoutController
+{
+
+  public AutoTableItemLayoutController()
+  {
+  }
+
+  protected AutoTableLayoutController findTableParent ()
+  {
+    LayoutController parent = getParent();
+    while (parent != null)
+    {
+      if (parent instanceof AutoTableLayoutController)
+      {
+        return (AutoTableLayoutController) parent;
+      }
+
+      parent = parent.getParent();
+    }
+    return null;
+  }
+
+  protected LayoutController processContent(final ReportTarget target)
+      throws DataSourceException, ReportProcessingException, ReportDataFactoryException
+  {
+    final AutoTableCellContent content = (AutoTableCellContent) getElement();
+    final FlowController flowController = getFlowController();
+    final ReportDataRow reportDataRow =
+        flowController.getMasterRow().getReportDataRow();
+
+    final AutoTableLayoutController table = findTableParent();
+    if (table == null)
+    {
+      throw new ReportProcessingException("Invalid state: have no auto-table as context.");
+    }
+    final int currentColumn = table.getCurrentColumn();
+
+    if ("name".equals(content.getItem()))
+    {
+      final String columnName = reportDataRow.getColumnName(currentColumn);
+      target.processText(columnName);
+    }
+    else if ("value".equals(content.getItem()))
+    {
+      final DataFlags flags = reportDataRow.getFlags(currentColumn);
+      target.processContent(flags);
+    }
+    else
+    {
+      throw new ReportProcessingException("Invalid definition: Content-Item with no valid type");
+    }
+
+    AutoTableItemLayoutController derived = (AutoTableItemLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.FINISHING);
+    derived.setFlowController(flowController);
+    return derived;
+
+  }
+
+  /**
+   * Joins with a delegated process flow. This is generally called from a child
+   * flow and should *not* (I mean it!) be called from outside. If you do,
+   * you'll suffer.
+   *
+   * @param flowController the flow controller of the parent.
+   * @return the joined layout controller that incorperates all changes from
+   * the delegate.
+   */
+  public LayoutController join(final FlowController flowController)
+  {
+    final AutoTableItemLayoutController derived = (AutoTableItemLayoutController) clone();
+    derived.setProcessingState(ElementLayoutController.FINISHING);
+    derived.setFlowController(flowController);
+    return derived;
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/autotable/flow/AutoTableLayoutController.java b/source/org/jfree/report/modules/misc/autotable/flow/AutoTableLayoutController.java
new file mode 100644
index 0000000..c2098ec
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/flow/AutoTableLayoutController.java
@@ -0,0 +1,265 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AutoTableLayoutController.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.autotable.flow;
+
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.report.DataSourceException;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.ReportProcessingException;
+import org.jfree.report.data.ReportDataRow;
+import org.jfree.report.flow.FlowControlOperation;
+import org.jfree.report.flow.FlowController;
+import org.jfree.report.flow.ReportContext;
+import org.jfree.report.flow.ReportTarget;
+import org.jfree.report.flow.layoutprocessor.ElementLayoutController;
+import org.jfree.report.flow.layoutprocessor.LayoutController;
+import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory;
+import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil;
+import org.jfree.report.modules.misc.autotable.AutoTableElement;
+import org.jfree.report.modules.misc.autotable.AutoTableModule;
+
+/**
+ * Creation-Date: Dec 9, 2006, 6:05:58 PM
+ *
+ * @author Thomas Morgner
+ */
+public class AutoTableLayoutController extends ElementLayoutController
+{
+  public static final int HANDLING_HEADER = 0;
+  public static final int HANDLING_DATA = 1;
+  public static final int HANDLING_FOOTER = 2;
+
+  private int currentColumn;
+  private int processingState;
+  private int columnCount;
+
+  public AutoTableLayoutController()
+  {
+  }
+
+  public void initialize(final Object node, final FlowController flowController, final LayoutController parent)
+      throws DataSourceException, ReportDataFactoryException, ReportProcessingException
+  {
+    super.initialize(node, flowController, parent);
+    final ReportDataRow reportDataRow =
+        flowController.getMasterRow().getReportDataRow();
+    this.columnCount = reportDataRow.getColumnCount();
+  }
+
+  protected LayoutController processContent(final ReportTarget target)
+      throws DataSourceException, ReportProcessingException, ReportDataFactoryException
+  {
+    switch (processingState)
+    {
+      case AutoTableLayoutController.HANDLING_HEADER:
+        return processHeader(target);
+      case AutoTableLayoutController.HANDLING_FOOTER:
+        return processFooter(target);
+      case AutoTableLayoutController.HANDLING_DATA:
+        return processData(target);
+      default:
+        throw new ReportProcessingException("No such state.");
+    }
+
+  }
+
+  private LayoutController processData(final ReportTarget target)
+      throws ReportProcessingException, DataSourceException, ReportDataFactoryException
+  {
+    // the auto-table is responsible for the iteration over the table.
+    final AutoTableElement node = (AutoTableElement) getElement();
+    if (node.getContentCount() == 0)
+    {
+      throw new ReportProcessingException
+          ("An Auto-Table must have at least one defined column.");
+    }
+
+    if (currentColumn == 0)
+    {
+      // Start a new table-header section ..
+      final AttributeMap elementMap = LayoutControllerUtil.createEmptyMap
+          (AutoTableModule.AUTOTABLE_NAMESPACE, "data-row");
+      target.startElement(elementMap);
+    }
+
+    if (currentColumn < columnCount)
+    {
+      // now delegate the processing to the section handler for the header ..
+      final FlowController flowController = getFlowController();
+      final ReportContext reportContext = flowController.getReportContext();
+      final LayoutControllerFactory layoutControllerFactory =
+          reportContext.getLayoutControllerFactory();
+
+      final int idx = currentColumn % node.getContentCount();
+      final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+      return layoutControllerFactory.create
+          (flowController, node.getContentCell(idx), derived);
+    }
+
+    // close the table-header section ..
+    final AttributeMap elementMap = LayoutControllerUtil.createEmptyMap
+        (AutoTableModule.AUTOTABLE_NAMESPACE, "data-row");
+    target.endElement(elementMap);
+
+    final FlowController flowController =
+        getFlowController().performOperation(FlowControlOperation.ADVANCE);
+    final FlowController cfc = tryRepeatingCommit(flowController);
+    if (cfc != null)
+    {
+      // Go back to the beginning. We have made a commit, so the cursor points
+      // to the next row of data ..
+      final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+      derived.setFlowController(cfc);
+      derived.currentColumn = 0;
+      return derived;
+    }
+
+    // Advance is impossible, that means we reached the end of the group or
+    // the end of the table ..
+    final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+    derived.currentColumn = 0;
+    derived.processingState = AutoTableLayoutController.HANDLING_FOOTER;
+    return derived;
+  }
+
+  private LayoutController processFooter(final ReportTarget target)
+      throws ReportProcessingException, DataSourceException, ReportDataFactoryException
+  {
+    final AutoTableElement node = (AutoTableElement) getElement();
+    if (node.getFooterCount() == 0)
+    {
+      final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+      derived.currentColumn = 0;
+      derived.processingState = -1;
+      derived.setProcessingState(ElementLayoutController.FINISHING);
+      return derived;
+    }
+
+    if (currentColumn == 0)
+    {
+      // Start a new table-header section ..
+      final AttributeMap elementMap = LayoutControllerUtil.createEmptyMap
+          (AutoTableModule.AUTOTABLE_NAMESPACE, "footer-row");
+      target.startElement(elementMap);
+    }
+
+    if (currentColumn < columnCount)
+    {
+      // now delegate the processing to the section handler for the header ..
+      final FlowController flowController = getFlowController();
+      final ReportContext reportContext = flowController.getReportContext();
+      final LayoutControllerFactory layoutControllerFactory =
+          reportContext.getLayoutControllerFactory();
+
+      final int idx = currentColumn % node.getFooterCount();
+      final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+      return layoutControllerFactory.create
+          (flowController, node.getFooterCell(idx), derived);
+    }
+
+    // close the table-header section ..
+    final AttributeMap elementMap = LayoutControllerUtil.createEmptyMap
+        (AutoTableModule.AUTOTABLE_NAMESPACE, "footer-row");
+    target.endElement(elementMap);
+
+    final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+    derived.currentColumn = 0;
+    derived.processingState = -1;
+    derived.setProcessingState(ElementLayoutController.FINISHING);
+    return derived;
+  }
+
+  private LayoutController processHeader(final ReportTarget target)
+      throws ReportProcessingException, DataSourceException, ReportDataFactoryException
+  {
+    final AutoTableElement node = (AutoTableElement) getElement();
+    if (node.getHeaderCount() == 0)
+    {
+      final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+      derived.currentColumn = 0;
+      derived.processingState = AutoTableLayoutController.HANDLING_DATA;
+      return derived;
+    }
+
+    if (currentColumn == 0)
+    {
+      // Start a new table-header section ..
+      final AttributeMap elementMap = LayoutControllerUtil.createEmptyMap
+          (AutoTableModule.AUTOTABLE_NAMESPACE, "header-row");
+      target.startElement(elementMap);
+    }
+
+    if (currentColumn < columnCount)
+    {
+      // now delegate the processing to the section handler for the header ..
+      final FlowController flowController = getFlowController();
+      final ReportContext reportContext = flowController.getReportContext();
+      final LayoutControllerFactory layoutControllerFactory =
+          reportContext.getLayoutControllerFactory();
+
+      final int idx = currentColumn % node.getHeaderCount();
+      final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+      return layoutControllerFactory.create
+          (flowController, node.getHeaderCell(idx), derived);
+    }
+
+    // close the table-header section ..
+    final AttributeMap elementMap = LayoutControllerUtil.createEmptyMap
+        (AutoTableModule.AUTOTABLE_NAMESPACE, "header-row");
+    target.endElement(elementMap);
+
+    final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+    derived.currentColumn = 0;
+    derived.processingState = AutoTableLayoutController.HANDLING_DATA;
+    return derived;
+  }
+
+  /**
+   * Joins with a delegated process flow. This is generally called from a child flow and should *not* (I mean it!) be
+   * called from outside. If you do, you'll suffer.
+   *
+   * @param flowController the flow controller of the parent.
+   * @return the joined layout controller that incorperates all changes from the delegate.
+   */
+  public LayoutController join(final FlowController flowController)
+  {
+    final AutoTableLayoutController derived = (AutoTableLayoutController) clone();
+    derived.setFlowController(flowController);
+    derived.currentColumn += 1;
+    return derived;
+  }
+
+  public int getCurrentColumn()
+  {
+    return currentColumn;
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/autotable/module.properties b/source/org/jfree/report/modules/misc/autotable/module.properties
new file mode 100644
index 0000000..9eb3131
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/module.properties
@@ -0,0 +1,20 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: misc-autotable
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Utility classes for creating automatic tables in reports.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+
+
diff --git a/source/org/jfree/report/modules/misc/autotable/xml/AutoTableCellContentReadHandler.java b/source/org/jfree/report/modules/misc/autotable/xml/AutoTableCellContentReadHandler.java
new file mode 100644
index 0000000..ec0f170
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/xml/AutoTableCellContentReadHandler.java
@@ -0,0 +1,84 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AutoTableCellContentReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.autotable.xml;
+
+import org.jfree.report.modules.factories.report.flow.AbstractElementReadHandler;
+import org.jfree.report.modules.factories.report.flow.FlowReportFactoryModule;
+import org.jfree.report.modules.misc.autotable.AutoTableCellContent;
+import org.jfree.report.structure.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: Dec 9, 2006, 5:47:25 PM
+ *
+ * @author Thomas Morgner
+ */
+public class AutoTableCellContentReadHandler extends AbstractElementReadHandler
+{
+  private AutoTableCellContent autoTableCellContent;
+
+  public AutoTableCellContentReadHandler()
+  {
+    autoTableCellContent = new AutoTableCellContent();
+  }
+
+  /**
+   * Starts parsing.
+   *
+   * @param attrs the attributes.
+   * @throws org.xml.sax.SAXException if there is a parsing error.
+   */
+  protected void startParsing(final Attributes attrs) throws SAXException
+  {
+    super.startParsing(attrs);
+
+    final Element element = getElement();
+    // Copy all other attributes ..
+    final int attrLength = attrs.getLength();
+    for (int i = 0; i < attrLength; i++)
+    {
+      final String uri = attrs.getURI(i);
+      final String local = attrs.getLocalName(i);
+      if (FlowReportFactoryModule.NAMESPACE.equals(uri) == false)
+      {
+        final String value = attrs.getValue(i);
+        element.setAttribute(uri, local, value);
+      }
+    }
+  }
+
+  protected Element getElement()
+  {
+    return autoTableCellContent;
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/autotable/xml/AutoTableElementReadHandler.java b/source/org/jfree/report/modules/misc/autotable/xml/AutoTableElementReadHandler.java
new file mode 100644
index 0000000..bf4f998
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/autotable/xml/AutoTableElementReadHandler.java
@@ -0,0 +1,144 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AutoTableElementReadHandler.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.autotable.xml;
+
+import java.util.ArrayList;
+
+import org.jfree.report.modules.factories.report.flow.AbstractElementReadHandler;
+import org.jfree.report.modules.factories.report.base.NodeReadHandlerFactory;
+import org.jfree.report.modules.factories.report.base.NodeReadHandler;
+import org.jfree.report.modules.misc.autotable.AutoTableElement;
+import org.jfree.report.modules.misc.autotable.AutoTableModule;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+/**
+ * Creation-Date: Dec 9, 2006, 5:47:25 PM
+ *
+ * @author Thomas Morgner
+ */
+public class AutoTableElementReadHandler extends AbstractElementReadHandler
+{
+  private AutoTableElement autoTableElement;
+  private ArrayList headerSections;
+  private ArrayList footerSections;
+  private ArrayList contentSections;
+
+  public AutoTableElementReadHandler()
+  {
+    autoTableElement = new AutoTableElement();
+    headerSections = new ArrayList();
+    contentSections = new ArrayList();
+    footerSections = new ArrayList();
+  }
+
+  protected Element getElement()
+  {
+    return autoTableElement;
+  }
+
+  /**
+   * Returns the handler for a child element.
+   *
+   * @param tagName the tag name.
+   * @param atts    the attributes.
+   * @return the handler or null, if the tagname is invalid.
+   * @throws org.xml.sax.SAXException if there is a parsing error.
+   */
+  protected XmlReadHandler getHandlerForChild(final String uri,
+                                              final String tagName,
+                                              final Attributes atts)
+      throws SAXException
+  {
+    if (AutoTableModule.AUTOTABLE_NAMESPACE.equals(uri) == false)
+    {
+      return super.getHandlerForChild(uri, tagName, atts);
+    }
+
+    final NodeReadHandlerFactory factory = NodeReadHandlerFactory.getInstance();
+    final NodeReadHandler handler = (NodeReadHandler) factory.getHandler(uri, tagName);
+    if (handler == null)
+    {
+      return null;
+    }
+
+    if (tagName.equals("auto-table-header"))
+    {
+      headerSections.add(handler);
+      return handler;
+    }
+
+    if (tagName.equals("auto-table-footer"))
+    {
+      footerSections.add(handler);
+      return handler;
+    }
+
+    if (tagName.equals("auto-table-cell"))
+    {
+      contentSections.add(handler);
+      return handler;
+    }
+
+    return null;
+  }
+
+
+  /**
+   * Done parsing.
+   *
+   * @throws org.xml.sax.SAXException if there is a parsing error.
+   */
+  protected void doneParsing() throws SAXException
+  {
+    for (int i = 0; i < headerSections.size(); i++)
+    {
+      final NodeReadHandler handler = (NodeReadHandler) headerSections.get(i);
+      autoTableElement.addHeader((Section) handler.getNode());
+    }
+
+    for (int i = 0; i < footerSections.size(); i++)
+    {
+      final NodeReadHandler handler = (NodeReadHandler) footerSections.get(i);
+      autoTableElement.addFooter((Section) handler.getNode());
+    }
+
+    for (int i = 0; i < contentSections.size(); i++)
+    {
+      final NodeReadHandler handler = (NodeReadHandler) contentSections.get(i);
+      autoTableElement.addContent((Section) handler.getNode());
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/referencedoc/DataSourceReferenceReport.xml b/source/org/jfree/report/modules/misc/referencedoc/DataSourceReferenceReport.xml
new file mode 100644
index 0000000..f819b4f
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/referencedoc/DataSourceReferenceReport.xml
@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE report-definition
+  PUBLIC "-//JFreeReport//DTD report definition//EN//extended/version 0.8.5"
+         "http://jfreereport.sourceforge.net/extreport-085.dtd">
+<report-definition name="DataSource Reference Report">
+  <parser-config>
+    <object-factory class="org.jfree.report.modules.parser.ext.factory.objects.DefaultClassFactory"/>
+    <element-factory class="org.jfree.report.modules.parser.ext.factory.elements.DefaultElementFactory"/>
+    <stylekey-factory class="org.jfree.report.modules.parser.ext.factory.stylekey.DefaultStyleKeyFactory"/>
+    <stylekey-factory class="org.jfree.report.modules.parser.ext.factory.stylekey.PageableLayoutStyleKeyFactory"/>
+    <template-factory class="org.jfree.report.modules.parser.ext.factory.templates.DefaultTemplateCollection"/>
+    <datasource-factory class="org.jfree.report.modules.parser.ext.factory.datasource.DefaultDataSourceFactory"/>
+  </parser-config>
+
+  <report-config>
+    <page-definition>
+      <page orientation="portrait" pageformat="A4" topmargin="24" bottommargin="24" leftmargin="24" rightmargin="24"/>
+    </page-definition>
+    <configuration>
+      <property name="org.jfree.report.modules.output.pageable.pdf.PDFOutputTarget.default.Author">JFreeReport</property>
+      <property name="org.jfree.report.modules.output.pageable.pdf.PDFOutputTarget.default.Encoding">iso-8859-15</property>
+    </configuration>
+  </report-config>
+
+  <report-description>
+    <report-header>
+
+      <!-- The report header style -->
+      <style>
+        <compound-key name="min-size">
+          <basic-object name="height">18.0</basic-object>
+          <basic-object name="width">0.0</basic-object>
+        </compound-key>
+        <basic-key name="font-bold">true</basic-key>
+        <basic-key name="font-size">14</basic-key>
+        <basic-key name="font">Serif</basic-key>
+        <basic-key name="font-underline">false</basic-key>
+        <basic-key name="font-italic">false</basic-key>
+      </style>
+
+      <!-- The background element, draws the grey background box -->
+      <element name="background" type="shape/generic">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">-100.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <basic-key name="stroke" class="java.awt.BasicStroke">0.0</basic-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+          <basic-key name="paint">#BCDCE3</basic-key>
+          <basic-key name="fill-shape">true</basic-key>
+          <basic-key name="scale">true</basic-key>
+          <basic-key name="keepAspectRatio">false</basic-key>
+          <basic-key name="draw-shape">false</basic-key>
+        </style>
+        <template references="rectangle"/>
+      </element>
+
+      <!-- A text element, contains the report header -->
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">-100.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="label">
+          <basic-object name="content">Extended Parser: DataSource Factory Reference</basic-object>
+        </template>
+      </element>
+    </report-header>
+
+    <groups>
+      <group name="object-factory">
+        <fields>
+          <field>datasource-factory</field>
+        </fields>
+        <group-header>
+          <style>
+            <compound-key name="min-size">
+              <basic-object name="height">18.0</basic-object>
+              <basic-object name="width">0.0</basic-object>
+            </compound-key>
+            <basic-key name="font-bold">true</basic-key>
+            <basic-key name="font-size">14</basic-key>
+            <basic-key name="font">Serif</basic-key>
+            <basic-key name="font-underline">false</basic-key>
+            <basic-key name="font-italic">false</basic-key>
+          </style>
+
+          <!-- group header -->
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">-100.0</basic-object>
+                <basic-object name="width">150.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">0.0</basic-object>
+              </compound-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">DataSource Factory</basic-object>
+            </template>
+          </element>
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">12.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">18.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">10</basic-key>
+              <basic-key name="font">Monospaced</basic-key>
+            </style>
+            <template references="string-field">
+              <basic-object name="nullValue">-</basic-object>
+              <basic-object name="field">datasource-factory</basic-object>
+            </template>
+          </element>
+
+          <element type="shape/generic">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">0.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <basic-key name="stroke" class="java.awt.BasicStroke">1.0</basic-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">18.0</basic-object>
+              </compound-key>
+              <basic-key name="paint">#C8DBD6</basic-key>
+              <basic-key name="fill-shape">false</basic-key>
+              <basic-key name="scale">true</basic-key>
+              <basic-key name="keepAspectRatio">false</basic-key>
+              <basic-key name="draw-shape">true</basic-key>
+            </style>
+            <template references="horizontal-line"/>
+          </element>
+
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">14.0</basic-object>
+                <basic-object name="width">-30.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">32.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">12</basic-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">Name</basic-object>
+            </template>
+          </element>
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">14.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">-30.0</basic-object>
+                <basic-object name="y">32.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">12</basic-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">Implementation</basic-object>
+            </template>
+          </element>
+        </group-header>
+      </group>
+    </groups>
+
+    <itemband>
+      <style>
+        <compound-key name="min-size">
+          <basic-object name="height">12.0</basic-object>
+          <basic-object name="width">0.0</basic-object>
+        </compound-key>
+        <basic-key name="font-bold">false</basic-key>
+        <basic-key name="font-size">10</basic-key>
+        <basic-key name="font">Monospaced</basic-key>
+        <basic-key name="font-underline">false</basic-key>
+        <basic-key name="font-italic">false</basic-key>
+      </style>
+
+      <element type="text/plain" name="object-class">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">-30.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">datasource-name</basic-object>
+        </template>
+      </element>
+
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">-70.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">-30.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">datasource-class</basic-object>
+        </template>
+      </element>
+
+      <element type="shape/generic">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">0.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <basic-key name="stroke" class="java.awt.BasicStroke">0.1</basic-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">-100.0</basic-object>
+          </compound-key>
+          <basic-key name="paint">#DAE6F2</basic-key>
+          <basic-key name="fill-shape">false</basic-key>
+          <basic-key name="scale">true</basic-key>
+          <basic-key name="keepAspectRatio">false</basic-key>
+          <basic-key name="draw-shape">true</basic-key>
+        </style>
+        <template references="horizontal-line"/>
+      </element>
+
+    </itemband>
+
+  </report-description>
+</report-definition>
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/misc/referencedoc/ObjectReferenceReport.xml b/source/org/jfree/report/modules/misc/referencedoc/ObjectReferenceReport.xml
new file mode 100644
index 0000000..bd4372f
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/referencedoc/ObjectReferenceReport.xml
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE report-definition
+  PUBLIC "-//JFreeReport//DTD report definition//EN//extended/version 0.8.5"
+         "http://jfreereport.sourceforge.net/extreport-085.dtd">
+<report-definition name="Object Reference Report">
+  <parser-config>
+    <object-factory class="org.jfree.report.modules.parser.ext.factory.objects.DefaultClassFactory"/>
+    <element-factory class="org.jfree.report.modules.parser.ext.factory.elements.DefaultElementFactory"/>
+    <stylekey-factory class="org.jfree.report.modules.parser.ext.factory.stylekey.DefaultStyleKeyFactory"/>
+    <stylekey-factory class="org.jfree.report.modules.parser.ext.factory.stylekey.PageableLayoutStyleKeyFactory"/>
+    <template-factory class="org.jfree.report.modules.parser.ext.factory.templates.DefaultTemplateCollection"/>
+    <datasource-factory class="org.jfree.report.modules.parser.ext.factory.datasource.DefaultDataSourceFactory"/>
+  </parser-config>
+
+  <report-config>
+    <page-definition>
+      <page orientation="portrait" pageformat="LETTER" topmargin="72" bottommargin="72" leftmargin="72" rightmargin="72"/>
+    </page-definition>
+    <configuration>
+      <property name="org.jfree.report.modules.output.pageable.pdf.PDFOutputTarget.default.Author">Darkwing Duck</property>
+      <property name="org.jfree.report.modules.output.pageable.pdf.PDFOutputTarget.default.Encoding">iso-8859-15</property>
+    </configuration>
+  </report-config>
+
+  <report-description>
+    <report-header>
+
+      <!-- The report header style -->
+      <style>
+        <basic-key name="font-bold">true</basic-key>
+        <basic-key name="font-size">14</basic-key>
+        <basic-key name="font">Serif</basic-key>
+        <basic-key name="font-underline">false</basic-key>
+        <basic-key name="font-italic">false</basic-key>
+      </style>
+
+      <!-- The background element, draws the grey background box -->
+      <element name="background" type="shape/generic">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">20.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <basic-key name="stroke" class="java.awt.BasicStroke">0.0</basic-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+          <basic-key name="paint">#BEDBAC</basic-key>
+          <basic-key name="fill-shape">true</basic-key>
+          <basic-key name="scale">true</basic-key>
+          <basic-key name="keepAspectRatio">false</basic-key>
+          <basic-key name="draw-shape">false</basic-key>
+        </style>
+        <template references="rectangle"/>
+      </element>
+
+      <!-- A text element, contains the report header -->
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">14.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">2.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="label">
+          <basic-object name="content">Extended Parser: Class Factory Reference</basic-object>
+        </template>
+      </element>
+
+      <!-- A text element, contains the report header -->
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">14.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">22.0</basic-object>
+          </compound-key>
+          <basic-key name="font-size">10</basic-key>
+          <basic-key name="dynamic_height">true</basic-key>
+          <basic-key name="trim-text-content">true</basic-key>
+        </style>
+        <template references="label">
+          <basic-object name="content">Note: An object which only defined a single property called 'value' is considered a primitive or basic value.
+When defining or using such objects, you can use the 'basic-key' or 'basic-object' tag in the Extended-XML.
+</basic-object>
+        </template>
+      </element>
+
+    </report-header>
+
+    <groups>
+      <group name="object-factory">
+        <fields>
+          <field>object-factory</field>
+        </fields>
+        <group-header>
+          <style>
+            <compound-key name="min-size">
+              <basic-object name="height">18.0</basic-object>
+              <basic-object name="width">0.0</basic-object>
+            </compound-key>
+            <basic-key name="font-bold">true</basic-key>
+            <basic-key name="font-size">14</basic-key>
+            <basic-key name="font">Serif</basic-key>
+            <basic-key name="font-underline">false</basic-key>
+            <basic-key name="font-italic">false</basic-key>
+            <basic-key name="valignment">middle</basic-key>
+          </style>
+
+          <!-- group header -->
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">-100.0</basic-object>
+                <basic-object name="width">100.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">0.0</basic-object>
+              </compound-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">Class Factory</basic-object>
+            </template>
+          </element>
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">-100.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">100.0</basic-object>
+                <basic-object name="y">0.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">10</basic-key>
+            </style>
+            <template references="string-field">
+              <basic-object name="nullValue">-</basic-object>
+              <basic-object name="field">object-factory</basic-object>
+            </template>
+          </element>
+
+        </group-header>
+      </group>
+
+      <group name="object-class">
+        <fields>
+          <field>object-factory</field>
+          <field>object-class</field>
+        </fields>
+        <group-header>
+          <style>
+            <compound-key name="min-size">
+              <basic-object name="height">12.0</basic-object>
+              <basic-object name="width">0.0</basic-object>
+            </compound-key>
+            <basic-key name="font-bold">true</basic-key>
+            <basic-key name="font-size">12</basic-key>
+            <basic-key name="font">Serif</basic-key>
+            <basic-key name="font-underline">false</basic-key>
+            <basic-key name="font-italic">true</basic-key>
+          </style>
+
+          <!-- The background element, draws the grey background box -->
+          <element name="background" type="shape/generic">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">-100.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <basic-key name="stroke" class="java.awt.BasicStroke">0.0</basic-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">0.0</basic-object>
+              </compound-key>
+              <basic-key name="paint">#cfcfcf</basic-key>
+              <basic-key name="fill-shape">true</basic-key>
+              <basic-key name="scale">true</basic-key>
+              <basic-key name="keepAspectRatio">false</basic-key>
+              <basic-key name="draw-shape">false</basic-key>
+            </style>
+            <template references="rectangle"/>
+          </element>
+
+          <!-- group header -->
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">12.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">0.0</basic-object>
+              </compound-key>
+            </style>
+            <template references="string-field">
+              <basic-object name="nullValue">-</basic-object>
+              <basic-object name="field">object-class</basic-object>
+            </template>
+          </element>
+        </group-header>
+      </group>
+    </groups>
+
+    <itemband>
+      <style>
+        <compound-key name="min-size">
+          <basic-object name="height">12.0</basic-object>
+          <basic-object name="width">0.0</basic-object>
+        </compound-key>
+        <basic-key name="font-bold">true</basic-key>
+        <basic-key name="font-size">10</basic-key>
+        <basic-key name="font">SansSerif</basic-key>
+        <basic-key name="font-underline">false</basic-key>
+        <basic-key name="font-italic">false</basic-key>
+      </style>
+
+      <element type="text/plain" name="object-class">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">160.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">parameter-name</basic-object>
+        </template>
+      </element>
+
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">170.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">parameter-class</basic-object>
+        </template>
+      </element>
+
+    </itemband>
+
+  </report-description>
+</report-definition>
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/misc/referencedoc/StyleKeyReferenceReport.xml b/source/org/jfree/report/modules/misc/referencedoc/StyleKeyReferenceReport.xml
new file mode 100644
index 0000000..af777b1
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/referencedoc/StyleKeyReferenceReport.xml
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE report-definition
+  PUBLIC "-//JFreeReport//DTD report definition//EN//extended/version 0.8.5"
+         "http://jfreereport.sourceforge.net/extreport-085.dtd">
+<report-definition name="StyleKey Reference Report">
+  <parser-config>
+    <object-factory class="org.jfree.report.modules.parser.ext.factory.objects.DefaultClassFactory"/>
+    <element-factory class="org.jfree.report.modules.parser.ext.factory.elements.DefaultElementFactory"/>
+    <stylekey-factory class="org.jfree.report.modules.parser.ext.factory.stylekey.DefaultStyleKeyFactory"/>
+    <stylekey-factory class="org.jfree.report.modules.parser.ext.factory.stylekey.PageableLayoutStyleKeyFactory"/>
+    <template-factory class="org.jfree.report.modules.parser.ext.factory.templates.DefaultTemplateCollection"/>
+    <datasource-factory class="org.jfree.report.modules.parser.ext.factory.datasource.DefaultDataSourceFactory"/>
+  </parser-config>
+
+  <report-config>
+    <page-definition>
+      <page orientation="portrait" pageformat="A4" topmargin="24" bottommargin="24" leftmargin="24" rightmargin="24"/>
+    </page-definition>
+    <configuration>
+      <property name="org.jfree.report.modules.output.pageable.pdf.PDFOutputTarget.default.Author">JFreeReport - http://jfreereport.pentaho.org</property>
+      <property name="org.jfree.report.modules.output.pageable.pdf.PDFOutputTarget.default.Encoding">iso-8859-15</property>
+    </configuration>
+  </report-config>
+
+  <report-description>
+    <report-header>
+
+      <!-- The report header style -->
+      <style>
+        <compound-key name="min-size">
+          <basic-object name="height">18.0</basic-object>
+          <basic-object name="width">0.0</basic-object>
+        </compound-key>
+        <basic-key name="font-bold">true</basic-key>
+        <basic-key name="font-size">14</basic-key>
+        <basic-key name="font">SansSerif</basic-key>
+        <basic-key name="font-underline">false</basic-key>
+        <basic-key name="font-italic">false</basic-key>
+      </style>
+
+      <!-- The background element, draws the grey background box -->
+      <element name="background" type="shape/generic">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">-100.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <basic-key name="stroke" class="java.awt.BasicStroke">0.0</basic-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+          <basic-key name="paint">#DCDB64</basic-key>
+          <basic-key name="fill-shape">true</basic-key>
+          <basic-key name="scale">true</basic-key>
+          <basic-key name="keepAspectRatio">false</basic-key>
+          <basic-key name="draw-shape">false</basic-key>
+        </style>
+        <template references="rectangle"/>
+      </element>
+
+      <!-- A text element, contains the report header -->
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">-100.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+          <basic-key name="valignment">middle</basic-key>
+        </style>
+        <template references="label">
+          <basic-object name="content">Extended Parser: StyleKey Factory Reference</basic-object>
+        </template>
+      </element>
+
+    </report-header>
+
+    <groups>
+      <group name="object-factory">
+        <fields>
+          <field>stylekey-factory</field>
+        </fields>
+        <group-header>
+          <style>
+            <compound-key name="min-size">
+              <basic-object name="height">18.0</basic-object>
+              <basic-object name="width">0.0</basic-object>
+            </compound-key>
+            <basic-key name="font-bold">true</basic-key>
+            <basic-key name="font-size">14</basic-key>
+            <basic-key name="font">SansSerif</basic-key>
+            <basic-key name="font-underline">false</basic-key>
+            <basic-key name="font-italic">false</basic-key>
+            <basic-key name="valignment">middle</basic-key>
+          </style>
+
+          <element type="shape/generic">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">-100.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <basic-key name="stroke" class="java.awt.BasicStroke">1.0</basic-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">0.0</basic-object>
+              </compound-key>
+              <basic-key name="paint">#EAEAAB</basic-key>
+              <basic-key name="fill-shape">true</basic-key>
+              <basic-key name="scale">true</basic-key>
+              <basic-key name="keepAspectRatio">false</basic-key>
+              <basic-key name="draw-shape">false</basic-key>
+            </style>
+            <template references="rectangle"/>
+          </element>
+
+          <!-- group header -->
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">14</basic-object>
+                <basic-object name="width">120.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">2.0</basic-object>
+              </compound-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">StyleKey Factory</basic-object>
+            </template>
+          </element>
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">12.0</basic-object>
+                <basic-object name="width">-100.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">18.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">10</basic-key>
+              <basic-key name="font">Monospaced</basic-key>
+            </style>
+            <template references="string-field">
+              <basic-object name="nullValue">-</basic-object>
+              <basic-object name="field">stylekey-factory</basic-object>
+            </template>
+          </element>
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">14.0</basic-object>
+                <basic-object name="width">-25.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">0.0</basic-object>
+                <basic-object name="y">32.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">12</basic-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">Name</basic-object>
+            </template>
+          </element>
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">14.0</basic-object>
+                <basic-object name="width">-50.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">-25.0</basic-object>
+                <basic-object name="y">32.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">12</basic-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">Type</basic-object>
+            </template>
+          </element>
+
+          <element type="text/plain">
+            <style>
+              <compound-key name="min-size">
+                <basic-object name="height">14.0</basic-object>
+                <basic-object name="width">-25.0</basic-object>
+              </compound-key>
+              <compound-key name="absolute_pos">
+                <basic-object name="x">-75.0</basic-object>
+                <basic-object name="y">32.0</basic-object>
+              </compound-key>
+              <basic-key name="font-size">12</basic-key>
+            </style>
+            <template references="label">
+              <basic-object name="content">Inherited/Transient</basic-object>
+            </template>
+          </element>
+
+        </group-header>
+      </group>
+    </groups>
+
+    <itemband>
+      <style>
+        <compound-key name="min-size">
+          <basic-object name="height">12.0</basic-object>
+          <basic-object name="width">0.0</basic-object>
+        </compound-key>
+        <basic-key name="font-bold">true</basic-key>
+        <basic-key name="font-size">10</basic-key>
+        <basic-key name="font">Monospaced</basic-key>
+        <basic-key name="font-underline">false</basic-key>
+        <basic-key name="font-italic">false</basic-key>
+        <basic-key name="valignment">middle</basic-key>
+      </style>
+
+      <element type="text/plain" name="object-class">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">-25</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">key-name</basic-object>
+        </template>
+      </element>
+
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">-50.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">-25.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">key-class</basic-object>
+        </template>
+      </element>
+
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">-10.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">-80.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">inherit</basic-object>
+        </template>
+      </element>
+
+      <element type="text/plain">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">12.0</basic-object>
+            <basic-object name="width">-10.0</basic-object>
+          </compound-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">-90.0</basic-object>
+            <basic-object name="y">0.0</basic-object>
+          </compound-key>
+        </style>
+        <template references="string-field">
+          <basic-object name="nullValue">-</basic-object>
+          <basic-object name="field">transient</basic-object>
+        </template>
+      </element>
+
+      <element type="shape/generic">
+        <style>
+          <compound-key name="min-size">
+            <basic-object name="height">0.0</basic-object>
+            <basic-object name="width">-100.0</basic-object>
+          </compound-key>
+          <basic-key name="stroke" class="java.awt.BasicStroke">0.1</basic-key>
+          <compound-key name="absolute_pos">
+            <basic-object name="x">0.0</basic-object>
+            <basic-object name="y">-100.0</basic-object>
+          </compound-key>
+          <basic-key name="paint">#EEEEC0</basic-key>
+          <basic-key name="fill-shape">false</basic-key>
+          <basic-key name="scale">true</basic-key>
+          <basic-key name="keepAspectRatio">false</basic-key>
+          <basic-key name="draw-shape">true</basic-key>
+        </style>
+        <template references="horizontal-line"/>
+      </element>
+
+    </itemband>
+
+  </report-description>
+</report-definition>
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/misc/survey/SurveyModule.java b/source/org/jfree/report/modules/misc/survey/SurveyModule.java
new file mode 100644
index 0000000..a59774b
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/survey/SurveyModule.java
@@ -0,0 +1,59 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SurveyModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.survey;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+public class SurveyModule extends AbstractModule
+{
+  public SurveyModule ()
+          throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup operations. This
+   * method is called only once in a modules lifetime. If the initializing cannot be
+   * completed, throw a ModuleInitializeException to indicate the error,. The module will
+   * not be available to the system.
+   *
+   * @throws ModuleInitializeException if an error ocurred while initializing the module.
+   */
+  public void initialize (SubSystem subSystem)
+          throws ModuleInitializeException
+  {
+
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/survey/SurveyScale.java b/source/org/jfree/report/modules/misc/survey/SurveyScale.java
new file mode 100644
index 0000000..e88784c
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/survey/SurveyScale.java
@@ -0,0 +1,959 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SurveyScale.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.survey;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.awt.Shape;
+import java.awt.Stroke;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Line2D;
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+import org.pentaho.reporting.libraries.serializer.SerializerHelper;
+
+/**
+ * Draws a survey scale.  By implementing the Drawable interface, instances can be displayed within a report using the
+ * DrawableElement class.
+ *
+ * @author David Gilbert
+ */
+public class SurveyScale implements Serializable
+{
+  private static final Number[] EMPTY_VALUES = new Number[0];
+
+  /**
+   * The lowest response value on the scale.
+   */
+  private int lowest;
+
+  /**
+   * The highest response value on the scale.
+   */
+  private int highest;
+
+  /**
+   * The lower margin.
+   */
+  private double lowerMargin = 0.10;
+
+  /**
+   * The upper margin.
+   */
+  private double upperMargin = 0.10;
+
+  /**
+   * A list of flags that control whether or not the shapes are filled.
+   */
+  private ArrayList fillShapes;
+
+  /**
+   * The values to display.
+   */
+  private Number[] values;
+
+  /**
+   * The lower bound of the highlighted range.
+   */
+  private Number rangeLowerBound;
+
+  /**
+   * The upper bound of the highlighted range.
+   */
+  private Number rangeUpperBound;
+
+  /**
+   * Draw a border?
+   */
+  private boolean drawBorder;
+
+  /**
+   * Draw the tick marks?
+   */
+  private boolean drawTickMarks;
+
+  /**
+   * Draw the scale values.
+   */
+  private boolean drawScaleValues;
+
+  /**
+   * The font used to display the scale values.
+   */
+  private Font scaleValueFont;
+
+  /**
+   * The paint used to draw the scale values.
+   */
+  private transient Paint scaleValuePaint;
+
+  /**
+   * The range paint.
+   */
+  private transient Paint rangePaint;
+
+  /**
+   * The shapes to display.
+   */
+  private transient ArrayList shapes;
+
+  /**
+   * The fill paint.
+   */
+  private transient Paint fillPaint;
+
+  /**
+   * The outline stroke for the shapes.
+   */
+  private transient Stroke outlineStroke;
+
+  /**
+   * The default shape, if no shape is defined in the shapeList for the given value.
+   */
+  private transient Shape defaultShape;
+
+  /**
+   * The tick mark paint.
+   */
+  private transient Paint tickMarkPaint;
+
+  private transient Paint borderPaint;
+
+  private int range;
+  private double lowerBound;
+  private double upperBound;
+  private boolean useFontMetricsGetStringBounds;
+  private boolean autoConfigure;
+
+  /**
+   * Creates a new default instance.
+   */
+  public SurveyScale()
+  {
+    this(1, 5, SurveyScale.EMPTY_VALUES);
+  }
+
+  /**
+   * Creates a new instance.
+   *
+   * @param lowest  the lowest response value on the scale.
+   * @param highest the highest response value on the scale.
+   * @param values  the values to display.
+   */
+  public SurveyScale(final int lowest, final int highest,
+                     final Number[] values)
+  {
+    final String configFontMetricsStringBounds = JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+        ("org.jfree.report.modules.misc.survey.UseFontMetricsGetStringBounds", "auto");
+    if ("auto".equals(configFontMetricsStringBounds))
+    {
+      useFontMetricsGetStringBounds = (ObjectUtilities.isJDK14() == true);
+    }
+    else
+    {
+      useFontMetricsGetStringBounds = "true".equals(configFontMetricsStringBounds);
+    }
+
+    this.lowest = lowest;
+    this.highest = highest;
+    if (values == null)
+    {
+      this.values = SurveyScale.EMPTY_VALUES;
+    }
+    else
+    {
+      this.values = (Number[]) values.clone();
+    }
+
+    this.drawTickMarks = true;
+    this.tickMarkPaint = Color.gray;
+
+    this.scaleValuePaint = Color.black;
+    this.defaultShape = new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0);
+
+    this.rangeLowerBound = null;
+    this.rangeUpperBound = null;
+    this.rangePaint = Color.lightGray;
+
+    this.shapes = createShapeList();
+    this.fillShapes = new ArrayList();
+    this.fillShapes.add(0, Boolean.TRUE);
+    this.fillPaint = Color.black;
+    this.outlineStroke = new BasicStroke(0.5f);
+    recompute();
+  }
+
+  public boolean isAutoConfigure()
+  {
+    return autoConfigure;
+  }
+
+  public void setAutoConfigure(final boolean autoConfigure)
+  {
+    this.autoConfigure = autoConfigure;
+    recompute();
+  }
+
+  public int getLowest()
+  {
+    return lowest;
+  }
+
+  public void setLowest(final int lowest)
+  {
+    this.lowest = lowest;
+    recompute();
+  }
+
+  public int getHighest()
+  {
+    return highest;
+  }
+
+  public void setHighest(final int highest)
+  {
+    this.highest = highest;
+    recompute();
+  }
+
+  /**
+   * This method is called whenever lowest or highest has changed. It will recompute the range and upper and lower
+   * bounds.
+   */
+  protected void recompute()
+  {
+    this.range = Math.max(0, this.highest - this.lowest);
+    this.lowerBound = this.lowest - (range * this.lowerMargin);
+    this.upperBound = this.highest + (range * this.upperMargin);
+  }
+
+  protected int getRange()
+  {
+    return range;
+  }
+
+  protected void setRange(final int range)
+  {
+    this.range = range;
+  }
+
+  protected double getLowerBound()
+  {
+    return lowerBound;
+  }
+
+  protected void setLowerBound(final double lowerBound)
+  {
+    this.lowerBound = lowerBound;
+  }
+
+  protected double getUpperBound()
+  {
+    return upperBound;
+  }
+
+  protected void setUpperBound(final double upperBound)
+  {
+    this.upperBound = upperBound;
+  }
+
+  /**
+   * Creates the shape list used when drawing the scale. The list returned must contain exactly 6 elements.
+   *
+   * @return
+   */
+  protected ArrayList createShapeList()
+  {
+    final ArrayList shapes = new ArrayList();
+    //this.shapes.setShape(0, createDiagonalCross(3.0f, 0.5f));
+    shapes.add(new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));
+    shapes.add(SurveyScale.createDownTriangle(4.0f));
+    shapes.add(SurveyScale.createUpTriangle(4.0f));
+    shapes.add(SurveyScale.createDiamond(4.0f));
+    shapes.add(new Rectangle2D.Double(-4.0, -4.0, 8.0, 8.0));
+    shapes.add(new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));
+    //this.shapes.setShape(5, createDiagonalCross(3.0f, 0.5f));
+    return shapes;
+  }
+
+
+  /**
+   * Creates a diamond shape.
+   *
+   * @param s the size factor (equal to half the height of the diamond).
+   * @return A diamond shape.
+   */
+  public static Shape createDiamond(final float s)
+  {
+    final GeneralPath p0 = new GeneralPath();
+    p0.moveTo(0.0f, -s);
+    p0.lineTo(s, 0.0f);
+    p0.lineTo(0.0f, s);
+    p0.lineTo(-s, 0.0f);
+    p0.closePath();
+    return p0;
+  }
+
+  /**
+   * Creates a triangle shape that points upwards.
+   *
+   * @param s the size factor (equal to half the height of the triangle).
+   * @return A triangle shape.
+   */
+  public static Shape createUpTriangle(final float s)
+  {
+    final GeneralPath p0 = new GeneralPath();
+    p0.moveTo(0.0f, -s);
+    p0.lineTo(s, s);
+    p0.lineTo(-s, s);
+    p0.closePath();
+    return p0;
+  }
+
+  /**
+   * Creates a triangle shape that points downwards.
+   *
+   * @param s the size factor (equal to half the height of the triangle).
+   * @return A triangle shape.
+   */
+  public static Shape createDownTriangle(final float s)
+  {
+    final GeneralPath p0 = new GeneralPath();
+    p0.moveTo(0.0f, s);
+    p0.lineTo(s, -s);
+    p0.lineTo(-s, -s);
+    p0.closePath();
+    return p0;
+  }
+
+
+  /**
+   * Returns the lower bound of the highlighted range.  A <code>null</code> value indicates that no range is set for
+   * highlighting.
+   *
+   * @return The lower bound (possibly <code>null</code>).
+   */
+  public Number getRangeLowerBound()
+  {
+    return this.rangeLowerBound;
+  }
+
+  /**
+   * Sets the lower bound for the range that is highlighted on the scale.
+   *
+   * @param bound the lower bound (<code>null</code> permitted).
+   */
+  public void setRangeLowerBound(final Number bound)
+  {
+    this.rangeLowerBound = bound;
+  }
+
+  /**
+   * Returns the upper bound of the highlighted range.  A <code>null</code> value indicates that no range is set for
+   * highlighting.
+   *
+   * @return The upper bound (possibly <code>null</code>).
+   */
+  public Number getRangeUpperBound()
+  {
+    return this.rangeUpperBound;
+  }
+
+  /**
+   * Sets the upper bound for the range that is highlighted on the scale.
+   *
+   * @param bound the upper bound (<code>null</code> permitted).
+   */
+  public void setRangeUpperBound(final Number bound)
+  {
+    this.rangeUpperBound = bound;
+  }
+
+  /**
+   * Returns a flag that controls whether or not a border is drawn around the scale.
+   *
+   * @return A boolean.
+   */
+  public boolean isDrawBorder()
+  {
+    return this.drawBorder;
+  }
+
+  /**
+   * Sets a flag that controls whether or not a border is drawn around the scale.
+   *
+   * @param flag the flag.
+   */
+  public void setDrawBorder(final boolean flag)
+  {
+    this.drawBorder = flag;
+  }
+
+  /**
+   * Returns the flag that controls whether the tick marks are drawn.
+   *
+   * @return A boolean.
+   */
+  public boolean isDrawTickMarks()
+  {
+    return this.drawTickMarks;
+  }
+
+  /**
+   * Sets the flag that controls whether the tick marks are drawn.
+   *
+   * @param flag a boolean.
+   */
+  public void setDrawTickMarks(final boolean flag)
+  {
+    this.drawTickMarks = flag;
+  }
+
+  /**
+   * Returns a flag that controls whether or not scale values are drawn.
+   *
+   * @return a boolean.
+   */
+  public boolean isDrawScaleValues()
+  {
+    return this.drawScaleValues;
+  }
+
+  /**
+   * Sets a flag that controls whether or not scale values are drawn.
+   *
+   * @param flag the flag.
+   */
+  public void setDrawScaleValues(final boolean flag)
+  {
+    this.drawScaleValues = flag;
+  }
+
+  /**
+   * Returns the font used to display the scale values.
+   *
+   * @return A font (never <code>null</code>).
+   */
+  public Font getScaleValueFont()
+  {
+    return this.scaleValueFont;
+  }
+
+  /**
+   * Sets the font used to display the scale values.
+   *
+   * @param font the font (<code>null</code> not permitted).
+   */
+  public void setScaleValueFont(final Font font)
+  {
+    this.scaleValueFont = font;
+  }
+
+  /**
+   * Returns the color used to draw the scale values (if they are visible).
+   *
+   * @return A paint (never <code>null</code>).
+   */
+  public Paint getScaleValuePaint()
+  {
+    return this.scaleValuePaint;
+  }
+
+  /**
+   * Sets the color used to draw the scale values.
+   *
+   * @param paint the paint (<code>null</code> not permitted).
+   */
+  public void setScaleValuePaint(final Paint paint)
+  {
+    if (paint == null)
+    {
+      throw new IllegalArgumentException("Null 'paint' argument."); //$NON-NLS-1$
+    }
+    this.scaleValuePaint = paint;
+  }
+
+  /**
+   * Returns the shape used to indicate the value of a response.
+   *
+   * @param index the value index (zero-based).
+   * @return The shape.
+   */
+  public Shape getShape(final int index)
+  {
+    if (index < 0)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+    if (index < shapes.size())
+    {
+      return (Shape) this.shapes.get(index);
+    }
+    return null;
+  }
+
+  /**
+   * Sets the shape used to mark a particular value in the dataset.
+   *
+   * @param index the value index (zero-based).
+   * @param shape the shape (<code>null</code> not permitted).
+   */
+  public void setShape(final int index, final Shape shape)
+  {
+    if (index < 0)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+    if (shapes.size() > index)
+    {
+      this.shapes.set(index, shape);
+    }
+    else
+    {
+      while (shapes.size() < index)
+      {
+        shapes.ensureCapacity(index);
+        shapes.add(null);
+        shapes.add(shape);
+      }
+    }
+  }
+
+  /**
+   * Returns a flag that controls whether the shape for a particular value should be filled.
+   *
+   * @param index the value index (zero-based).
+   * @return A boolean.
+   */
+  public boolean isShapeFilled(final int index)
+  {
+    if (index < 0)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+    if (index < fillShapes.size())
+    {
+      final Boolean b = (Boolean) this.fillShapes.get(index);
+      if (b != null)
+      {
+        return b.booleanValue();
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Sets the flag that controls whether the shape for a particular value should be filled.
+   *
+   * @param index the value index (zero-based).
+   * @param fill  the flag.
+   */
+  public void setShapeFilled(final int index, final boolean fill)
+  {
+    //noinspection ConditionalExpression
+    this.fillShapes.set(index, fill ? Boolean.TRUE : Boolean.FALSE);
+  }
+
+  /**
+   * Returns the paint used to highlight the range.
+   *
+   * @return A {@link Paint} object (never <code>null</code>).
+   */
+  public Paint getRangePaint()
+  {
+    return this.rangePaint;
+  }
+
+  /**
+   * Sets the paint used to highlight the range (if one is specified).
+   *
+   * @param paint the paint (<code>null</code> not permitted).
+   */
+  public void setRangePaint(final Paint paint)
+  {
+    if (paint == null)
+    {
+      throw new IllegalArgumentException("Null 'paint' argument."); //$NON-NLS-1$
+    }
+    this.rangePaint = paint;
+  }
+
+  public Paint getBorderPaint()
+  {
+    return borderPaint;
+  }
+
+  public void setBorderPaint(final Paint borderPaint)
+  {
+    if (borderPaint == null)
+    {
+      throw new IllegalArgumentException("Null 'paint' argument."); //$NON-NLS-1$
+    }
+    this.borderPaint = borderPaint;
+  }
+
+  /**
+   * Returns the default shape, which is used, if a shape for a certain value is not defined.
+   *
+   * @return the default shape, never null.
+   */
+  public Shape getDefaultShape()
+  {
+    return defaultShape;
+  }
+
+  /**
+   * Redefines the default shape.
+   *
+   * @param defaultShape the default shape
+   * @throws NullPointerException if the given shape is null.
+   */
+  public void setDefaultShape(final Shape defaultShape)
+  {
+    if (defaultShape == null)
+    {
+      throw new NullPointerException("The default shape must not be null."); //$NON-NLS-1$
+    }
+    this.defaultShape = defaultShape;
+  }
+
+  public Paint getTickMarkPaint()
+  {
+    return tickMarkPaint;
+  }
+
+  public void setTickMarkPaint(final Paint tickMarkPaint)
+  {
+    if (tickMarkPaint == null)
+    {
+      throw new NullPointerException();
+    }
+    this.tickMarkPaint = tickMarkPaint;
+  }
+
+  public Number[] getValues()
+  {
+    return (Number[]) values.clone();
+  }
+
+  public Paint getFillPaint()
+  {
+    return fillPaint;
+  }
+
+  public void setFillPaint(final Paint fillPaint)
+  {
+    if (fillPaint == null)
+    {
+      throw new NullPointerException();
+    }
+    this.fillPaint = fillPaint;
+  }
+
+  public Stroke getOutlineStroke()
+  {
+    return outlineStroke;
+  }
+
+  public void setOutlineStroke(final Stroke outlineStroke)
+  {
+    if (outlineStroke == null)
+    {
+      throw new NullPointerException();
+    }
+    this.outlineStroke = outlineStroke;
+  }
+
+  public double getUpperMargin()
+  {
+    return upperMargin;
+  }
+
+  public void setUpperMargin(final double upperMargin)
+  {
+    this.upperMargin = upperMargin;
+  }
+
+  public double getLowerMargin()
+  {
+    return lowerMargin;
+  }
+
+  public void setLowerMargin(final double lowerMargin)
+  {
+    this.lowerMargin = lowerMargin;
+  }
+
+  /**
+   * Draws the survey scale.
+   *
+   * @param g2   the graphics device.
+   * @param area the area.
+   */
+  public void draw(final Graphics2D g2, final Rectangle2D area)
+  {
+
+    if (isDrawBorder())
+    {
+      drawBorder(g2, area);
+    }
+
+    drawRangeArea(area, g2);
+
+    // draw tick marks...
+    if (isDrawTickMarks())
+    {
+      drawTickMarks(g2, area);
+    }
+
+    // draw scale values...
+    if (isDrawScaleValues())
+    {
+      drawScaleValues(g2, area);
+    }
+
+    drawValues(g2, area);
+  }
+
+  protected void drawValues(final Graphics2D g2,
+                            final Rectangle2D area)
+  {
+
+    // draw data values...
+    final Number[] values = getValues();
+    if (values.length == 0)
+    {
+      return;
+    }
+
+    final double y = area.getCenterY();
+
+    final Stroke outlineStroke = getOutlineStroke();
+    final Shape defaultShape = getDefaultShape();
+
+    g2.setPaint(getFillPaint());
+    for (int i = 0; i < values.length; i++)
+    {
+      final Number n = values[i];
+      if (n == null)
+      {
+        continue;
+      }
+
+      final double v = n.doubleValue();
+      final double x = valueToJava2D(v, area);
+      Shape valueShape = getShape(i);
+      if (valueShape == null)
+      {
+        valueShape = defaultShape;
+      }
+      if (isShapeFilled(i))
+      {
+        g2.translate(x, y);
+        g2.fill(valueShape);
+        g2.translate(-x, -y);
+      }
+      else
+      {
+        g2.setStroke(outlineStroke);
+        g2.translate(x, y);
+        g2.draw(valueShape);
+        g2.translate(-x, -y);
+      }
+    }
+  }
+
+  protected void drawScaleValues(final Graphics2D g2, final Rectangle2D area)
+  {
+    g2.setPaint(getScaleValuePaint());
+    final Font valueFont = getScaleValueFont();
+    if (valueFont != null)
+    {
+      g2.setFont(valueFont);
+    }
+
+    final Font f = g2.getFont();
+    final FontMetrics fm = g2.getFontMetrics(f);
+    final FontRenderContext frc = g2.getFontRenderContext();
+    final double y = area.getCenterY();
+
+    final int highest = getHighest();
+    for (int i = getLowest(); i <= highest; i++)
+    {
+      final double x = valueToJava2D(i, area);
+      final String text = String.valueOf(i);
+
+      final float width;
+      if (useFontMetricsGetStringBounds)
+      {
+        final Rectangle2D bounds = fm.getStringBounds(text, g2);
+        // getStringBounds() can return incorrect height for some Unicode
+        // characters...see bug parade 6183356, let's replace it with
+        // something correct
+        width = (float) bounds.getWidth();
+      }
+      else
+      {
+        width = fm.stringWidth(text);
+      }
+
+
+      final LineMetrics metrics = f.getLineMetrics(text, frc);
+      final float descent = metrics.getDescent();
+      final float leading = metrics.getLeading();
+      final float yAdj = -descent - leading + (float) (metrics.getHeight() / 2.0);
+      final float xAdj = -width / 2.0f;
+      g2.drawString(text, (float) (x + xAdj), (float) (y + yAdj));
+    }
+  }
+
+  protected void drawTickMarks(final Graphics2D g2, final Rectangle2D area)
+  {
+    g2.setPaint(getTickMarkPaint());
+    g2.setStroke(new BasicStroke(0.1f));
+
+    final int highest = getHighest();
+    for (int i = getLowest(); i <= highest; i++)
+    {
+      for (int j = 0; j < 10; j++)
+      {
+        final double xx = valueToJava2D(i + j / 10.0, area);
+        final Line2D mark = new Line2D.Double(xx, area.getCenterY() - 2.0, xx,
+            area.getCenterY() + 2.0);
+        g2.draw(mark);
+      }
+    }
+    final double xx = valueToJava2D(highest, area);
+    final Line2D mark = new Line2D.Double(xx, area.getCenterY() - 2.0, xx,
+        area.getCenterY() + 2.0);
+    g2.draw(mark);
+  }
+
+  protected void drawRangeArea(final Rectangle2D area, final Graphics2D g2)
+  {
+    final Number rangeUpperBound = getRangeUpperBound();
+    final Number rangeLowerBound = getRangeLowerBound();
+    if (rangeLowerBound == null || rangeUpperBound == null)
+    {
+      return;
+    }
+    final double x0 = valueToJava2D(rangeLowerBound.doubleValue(), area);
+    final double x1 = valueToJava2D(rangeUpperBound.doubleValue(), area);
+    final Rectangle2D rangeArea = new Rectangle2D.Double(x0, area.getY(),
+        (x1 - x0), area.getHeight());
+    g2.setPaint(getRangePaint());
+    g2.fill(rangeArea);
+  }
+
+  protected void drawBorder(final Graphics2D g2, final Rectangle2D area)
+  {
+    g2.setStroke(getOutlineStroke());
+    g2.setPaint(getBorderPaint());
+    g2.draw(area);
+  }
+
+  /**
+   * Translates a data value to Java2D coordinates.
+   *
+   * @param value the value.
+   * @param area  the area.
+   * @return The Java2D coordinate.
+   */
+  private double valueToJava2D(final double value,
+                               final Rectangle2D area)
+  {
+
+    final double upperBound = getUpperBound();
+    final double lowerBound = getLowerBound();
+    return area.getMinX() + ((value - lowerBound) /
+        (upperBound - lowerBound) * area.getWidth());
+
+  }
+
+  private void writeObject(final ObjectOutputStream out)
+      throws IOException
+  {
+    out.defaultWriteObject();
+    final SerializerHelper helper = SerializerHelper.getInstance();
+    helper.writeObject(scaleValuePaint, out);
+    helper.writeObject(rangePaint, out);
+    helper.writeObject(fillPaint, out);
+    helper.writeObject(outlineStroke, out);
+    helper.writeObject(defaultShape, out);
+    helper.writeObject(tickMarkPaint, out);
+    helper.writeObject(borderPaint, out);
+    final int size = shapes.size();
+    out.writeInt(size);
+    for (int i = 0; i < size; i++)
+    {
+      final Shape s = (Shape) shapes.get(i);
+      helper.writeObject(s, out);
+    }
+  }
+
+  private void readObject(final ObjectInputStream in)
+      throws IOException, ClassNotFoundException
+  {
+    in.defaultReadObject();
+    final SerializerHelper helper = SerializerHelper.getInstance();
+    scaleValuePaint = (Paint) helper.readObject(in);
+    rangePaint = (Paint) helper.readObject(in);
+    fillPaint = (Paint) helper.readObject(in);
+    outlineStroke = (Stroke) helper.readObject(in);
+    defaultShape = (Shape) helper.readObject(in);
+    tickMarkPaint = (Paint) helper.readObject(in);
+    borderPaint = (Paint) helper.readObject(in);
+    shapes = new ArrayList();
+
+    final int size = in.readInt();
+    for (int i = 0; i < size; i++)
+    {
+      final Shape s = (Shape) helper.readObject(in);
+      shapes.add(s);
+    }
+
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/survey/SurveyScaleExpression.java b/source/org/jfree/report/modules/misc/survey/SurveyScaleExpression.java
new file mode 100644
index 0000000..93fb776
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/survey/SurveyScaleExpression.java
@@ -0,0 +1,200 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SurveyScaleExpression.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.survey;
+
+import java.awt.Paint;
+import java.awt.Shape;
+import java.io.Serializable;
+
+import org.jfree.report.DataSourceException;
+import org.jfree.report.expressions.ColumnAggregationExpression;
+
+/**
+ * An expression that takes values from one or more fields in the current row of the
+ * report, builds a {@link SurveyScale} instance that will present those values, and
+ * returns that instance as the expression result.  The fields used by the expression are
+ * defined using properties named '0', '1', ... 'N', which need to be specified after the
+ * expression is created. These fields should contain {@link Number} instances.The {@link
+ * SurveyScale} class implements the Drawable interface, so it can be displayed
+ * using a DrawableElement.
+ */
+public class SurveyScaleExpression extends
+        ColumnAggregationExpression implements Serializable
+{
+  /**
+   * The name of the field containing the lower bound of the highlighted range.
+   */
+  private Number rangeLowerBound;
+
+  /**
+   * The name of the field containing the upper bound of the highlighted range.
+   */
+  private Number rangeUpperBound;
+
+  /**
+   * The range paint.
+   */
+  private Paint rangePaint;
+
+  /**
+   * An optional shape that is used (if present) for the first data value.
+   */
+  private Shape overrideShape;
+
+  /**
+   * A flag that controls whether or not the override shape is filled or not filled.
+   */
+  private boolean overrideShapeFilled;
+
+  private int lowestValue;
+  private int highestValue;
+
+  public SurveyScaleExpression ()
+  {
+  }
+
+  protected int getFieldListParameterPosition()
+  {
+    return 2;
+  }
+
+  public Number getRangeLowerBound()
+  {
+    return rangeLowerBound;
+  }
+
+  public void setRangeLowerBound(final Number rangeLowerBound)
+  {
+    this.rangeLowerBound = rangeLowerBound;
+  }
+
+  public Number getRangeUpperBound()
+  {
+    return rangeUpperBound;
+  }
+
+  public void setRangeUpperBound(final Number rangeUpperBound)
+  {
+    this.rangeUpperBound = rangeUpperBound;
+  }
+
+  public int getLowestValue()
+  {
+    return lowestValue;
+  }
+
+  public void setLowestValue(final int lowestValue)
+  {
+    this.lowestValue = lowestValue;
+  }
+
+  public int getHighestValue()
+  {
+    return highestValue;
+  }
+
+  public void setHighestValue(final int highestValue)
+  {
+    this.highestValue = highestValue;
+  }
+
+  /**
+   * Returns the override shape.
+   *
+   * @return The override shape (possibly <code>null</code>).
+   */
+  public Shape getOverrideShape ()
+  {
+    return this.overrideShape;
+  }
+
+  /**
+   * Sets the override shape.  The {@link SurveyScale} is created with a set of default
+   * shapes, this method allows you to clearFromParent the *first* shape if you need to (leave it
+   * as <code>null</code> otherwise).
+   *
+   * @param shape the shape (<code>null</code> permitted).
+   */
+  public void setOverrideShape (final Shape shape)
+  {
+    this.overrideShape = shape;
+  }
+
+  /**
+   * Sets a flag that controls whether the override shape is filled or not.
+   *
+   * @param b the flag.
+   */
+  public void setOverrideShapeFilled (final boolean b)
+  {
+    this.overrideShapeFilled = b;
+  }
+
+  /**
+   * Returns a {@link SurveyScale} instance that is set up to display the values in the
+   * current row.
+   *
+   * @return a {@link SurveyScale} instance.
+   */
+  public Object computeValue () throws DataSourceException
+  {
+    final Number[] fieldValues = (Number[]) getFieldValues(Number.class);
+    final SurveyScale result = new SurveyScale
+            (this.lowestValue, this.highestValue, fieldValues);
+
+    result.setRangeLowerBound(getRangeLowerBound());
+    result.setRangeUpperBound(getRangeUpperBound());
+    result.setRangePaint(this.rangePaint);
+
+    if (this.overrideShape != null)
+    {
+      result.setShape(0, this.overrideShape);
+      result.setShapeFilled(0, this.overrideShapeFilled);
+    }
+    return result;
+  }
+
+  public boolean isOverrideShapeFilled ()
+  {
+    return overrideShapeFilled;
+  }
+
+  public Paint getRangePaint ()
+  {
+    return rangePaint;
+  }
+
+  public void setRangePaint (final Paint rangePaint)
+  {
+    this.rangePaint = rangePaint;
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/survey/SurveyScaleLegendItem.java b/source/org/jfree/report/modules/misc/survey/SurveyScaleLegendItem.java
new file mode 100644
index 0000000..98e64e3
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/survey/SurveyScaleLegendItem.java
@@ -0,0 +1,193 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SurveyScaleLegendItem.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.survey;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.Shape;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * A Drawable object that represents a legend item for a {@link SurveyScale}.
+ */
+public class SurveyScaleLegendItem
+{
+
+  /**
+   * The shape.
+   */
+  private Shape shape;
+
+  /**
+   * The label.
+   */
+  private String label;
+
+  /**
+   * Draw the shape?
+   */
+  private boolean draw;
+
+  /**
+   * Fill the shape?
+   */
+  private boolean fill;
+
+  /**
+   * The label font.
+   */
+  private Font font;
+
+  public SurveyScaleLegendItem ()
+  {
+    font = new Font("Serif", Font.ITALIC, 10); //$NON-NLS-1$
+  }
+
+  /**
+   * Creates a new legend item.
+   *
+   * @param shape the shape.
+   * @param label the label.
+   * @param draw  draw the shape?
+   * @param fill  fill the shape?
+   */
+  public SurveyScaleLegendItem (final Shape shape,
+                                final String label,
+                                final boolean draw,
+                                final boolean fill)
+  {
+    this.shape = shape;
+    this.label = label;
+    this.draw = draw;
+    this.fill = fill;
+  }
+
+  /**
+   * Draws the legend item.
+   *
+   * @param g2   the graphic device.
+   * @param area the area.
+   */
+  public void draw (final Graphics2D g2, final Rectangle2D area)
+  {
+    if (shape == null || font == null || label == null)
+    {
+      return;
+    }
+    if (draw == false && fill == false)
+    {
+      return;
+    }
+
+    final Rectangle2D b = this.shape.getBounds2D();
+    double x = area.getMinX() + b.getWidth() / 2.0 + 1.0;
+    final double y = area.getCenterY();
+    final Shape s = getShape();
+    g2.translate(x,y);
+    g2.setPaint(Color.black);
+    if (this.draw)
+    {
+      g2.setStroke(new BasicStroke(0.5f));
+      g2.draw(s);
+    }
+    if (this.fill)
+    {
+      g2.fill(s);
+    }
+    g2.translate(-x, -y);
+    x += b.getWidth() / 2.0 + 3.0;
+    g2.setFont(this.font);
+
+    final FontRenderContext frc = g2.getFontRenderContext();
+    final Font f = g2.getFont();
+//    final FontMetrics fm = g2.getFontMetrics(f);
+    final LineMetrics metrics = f.getLineMetrics(label, frc);
+    final float ascent = metrics.getAscent();
+    final float halfAscent = ascent / 2.0f;
+    g2.drawString(label, (float) x, (float) (y + halfAscent));
+  }
+
+  public boolean isDraw ()
+  {
+    return draw;
+  }
+
+  public void setDraw (final boolean draw)
+  {
+    this.draw = draw;
+  }
+
+  public boolean isFill ()
+  {
+    return fill;
+  }
+
+  public void setFill (final boolean fill)
+  {
+    this.fill = fill;
+  }
+
+  public Font getFont ()
+  {
+    return font;
+  }
+
+  public void setFont (final Font font)
+  {
+    this.font = font;
+  }
+
+  public String getLabel ()
+  {
+    return label;
+  }
+
+  public void setLabel (final String label)
+  {
+    this.label = label;
+  }
+
+  public Shape getShape ()
+  {
+    return shape;
+  }
+
+  public void setShape (final Shape shape)
+  {
+    this.shape = shape;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/misc/survey/module.properties b/source/org/jfree/report/modules/misc/survey/module.properties
new file mode 100644
index 0000000..9ac3646
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/survey/module.properties
@@ -0,0 +1,20 @@
+#
+# Reference documentation generatorBeanInfoBeanInfoBeanInfo for the extended xml parser.
+#
+
+module-info:
+  name: misc-survey
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Utility classes for creating survey reports.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+
+
diff --git a/source/org/jfree/report/modules/misc/tablemodel/CSVTableModel.java b/source/org/jfree/report/modules/misc/tablemodel/CSVTableModel.java
new file mode 100644
index 0000000..50b2fcc
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/CSVTableModel.java
@@ -0,0 +1,162 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CSVTableModel.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.tablemodel;
+
+import javax.swing.table.AbstractTableModel;
+
+/**
+ * <code>TableModel</code> used by the <code>CSVTableModelProducer</code> class. It has a
+ * feature which generates the column name if it is not know.
+ *
+ * @author Mimil
+ * @see this.getColumnName()
+ */
+public class CSVTableModel extends AbstractTableModel
+{
+
+  private String[] columnNames = null;
+  private int rowCount = 0;
+  private int maxColumnCount = 0;
+  private Object[][] data;
+
+  public CSVTableModel ()
+  {
+  }
+
+  public Object[][] getData ()
+  {
+    return data;
+  }
+
+  public void setData (final Object[][] data)
+  {
+    this.data = data;
+  }
+
+  public String[] getColumnNames ()
+  {
+    return columnNames;
+  }
+
+  public void setColumnNames (final String[] columnNames)
+  {
+    this.columnNames = columnNames;
+  }
+
+  /**
+   * Counts columns of this <code>TableModel</code>.
+   *
+   * @return the column count
+   */
+  public int getColumnCount ()
+  {
+    if (this.columnNames != null)
+    {
+      return columnNames.length;
+    }
+
+    return this.maxColumnCount;
+  }
+
+  /**
+   * Counts rows of this <code>TableModel</code>.
+   *
+   * @return the row count
+   */
+  public int getRowCount ()
+  {
+    return this.rowCount;
+  }
+
+  /**
+   * Gets the Object at specified row and column positions.
+   *
+   * @param rowIndex    row index
+   * @param columnIndex column index
+   * @return The requested Object
+   */
+  public Object getValueAt (final int rowIndex, final int columnIndex)
+  {
+    final Object[] line = this.data[rowIndex];
+
+    if (line.length < columnIndex)
+    {
+      return null;
+    }
+    else
+    {
+      return line[columnIndex];
+    }
+  }
+
+  /**
+   * Sets the maximum column count if it is bigger than the current one.
+   *
+   * @param maxColumnCount
+   */
+  public void setMaxColumnCount (final int maxColumnCount)
+  {
+    if (this.maxColumnCount < maxColumnCount)
+    {
+      this.maxColumnCount = maxColumnCount;
+    }
+  }
+
+  public int getMaxColumnCount()
+  {
+    return maxColumnCount;
+  }
+
+  /**
+   * Return the column name at a specified position.
+   *
+   * @param column column index
+   * @return the column name
+   */
+  public String getColumnName (final int column)
+  {
+    if (this.columnNames != null)
+    {
+      return this.columnNames[column];
+    }
+    else
+    {
+      if (column >= this.maxColumnCount)
+      {
+        throw new IllegalArgumentException("Column (" + column + ") does not exist");
+      }
+      else
+      {
+        return "COLUMN_" + column;
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/CSVTableModelProducer.java b/source/org/jfree/report/modules/misc/tablemodel/CSVTableModelProducer.java
new file mode 100644
index 0000000..7004d03
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/CSVTableModelProducer.java
@@ -0,0 +1,199 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CSVTableModelProducer.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.tablemodel;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import javax.swing.table.TableModel;
+
+import org.jfree.report.util.CSVTokenizer;
+
+/**
+ * Creates a <code>TableModel</code> using a file formated in CSV for input. The
+ * separation can be what ever you want (as it is an understandable regexp). The default
+ * separator is a <code>,</code>.
+ *
+ * @author Mimil
+ */
+public class CSVTableModelProducer
+{
+  private BufferedReader reader;
+  private String separator;
+  private CSVTableModel tableModel;
+  private boolean columnNameFirst;
+
+  public CSVTableModelProducer (final InputStream in)
+  {
+    this(new BufferedReader(new InputStreamReader(in)));
+  }
+
+  public CSVTableModelProducer (final String filename)
+          throws FileNotFoundException
+  {
+    this(new BufferedReader(new FileReader(filename)));
+  }
+
+  public CSVTableModelProducer (final BufferedReader r)
+  {
+    if (r == null)
+    {
+      throw new NullPointerException("The input stream must not be null");
+    }
+    this.reader = r;
+    this.separator = ",";
+  }
+
+  public void close ()
+          throws IOException
+  {
+    this.reader.close();
+  }
+
+  /**
+   * Parses the input and stores data in a TableModel.
+   *
+   * @see this.getTableModel()
+   */
+  public synchronized TableModel parse ()
+          throws IOException
+  {
+    if (tableModel != null)
+    {
+      return tableModel;
+    }
+
+
+    this.tableModel = new CSVTableModel();
+
+    if (this.columnNameFirst == true)
+    {   //read the fisrt line
+      final String first = this.reader.readLine();
+
+      if (first == null)
+      {
+        // after the end of the file it makes no sense to read anything.
+        // so we can safely return ..
+        return tableModel;
+      }
+      this.tableModel.setColumnNames(splitLine(first));
+    }
+
+    final ArrayList data = new ArrayList();
+    String line;
+    int maxLength = 0;
+    while ((line = this.reader.readLine()) != null)
+    {
+      final String[] o = splitLine(line);
+      if (o.length > maxLength)
+      {
+        maxLength = o.length;
+      }
+      data.add(o);
+    }
+
+    close();
+
+    final Object[][] array = new Object[data.size()][];
+    data.toArray(array);
+    this.tableModel.setData(array);
+    return tableModel;
+  }
+
+  private String[] splitLine (final String line)
+  {
+    final ArrayList row = new ArrayList();
+    final CSVTokenizer tokenizer = new CSVTokenizer(line, getSeparator());
+    while (tokenizer.hasMoreElements())
+    {
+      row.add(tokenizer.nextElement());
+    }
+    return (String[]) row.toArray(new String[row.size()]);
+  }
+
+  /**
+   * Returns the current separator used to parse the input.
+   *
+   * @return a regexp
+   */
+  public String getSeparator ()
+  {
+    return separator;
+  }
+
+  /**
+   * Sets the separator for parsing the input. It can be a regexp as we use the function
+   * <code>String.split()</code>. The default separator is a <code>;</code>.
+   *
+   * @param separator a regexp
+   */
+  public void setSeparator (final String separator)
+  {
+    this.separator = separator;
+  }
+
+  /**
+   * Creates the corrspondant TableModel of the input.
+   *
+   * @return the new TableModel
+   */
+  public TableModel getTableModel ()
+          throws IOException
+  {
+    return this.parse();
+  }
+
+  /**
+   * Tells if the first line of the input was column names.
+   *
+   * @return boolean
+   */
+  public boolean isColumnNameFirstLine ()
+  {
+    return columnNameFirst;
+  }
+
+  /**
+   * Set if the first line of the input is column names or not.
+   *
+   * @param columnNameFirst boolean
+   */
+  public void setColumnNameFirstLine (final boolean columnNameFirst)
+  {
+    this.columnNameFirst = columnNameFirst;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/CloseableTableModel.java b/source/org/jfree/report/modules/misc/tablemodel/CloseableTableModel.java
new file mode 100644
index 0000000..009eb4f
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/CloseableTableModel.java
@@ -0,0 +1,43 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CloseableTableModel.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.tablemodel;
+
+import javax.swing.table.TableModel;
+
+/**
+ * Creation-Date: 05.04.2006, 15:14:25
+ *
+ * @author Thomas Morgner
+ */
+public interface CloseableTableModel extends TableModel
+{
+  public void close();
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/JoiningTableModel.java b/source/org/jfree/report/modules/misc/tablemodel/JoiningTableModel.java
new file mode 100644
index 0000000..f5f0716
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/JoiningTableModel.java
@@ -0,0 +1,330 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: JoiningTableModel.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.tablemodel;
+
+import java.util.ArrayList;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableModel;
+
+public class JoiningTableModel extends AbstractTableModel
+{
+  private static class TablePosition
+  {
+    private TableModel tableModel;
+    private String prefix;
+    private int tableOffset;
+    private int columnOffset;
+
+    public TablePosition (final TableModel tableModel,
+                          final String prefix)
+    {
+      if (tableModel == null)
+      {
+        throw new NullPointerException("Model must not be null");
+      }
+      if (prefix == null)
+      {
+        throw new NullPointerException("Prefix must not be null.");
+      }
+      this.tableModel = tableModel;
+      this.prefix = prefix;
+    }
+
+    public void updateOffsets (final int tableOffset, final int columnOffset)
+    {
+      this.tableOffset = tableOffset;
+      this.columnOffset = columnOffset;
+    }
+
+    public String getPrefix ()
+    {
+      return prefix;
+    }
+
+    public int getColumnOffset ()
+    {
+      return columnOffset;
+    }
+
+    public TableModel getTableModel ()
+    {
+      return tableModel;
+    }
+
+    public int getTableOffset ()
+    {
+      return tableOffset;
+    }
+  }
+
+  private class TableChangeHandler implements TableModelListener
+  {
+    public TableChangeHandler ()
+    {
+    }
+
+    /**
+     * This fine grain notification tells listeners the exact range of cells, rows, or
+     * columns that changed.
+     */
+    public void tableChanged (final TableModelEvent e)
+    {
+      if (e.getType() == TableModelEvent.HEADER_ROW)
+      {
+        updateStructure();
+      }
+      else if (e.getType() == TableModelEvent.INSERT ||
+          e.getType() == TableModelEvent.DELETE)
+      {
+        updateRowCount();
+      }
+      else
+      {
+        updateData();
+      }
+    }
+  }
+
+  // the column names of all tables ..
+  private String[] columnNames;
+  // all column types of all tables ..
+  private Class[] columnTypes;
+
+  private ArrayList models;
+  private TableChangeHandler changeHandler;
+  private int rowCount;
+  public static final String TABLE_PREFIX_COLUMN = "TablePrefix";
+
+  public JoiningTableModel ()
+  {
+    models = new ArrayList();
+    changeHandler = new TableChangeHandler();
+  }
+
+  public synchronized void addTableModel (final String prefix, final TableModel model)
+  {
+    models.add(new TablePosition(model, prefix));
+    model.addTableModelListener(changeHandler);
+    updateStructure();
+  }
+
+  public synchronized void removeTableModel (final TableModel model)
+  {
+    for (int i = 0; i < models.size(); i++)
+    {
+      final TablePosition position = (TablePosition) models.get(i);
+      if (position.getTableModel() == model)
+      {
+        models.remove(model);
+        model.removeTableModelListener(changeHandler);
+        updateStructure();
+        return;
+      }
+    }
+    return;
+  }
+
+  public synchronized int getTableModelCount ()
+  {
+    return models.size();
+  }
+
+  public synchronized TableModel getTableModel (final int pos)
+  {
+    final TablePosition position = (TablePosition) models.get(pos);
+    return position.getTableModel();
+  }
+
+  protected synchronized void updateStructure()
+  {
+    final ArrayList columnNames = new ArrayList();
+    final ArrayList columnTypes = new ArrayList();
+    int rowOffset = 0;
+    int columnOffset = 1;
+
+    columnNames.add(TABLE_PREFIX_COLUMN);
+    columnTypes.add(String.class);
+
+    for (int i = 0; i < models.size(); i++)
+    {
+      final TablePosition pos = (TablePosition) models.get(i);
+      pos.updateOffsets(rowOffset, columnOffset);
+      final TableModel tableModel = pos.getTableModel();
+      rowOffset += tableModel.getRowCount();
+      columnOffset += tableModel.getColumnCount();
+      for (int c = 0; c < tableModel.getColumnCount(); c++)
+      {
+        columnNames.add(pos.getPrefix() + "." + tableModel.getColumnName(c));
+        columnTypes.add(tableModel.getColumnClass(c));
+      }
+    }
+    this.columnNames = (String[]) columnNames.toArray(new String[columnNames.size()]);
+    this.columnTypes = (Class[]) columnTypes.toArray(new Class[columnTypes.size()]);
+    this.rowCount = rowOffset;
+    fireTableStructureChanged();
+  }
+
+  protected synchronized void updateRowCount()
+  {
+    int rowOffset = 0;
+    int columnOffset = 1;
+    for (int i = 0; i < models.size(); i++)
+    {
+      final TablePosition model = (TablePosition) models.get(i);
+      model.updateOffsets(rowOffset, columnOffset);
+      rowOffset += model.getTableModel().getRowCount();
+      columnOffset += model.getTableModel().getColumnCount();
+    }
+    fireTableStructureChanged();
+  }
+
+  protected void updateData()
+  {
+    // this is lazy, but we do not optimize for edit-speed here ...
+    fireTableDataChanged();
+  }
+
+  /**
+   * Returns <code>Object.class</code> regardless of <code>columnIndex</code>.
+   *
+   * @param columnIndex the column being queried
+   * @return the Object.class
+   */
+  public synchronized Class getColumnClass (final int columnIndex)
+  {
+    return columnTypes[columnIndex];
+  }
+
+  /**
+   * Returns a default name for the column using spreadsheet conventions: A, B, C, ... Z,
+   * AA, AB, etc.  If <code>column</code> cannot be found, returns an empty string.
+   *
+   * @param column the column being queried
+   * @return a string containing the default name of <code>column</code>
+   */
+  public synchronized String getColumnName (final int column)
+  {
+    return columnNames[column];
+  }
+
+  /**
+   * Returns false. JFreeReport does not like changing cells.
+   *
+   * @param rowIndex    the row being queried
+   * @param columnIndex the column being queried
+   * @return false
+   */
+  public final boolean isCellEditable (final int rowIndex, final int columnIndex)
+  {
+    return false;
+  }
+
+  /**
+   * Returns the number of columns managed by the data source object. A <B>JTable</B> uses
+   * this method to determine how many columns it should create and display on
+   * initialization.
+   *
+   * @return the number or columns in the model
+   *
+   * @see #getRowCount
+   */
+  public synchronized int getColumnCount ()
+  {
+    return columnNames.length;
+  }
+
+  /**
+   * Returns the number of records managed by the data source object. A <B>JTable</B> uses
+   * this method to determine how many rows it should create and display.  This method
+   * should be quick, as it is call by <B>JTable</B> quite frequently.
+   *
+   * @return the number or rows in the model
+   *
+   * @see #getColumnCount
+   */
+  public synchronized int getRowCount ()
+  {
+    return rowCount;
+  }
+
+  /**
+   * Returns an attribute value for the cell at <I>columnIndex</I> and <I>rowIndex</I>.
+   *
+   * @param	rowIndex	the row whose value is to be looked up
+   * @param	columnIndex the column whose value is to be looked up
+   * @return	the value Object at the specified cell
+   */
+  public synchronized Object getValueAt (final int rowIndex, final int columnIndex)
+  {
+    // first: find the correct table model...
+    final TablePosition pos = getTableModelForRow(rowIndex);
+    if (pos == null)
+    {
+      return null;
+    }
+
+    if (columnIndex == 0)
+    {
+      return pos.getPrefix();
+    }
+
+    final int columnOffset = pos.getColumnOffset();
+    if (columnIndex < columnOffset)
+    {
+      return null;
+    }
+
+    final TableModel tableModel = pos.getTableModel();
+    if (columnIndex >= (columnOffset + tableModel.getColumnCount()))
+    {
+      return null;
+    }
+    return tableModel.getValueAt
+            (rowIndex - pos.getTableOffset(), columnIndex - columnOffset);
+  }
+
+  private TablePosition getTableModelForRow (final int row)
+  {
+    // assume, that the models are in ascending order ..
+    for (int i = 0; i < models.size(); i++)
+    {
+      final TablePosition pos = (TablePosition) models.get(i);
+      final int maxRow = pos.getTableOffset() + pos.getTableModel().getRowCount();
+      if (row < maxRow)
+      {
+        return pos;
+      }
+    }
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/PrintableTableModel.java b/source/org/jfree/report/modules/misc/tablemodel/PrintableTableModel.java
new file mode 100644
index 0000000..2798a7b
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/PrintableTableModel.java
@@ -0,0 +1,119 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PrintableTableModel.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.tablemodel;
+
+import javax.swing.event.TableModelListener;
+import javax.swing.table.TableModel;
+
+/**
+ * A tablemodel that allows to override the column names. This is usefull
+ * in internationalized environments, where the tablemodel returns diffent
+ * columnnames depending on the current locale.
+ *
+ * @author LordOfCode
+ */
+public class PrintableTableModel implements TableModel
+{
+
+  /** The original TableModel. */
+  private TableModel model;
+  /**
+   * The column keys to retrieve the internationalized names from the
+   * ResourceBundle.
+   */
+  private String[] i18nKeys;
+
+
+  public PrintableTableModel(TableModel source, String[] keys)
+  {
+    model = source;
+    i18nKeys = keys;
+  }
+
+  public int getColumnCount()
+  {
+    return model.getColumnCount();
+  }
+
+  public int getRowCount()
+  {
+    return model.getRowCount();
+  }
+
+
+  public boolean isCellEditable(int rowIndex, int columnIndex)
+  {
+    return model.isCellEditable(rowIndex, columnIndex);
+  }
+
+  public Class getColumnClass(int columnIndex)
+  {
+    return model.getColumnClass(columnIndex);
+  }
+
+  public Object getValueAt(int rowIndex, int columnIndex)
+  {
+    return model.getValueAt(rowIndex, columnIndex);
+  }
+
+  public void setValueAt(Object aValue, int rowIndex, int columnIndex)
+  {
+    model.setValueAt(aValue, rowIndex, columnIndex);
+  }
+
+  /**
+   * Retrieves the internationalized column name from the string array.
+   *
+   * @see TableModel#getColumnName(int)
+   */
+  public String getColumnName(int columnIndex)
+  {
+    if (columnIndex < i18nKeys.length)
+    {
+      final String columnName = i18nKeys[columnIndex];
+      if (columnName != null)
+      {
+        return columnName;
+      }
+    }
+    return model.getColumnName(columnIndex);
+  }
+
+  public void addTableModelListener(TableModelListener l)
+  {
+    model.addTableModelListener(l);
+  }
+
+  public void removeTableModelListener(TableModelListener l)
+  {
+    model.removeTableModelListener(l);
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/ResultSetTableModelFactory.java b/source/org/jfree/report/modules/misc/tablemodel/ResultSetTableModelFactory.java
new file mode 100644
index 0000000..bded090
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/ResultSetTableModelFactory.java
@@ -0,0 +1,294 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ResultSetTableModelFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.tablemodel;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import javax.swing.table.DefaultTableModel;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * Creates a <code>TableModel</code> which is backed up by a <code>ResultSet</code>. If
+ * the <code>ResultSet</code> is scrollable, a {@link org.jfree.report.modules.misc.tablemodel.ScrollableResultSetTableModel}
+ * is created, otherwise all data is copied from the <code>ResultSet</code> into a
+ * <code>DefaultTableModel</code>.
+ * <p/>
+ * The creation of a <code>DefaultTableModel</code> can be forced if the system property
+ * <code>"org.jfree.report.modules.misc.tablemodel.TableFactoryMode"</code> is set to
+ * <code>"simple"</code>.
+ *
+ * @author Thomas Morgner
+ */
+public final class ResultSetTableModelFactory
+{
+  /**
+   * The configuration key defining how to map column names to column indices.
+   */
+  public static final String COLUMN_NAME_MAPPING_KEY =
+          "org.jfree.report.modules.misc.tablemodel.ColumnNameMapping";
+
+  /**
+   * The 'ResultSet factory mode'.
+   */
+  public static final String RESULTSET_FACTORY_MODE
+          = "org.jfree.report.modules.misc.tablemodel.TableFactoryMode";
+
+  /**
+   * Singleton instance of the factory.
+   */
+  private static ResultSetTableModelFactory defaultInstance;
+
+  /**
+   * Default constructor. This is a Singleton, use getInstance().
+   */
+  private ResultSetTableModelFactory ()
+  {
+  }
+
+  /**
+   * Creates a table model by using the given <code>ResultSet</code> as the backend. If
+   * the <code>ResultSet</code> is scrollable (the type is not
+   * <code>TYPE_FORWARD_ONLY</code>), an instance of {@link org.jfree.report.modules.misc.tablemodel.ScrollableResultSetTableModel}
+   * is returned. This model uses the extended capabilities of scrollable resultsets to
+   * directly read data from the database without caching or the need of copying the
+   * complete <code>ResultSet</code> into the programs memory.
+   * <p/>
+   * If the <code>ResultSet</code> lacks the scollable features, the data will be copied
+   * into a <code>DefaultTableModel</code> and the <code>ResultSet</code> gets closed.
+   *
+   * @param rs the result set.
+   * @return a closeable table model.
+   *
+   * @throws SQLException if there is a problem with the result set.
+   */
+  public CloseableTableModel createTableModel (final ResultSet rs)
+          throws SQLException
+  {
+    return createTableModel
+            (rs, JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+            (COLUMN_NAME_MAPPING_KEY, "Label").equals("Label"));
+  }
+
+  /**
+   * Creates a table model by using the given <code>ResultSet</code> as the backend. If
+   * the <code>ResultSet</code> is scrollable (the type is not
+   * <code>TYPE_FORWARD_ONLY</code>), an instance of {@link org.jfree.report.modules.misc.tablemodel.ScrollableResultSetTableModel}
+   * is returned. This model uses the extended capabilities of scrollable resultsets to
+   * directly read data from the database without caching or the need of copying the
+   * complete <code>ResultSet</code> into the programs memory.
+   * <p/>
+   * If the <code>ResultSet</code> lacks the scollable features, the data will be copied
+   * into a <code>DefaultTableModel</code> and the <code>ResultSet</code> gets closed.
+   *
+   * @param rs           the result set.
+   * @param labelMapping defines, whether to use column names or column labels to compute
+   *                     the column index.
+   * @return a closeable table model.
+   *
+   * @throws SQLException if there is a problem with the result set.
+   */
+  public CloseableTableModel createTableModel (final ResultSet rs,
+                                               final boolean labelMapping)
+          throws SQLException
+  {
+    // Allow for override, some jdbc drivers are buggy :(
+    final String prop =
+            JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+                    (RESULTSET_FACTORY_MODE, "");
+
+    if (prop.equalsIgnoreCase("simple"))
+    {
+      return generateDefaultTableModel(rs, labelMapping);
+    }
+
+    int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
+    try
+    {
+      resultSetType = rs.getType();
+    }
+    catch (SQLException sqle)
+    {
+      DebugLog.log("ResultSet type could not be determined, assuming default table model.");
+    }
+    if (resultSetType == ResultSet.TYPE_FORWARD_ONLY)
+    {
+      return generateDefaultTableModel(rs, labelMapping);
+    }
+    else
+    {
+      return new ScrollableResultSetTableModel(rs, labelMapping);
+    }
+  }
+
+  /**
+   * A DefaultTableModel that implements the CloseableTableModel interface.
+   */
+  private static final class CloseableDefaultTableModel extends DefaultTableModel
+          implements CloseableTableModel
+  {
+    /**
+     * The results set.
+     */
+    private final ResultSet res;
+
+    /**
+     * Creates a new closeable table model.
+     *
+     * @param objects  the table data.
+     * @param objects1 the column names.
+     * @param res      the result set.
+     */
+    private CloseableDefaultTableModel (final Object[][] objects,
+                                        final Object[] objects1, final ResultSet res)
+    {
+      super(objects, objects1);
+      this.res = res;
+    }
+
+    /**
+     * If this model has a resultset assigned, close it, if this is a DefaultTableModel,
+     * remove all data.
+     */
+    public void close ()
+    {
+      setDataVector(new Object[0][0], new Object[0]);
+      try
+      {
+        res.close();
+      }
+      catch (Exception e)
+      {
+        //Log.debug ("Close failed for resultset table model", e);
+      }
+    }
+  }
+
+  /**
+   * Generates a <code>TableModel</code> that gets its contents filled from a
+   * <code>ResultSet</code>. The column names of the <code>ResultSet</code> will form the
+   * column names of the table model.
+   * <p/>
+   * Hint: To customize the names of the columns, use the SQL column aliasing (done with
+   * <code>SELECT nativecolumnname AS "JavaColumnName" FROM ....</code>
+   *
+   * @param rs the result set.
+   * @return a closeable table model.
+   *
+   * @throws SQLException if there is a problem with the result set.
+   */
+  public CloseableTableModel generateDefaultTableModel (final ResultSet rs)
+          throws SQLException
+  {
+    return generateDefaultTableModel(rs,
+            JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+            (COLUMN_NAME_MAPPING_KEY, "Label").equals("Label"));
+  }
+
+  /**
+   * Generates a <code>TableModel</code> that gets its contents filled from a
+   * <code>ResultSet</code>. The column names of the <code>ResultSet</code> will form the
+   * column names of the table model.
+   * <p/>
+   * Hint: To customize the names of the columns, use the SQL column aliasing (done with
+   * <code>SELECT nativecolumnname AS "JavaColumnName" FROM ....</code>
+   *
+   * @param rs           the result set.
+   * @param labelMapping defines, whether to use column names or column labels to compute
+   *                     the column index.
+   * @return a closeable table model.
+   *
+   * @throws SQLException if there is a problem with the result set.
+   */
+  public CloseableTableModel generateDefaultTableModel
+          (final ResultSet rs, final boolean labelMapping)
+          throws SQLException
+  {
+    final ResultSetMetaData rsmd = rs.getMetaData();
+    final int colcount = rsmd.getColumnCount();
+    final ArrayList header = new ArrayList(colcount);
+    for (int i = 0; i < colcount; i++)
+    {
+      if (labelMapping)
+      {
+        final String name = rsmd.getColumnLabel(i + 1);
+        header.add(name);
+      }
+      else
+      {
+        final String name = rsmd.getColumnName(i + 1);
+        header.add(name);
+      }
+    }
+    final ArrayList rows = new ArrayList();
+    while (rs.next())
+    {
+      final Object[] column = new Object[colcount];
+      for (int i = 0; i < colcount; i++)
+      {
+        final Object val = rs.getObject(i + 1);
+        column[i] = val;
+      }
+      rows.add(column);
+    }
+
+    final Object[] tempRows = rows.toArray();
+    final Object[][] rowMap = new Object[tempRows.length][];
+    for (int i = 0; i < tempRows.length; i++)
+    {
+      rowMap[i] = (Object[]) tempRows[i];
+    }
+    final CloseableDefaultTableModel model =
+            new CloseableDefaultTableModel(rowMap, header.toArray(), rs);
+    for (int i = 0; i < colcount; i++)
+    {
+    }
+    return model;
+  }
+
+  /**
+   * Returns the singleton instance of the factory.
+   *
+   * @return an instance of this factory.
+   */
+  public synchronized static ResultSetTableModelFactory getInstance ()
+  {
+    if (defaultInstance == null)
+    {
+      defaultInstance = new ResultSetTableModelFactory();
+    }
+    return defaultInstance;
+  }
+
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/ScrollableResultSetTableModel.java b/source/org/jfree/report/modules/misc/tablemodel/ScrollableResultSetTableModel.java
new file mode 100644
index 0000000..93b595b
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/ScrollableResultSetTableModel.java
@@ -0,0 +1,360 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ScrollableResultSetTableModel.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.tablemodel;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import javax.swing.table.AbstractTableModel;
+
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * A tableModel which is backed up by a java.sql.ResultSet. Use this to directly feed your
+ * database data into JFreeReport. If you have trouble using this TableModel and you have
+ * either enough memory or your query result is not huge, you may want to use
+ * <code>ResultSetTableModelFactory.generateDefaultTableModel (ResultSet rs)</code>. That
+ * implementation will read all data from the given ResultSet and keep that data in
+ * memory.
+ * <p/>
+ * Use the close() function to close the ResultSet contained in this model.
+ *
+ * @author Thomas Morgner
+ */
+public class ScrollableResultSetTableModel extends AbstractTableModel
+        implements CloseableTableModel
+{
+  /**
+   * The scrollable ResultSet source.
+   */
+  private ResultSet resultset;
+  /**
+   * The ResultSetMetaData object for this result set.
+   */
+  private ResultSetMetaData dbmd;
+  /**
+   * The number of rows in the result set.
+   */
+  private int rowCount;
+  /**
+   * Defines the column naming mode.
+   */
+  private final boolean labelMapMode;
+  /**
+   * The column types as read from the result set.
+   */
+  private Class[] types;
+
+  /**
+   * Constructs the model.
+   *
+   * @param resultset    the result set.
+   * @param labelMapMode defines, whether to use column names or column labels to compute
+   *                     the column index.
+   * @throws SQLException if there is a problem with the result set.
+   */
+  public ScrollableResultSetTableModel (final ResultSet resultset,
+                                        final boolean labelMapMode)
+          throws SQLException
+  {
+    this.labelMapMode = labelMapMode;
+    if (resultset != null)
+    {
+      updateResultSet(resultset);
+    }
+    else
+    {
+      close();
+    }
+  }
+
+  /**
+   * Creates a new scrollable result set with no resultset assigned and the specified
+   * label map mode.
+   *
+   * @param labelMapMode defines, whether to use column names or column labels to compute
+   *                     the column index.
+   */
+  protected ScrollableResultSetTableModel (final boolean labelMapMode)
+  {
+    this.labelMapMode = labelMapMode;
+  }
+
+  /**
+   * Returns the column name mode used to map column names into column indices. If true,
+   * then the Label is used, else the Name is used.
+   *
+   * @return true, if the column label is used for the mapping, false otherwise.
+   *
+   * @see ResultSetMetaData#getColumnLabel
+   * @see ResultSetMetaData#getColumnName
+   */
+  public boolean isLabelMapMode ()
+  {
+    return labelMapMode;
+  }
+
+  /**
+   * Updates the result set in this model with the given ResultSet object.
+   *
+   * @param resultset the new result set.
+   * @throws SQLException if there is a problem with the result set.
+   */
+  public void updateResultSet (final ResultSet resultset)
+          throws SQLException
+  {
+    if (this.resultset != null)
+    {
+      close();
+    }
+
+    this.resultset = resultset;
+    this.dbmd = resultset.getMetaData();
+
+    if (resultset.last())
+    {
+      rowCount = resultset.getRow();
+    }
+    else
+    {
+      rowCount = 0;
+    }
+
+    fireTableStructureChanged();
+  }
+
+  /**
+   * Clears the model of the current result set. The resultset is closed.
+   */
+  public void close ()
+  {
+    // Close the old result set if needed.
+    if (resultset != null)
+    {
+      try
+      {
+        resultset.close();
+      }
+      catch (SQLException e)
+      {
+        // Just in case the JDBC driver can't close a result set twice.
+        //  e.printStackTrace();
+      }
+    }
+    resultset = null;
+    dbmd = null;
+    rowCount = 0;
+    fireTableStructureChanged();
+  }
+
+  /**
+   * Get a rowCount. This can be a very expensive operation on large datasets. Returns -1
+   * if the total amount of rows is not known to the result set.
+   *
+   * @return the row count.
+   */
+  public int getRowCount ()
+  {
+    if (resultset == null)
+    {
+      return 0;
+    }
+
+    try
+    {
+      if (resultset.last())
+      {
+        rowCount = resultset.getRow();
+        if (rowCount == -1)
+        {
+          rowCount = 0;
+        }
+      }
+      else
+      {
+        rowCount = 0;
+      }
+    }
+    catch (SQLException sqle)
+    {
+      //Log.debug ("GetRowCount failed, returning 0 rows", sqle);
+      return 0;
+    }
+    return rowCount;
+  }
+
+  /**
+   * Returns the number of columns in the ResultSet. Returns 0 if no result set is set or
+   * the column count could not be retrieved.
+   *
+   * @return the column count.
+   *
+   * @see java.sql.ResultSetMetaData#getColumnCount()
+   */
+  public int getColumnCount ()
+  {
+    if (resultset == null)
+    {
+      return 0;
+    }
+
+    if (dbmd != null)
+    {
+      try
+      {
+        return dbmd.getColumnCount();
+      }
+      catch (SQLException e)
+      {
+        //Log.debug ("GetColumnCount failed", e);
+      }
+    }
+    return 0;
+  }
+
+  /**
+   * Returns the columnLabel or column name for the given column. Whether the label or the
+   * name is returned depends on the label map mode.
+   *
+   * @param column the column index.
+   * @return the column name.
+   *
+   * @see java.sql.ResultSetMetaData#getColumnLabel(int)
+   */
+  public String getColumnName (final int column)
+  {
+    if (dbmd != null)
+    {
+      try
+      {
+        if (isLabelMapMode())
+        {
+          return dbmd.getColumnLabel(column + 1);
+        }
+        else
+        {
+          return dbmd.getColumnName(column + 1);
+        }
+      }
+      catch (SQLException e)
+      {
+        DebugLog.log("ScrollableResultSetTableModel.getColumnName: SQLException.");
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Returns the value of the specified row and the specified column from within the
+   * resultset.
+   *
+   * @param row    the row index.
+   * @param column the column index.
+   * @return the value.
+   */
+  public Object getValueAt (final int row, final int column)
+  {
+    if (resultset != null)
+    {
+      try
+      {
+        resultset.absolute(row + 1);
+        return resultset.getObject(column + 1);
+      }
+      catch (SQLException e)
+      {
+        //Log.debug ("Query failed for [" + row + "," + column + "]", e);
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Returns the class of the resultset column. Returns Object.class if an error
+   * occurred.
+   *
+   * @param column the column index.
+   * @return the column class.
+   */
+  public Class getColumnClass (final int column)
+  {
+    if (types != null)
+    {
+      return types[column];
+    }
+    if (dbmd != null)
+    {
+      try
+      {
+        types = TypeMapper.mapTypes(dbmd);
+        return types[column];
+      }
+      catch (Exception e)
+      {
+        //Log.debug ("GetColumnClass failed for " + column, e);
+      }
+    }
+    return Object.class;
+  }
+
+
+  /**
+   * Returns the classname of the resultset column. Returns Object.class if an error
+   * occurred.
+   *
+   * @param column the column index.
+   * @return the column class name.
+   */
+  public String getColumnClassName (final int column)
+  {
+    if (dbmd != null)
+    {
+      return mckoiDBFixClassName(getColumnClass(column).getName());
+    }
+    return Object.class.getName();
+  }
+
+  /**
+   * Just removes the word class from the start of the classname string McKoiDB version
+   * 0.92 was not able to properly return classnames of resultset elements.
+   *
+   * @param classname the class name.
+   * @return the modified class name.
+   */
+  private String mckoiDBFixClassName (final String classname)
+  {
+    if (classname.startsWith("class "))
+    {
+      return classname.substring(6).trim();
+    }
+    return classname;
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/SubSetTableModel.java b/source/org/jfree/report/modules/misc/tablemodel/SubSetTableModel.java
new file mode 100644
index 0000000..f437b84
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/SubSetTableModel.java
@@ -0,0 +1,339 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SubSetTableModel.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.tablemodel;
+
+import java.util.ArrayList;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.TableModel;
+
+/**
+ * A TableModel that proxies an other tablemodel and cuts rows from the start and/or the
+ * end of the other tablemodel.
+ *
+ * @author Thomas Morgner
+ */
+public class SubSetTableModel implements TableModel
+{
+  /**
+   * A helper class, that translates tableevents received from the wrapped table model and
+   * forwards them with changed indices to the registered listeners.
+   */
+  private final class TableEventTranslator implements TableModelListener
+  {
+    /**
+     * the registered listeners.
+     */
+    private final ArrayList listeners;
+
+    /**
+     * Default Constructor.
+     */
+    private TableEventTranslator ()
+    {
+      listeners = new ArrayList();
+    }
+
+    /**
+     * This fine grain notification tells listeners the exact range of cells, rows, or
+     * columns that changed. The received rows are translated to fit the external
+     * tablemodel size.
+     *
+     * @param e the event, that should be translated.
+     */
+    public void tableChanged (final TableModelEvent e)
+    {
+      int firstRow = e.getFirstRow();
+      if (e.getFirstRow() > 0)
+      {
+        firstRow -= getStart();
+      }
+
+      int lastRow = e.getLastRow();
+      if (lastRow > 0)
+      {
+        lastRow -= getStart();
+        lastRow -= (getEnclosedModel().getRowCount() - getEnd());
+      }
+      final int type = e.getType();
+      final int column = e.getColumn();
+
+      final TableModelEvent event =
+              new TableModelEvent(SubSetTableModel.this, firstRow, lastRow, column, type);
+
+      for (int i = 0; i < listeners.size(); i++)
+      {
+        final TableModelListener l = (TableModelListener) listeners.get(i);
+        l.tableChanged(event);
+      }
+    }
+
+    /**
+     * Adds the TableModelListener to this Translator.
+     *
+     * @param l the tablemodel listener
+     */
+    protected void addTableModelListener (final TableModelListener l)
+    {
+      listeners.add(l);
+    }
+
+    /**
+     * Removes the TableModelListener from this Translator.
+     *
+     * @param l the tablemodel listener
+     */
+    protected void removeTableModelListener (final TableModelListener l)
+    {
+      listeners.remove(l);
+    }
+  }
+
+  /**
+   * the row that should be the first row.
+   */
+  private int start;
+
+  /**
+   * the row that should be the last row.
+   */
+  private int end;
+
+  /**
+   * the model.
+   */
+  private TableModel model;
+
+  /**
+   * the event translator.
+   */
+  private TableEventTranslator eventHandler;
+
+  /**
+   * Creates a new SubSetTableModel, the start and the end parameters define the new
+   * tablemodel row count. The parameter <code>start</code> must be a positive integer and
+   * denotes the number or rows removed from the start of the tablemodel. <code>end</code>
+   * is the number of the last translated row. Any row after <code>end</code> is ignored.
+   * End must be greater or equal the given start row.
+   *
+   * @param start the number of rows that should be removed.
+   * @param end   the last row.
+   * @param model the wrapped model
+   * @throws NullPointerException     if the given model is null
+   * @throws IllegalArgumentException if start or end are invalid.
+   */
+  public SubSetTableModel (final int start, final int end, final TableModel model)
+  {
+    if (start < 0)
+    {
+      throw new IllegalArgumentException("Start < 0");
+    }
+    if (end <= start)
+    {
+      throw new IllegalArgumentException("end < start");
+    }
+    if (model == null)
+    {
+      throw new NullPointerException();
+    }
+    if (end >= model.getRowCount())
+    {
+      throw new IllegalArgumentException("End >= Model.RowCount");
+    }
+
+    this.start = start;
+    this.end = end;
+    this.model = model;
+    this.eventHandler = new TableEventTranslator();
+  }
+
+  /**
+   * Translates the given row to fit for the wrapped tablemodel.
+   *
+   * @param rowIndex the original row index.
+   * @return the translated row index.
+   */
+  private int getClientRowIndex (final int rowIndex)
+  {
+    return rowIndex + start;
+  }
+
+  /**
+   * Returns the number of rows in the model. A <code>JTable</code> uses this method to
+   * determine how many rows it should display.  This method should be quick, as it is
+   * called frequently during rendering.
+   *
+   * @return the number of rows in the model
+   *
+   * @see #getColumnCount
+   */
+  public int getRowCount ()
+  {
+    final int rowCount = model.getRowCount();
+    return rowCount - start - (rowCount - end);
+  }
+
+  /**
+   * Returns the number of columns in the model. A <code>JTable</code> uses this method to
+   * determine how many columns it should create and display by default.
+   *
+   * @return the number of columns in the model
+   *
+   * @see #getRowCount
+   */
+  public int getColumnCount ()
+  {
+    return model.getColumnCount();
+  }
+
+  /**
+   * Returns the name of the column at <code>columnIndex</code>.  This is used to
+   * initialize the table's column header name.  Note: this name does not need to be
+   * unique; two columns in a table can have the same name.
+   *
+   * @param columnIndex the index of the column
+   * @return the name of the column
+   */
+  public String getColumnName (final int columnIndex)
+  {
+    return model.getColumnName(columnIndex);
+  }
+
+  /**
+   * Returns the most specific superclass for all the cell values in the column.  This is
+   * used by the <code>JTable</code> to set up a default renderer and editor for the
+   * column.
+   *
+   * @param columnIndex the index of the column
+   * @return the base ancestor class of the object values in the model.
+   */
+  public Class getColumnClass (final int columnIndex)
+  {
+    return model.getColumnClass(columnIndex);
+  }
+
+  /**
+   * Returns true if the cell at <code>rowIndex</code> and <code>columnIndex</code> is
+   * editable.  Otherwise, <code>setValueAt</code> on the cell will not change the value
+   * of that cell.
+   *
+   * @param rowIndex    the row whose value to be queried
+   * @param columnIndex the column whose value to be queried
+   * @return true if the cell is editable
+   *
+   * @see #setValueAt
+   */
+  public boolean isCellEditable (final int rowIndex, final int columnIndex)
+  {
+    return model.isCellEditable(getClientRowIndex(rowIndex), columnIndex);
+  }
+
+  /**
+   * Returns the value for the cell at <code>columnIndex</code> and
+   * <code>rowIndex</code>.
+   *
+   * @param rowIndex    the row whose value is to be queried
+   * @param columnIndex the column whose value is to be queried
+   * @return the value Object at the specified cell
+   */
+  public Object getValueAt (final int rowIndex, final int columnIndex)
+  {
+    return model.getValueAt(getClientRowIndex(rowIndex), columnIndex);
+  }
+
+  /**
+   * Sets the value in the cell at <code>columnIndex</code> and <code>rowIndex</code> to
+   * <code>aValue</code>.
+   *
+   * @param aValue      the new value
+   * @param rowIndex    the row whose value is to be changed
+   * @param columnIndex the column whose value is to be changed
+   * @see #getValueAt
+   * @see #isCellEditable
+   */
+  public void setValueAt (final Object aValue, final int rowIndex, final int columnIndex)
+  {
+    model.setValueAt(aValue, getClientRowIndex(rowIndex), columnIndex);
+  }
+
+  /**
+   * Adds a listener to the list that is notified each time a change to the data model
+   * occurs.
+   *
+   * @param l the TableModelListener
+   */
+  public void addTableModelListener (final TableModelListener l)
+  {
+    eventHandler.addTableModelListener(l);
+  }
+
+  /**
+   * Removes a listener from the list that is notified each time a change to the data
+   * model occurs.
+   *
+   * @param l the TableModelListener
+   */
+  public void removeTableModelListener (final TableModelListener l)
+  {
+    eventHandler.removeTableModelListener(l);
+  }
+
+  /**
+   * Returns the enclosed tablemodel, which is wrapped by this subset table model.
+   *
+   * @return the enclosed table model, never null.
+   */
+  protected TableModel getEnclosedModel ()
+  {
+    return model;
+  }
+
+  /**
+   * Returns the start row that should be mapped to row 0 of this model.
+   *
+   * @return the first row that should be visible.
+   */
+  protected int getStart ()
+  {
+    return start;
+  }
+
+  /**
+   * Returns the last row that should be visible.
+   *
+   * @return the number of the last row.
+   */
+  protected int getEnd ()
+  {
+    return end;
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/TableModelInfo.java b/source/org/jfree/report/modules/misc/tablemodel/TableModelInfo.java
new file mode 100644
index 0000000..36c30e0
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/TableModelInfo.java
@@ -0,0 +1,118 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TableModelInfo.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.tablemodel;
+
+import javax.swing.table.TableModel;
+
+/**
+ * A utility class that prints out information about a TableModel.
+ *
+ * @author Thomas Morgner
+ */
+public final class TableModelInfo
+{
+  /**
+   * DefaultConstructor.
+   */
+  private TableModelInfo ()
+  {
+  }
+
+  /**
+   * Prints a table model to standard output.
+   *
+   * @param mod the model.
+   */
+  public static void printTableModel (final TableModel mod)
+  {
+    System.out.println("Tablemodel contains " + mod.getRowCount() + " rows.");
+    for (int i = 0; i < mod.getColumnCount(); i++)
+    {
+      System.out.println("Column: " + i + " Name = " + mod.getColumnName(i) + "; DataType = "
+              + mod.getColumnClass(i));
+    }
+
+    System.out.println("Checking the data inside");
+    for (int rows = 0; rows < mod.getRowCount(); rows++)
+    {
+      for (int i = 0; i < mod.getColumnCount(); i++)
+      {
+        final Object value = mod.getValueAt(rows, i);
+        final Class c = mod.getColumnClass(i);
+        if (value == null)
+        {
+          System.out.println("ValueAt (" + rows + ", " + i + ") is null");
+        }
+        else
+        {
+          if (c.isAssignableFrom(value.getClass()) == false)
+          {
+            System.out.println
+                    ("ValueAt (" + rows + ", " + i + ") is not assignable from " + c);
+          }
+          if (c.equals(Object.class))
+          {
+            System.out.println
+                    ("ValueAt (" + rows + ", " + i + ") is in a generic column and is of "
+                    + "type " + value.getClass());
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Prints a table model to standard output.
+   *
+   * @param mod the model.
+   */
+  public static void printTableModelContents (final TableModel mod)
+  {
+    System.out.println("Tablemodel contains " + mod.getRowCount() + " rows.");
+    for (int i = 0; i < mod.getColumnCount(); i++)
+    {
+      System.out.println("Column: " + i + " Name = " + mod.getColumnName(i) + "; DataType = "
+              + mod.getColumnClass(i));
+    }
+
+    System.out.println("Checking the data inside");
+    for (int rows = 0; rows < mod.getRowCount(); rows++)
+    {
+      for (int i = 0; i < mod.getColumnCount(); i++)
+      {
+        final Object value = mod.getValueAt(rows, i);
+        //final Class c = mod.getColumnClass(i);
+        System.out.println("ValueAt (" + rows + ", " + i + ") is " + value);
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/TableModelModule.java b/source/org/jfree/report/modules/misc/tablemodel/TableModelModule.java
new file mode 100644
index 0000000..6b20a45
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/TableModelModule.java
@@ -0,0 +1,71 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TableModelModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.misc.tablemodel;
+
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * The module definition for the table model utility classes module.
+ *
+ * @author Thomas Morgner
+ */
+public class TableModelModule extends AbstractModule
+{
+  /**
+   * DefaultConstructor. Loads the module specification.
+   *
+   * @throws ModuleInitializeException if an error occured.
+   */
+  public TableModelModule ()
+          throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup operations. This
+   * method is called only once in a modules lifetime. If the initializing cannot be
+   * completed, throw a ModuleInitializeException to indicate the error,. The module will
+   * not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize (SubSystem subSystem)
+          throws ModuleInitializeException
+  {
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/TypeMapper.java b/source/org/jfree/report/modules/misc/tablemodel/TypeMapper.java
new file mode 100644
index 0000000..0a331b1
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/TypeMapper.java
@@ -0,0 +1,163 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TypeMapper.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.modules.misc.tablemodel;
+
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Ref;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Struct;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+
+/**
+ * @author $Author: tmorgner $
+ * @version $Id: TypeMapper.java 10756 2009-12-02 15:58:24Z tmorgner $
+ */
+public class TypeMapper
+{
+  private static Class byteArrayClass = (new byte[0]).getClass();
+
+  private static Class mapSQLType (final int t)
+  {
+    switch (t)
+    {
+      case Types.ARRAY:
+        return (new Object[0]).getClass();
+      case Types.BIGINT:
+        return Long.class;
+      case Types.BINARY:
+        return byteArrayClass;
+      case Types.BIT:
+        return Boolean.class;
+      case Types.BLOB:
+        return Blob.class;
+      case 16: // Types.BOOLEAN was not part of JDK1.2.2
+        return Boolean.class;
+      case Types.CHAR:
+        return String.class;
+      case Types.CLOB:
+        return Clob.class;
+      case 70: // Types.DATALINK was not part of JDK 1.2.2
+        return Object.class;
+      case Types.DATE:
+        return java.sql.Date.class;
+      case Types.DECIMAL:
+        return java.math.BigDecimal.class;
+      case Types.DISTINCT:
+        return Object.class;
+      case Types.DOUBLE:
+        return Double.class;
+      case Types.FLOAT:
+        return Double.class;
+      case Types.INTEGER:
+        return Integer.class;
+      case Types.JAVA_OBJECT:
+        return Object.class;
+      case Types.LONGVARBINARY:
+        return byteArrayClass;
+      case Types.LONGVARCHAR:
+        return String.class;
+      case Types.NULL:
+        return Object.class;
+      case Types.NUMERIC:
+        return java.math.BigDecimal.class;
+      case Types.OTHER:
+        return Object.class;
+      case Types.REAL:
+        return Float.class;
+      case Types.REF:
+        return Ref.class;
+      case Types.SMALLINT:
+        return Short.class;
+      case Types.STRUCT:
+        return Struct.class;
+      case Types.TIME:
+        return Time.class;
+      case Types.TIMESTAMP:
+        return Timestamp.class;
+      case Types.TINYINT:
+        return Byte.class;
+      case Types.VARBINARY:
+        return byteArrayClass;
+      case Types.VARCHAR:
+        return String.class;
+      default:
+        return Object.class;
+    }
+  }
+
+  public static Class[] mapTypes (final ResultSetMetaData rsmd)
+  {
+    final Class[] types;
+    try
+    {
+      types = new Class[rsmd.getColumnCount()];
+    }
+    catch (SQLException sqle)
+    {
+      return null;
+    }
+
+    final ClassLoader cl = ObjectUtilities.getClassLoader(TypeMapper.class);
+    for (int i = 0; i < types.length; i++)
+    {
+      try
+      {
+        try
+        {
+          final String tn = rsmd.getColumnClassName(i + 1);
+          types[i] = cl.loadClass(tn);
+        }
+        catch (Exception oops)
+        {
+          final int colType = rsmd.getColumnType(i + 1);
+          types[i] = mapSQLType(colType);
+        }
+      }
+      catch (Exception e)
+      {
+        types[i] = Object.class;
+      }
+    }
+
+    return types;
+  }
+
+  private TypeMapper ()
+  {
+  }
+}
diff --git a/source/org/jfree/report/modules/misc/tablemodel/configuration.properties b/source/org/jfree/report/modules/misc/tablemodel/configuration.properties
new file mode 100644
index 0000000..28fb909
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/configuration.properties
@@ -0,0 +1,23 @@
+#
+# The tablemodel factory mode for the ResultSetTableModelFactory
+# if set to "simple" the factory will always return a DefaultTableModel.
+#
+# Valid values are "auto" or "simple".
+org.jfree.report.modules.misc.tablemodel.TableFactoryMode=auto
+
+#
+# Defines, whether ResultSetMetaData.getLabel() or ResultSetMetaData.getName()
+# should be used to map column names into column indices.
+#
+# Valid values are "Label" or "Name".
+#
+# Explaination: The JDBC specifications allow the use of both, column
+# names and column labels to query a column. As the ResultSetTablemodel
+# requires a one-to-one mapping between a column name and the column index
+# we have to limit the use to one of them.
+#
+# For most simple queries you may not see any differences. This value defaults
+# to Name for the sake of backward compatibility.
+org.jfree.report.modules.misc.tablemodel.ColumnNameMapping=Name
+
+
diff --git a/source/org/jfree/report/modules/misc/tablemodel/module.properties b/source/org/jfree/report/modules/misc/tablemodel/module.properties
new file mode 100644
index 0000000..1a6a390
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/module.properties
@@ -0,0 +1,19 @@
+#
+# Support classes to make the handling of tablemodels easier.
+#
+
+module-info:
+  name: misc-tablemodel
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Some utility classes to make tablemodels easier to use.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+
diff --git a/source/org/jfree/report/modules/misc/tablemodel/package.html b/source/org/jfree/report/modules/misc/tablemodel/package.html
new file mode 100644
index 0000000..852518c
--- /dev/null
+++ b/source/org/jfree/report/modules/misc/tablemodel/package.html
@@ -0,0 +1,4 @@
+<html><body>
+TableModel support classes. The SQL support is now a native part of JFreeReport,
+and there is no need for ResultSetTableModels at all.
+</body></html>
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/preferences/base/ConfigFactory.java b/source/org/jfree/report/modules/preferences/base/ConfigFactory.java
new file mode 100644
index 0000000..2062e1d
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/base/ConfigFactory.java
@@ -0,0 +1,194 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConfigFactory.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.base;
+
+
+/**
+ * The config factory is used to access the currently active config storage
+ * implementation. The implementation itself allows to read or store a set of properties
+ * stored under a certain path.
+ *
+ * @author Thomas Morgner
+ */
+public final class ConfigFactory
+{
+  /**
+   * The selector configuration key that defines the active config storage
+   * implementation.
+   */
+  public static final String CONFIG_TARGET_KEY = "org.jfree.report.ConfigStore";
+
+  /**
+   * The singleton instance of the config factory.
+   */
+  private static ConfigFactory factory;
+  /**
+   * The user storage is used to store user dependend settings.
+   */
+  private ConfigStorage userStorage;
+  /**
+   * The system storage is used to store system wide settings.
+   */
+  private ConfigStorage systemStorage;
+
+  /**
+   * Returns the singleton instance of the config factory.
+   *
+   * @return the config factory
+   */
+  public synchronized static ConfigFactory getInstance ()
+  {
+    if (factory == null)
+    {
+      factory = new ConfigFactory();
+      factory.defineSystemStorage(new NullConfigStorage());
+      factory.defineUserStorage(new NullConfigStorage());
+    }
+    return factory;
+  }
+
+  /**
+   * DefaultConstructor.
+   */
+  private ConfigFactory ()
+  {
+  }
+
+  /**
+   * Defines the user storage implementation that should be used. This method should only
+   * be called by the module initialization methods.
+   *
+   * @param storage the user settings storage implementation.
+   */
+  public void defineUserStorage (final ConfigStorage storage)
+  {
+    if (storage == null)
+    {
+      throw new NullPointerException();
+    }
+    this.userStorage = storage;
+  }
+
+  /**
+   * Defines the system storage implementation that should be used. This method should
+   * only be called by the module initialization methods.
+   *
+   * @param storage the system settings storage implementation.
+   */
+  public void defineSystemStorage (final ConfigStorage storage)
+  {
+    if (storage == null)
+    {
+      throw new NullPointerException();
+    }
+    this.systemStorage = storage;
+  }
+
+  /**
+   * Returns the user settings storage implementation used in the config subsystem.
+   *
+   * @return the user settingsstorage provider.
+   */
+  public ConfigStorage getUserStorage ()
+  {
+    return userStorage;
+  }
+
+  /**
+   * Returns the system settings storage implementation used in the config subsystem.
+   *
+   * @return the system settings storage provider.
+   */
+  public ConfigStorage getSystemStorage ()
+  {
+    return systemStorage;
+  }
+
+  /**
+   * Checks, whether the given string denotes a valid config storage path. Such an path
+   * must not contain whitespaces or non-alphanumeric characters.
+   *
+   * @param path the path that should be tested.
+   * @return true, if the path is valid, false otherwise.
+   */
+  public static boolean isValidPath (final String path)
+  {
+    final char[] data = path.toCharArray();
+    for (int i = 0; i < data.length; i++)
+    {
+      if (Character.isJavaIdentifierPart(data[i]) == false)
+      {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  /**
+   * Encodes the given configuration path. All non-ascii characters get
+   * replaced by an escape sequence.
+   *
+   * @param path the path.
+   * @return the translated path.
+   */
+  public static String encodePath (final String path)
+  {
+    final char[] data = path.toCharArray();
+    final StringBuffer encoded = new StringBuffer();
+    for (int i = 0; i < data.length; i++)
+    {
+      if (data[i] == '$')
+      {
+        // double quote
+        encoded.append('$');
+        encoded.append('$');
+      }
+      else if (Character.isJavaIdentifierPart(data[i]) == false)
+      {
+        // padded hex string
+        encoded.append('$');
+        final String hex = Integer.toHexString(data[i]);
+        for (int x = hex.length(); x < 4; x++)
+        {
+          encoded.append('0');
+        }
+        encoded.append(hex);
+      }
+      else
+      {
+        encoded.append(data[i]);
+      }
+    }
+    return encoded.toString();
+
+  }
+}
diff --git a/source/org/jfree/report/modules/preferences/base/ConfigStorage.java b/source/org/jfree/report/modules/preferences/base/ConfigStorage.java
new file mode 100644
index 0000000..64edf3a
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/base/ConfigStorage.java
@@ -0,0 +1,77 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConfigStorage.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.base;
+
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+/**
+ * Config storage implementations are used to store a set of properties to a certain key.
+ * <p/>
+ * A valid configuration path does not contain dots, semicolons or colons.
+ * <p/>
+ * A valid path obeys to the same rules as java identifiers ..
+ *
+ * @author Thomas Morgner
+ */
+public interface ConfigStorage
+{
+  /**
+   * Stores the given properties on the defined path.
+   *
+   * @param configPath the path on where to store the properties.
+   * @param properties the properties which should be stored.
+   * @throws ConfigStoreException if an error occured.
+   */
+  public void store (String configPath, Configuration properties)
+          throws ConfigStoreException;
+
+  /**
+   * Loads the properties from the given path, specifying the given properties as
+   * default.
+   *
+   * @param configPath the configuration path from where to read the properties.
+   * @param defaults   the property set that acts as fallback to provide default values.
+   * @return the loaded properties
+   *
+   * @throws ConfigStoreException if an error occured.
+   */
+  public Configuration load (String configPath, Configuration defaults)
+          throws ConfigStoreException;
+
+  /**
+   * Tests, whether some configuration data exists for the given configuration.
+   *
+   * @param configPath the configuration path to the property storage.
+   * @return true, if there are properties under this path, false otherwise.
+   */
+  public boolean isAvailable (String configPath);
+}
diff --git a/source/org/jfree/report/modules/preferences/base/ConfigStoreBaseModule.java b/source/org/jfree/report/modules/preferences/base/ConfigStoreBaseModule.java
new file mode 100644
index 0000000..93e6690
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/base/ConfigStoreBaseModule.java
@@ -0,0 +1,71 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConfigStoreBaseModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.base;
+
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+
+/**
+ * The module definition for the config store system.
+ *
+ * @author Thomas Morgner
+ */
+public class ConfigStoreBaseModule extends AbstractModule
+{
+  /**
+   * DefaultConstructor. Loads the module specification.
+   *
+   * @throws ModuleInitializeException if an error occured.
+   */
+  public ConfigStoreBaseModule ()
+          throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup operations. This
+   * method is called only once in a modules lifetime. If the initializing cannot be
+   * completed, throw a ModuleInitializeException to indicate the error,. The module will
+   * not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize (SubSystem subSystem)
+          throws ModuleInitializeException
+  {
+  }
+}
diff --git a/source/org/jfree/report/modules/preferences/base/ConfigStoreException.java b/source/org/jfree/report/modules/preferences/base/ConfigStoreException.java
new file mode 100644
index 0000000..7997050
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/base/ConfigStoreException.java
@@ -0,0 +1,72 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConfigStoreException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.base;
+
+import org.pentaho.reporting.libraries.base.util.StackableException;
+
+
+/**
+ * The config store exception is throwns if an error prevents an operation on the current
+ * configuration storage provider.
+ *
+ * @author Thomas Morgner
+ */
+public class ConfigStoreException extends StackableException
+{
+  /**
+   * DefaultConstructor.
+   */
+  public ConfigStoreException ()
+  {
+  }
+
+  /**
+   * Creates a config store exception with the given message and root exception.
+   *
+   * @param s the exception message.
+   * @param e the exception that caused all the trouble.
+   */
+  public ConfigStoreException (final String s, final Exception e)
+  {
+    super(s, e);
+  }
+
+  /**
+   * Creates a config store exception with the given message.
+   *
+   * @param s the message.
+   */
+  public ConfigStoreException (final String s)
+  {
+    super(s);
+  }
+}
diff --git a/source/org/jfree/report/modules/preferences/base/NullConfigStorage.java b/source/org/jfree/report/modules/preferences/base/NullConfigStorage.java
new file mode 100644
index 0000000..72d1054
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/base/NullConfigStorage.java
@@ -0,0 +1,96 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: NullConfigStorage.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.base;
+
+import org.pentaho.reporting.libraries.base.config.Configuration;
+
+
+/**
+ * An empty default implementation. This config storare will not store any values and will
+ * provide no read access to stored properties by denying their existence.
+ *
+ * @author Thomas Morgner
+ */
+public class NullConfigStorage implements ConfigStorage
+{
+  /**
+   * DefaultConstructor.
+   */
+  public NullConfigStorage ()
+  {
+  }
+
+  /**
+   * This method does nothing.
+   *
+   * @param configPath this parameter is not used.
+   * @param properties this parameter is not used.
+   * @see org.jfree.report.modules.misc.configstore.base.ConfigStorage#storeProperties
+   *      (java.lang.String, java.util.Properties)
+   */
+  public void store (final String configPath, final Configuration properties)
+  {
+  }
+
+  /**
+   * Loads the properties from the given path, specifying the given properties as
+   * default.
+   * <p/>
+   * This implementation will always throw and ConfigStoreException as the specified
+   * resource is not available.
+   *
+   * @param configPath the configuration path from where to read the properties.
+   * @param defaults   the property set that acts as fallback to provide default values.
+   * @return the loaded properties
+   *
+   * @throws ConfigStoreException always throws this exception as the specified resource
+   *                              will be not available.
+   */
+  public Configuration load (final String configPath, final Configuration defaults)
+          throws ConfigStoreException
+  {
+    throw new ConfigStoreException("This configuration path is not available.");
+  }
+
+  /**
+   * Tests, whether some configuration data exists for the given configuration.
+   * <p/>
+   * This method returns always false and denies the existence of any resource.
+   *
+   * @param configPath the configuration path to the property storage.
+   * @return always false as this implementation does not store anything.
+   */
+  public boolean isAvailable (final String configPath)
+  {
+    return false;
+  }
+}
diff --git a/source/org/jfree/report/modules/preferences/base/module.properties b/source/org/jfree/report/modules/preferences/base/module.properties
new file mode 100644
index 0000000..98344a5
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/base/module.properties
@@ -0,0 +1,24 @@
+#
+# Support for temporary configuration files. This should be used to cache
+# results from other modules. This is not intended to configure the behaviour
+# of JFreeReport, use the ReportConfiguration for that purpose.
+#
+# Deleting these configurations should not kill your application, if it does
+# the module implementor did a really bad job.
+#
+
+module-info:
+  name: preferences-base
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Initialializer to support external configuration storages.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+  subsystem: configstore
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/preferences/base/package.html b/source/org/jfree/report/modules/preferences/base/package.html
new file mode 100644
index 0000000..8a38c2f
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/base/package.html
@@ -0,0 +1,7 @@
+<html>
+<body>
+Base classes for the config store system. This module provides base
+services to save property files in a plattform and java vm version
+independent way.
+</body>
+</html>
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/preferences/filesystem/FileConfigStorage.java b/source/org/jfree/report/modules/preferences/filesystem/FileConfigStorage.java
new file mode 100644
index 0000000..a8fe277
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/filesystem/FileConfigStorage.java
@@ -0,0 +1,190 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FileConfigStorage.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.filesystem;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.jfree.report.modules.preferences.base.ConfigFactory;
+import org.jfree.report.modules.preferences.base.ConfigStorage;
+import org.jfree.report.modules.preferences.base.ConfigStoreException;
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.base.config.HierarchicalConfiguration;
+import org.pentaho.reporting.libraries.base.config.ModifiableConfiguration;
+
+
+/**
+ * The FileConfigStorage is a storage provider that stores its content on the
+ * local filesystem. The directory used contains the data as plain text property
+ * files.
+ *
+ * @author Thomas Morgner
+ */
+public class FileConfigStorage implements ConfigStorage
+{
+  /** The base directory of the storage provider. */
+  private final File baseDirectory;
+  /** The configuration header text that is appended to all property files. */
+  private static final String CONFIGHEADER =
+          "part of the jfreereport filesystem config store";
+
+  /**
+   * Creates a new file config storage and stores the contents in the given
+   * directory.
+   *
+   * @param baseDirectory the directory that should contain the files.
+   */
+  public FileConfigStorage(final File baseDirectory)
+  {
+    this.baseDirectory = baseDirectory;
+  }
+
+  /**
+   * Stores the given properties on the defined path.
+   * <p/>
+   * This implementation stores the data as property files.
+   *
+   * @param configPath the configuration path that specifies where to store the
+   *                   properties.
+   * @param config the properties which should be stored.
+   * @throws ConfigStoreException if an error occured.
+   */
+  public void store(final String configPath, final Configuration config)
+          throws ConfigStoreException
+  {
+    if (ConfigFactory.isValidPath(configPath) == false)
+    {
+      throw new IllegalArgumentException("The give path is not valid.");
+    }
+    final Enumeration keys = config.getConfigProperties();
+    final Properties properties = new Properties();
+    while (keys.hasMoreElements())
+    {
+      final String key = (String) keys.nextElement();
+      final String value = config.getConfigProperty(key);
+      if (value != null && key != null)
+      {
+        properties.put(key, value);
+      }
+    }
+
+    final File target = new File(baseDirectory, configPath);
+    if (target.exists() == true && target.canWrite() == false)
+    {
+      return;
+    }
+    try
+    {
+      final OutputStream out = new BufferedOutputStream(new FileOutputStream(
+              target));
+      properties.store(out, CONFIGHEADER);
+      out.close();
+    }
+    catch (Exception e)
+    {
+      throw new ConfigStoreException("Failed to write config " + configPath, e);
+    }
+  }
+
+  /**
+   * Loads the properties from the given path, specifying the given properties
+   * as default.
+   *
+   * @param configPath the configuration path from where to load the
+   *                   properties.
+   * @param defaults   the property set that acts as fallback to provide default
+   *                   values.
+   * @return the loaded properties.
+   * @throws ConfigStoreException if an error occured.
+   */
+  public Configuration load(final String configPath,
+                            final Configuration defaults)
+          throws ConfigStoreException
+  {
+    if (ConfigFactory.isValidPath(configPath) == false)
+    {
+      throw new IllegalArgumentException("The given path is not valid.");
+    }
+    try
+    {
+      final Properties properties = new Properties();
+      final File target = new File(baseDirectory, configPath);
+      final InputStream in = new BufferedInputStream(new FileInputStream(
+              target));
+      properties.load(in);
+      in.close();
+
+      final ModifiableConfiguration config = new HierarchicalConfiguration(defaults);
+      final Iterator keys = properties.keySet().iterator();
+      while (keys.hasNext())
+      {
+        String key = (String) keys.next();
+        config.setConfigProperty(key, properties.getProperty(key));
+      }
+      return config;
+    }
+    catch (Exception e)
+    {
+      throw new ConfigStoreException("Failed to read config" + configPath, e);
+    }
+  }
+
+  /**
+   * Tests, whether some configuration data exists for the given configuration.
+   *
+   * @param configPath the configuration path to the property storage.
+   * @return true, if there are properties under this path, false otherwise.
+   */
+  public boolean isAvailable(final String configPath)
+  {
+    if (ConfigFactory.isValidPath(configPath) == false)
+    {
+      throw new IllegalArgumentException("The give path is not valid.");
+    }
+
+    final File target = new File(baseDirectory, configPath);
+    return target.exists() && target.canRead();
+  }
+
+  public String toString()
+  {
+    return "FileConfigStorage={baseDir=" + baseDirectory + "}";
+  }
+}
diff --git a/source/org/jfree/report/modules/preferences/filesystem/FileConfigStoreModule.java b/source/org/jfree/report/modules/preferences/filesystem/FileConfigStoreModule.java
new file mode 100644
index 0000000..97a2d25
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/filesystem/FileConfigStoreModule.java
@@ -0,0 +1,79 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FileConfigStoreModule.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.filesystem;
+
+import org.jfree.report.JFreeReportBoot;
+import org.pentaho.reporting.libraries.base.boot.AbstractModule;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+import org.pentaho.reporting.libraries.base.boot.SubSystem;
+
+/**
+ * The module definition for the filesystem config storage module. This module provides an
+ * configuration store implementation that saves all properties to an configurable
+ * directory on the filesystem.
+ *
+ * @author Thomas Morgner
+ */
+public class FileConfigStoreModule extends AbstractModule
+{
+  /**
+   * DefaultConstructor. Loads the module specification.
+   *
+   * @throws ModuleInitializeException if an error occured.
+   */
+  public FileConfigStoreModule ()
+          throws ModuleInitializeException
+  {
+    loadModuleInfo();
+  }
+
+  /**
+   * Initializes the module. Use this method to perform all initial setup operations. This
+   * method is called only once in a modules lifetime. If the initializing cannot be
+   * completed, throw a ModuleInitializeException to indicate the error,. The module will
+   * not be available to the system.
+   *
+   * @param subSystem the subSystem.
+   * @throws ModuleInitializeException
+   *          if an error ocurred while initializing the module.
+   */
+  public void initialize (final SubSystem subSystem)
+          throws ModuleInitializeException
+  {
+    final String value = JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+            ("org.jfree.report.ConfigStore", "<not defined>");
+    if (value.equals(FileConfigStorage.class.getName()))
+    {
+      performExternalInitialize(FileConfigStoreModuleInitializer.class.getName(), FileConfigStoreModule.class);
+    }
+  }
+}
diff --git a/source/org/jfree/report/modules/preferences/filesystem/FileConfigStoreModuleInitializer.java b/source/org/jfree/report/modules/preferences/filesystem/FileConfigStoreModuleInitializer.java
new file mode 100644
index 0000000..ffb390c
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/filesystem/FileConfigStoreModuleInitializer.java
@@ -0,0 +1,157 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FileConfigStoreModuleInitializer.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.preferences.filesystem;
+
+import java.io.File;
+
+import org.jfree.report.JFreeReportBoot;
+import org.jfree.report.modules.preferences.base.ConfigFactory;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializer;
+import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException;
+
+/**
+ * The initializer is used to setup the file system storage provider and to register the
+ * providers at the configfactory.
+ * <p/>
+ * The directories are specified in the report configuration at boot time. If an directory
+ * name starts with "~/", the users home directory is used as base directory for that
+ * string.
+ *
+ * @author Thomas Morgner
+ */
+public class FileConfigStoreModuleInitializer implements ModuleInitializer
+{
+  /**
+   * The configuration key that specifies the base directory for the user configuration
+   * storage.
+   */
+  public static final String USER_BASEDIR_CONFIG_KEY =
+          "org.jfree.report.modules.misc.configstore.filesystem.UserTargetDir";
+
+  /**
+   * The configuration key that specifies the base directory for the system configuration
+   * storage.
+   */
+  public static final String SYSTEM_BASEDIR_CONFIG_KEY =
+          "org.jfree.report.modules.misc.configstore.filesystem.SystemTargetDir";
+
+  /**
+   * DefaultConstructor.
+   */
+  public FileConfigStoreModuleInitializer ()
+  {
+  }
+
+  /**
+   * Performs the module initialization and registers the storage providers at the config
+   * factory.
+   *
+   * @throws ModuleInitializeException if an error occures
+   */
+  public void performInit ()
+          throws ModuleInitializeException
+  {
+    final String userBaseDirectory =
+            JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+            (USER_BASEDIR_CONFIG_KEY, "~/.jfreereport/user");
+
+    final String systemBaseDirectory =
+            JFreeReportBoot.getInstance().getGlobalConfig().getConfigProperty
+            (SYSTEM_BASEDIR_CONFIG_KEY, "~/.jfreereport/system");
+
+    final ConfigFactory factory = ConfigFactory.getInstance();
+    factory.defineUserStorage(new FileConfigStorage(getStoragePath(userBaseDirectory)));
+    factory.defineSystemStorage(new FileConfigStorage(getStoragePath(systemBaseDirectory)));
+  }
+
+  /**
+   * Tries to fint the specified directory and creates a new one if the directory does not
+   * yet exist. An occurence of "~/" at the beginning of the name will be replaced with
+   * the users home directory.
+   *
+   * @param baseDirectory the base directory as specified in the configuration.
+   * @return the file object pointing to that directory.
+   *
+   * @throws ModuleInitializeException
+   *          if an error occured or the directory could not be created.
+   */
+  private File getStoragePath (String baseDirectory)
+          throws ModuleInitializeException
+  {
+    final File baseDirectoryFile;
+
+    if (baseDirectory.startsWith("~/") == false)
+    {
+      baseDirectoryFile = new File(baseDirectory);
+    }
+    else
+    {
+      try
+      {
+        final String homeDirectory = System.getProperty("user.home");
+        if (baseDirectory.equals("~/"))
+        {
+          baseDirectoryFile = new File(homeDirectory);
+        }
+        else
+        {
+          baseDirectory = "." + baseDirectory.substring(1);
+          baseDirectoryFile = new File(homeDirectory, baseDirectory);
+        }
+      }
+      catch (Exception e)
+      {
+        throw new ModuleInitializeException
+                ("Failed to create the file config storage.", e);
+      }
+    }
+
+    if (baseDirectoryFile.exists() == false)
+    {
+      if (baseDirectoryFile.mkdirs() == false)
+      {
+        throw new ModuleInitializeException
+                ("Unable to create the specified directory.");
+      }
+    }
+    else
+    {
+      if (baseDirectoryFile.canRead() == false ||
+              baseDirectoryFile.canWrite() == false)
+      {
+        throw new ModuleInitializeException
+                ("Unable to access the specified directory.");
+      }
+    }
+    return baseDirectoryFile;
+  }
+}
diff --git a/source/org/jfree/report/modules/preferences/filesystem/configuration.properties b/source/org/jfree/report/modules/preferences/filesystem/configuration.properties
new file mode 100644
index 0000000..3d1f341
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/filesystem/configuration.properties
@@ -0,0 +1,15 @@
+#
+# Configuration settings for the file config storage provider module.
+#
+
+#
+# Defines the directory, where the user settings will be stored.
+# If the directory starts with an '~/', the given directory will be
+# considered relative to the users home directory.
+org.jfree.report.modules.preferences.filesystem.UserTargetDir=~/.jfreereport/user
+
+#
+# Defines the directory, where the system settings will be stored.
+# If the directory starts with an '~/', the given directory will be
+# considered relative to the users home directory.
+org.jfree.report.modules.preferences.filesystem.SystemTargetDir=~/.jfreereport/system
\ No newline at end of file
diff --git a/source/org/jfree/report/modules/preferences/filesystem/module.properties b/source/org/jfree/report/modules/preferences/filesystem/module.properties
new file mode 100644
index 0000000..ab3d219
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/filesystem/module.properties
@@ -0,0 +1,32 @@
+#
+# Support for temporary configuration files. This should be used to cache
+# results from other modules. This is not intended to configure the behaviour
+# of JFreeReport, use the ReportConfiguration for that purpose.
+#
+# Deleting these configurations should not kill your application, if it does
+# the module implementor did a really bad job.
+#
+# This implementation stores the files in a user defined folder.
+# Use ~ to define a home directory relative storage path.
+#
+module-info:
+  name: preferences-filesystem
+  producer: The JFreeReport project - jfreereport.pentaho.org
+  description: Initialializer to support external configuration storages.
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+  subsystem: configstore
+
+depends:
+  module: org.jfree.report.modules.preferences.base.ConfigStoreBaseModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
+depends:
+  module: org.jfree.report.JFreeReportCoreModule
+  version.major: 0
+  version.minor: 90
+  version.patchlevel: 0
+
diff --git a/source/org/jfree/report/modules/preferences/filesystem/package.html b/source/org/jfree/report/modules/preferences/filesystem/package.html
new file mode 100644
index 0000000..4dda40d
--- /dev/null
+++ b/source/org/jfree/report/modules/preferences/filesystem/package.html
@@ -0,0 +1,6 @@
+<html>
+<body>
+Supports storing the configuration settings into the local
+filesystem. 
+</body>
+</html>
\ No newline at end of file
diff --git a/source/org/jfree/report/package.html b/source/org/jfree/report/package.html
new file mode 100644
index 0000000..6366dc1
--- /dev/null
+++ b/source/org/jfree/report/package.html
@@ -0,0 +1,81 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<body bgcolor="white">
+Main classes in the JFreeReport class library.
+<p>
+Some rules when working with the report definition objects:
+<ul>
+<li>Functions cannot be added to the report once the report generation has
+started.
+<li>Do not modify the report structure after the report
+generation is started, unless you know exactly what you are doing.
+<li>It is safe to modify the report definition <b>before</b> the report is
+started.
+<li>Once the report processing has started, the report from the report
+processor must not be reused for other purposes.
+</ul>  
+</p>
+<h2>Groups</h2>
+<p>
+A group is a set of database rows, where the contents of the group
+fields are equal for all rows.
+</p>
+<p>
+Lets look at the following table:
+</p>
+<p>
+<table>
+<tr><th>Car</th><th>Color</th><th>Price</th></tr>
+<tr><td>Toyota</td><td>blue</td><td>10.000</td></tr>
+<tr><td>Toyota</td><td>blue</td><td>20.000</td></tr>
+<tr><td>Toyota</td><td>red</td><td>15.000</td></tr>
+<tr><td>Lexus</td><td>blue</td><td>25.000</td></tr>
+<tr><td>Lexus</td><td>yellow</td><td>15.000</td></tr>
+<tr><td>BMW</td><td>yellow</td><td>40.000</td></tr>
+<tr><td>BMW</td><td>blue</td><td>35.000</td></tr>
+<tr><td>BMW</td><td>green</td><td>5.000</td></tr>
+</table>
+</p>
+<p>
+ Groups are always defined on sorted tables.
+ A group is defined by selecting one or more rows, which should
+ form the group. A group instance will contain all rows from the
+ beginning of the group until one of the group fields changes.
+</p>
+<p>
+ Lets select the row car for our group:
+</p>
+<p>
+ Selecting that row as group argument will result in 3 group instances.
+ The first group instance will contain the first 3 rows (as the contents
+ of these rows are equal).
+</p>
+<p>
+ The next instance will contain all rows of the "Lexus" car and the
+ last group contains all rows from the "BMW" rows.
+</p>
+<p>
+ If a group is defined by more than one field, then the group will end,
+ if one of the group member fields changes.
+</p>
+<p>
+ Lets define a group which consists of "Car" and "Color".
+</p>
+<p>
+ The first instance of the group will contain the first 2 rows (Toyota,blue).
+ Then the value in the column "Color" changes, so a new group
+ instance is started. This new group contains a single row, as the
+ column "Car" in the next row will contain a different value.
+</p>
+<p>
+ The next two group instances are "Lexus, blue" and "Lexus, yellow", both
+ group instances contain 1 row, as the color changes after 1 row.
+</p>
+<p>
+ The next row starts a new group, as the column "Car" contains a different
+ value (BWM instead of Lexus). It doesn't matter, that the color is still
+ equal, to end a group instance, it is sufficient that one column value
+ changed.
+</p>
+</body>
+</html>
diff --git a/source/org/jfree/report/structure/ContentElement.java b/source/org/jfree/report/structure/ContentElement.java
new file mode 100644
index 0000000..20ceada
--- /dev/null
+++ b/source/org/jfree/report/structure/ContentElement.java
@@ -0,0 +1,72 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ContentElement.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.structure;
+
+import org.jfree.report.expressions.Expression;
+
+/**
+ * A element holding values from the report data sources. These values can be
+ * URLs (pointing to text, images or drawables), Images, Text, Nodes, Drawables
+ * or Shapes.
+ *
+ * @author Thomas Morgner
+ */
+public class ContentElement extends Element
+{
+  private Expression valueExpression;
+
+  public ContentElement()
+  {
+    setType("content");
+  }
+
+  public Expression getValueExpression()
+  {
+    return valueExpression;
+  }
+
+  public void setValueExpression(final Expression valueExpression)
+  {
+    this.valueExpression = valueExpression;
+  }
+
+
+  public Object clone()
+      throws CloneNotSupportedException
+  {
+    final ContentElement ce = (ContentElement) super.clone();
+    if (valueExpression != null)
+    {
+      ce.valueExpression = (Expression) valueExpression.clone();
+    }
+    return ce;
+  }
+}
diff --git a/source/org/jfree/report/structure/DetailSection.java b/source/org/jfree/report/structure/DetailSection.java
new file mode 100644
index 0000000..aecc411
--- /dev/null
+++ b/source/org/jfree/report/structure/DetailSection.java
@@ -0,0 +1,48 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DetailSection.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.structure;
+
+import org.jfree.report.flow.FlowControlOperation;
+
+/**
+ * This is a convienence class. Reports dont look for it, but users do.
+ *
+ * @author Thomas Morgner
+ */
+public class DetailSection extends Section
+{
+  public DetailSection()
+  {
+    setType("detail-section");
+    addOperationBefore(FlowControlOperation.ADVANCE);
+    setRepeat(true);
+  }
+}
diff --git a/source/org/jfree/report/structure/Element.java b/source/org/jfree/report/structure/Element.java
new file mode 100644
index 0000000..3d79409
--- /dev/null
+++ b/source/org/jfree/report/structure/Element.java
@@ -0,0 +1,573 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: Element.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.structure;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.Collections;
+
+import org.jfree.layouting.input.style.CSSStyleRule;
+import org.jfree.layouting.input.style.keys.box.BoxStyleKeys;
+import org.jfree.layouting.input.style.values.CSSConstant;
+import org.jfree.layouting.namespace.Namespaces;
+import org.jfree.layouting.util.AttributeMap;
+import org.jfree.layouting.util.LocaleUtility;
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.expressions.Expression;
+
+/**
+ * An element is a node that can have attributes. The 'id' and the 'name'
+ * attribute is defined for all elements.
+ * <p/>
+ * Both the name and the id attribute may be null.
+ * <p/>
+ * Properties in the 'http://jfreereport.sourceforge.net/namespaces/engine/flow'
+ * namespace and in the 'http://jfreereport.sourceforge.net/namespaces/engine/compatibility'
+ * namespace are considered internal. You should only touch them, if you really
+ * know what you are doing.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class Element extends Node
+{
+  private static final Expression[] EMPTY_EXPRESSIONS = new Expression[0];
+  private static final Map EMPTY_MAP = Collections.unmodifiableMap(new HashMap());
+  public static final String NAME_ATTRIBUTE = "name";
+  public static final String ID_ATTRIBUTE = "id";
+  /**
+   * The type corresponds (somewhat) to the tagname of HTML.
+   */
+  public static final String TYPE_ATTRIBUTE = "type";
+  /**
+   * See XML-Namespaces for the idea of that one ...
+   */
+  public static final String NAMESPACE_ATTRIBUTE = "namespace";
+  public static final String VIRTUAL_ATTRIBUTE = "virtual";
+
+  private transient AttributeMap readOnlyAttributes;
+  private AttributeMap attributes;
+  private CSSStyleRule style;
+  private ArrayList expressions;
+  private transient AttributeMap readOnlyAttributeExpressions;
+  private AttributeMap attributeExpressions;
+  private HashMap styleExpressions;
+  private Map cachedStyleExpressions;
+  private boolean enabled;
+  private boolean virtual;
+  private Expression displayCondition;
+
+  /**
+   * Constructs an element.
+   * <p/>
+   * The element inherits the element's defined default ElementStyleSheet to
+   * provide reasonable default values for common stylekeys. When the element is
+   * added to the band, the bands stylesheet is set as parent to the element's
+   * stylesheet.
+   * <p/>
+   * A datasource is assigned with this element is set to a default source,
+   * which always returns null.
+   */
+  protected Element()
+  {
+    this.style = new CSSStyleRule(null, null);
+    this.attributes = new AttributeMap();
+    this.enabled = true;
+    setNamespace(JFreeReportInfo.REPORT_NAMESPACE);
+  }
+
+  public String getNamespace()
+  {
+    return (String) getAttribute
+        (JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE);
+  }
+
+  public void setNamespace(final String id)
+  {
+    setAttribute
+        (JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, id);
+  }
+
+  public String getId()
+  {
+    return (String) getAttribute
+        (Namespaces.XML_NAMESPACE, Element.ID_ATTRIBUTE);
+  }
+
+  public void setId(final String id)
+  {
+    setAttribute(Namespaces.XML_NAMESPACE, Element.ID_ATTRIBUTE, id);
+  }
+
+  public String getType()
+  {
+    return (String) getAttribute
+        (JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE);
+  }
+
+  public void setType(final String type)
+  {
+    setAttribute
+        (JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, type);
+  }
+
+  /**
+   * Defines the name for this Element. The name must not be empty, or a
+   * NullPointerException is thrown.
+   * <p/>
+   * Names can be used to lookup an element within a band. There is no
+   * requirement for element names to be unique.
+   *
+   * @param name the name of this element
+   */
+  public void setName(final String name)
+  {
+    setAttribute(Namespaces.XML_NAMESPACE, Element.NAME_ATTRIBUTE, name);
+  }
+
+
+  /**
+   * Returns the name of the Element. The name of the Element is never null.
+   *
+   * @return the name.
+   */
+  public String getName()
+  {
+    return (String) getAttribute
+        (Namespaces.XML_NAMESPACE, Element.NAME_ATTRIBUTE);
+  }
+
+  public void setAttribute(final String name, final Object value)
+  {
+    setAttribute(getNamespace(), name, value);
+  }
+
+  public void setAttribute(final String namespace,
+                           final String name,
+                           final Object value)
+  {
+    if (name == null)
+    {
+      throw new NullPointerException();
+    }
+    this.attributes.setAttribute(namespace, name, value);
+    readOnlyAttributes = null;
+  }
+
+  public Object getAttribute(final String name)
+  {
+    return getAttribute(getNamespace(), name);
+  }
+
+  public Object getAttribute(final String namespace, final String name)
+  {
+    return this.attributes.getAttribute(namespace, name);
+  }
+
+  public AttributeMap getAttributeMap()
+  {
+    if (this.readOnlyAttributes == null)
+    {
+      this.readOnlyAttributes = this.attributes.createUnmodifiableMap();
+    }
+    else if (readOnlyAttributes.getChangeTracker() != this.attributes.getChangeTracker())
+    {
+      this.readOnlyAttributes = this.attributes.createUnmodifiableMap();
+    }
+    return readOnlyAttributes;
+  }
+
+  /**
+   * Returns this elements private stylesheet. This sheet can be used to
+   * override the default values set in one of the parent-stylesheets.
+   *
+   * @return the Element's stylesheet
+   */
+  public CSSStyleRule getStyle()
+  {
+    return style;
+  }
+
+  public void setVisibility(final CSSConstant v)
+  {
+    getStyle().setPropertyValue(BoxStyleKeys.VISIBILITY, v);
+  }
+
+
+  public CSSConstant getVisibility()
+  {
+    return (CSSConstant) getStyle().getPropertyCSSValue(BoxStyleKeys.VISIBILITY);
+  }
+
+  public void setAttributeExpression(final String attr,
+                                     final Expression function)
+  {
+    setAttribute(getNamespace(), attr, function);
+  }
+
+  /**
+   * Adds a function to the report's collection of expressions.
+   *
+   * @param namespace
+   * @param attr
+   * @param function  the function.
+   */
+  public void setAttributeExpression(final String namespace,
+                                     final String attr,
+                                     final Expression function)
+  {
+
+    if (attributeExpressions == null)
+    {
+      if (function == null)
+      {
+        return;
+      }
+      this.attributeExpressions = new AttributeMap();
+    }
+    attributeExpressions.setAttribute(namespace, attr, function);
+    readOnlyAttributeExpressions = null;
+  }
+
+  /**
+   * Returns the expressions for the report.
+   *
+   * @param attr
+   * @return the expressions.
+   */
+  public Expression getAttributeExpression(final String attr)
+  {
+    return getAttributeExpression(getNamespace(), attr);
+  }
+
+  public Expression getAttributeExpression(final String namespace,
+                                           final String attr)
+  {
+    if (attributeExpressions == null)
+    {
+      return null;
+    }
+    return (Expression) attributeExpressions.getAttribute(namespace, attr);
+  }
+
+  public Map getAttributeExpressions(final String namespace)
+  {
+    if (attributeExpressions == null)
+    {
+      return null;
+    }
+    return attributeExpressions.getAttributes(namespace);
+  }
+
+  public AttributeMap getAttributeExpressionMap()
+  {
+    if (this.attributeExpressions == null)
+    {
+      this.readOnlyAttributeExpressions = new AttributeMap();
+      return readOnlyAttributeExpressions;
+    }
+
+    if (this.readOnlyAttributeExpressions == null)
+    {
+      this.readOnlyAttributeExpressions = this.attributeExpressions.createUnmodifiableMap();
+    }
+    else if (readOnlyAttributeExpressions.getChangeTracker() != this.attributeExpressions.getChangeTracker())
+    {
+      this.readOnlyAttributeExpressions = this.attributeExpressions.createUnmodifiableMap();
+    }
+    return readOnlyAttributeExpressions;
+  }
+
+
+  /**
+   * Adds a function to the report's collection of expressions.
+   *
+   * @param function the function.
+   * @param property
+   */
+  public void setStyleExpression(final String property,
+                                 final Expression function)
+  {
+    if (function == null)
+    {
+      if (styleExpressions != null)
+      {
+        styleExpressions.remove(property);
+        cachedStyleExpressions = null;
+      }
+    }
+    else
+    {
+      if (styleExpressions == null)
+      {
+        styleExpressions = new HashMap();
+      }
+      styleExpressions.put(property, function);
+      cachedStyleExpressions = null;
+    }
+  }
+
+  /**
+   * Returns the expressions for the report.
+   *
+   * @param property
+   * @return the expressions.
+   */
+  public Expression getStyleExpression(final String property)
+  {
+    if (styleExpressions == null)
+    {
+      return null;
+    }
+    return (Expression) styleExpressions.get(property);
+  }
+
+  /** @noinspection ReturnOfCollectionOrArrayField*/
+  public Map getStyleExpressions()
+  {
+    if (styleExpressions == null)
+    {
+      return Element.EMPTY_MAP;
+    }
+    if (cachedStyleExpressions != null)
+    {
+      return cachedStyleExpressions;
+    }
+    cachedStyleExpressions = Collections.unmodifiableMap(styleExpressions);
+    return cachedStyleExpressions;
+  }
+
+  /**
+   * Adds a function to the report's collection of expressions.
+   *
+   * @param function the function.
+   */
+  public void addExpression(final Expression function)
+  {
+    if (expressions == null)
+    {
+      expressions = new ArrayList();
+    }
+    expressions.add(function);
+  }
+
+  /**
+   * Returns the expressions for the report.
+   *
+   * @return the expressions.
+   */
+  public Expression[] getExpressions()
+  {
+    if (expressions == null)
+    {
+      return Element.EMPTY_EXPRESSIONS;
+    }
+    return (Expression[]) expressions.toArray
+        (new Expression[expressions.size()]);
+  }
+
+  /**
+   * Sets the expressions for the report.
+   *
+   * @param expressions the expressions (<code>null</code> not permitted).
+   */
+  public void setExpressions(final Expression[] expressions)
+  {
+    if (expressions == null)
+    {
+      throw new NullPointerException(
+          "JFreeReport.setExpressions(...) : null not permitted.");
+    }
+    if (this.expressions == null)
+    {
+      this.expressions = new ArrayList(expressions.length);
+    }
+    else
+    {
+      this.expressions.clear();
+    }
+    this.expressions.addAll(Arrays.asList(expressions));
+  }
+
+  /**
+   * Returns true, if the element is enabled.
+   *
+   * @return true or false
+   */
+  public boolean isEnabled()
+  {
+    return enabled;
+  }
+
+  /**
+   * Defines whether the element is enabled. Disabled elements will be fully
+   * ignored by the report processor. This is a design time property to exclude
+   * elements from the processing without actually having to deal with the other
+   * complex properties.
+   *
+   * @param enabled
+   */
+  public void setEnabled(final boolean enabled)
+  {
+    this.enabled = enabled;
+  }
+
+  public Expression getDisplayCondition()
+  {
+    return displayCondition;
+  }
+
+  public void setDisplayCondition(final Expression displayCondition)
+  {
+    this.displayCondition = displayCondition;
+  }
+
+  public Locale getLocale()
+  {
+    final Locale locale = getLocaleFromAttributes();
+    if (locale != null)
+    {
+      return locale;
+    }
+    return super.getLocale();
+  }
+
+  protected Locale getLocaleFromAttributes()
+  {
+    final Object mayBeXmlLang = getAttribute(Namespaces.XML_NAMESPACE, "lang");
+    if (mayBeXmlLang instanceof String)
+    {
+      return LocaleUtility.createLocale((String) mayBeXmlLang);
+    }
+    else if (mayBeXmlLang instanceof Locale)
+    {
+      return (Locale) mayBeXmlLang;
+    }
+
+    final Object mayBeXhtmlLang = getAttribute(Namespaces.XHTML_NAMESPACE,
+        "lang");
+    if (mayBeXhtmlLang instanceof String)
+    {
+      return LocaleUtility.createLocale((String) mayBeXhtmlLang);
+    }
+    else if (mayBeXhtmlLang instanceof Locale)
+    {
+      return (Locale) mayBeXhtmlLang;
+    }
+//
+//    final Object mayBeHtmlLang = getAttribute(Namespaces.XHTML_NAMESPACE, "lang");
+//    if (mayBeHtmlLang instanceof String)
+//    {
+//      return LocaleUtility.createLocale((String) mayBeHtmlLang);
+//    }
+//    else if (mayBeHtmlLang instanceof Locale)
+//    {
+//      return (Locale) mayBeHtmlLang;
+//    }
+
+    return null;
+  }
+
+  public boolean isVirtual()
+  {
+    return virtual;
+  }
+
+  public void setVirtual(final boolean virtual)
+  {
+    this.virtual = virtual;
+  }
+
+
+  public Object clone()
+      throws CloneNotSupportedException
+  {
+    final Element element = (Element) super.clone();
+    element.style = (CSSStyleRule) style.clone();
+    if (attributes != null)
+    {
+      element.attributes = (AttributeMap) attributes.clone();
+    }
+
+    if (attributeExpressions != null)
+    {
+      element.attributeExpressions = (AttributeMap) attributeExpressions.clone();
+      final String[] namespaces = element.attributeExpressions.getNameSpaces();
+      for (int i = 0; i < namespaces.length; i++)
+      {
+        final String namespace = namespaces[i];
+        final Map attrsNs = element.attributeExpressions.getAttributes(
+            namespace);
+        final Iterator it =
+            attrsNs.entrySet().iterator();
+        while (it.hasNext())
+        {
+          final Map.Entry entry = (Map.Entry) it.next();
+          final Expression exp = (Expression) entry.getValue();
+          entry.setValue(exp.clone());
+        }
+      }
+    }
+
+    if (expressions != null)
+    {
+      element.expressions = (ArrayList) expressions.clone();
+      element.expressions.clear();
+      for (int i = 0; i < expressions.size(); i++)
+      {
+        final Expression expression = (Expression) expressions.get(i);
+        element.expressions.add(expression.clone());
+      }
+    }
+    if (styleExpressions != null)
+    {
+      element.styleExpressions = (HashMap) styleExpressions.clone();
+      final Iterator styleExpressionsIt =
+          element.styleExpressions.entrySet().iterator();
+      while (styleExpressionsIt.hasNext())
+      {
+        final Map.Entry entry = (Map.Entry) styleExpressionsIt.next();
+        final Expression exp = (Expression) entry.getValue();
+        entry.setValue(exp.clone());
+      }
+    }
+
+    if (displayCondition != null)
+    {
+      element.displayCondition = (Expression) displayCondition.clone();
+    }
+    return element;
+  }
+}
diff --git a/source/org/jfree/report/structure/Group.java b/source/org/jfree/report/structure/Group.java
new file mode 100644
index 0000000..8e00ad6
--- /dev/null
+++ b/source/org/jfree/report/structure/Group.java
@@ -0,0 +1,104 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: Group.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.structure;
+
+import org.jfree.report.expressions.Expression;
+
+/**
+ * A report group. A group is a repeated section which is bound to an
+ * expression.
+ * <p/>
+ * <h2>Default Behaviour</h2> Whether a new group should be started is evaluated
+ * by the group's expression. If that expression returns Boolean.TRUE, a new
+ * group instance is started. (That expression answers the Questions: 'Does this
+ * group instance end here?').
+ * <p/>
+ * If the group expression is invalid or there is no group expression at all, a
+ * group will consume all rows until the datasource is no longer advanceable.
+ *
+ * @author David Gilbert
+ * @author Thomas Morgner
+ */
+public class Group extends Section
+{
+  private Expression groupingExpression;
+
+  /**
+   * Constructs a group with no fields, and an empty header and footer.
+   */
+  public Group()
+  {
+    setType("group");
+    setRepeat(true);
+  }
+
+  /**
+   * Returns a string representation of the group (useful for debugging).
+   *
+   * @return A string.
+   */
+  public String toString()
+  {
+    final StringBuffer b = new StringBuffer();
+    b.append("Group={Name='");
+    b.append(getName());
+    b.append("} ");
+    return b.toString();
+  }
+
+  public Expression getGroupingExpression()
+  {
+    return groupingExpression;
+  }
+
+  public void setGroupingExpression(final Expression groupingExpression)
+  {
+    this.groupingExpression = groupingExpression;
+  }
+
+  public Group getGroup()
+  {
+    return this;
+  }
+
+
+  public Object clone()
+      throws CloneNotSupportedException
+  {
+    final Group group = (Group) super.clone();
+    if (groupingExpression != null)
+    {
+      group.groupingExpression = (Expression) groupingExpression.clone();
+    }
+    return group;
+  }
+}
diff --git a/source/org/jfree/report/structure/Node.java b/source/org/jfree/report/structure/Node.java
new file mode 100644
index 0000000..5936646
--- /dev/null
+++ b/source/org/jfree/report/structure/Node.java
@@ -0,0 +1,142 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: Node.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.structure;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+import org.jfree.report.JFreeReport;
+import org.jfree.report.expressions.Expression;
+
+/**
+ * A node is the most basic unit in a report. It acts as general superclass for
+ * all other elements.
+ *
+ * @author Thomas Morgner
+ */
+public abstract class Node implements Serializable, Cloneable
+{
+  private Node parent;
+
+  protected Node()
+  {
+  }
+
+  public Node getParent()
+  {
+    return parent;
+  }
+
+  protected void setParent(final Node parent)
+  {
+    this.parent = parent;
+  }
+
+  /**
+   * This is an extra method to allow me to track all *illegal* write-accesses
+   * to the parent.
+   *
+   * @param parent
+   */
+  public void updateParent(final Node parent)
+  {
+    this.parent = parent;
+  }
+
+  public Group getGroup()
+  {
+    Node parent = getParent();
+    while (parent != null)
+    {
+      if (parent instanceof Group)
+      {
+        return (Group) parent;
+      }
+
+      parent = parent.getParent();
+    }
+    return null;
+  }
+
+  public ReportDefinition getReport()
+  {
+    Node parent = getParent();
+    while (parent != null)
+    {
+      if (parent instanceof ReportDefinition)
+      {
+        return (ReportDefinition) parent;
+      }
+
+      parent = parent.getParent();
+    }
+    return null;
+  }
+
+  public JFreeReport getRootReport()
+  {
+    Node parent = getParent();
+    while (parent != null)
+    {
+      if (parent instanceof JFreeReport)
+      {
+        return (JFreeReport) parent;
+      }
+
+      parent = parent.getParent();
+    }
+    return null;
+  }
+
+  public Locale getLocale()
+  {
+    if (parent != null)
+    {
+      return parent.getLocale();
+    }
+    return Locale.getDefault();
+  }
+
+  public Expression getDisplayCondition()
+  {
+    return null;
+  }
+
+  public boolean isEnabled()
+  {
+    return true;
+  }
+
+  public Object clone () throws CloneNotSupportedException
+  {
+    return super.clone();
+  }
+}
diff --git a/source/org/jfree/report/structure/ReportDefinition.java b/source/org/jfree/report/structure/ReportDefinition.java
new file mode 100644
index 0000000..3a1b833
--- /dev/null
+++ b/source/org/jfree/report/structure/ReportDefinition.java
@@ -0,0 +1,65 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportDefinition.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.structure;
+
+/**
+ * Creation-Date: 04.03.2006, 21:39:13
+ *
+ * @author Thomas Morgner
+ */
+public abstract class ReportDefinition extends Section
+{
+  private String query;
+
+  protected ReportDefinition()
+  {
+  }
+
+  public String getQuery()
+  {
+    return query;
+  }
+
+  public void setQuery(final String query)
+  {
+    this.query = query;
+  }
+
+  public ReportDefinition getReport()
+  {
+    return this;
+  }
+
+  public Group getGroup()
+  {
+    return null;
+  }
+}
diff --git a/source/org/jfree/report/structure/Section.java b/source/org/jfree/report/structure/Section.java
new file mode 100644
index 0000000..187f0db
--- /dev/null
+++ b/source/org/jfree/report/structure/Section.java
@@ -0,0 +1,518 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: Section.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.structure;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jfree.report.flow.FlowControlOperation;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * A report section is a collection of other elements and sections.
+ * <p/>
+ * This implementation is not synchronized, to take care that you externally
+ * synchronize it when using multiple threads to modify instances of this
+ * class.
+ * <p/>
+ * Trying to add a parent of an band as child to the band, will result in an
+ * exception.
+ * <p/>
+ * The attribute and style expressions added to the element are considered
+ * unnamed and stateless. To define a named, statefull state expression, one
+ * would create an ordinary named expression or function and would then
+ * reference that expression from within a style or attribute expression.
+ *
+ * @author Thomas Morgner
+ */
+public class Section extends Element
+{
+  /**
+   * An empty array to prevent object creation.
+   */
+  private static final Node[] EMPTY_ARRAY = new Node[0];
+  private static final FlowControlOperation[] EMPTY_FLOWCONTROL = new FlowControlOperation[0];
+  /**
+   * All the elements for this band, stored by name.
+   */
+  private ArrayList allElements;
+
+  /**
+   * Cached elements.
+   */
+  private transient Node[] allElementsCached;
+
+  private ArrayList operationsBefore;
+  private ArrayList operationsAfter;
+  private transient FlowControlOperation[] operationsBeforeCached;
+  private transient FlowControlOperation[] operationsAfterCached;
+  private boolean repeat;
+
+  /**
+   * Constructs a new band (initially empty).
+   */
+  public Section()
+  {
+    setType("section");
+    allElements = new ArrayList();
+
+  }
+
+  /**
+   * Adds a report element to the band.
+   *
+   * @param element the element that should be added
+   * @throws NullPointerException     if the given element is null
+   * @throws IllegalArgumentException if the position is invalid, either
+   *                                  negative or greater than the number of
+   *                                  elements in this band or if the given
+   *                                  element is a parent of this element.
+   */
+  public void addNode(final Node element)
+  {
+    addNode(allElements.size(), element);
+  }
+
+  /**
+   * Adds a report element to the band. The element will be inserted at the
+   * specified position.
+   *
+   * @param position the position where to insert the element
+   * @param element  the element that should be added
+   * @throws NullPointerException     if the given element is null
+   * @throws IllegalArgumentException if the position is invalid, either
+   *                                  negative or greater than the number of
+   *                                  elements in this band or if the given
+   *                                  element is a parent of this element.
+   */
+  public void addNode(final int position, final Node element)
+  {
+    if (position < 0)
+    {
+      throw new IllegalArgumentException("Position < 0");
+    }
+    if (position > allElements.size())
+    {
+      throw new IllegalArgumentException("Position < 0");
+    }
+    if (element == null)
+    {
+      throw new NullPointerException("Band.addElement(...): element is null.");
+    }
+
+    // check for component loops ...
+    if (element instanceof Section)
+    {
+      Node band = this;
+      while (band != null)
+      {
+        if (band == element)
+        {
+          throw new IllegalArgumentException(
+              "adding container's parent to itself");
+        }
+        band = band.getParent();
+      }
+    }
+
+    // remove the element from its old parent ..
+    // this is the default AWT behaviour when adding Components to Container
+    final Node parent = element.getParent();
+    if (parent != null)
+    {
+      if (parent == this)
+      {
+        // already a child, wont add twice ...
+        return;
+      }
+
+      if (parent instanceof Section)
+      {
+        final Section section = (Section) parent;
+        section.removeNode(element);
+      }
+      else
+      {
+        element.setParent(null);
+      }
+    }
+
+    // add the element, update the childs Parent and the childs stylesheet.
+    allElements.add(position, element);
+    allElementsCached = null;
+
+    // then add the parents, or the band's parent will be unregistered ..
+    element.setParent(this);
+  }
+
+  /**
+   * Adds a collection of elements to the band.
+   *
+   * @param elements the element collection.
+   * @throws NullPointerException     if one of the given elements is null
+   * @throws IllegalArgumentException if one of the given element is a parent of
+   *                                  this element.
+   */
+  public void addNodes(final Collection elements)
+  {
+    if (elements == null)
+    {
+      throw new NullPointerException(
+          "Band.addElements(...): collection is null.");
+    }
+
+    final Iterator iterator = elements.iterator();
+    while (iterator.hasNext())
+    {
+      final Element element = (Element) iterator.next();
+      addNode(element);
+    }
+  }
+
+  /**
+   * Returns the first element in the list that is known by the given name.
+   *
+   * @param name the element name.
+   * @return the first element with the specified name, or <code>null</code> if
+   *         there is no such element.
+   *
+   * @throws NullPointerException if the given name is null.
+   */
+  public Element getElementByName(final String name)
+  {
+    if (name == null)
+    {
+      throw new NullPointerException("Band.getElement(...): name is null.");
+    }
+
+    final Node[] elements = getNodeArray();
+    final int elementsSize = elements.length;
+    for (int i = 0; i < elementsSize; i++)
+    {
+      final Node e = elements[i];
+      if (e instanceof Element == false)
+      {
+        continue;
+      }
+      final Element element = (Element) e;
+      final String elementName = element.getName();
+      if (elementName != null)
+      {
+        if (elementName.equals(name))
+        {
+          return element;
+        }
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Removes an element from the band.
+   *
+   * @param e the element to be removed.
+   * @throws NullPointerException if the given element is null.
+   */
+  public void removeNode(final Node e)
+  {
+    if (e == null)
+    {
+      throw new NullPointerException();
+    }
+    if (e.getParent() != this)
+    {
+      // this is none of my childs, ignore the request ...
+      return;
+    }
+
+    e.setParent(null);
+    allElements.remove(e);
+    allElementsCached = null;
+  }
+
+  /**
+   * Returns all child-elements of this band as immutable list.
+   *
+   * @return an immutable list of all registered elements for this band.
+   *
+   * @deprecated use <code>getElementArray()</code> instead.
+   */
+  public List getNodes()
+  {
+    return Collections.unmodifiableList(allElements);
+  }
+
+  /**
+   * Returns the number of elements in this band.
+   *
+   * @return the number of elements of this band.
+   */
+  public int getNodeCount()
+  {
+    return allElements.size();
+  }
+
+  /**
+   * Returns an array of the elements in the band. If the band is empty, an
+   * empty array is returned.
+   * <p/>
+   * For performance reasons, a shared cached instance is returned. Do not
+   * modify the returned array or live with the consquences.
+   *
+   * @return the elements.
+   */
+  public Node[] getNodeArray()
+  {
+    if (allElementsCached == null)
+    {
+      if (allElements.isEmpty())
+      {
+        allElementsCached = Section.EMPTY_ARRAY;
+      }
+      else
+      {
+        Node[] elements = new Node[allElements.size()];
+        elements = (Node[]) allElements.toArray(elements);
+        allElementsCached = elements;
+      }
+    }
+    return allElementsCached;
+  }
+
+  /**
+   * Returns the element stored add the given index.
+   *
+   * @param index the element position within this band
+   * @return the element
+   *
+   * @throws IndexOutOfBoundsException if the index is invalid.
+   */
+  public Node getNode(final int index)
+  {
+    if (allElementsCached == null)
+    {
+      if (allElements.isEmpty())
+      {
+        allElementsCached = Section.EMPTY_ARRAY;
+      }
+      else
+      {
+        Node[] elements = new Node[allElements.size()];
+        elements = (Node[]) allElements.toArray(elements);
+        allElementsCached = elements;
+      }
+    }
+    return allElementsCached[index];
+  }
+
+  /**
+   * Returns a string representation of the band and all the elements it
+   * contains, useful mainly for debugging purposes.
+   *
+   * @return a string representation of this band.
+   */
+  public String toString()
+  {
+    final StringBuffer b = new StringBuffer();
+    b.append(this.getClass().getName());
+    b.append("={name=\"");
+    b.append(getName());
+    b.append("\", namespace=\"");
+    b.append(getNamespace());
+    b.append("\", type=\"");
+    b.append(getType());
+    b.append("\", size=\"");
+    b.append(allElements.size());
+    b.append("\"}");
+    return b.toString();
+  }
+
+  public FlowControlOperation[] getOperationBefore()
+  {
+    if (operationsBefore == null)
+    {
+      return Section.EMPTY_FLOWCONTROL;
+    }
+    if (operationsBeforeCached == null)
+    {
+      operationsBeforeCached = (FlowControlOperation[])
+          operationsBefore.toArray(Section.EMPTY_FLOWCONTROL);
+    }
+    return operationsBeforeCached;
+  }
+
+  public FlowControlOperation[] getOperationAfter()
+  {
+    if (operationsAfter == null)
+    {
+      return Section.EMPTY_FLOWCONTROL;
+    }
+    if (operationsAfterCached == null)
+    {
+      operationsAfterCached = (FlowControlOperation[])
+          operationsAfter.toArray(Section.EMPTY_FLOWCONTROL);
+    }
+    return operationsAfterCached;
+  }
+
+  public void setOperationBefore(final FlowControlOperation[] before)
+  {
+    if (operationsBefore == null)
+    {
+      operationsBefore = new ArrayList(before.length);
+    }
+    else
+    {
+      operationsBefore.clear();
+      operationsBefore.ensureCapacity(before.length);
+    }
+    for (int i = 0; i < before.length; i++)
+    {
+      operationsBefore.add(before[i]);
+    }
+
+    operationsBeforeCached =
+        (FlowControlOperation[]) before.clone();
+  }
+
+  public void setOperationAfter(final FlowControlOperation[] ops)
+  {
+    if (operationsAfter == null)
+    {
+      operationsAfter = new ArrayList(ops.length);
+    }
+    else
+    {
+      operationsAfter.clear();
+      operationsAfter.ensureCapacity(ops.length);
+    }
+    for (int i = 0; i < ops.length; i++)
+    {
+      operationsAfter.add(ops[i]);
+    }
+
+    operationsAfterCached =
+        (FlowControlOperation[]) ops.clone();
+  }
+
+  public void addOperationAfter(final FlowControlOperation op)
+  {
+    if (operationsAfter == null)
+    {
+      operationsAfter = new ArrayList();
+    }
+    operationsAfter.add(op);
+    operationsAfterCached = null;
+  }
+
+  public void addOperationBefore(final FlowControlOperation op)
+  {
+    if (operationsBefore == null)
+    {
+      operationsBefore = new ArrayList();
+    }
+    operationsBefore.add(op);
+    operationsBeforeCached = null;
+  }
+
+  public boolean isRepeat()
+  {
+    return repeat;
+  }
+
+  public void setRepeat(final boolean repeat)
+  {
+    this.repeat = repeat;
+  }
+
+  public Element findFirstChild (final String uri, final String tagName)
+  {
+    final Node[] nodes = getNodeArray();
+    for (int i = 0; i < nodes.length; i++)
+    {
+      final Node node = nodes[i];
+      if (node instanceof Element == false)
+      {
+        continue;
+      }
+      final Element e = (Element) node;
+      if (ObjectUtilities.equal(uri, e.getNamespace()) &&
+          ObjectUtilities.equal(tagName, e.getType()))
+      {
+        return e;
+      }
+    }
+    return null;
+  }
+
+  public Object clone()
+      throws CloneNotSupportedException
+  {
+    final Section section = (Section) super.clone();
+    if (operationsAfter != null)
+    {
+      section.operationsAfter = (ArrayList) operationsAfter.clone();
+    }
+    if (operationsBefore != null)
+    {
+      section.operationsBefore = (ArrayList) operationsBefore.clone();
+    }
+    section.allElements = (ArrayList) allElements.clone();
+    section.allElements.clear();
+    final int elementSize = allElements.size();
+    if (allElementsCached != null)
+    {
+      section.allElementsCached = (Node[]) allElementsCached.clone();
+      for (int i = 0; i < allElementsCached.length; i++)
+      {
+        final Node eC = (Node) allElementsCached[i].clone();
+        section.allElements.add(eC);
+        section.allElementsCached[i] = eC;
+        eC.setParent(section);
+      }
+    }
+    else
+    {
+      for (int i = 0; i < elementSize; i++)
+      {
+        final Node e = (Node) allElements.get(i);
+        final Node eC = (Node) e.clone();
+        section.allElements.add(eC);
+        eC.setParent(section);
+      }
+    }
+    return section;
+  }
+}
diff --git a/source/org/jfree/report/structure/StaticText.java b/source/org/jfree/report/structure/StaticText.java
new file mode 100644
index 0000000..f2a7cc8
--- /dev/null
+++ b/source/org/jfree/report/structure/StaticText.java
@@ -0,0 +1,61 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticText.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.structure;
+
+/**
+ * Creation-Date: 19.02.2006, 16:48:35
+ *
+ * @author Thomas Morgner
+ */
+public class StaticText extends Node
+{
+  private String text;
+
+  public StaticText(final String text)
+  {
+    this.text = text;
+  }
+
+  public String getText()
+  {
+    return text;
+  }
+
+
+  public String toString()
+  {
+    final StringBuffer sb = new StringBuffer();
+    sb.append("StaticText");
+    sb.append("{text='").append(text).append('\'');
+    sb.append('}');
+    return sb.toString();
+  }
+}
diff --git a/source/org/jfree/report/structure/SubReport.java b/source/org/jfree/report/structure/SubReport.java
new file mode 100644
index 0000000..c45398c
--- /dev/null
+++ b/source/org/jfree/report/structure/SubReport.java
@@ -0,0 +1,162 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SubReport.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.structure;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jfree.report.flow.ParameterMapping;
+
+/**
+ * Creation-Date: 04.03.2006, 21:38:21
+ *
+ * @author Thomas Morgner
+ */
+public class SubReport extends ReportDefinition
+{
+  private HashMap exportParameters;
+  private HashMap inputParameters;
+
+  public SubReport()
+  {
+    setType("sub-report");
+    exportParameters = new HashMap();
+    inputParameters = new HashMap();
+  }
+
+  public void addExportParameter (final String outerName,
+                                  final String innerName)
+  {
+    exportParameters.put(outerName, innerName);
+  }
+
+  public void removeExportParameter (final String outerName)
+  {
+    exportParameters.remove(outerName);
+  }
+
+  public String getExportParameter (final String outerName)
+  {
+    return (String) exportParameters.get(outerName);
+  }
+
+  public String[] getExportParameters ()
+  {
+    return (String[])
+            exportParameters.keySet().toArray(new String[exportParameters.size()]);
+  }
+
+  public String[] getPeerExportParameters ()
+  {
+    return (String[])
+            exportParameters.values().toArray(new String[exportParameters.size()]);
+  }
+
+  public ParameterMapping[] getExportMappings ()
+  {
+    final Map.Entry[] inputEntries = (Map.Entry[])
+        exportParameters.entrySet().toArray(new Map.Entry[exportParameters.size()]);
+    final ParameterMapping[] mapping =
+        new ParameterMapping[exportParameters.size()];
+
+    for (int i = 0; i < inputEntries.length; i++)
+    {
+      final Map.Entry entry = inputEntries[i];
+      mapping[i] = new ParameterMapping
+          ((String) entry.getKey(), (String) entry.getValue());
+    }
+    return mapping;
+  }
+
+  public void addInputParameter (final String outerName,
+                                 final String innerName)
+  {
+    inputParameters.put(outerName, innerName);
+  }
+
+  public void removeInputParameter (final String outerName)
+  {
+    inputParameters.remove(outerName);
+  }
+
+  public String getInnerParameter (final String outerName)
+  {
+    return (String) inputParameters.get(outerName);
+  }
+
+  public String[] getInputParameters ()
+  {
+    return (String[])
+            inputParameters.keySet().toArray(new String[inputParameters.size()]);
+  }
+
+  public String[] getPeerInputParameters ()
+  {
+    return (String[])
+            inputParameters.values().toArray(new String[inputParameters.size()]);
+  }
+
+  public ParameterMapping[] getInputMappings ()
+  {
+    final Map.Entry[] inputEntries = (Map.Entry[])
+        inputParameters.entrySet().toArray(new Map.Entry[inputParameters.size()]);
+    final ParameterMapping[] mapping =
+        new ParameterMapping[inputParameters.size()];
+
+    for (int i = 0; i < inputEntries.length; i++)
+    {
+      final Map.Entry entry = inputEntries[i];
+      mapping[i] = new ParameterMapping
+          ((String) entry.getKey(), (String) entry.getValue());
+    }
+    return mapping;
+  }
+
+  public boolean isGlobalImport()
+  {
+    return "*".equals(inputParameters.get("*"));
+  }
+
+  public boolean isGlobalExport()
+  {
+    return "*".equals(exportParameters.get("*"));
+  }
+
+
+  public Object clone()
+      throws CloneNotSupportedException
+  {
+    final SubReport report = (SubReport) super.clone();
+    report.inputParameters = (HashMap) inputParameters.clone();
+    report.exportParameters = (HashMap) exportParameters.clone();
+    return report;
+  }
+}
diff --git a/source/org/jfree/report/util/AttributeNameGenerator.java b/source/org/jfree/report/util/AttributeNameGenerator.java
new file mode 100644
index 0000000..8fd7d11
--- /dev/null
+++ b/source/org/jfree/report/util/AttributeNameGenerator.java
@@ -0,0 +1,78 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: AttributeNameGenerator.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.util.HashMap;
+
+/**
+ * Creation-Date: 21.11.2006, 13:24:41
+ *
+ * @author Thomas Morgner
+ */
+public class AttributeNameGenerator
+{
+  private HashMap names;
+
+  public AttributeNameGenerator()
+  {
+    names = new HashMap();
+  }
+
+  public String generateName (final String base)
+  {
+    final Long keyObject = (Long) names.get(base);
+    if (keyObject == null)
+    {
+      names.put (base, new Long(0));
+      return base;
+    }
+    else
+    {
+      long keyIdx = keyObject.longValue();
+      String newName = base + keyIdx;
+      while (names.containsKey(newName))
+      {
+        keyIdx += 1;
+        newName = base + keyIdx;
+      }
+
+      names.put (newName, new Long (0));
+      names.put (base, new Long (keyIdx));
+      return newName;
+    }
+  }
+
+  public void reset ()
+  {
+    names.clear();
+  }
+}
diff --git a/source/org/jfree/report/util/CSVQuoter.java b/source/org/jfree/report/util/CSVQuoter.java
new file mode 100644
index 0000000..4deba2c
--- /dev/null
+++ b/source/org/jfree/report/util/CSVQuoter.java
@@ -0,0 +1,217 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CSVQuoter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+/**
+ * The <code>CSVQuoter</code> is a helper class to encode a string for the CSV file
+ * format.
+ *
+ * @author Thomas Morgner.
+ */
+public class CSVQuoter
+{
+  /**
+   * The separator used in the CSV file.
+   */
+  private char separator;
+  /**
+   * The quoting character or a single quote.
+   */
+  private char quate;
+  /**
+   * The double quote. This is a string containing the quate two times.
+   */
+  private String doubleQuate;
+
+  /**
+   * Creates a new CSVQuoter, which uses a comma as the default separator.
+   */
+  public CSVQuoter ()
+  {
+    this(',', '"');
+  }
+
+  /**
+   * Creates a new <code>CSVQuoter</code>, which uses the defined separator.
+   *
+   * @param separator the separator.
+   * @throws NullPointerException if the given separator is <code>null</code>.
+   */
+  public CSVQuoter (final char separator)
+  {
+    this(separator,  '"');
+  }
+
+  /**
+   * Creates a new CSVQuoter with the given separator and quoting character.
+   *
+   * @param separator the separator
+   * @param quate the quoting character
+   */
+  public CSVQuoter (final char separator, final char quate)
+  {
+    this.separator = separator;
+    this.quate = quate;
+    this.doubleQuate = "" + quate + quate;
+  }
+
+  /**
+   * Encodes the string, so that the string can safely be used in CSV files. If the string
+   * does not need quoting, the original string is returned unchanged.
+   *
+   * @param original the unquoted string.
+   * @return The quoted string
+   */
+  public String doQuoting (final String original)
+  {
+    if (isQuotingNeeded(original))
+    {
+      final StringBuffer retval = new StringBuffer();
+      retval.append(quate);
+      applyQuote(retval, original);
+      retval.append(quate);
+      return retval.toString();
+    }
+    else
+    {
+      return original;
+    }
+  }
+
+  /**
+   * Decodes the string, so that all escape sequences get removed. If the string was not
+   * quoted, then the string is returned unchanged.
+   *
+   * @param nativeString the quoted string.
+   * @return The unquoted string.
+   */
+  public String undoQuoting (final String nativeString)
+  {
+    if (isQuotingNeeded(nativeString))
+    {
+      final StringBuffer b = new StringBuffer(nativeString.length());
+      final int length = nativeString.length() - 1;
+      int start = 1;
+
+      int pos = start;
+      while (pos != -1)
+      {
+        pos = nativeString.indexOf(doubleQuate, start);
+        if (pos == -1)
+        {
+          b.append(nativeString.substring(start, length));
+        }
+        else
+        {
+          b.append(nativeString.substring(start, pos));
+          start = pos + 1;
+        }
+      }
+      return b.toString();
+    }
+    else
+    {
+      return nativeString;
+    }
+  }
+
+  /**
+   * Tests, whether this string needs to be quoted. A string is encoded if the string
+   * contains a newline character, a quote character or the defined separator.
+   *
+   * @param str the string that should be tested.
+   * @return true, if quoting needs to be applied, false otherwise.
+   */
+  private boolean isQuotingNeeded (final String str)
+  {
+    if (str.indexOf(separator) != -1)
+    {
+      return true;
+    }
+    if (str.indexOf('\n') != -1)
+    {
+      return true;
+    }
+    if (str.indexOf(quate, 1) != -1)
+    {
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Applies the quoting to a given string, and stores the result in the StringBuffer
+   * <code>b</code>.
+   *
+   * @param b        the result buffer
+   * @param original the string, that should be quoted.
+   */
+  private void applyQuote (final StringBuffer b, final String original)
+  {
+    // This solution needs improvements. Copy blocks instead of single
+    // characters.
+    final int length = original.length();
+
+    for (int i = 0; i < length; i++)
+    {
+      final char c = original.charAt(i);
+      if (c == quate)
+      {
+        b.append(doubleQuate);
+      }
+      else
+      {
+        b.append(c);
+      }
+    }
+  }
+
+  /**
+   * Gets the separator used in this quoter and the CSV file.
+   *
+   * @return the separator (never <code>null</code>).
+   */
+  public char getSeparator ()
+  {
+    return separator;
+  }
+
+  /**
+   * Returns the quoting character.
+   *
+   * @return the quote character.
+   */
+  public char getQuate ()
+  {
+    return quate;
+  }
+}
diff --git a/source/org/jfree/report/util/CSVTokenizer.java b/source/org/jfree/report/util/CSVTokenizer.java
new file mode 100644
index 0000000..134239b
--- /dev/null
+++ b/source/org/jfree/report/util/CSVTokenizer.java
@@ -0,0 +1,365 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CSVTokenizer.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * The csv tokenizer class allows an application to break a Comma Separated Value format
+ * into tokens. The tokenization method is much simpler than the one used by the
+ * <code>StringTokenizer</code> class. The <code>CSVTokenizer</code> methods do not
+ * distinguish among identifiers, numbers, and quoted strings, nor do they recognize and
+ * skip comments.
+ * <p/>
+ * The set of separator (the characters that separate tokens) may be specified either at
+ * creation time or on a per-token basis.
+ * <p/>
+ * An instance of <code>CSVTokenizer</code> behaves in one of two ways, depending on
+ * whether it was created with the <code>returnSeparators</code> flag having the value
+ * <code>true</code> or <code>false</code>: <ul> <li>If the flag is <code>false</code>,
+ * delimiter characters serve to separate tokens. A token is a maximal sequence of
+ * consecutive characters that are not separator. <li>If the flag is <code>true</code>,
+ * delimiter characters are themselves considered to be tokens. A token is thus either one
+ * delimiter character, or a maximal sequence of consecutive characters that are not
+ * separator. </ul><p> A <tt>CSVTokenizer</tt> object internally maintains a current
+ * position within the string to be tokenized. Some operations advance this current
+ * position past the characters processed.<p> A token is returned by taking a substring of
+ * the string that was used to create the <tt>CSVTokenizer</tt> object.
+ * <p/>
+ * The following is one example of the use of the tokenizer. The code:
+ * <blockquote><pre>
+ *     CSVTokenizer csvt = new CSVTokenizer("this,is,a,test");
+ *     while (csvt.hasMoreTokens()) {
+ *         println(csvt.nextToken());
+ *     }
+ * </pre></blockquote>
+ * <p/>
+ * prints the following output:
+ * <blockquote><pre>
+ *     this
+ *     is
+ *     a
+ *     test
+ * </pre></blockquote>
+ *
+ * @author abupon
+ */
+public class CSVTokenizer implements Enumeration
+{
+  /**
+   * The complete record that should be separated into elements.
+   */
+  private String record;
+  /**
+   * The separator.
+   */
+  private String separator;
+  /**
+   * The quoting char.
+   */
+  private String quate;
+
+  /**
+   * the current parsing position.
+   */
+  private int currentIndex;
+
+  private boolean beforeStart;
+
+  /**
+   * A possible separator constant.
+   */
+  public static final String SEPARATOR_COMMA = ",";
+  /**
+   * A possible separator constant.
+   */
+  public static final String SEPARATOR_TAB = "\t";
+  /**
+   * A possible separator constant.
+   */
+  public static final String SEPARATOR_SPACE = " ";
+
+  /**
+   * A possible quote character constant.
+   */
+  public static final String DOUBLE_QUATE = "\"";
+  /**
+   * A possible quote character constant.
+   */
+  public static final String SINGLE_QUATE = "'";
+
+  /**
+   * Constructs a csv tokenizer for the specified string. <code>theSeparator</code>
+   * argument is the separator for separating tokens.
+   * <p/>
+   * If the <code>returnSeparators</code> flag is <code>true</code>, then the separator
+   * string is also returned as tokens. separator is returned as a string. If the flag is
+   * <code>false</code>, the separator string is skipped and only serve as separator
+   * between tokens.
+   *
+   * @param aString      a string to be parsed.
+   * @param theSeparator the separator (CSVTokenizer.SEPARATOR_COMMA, CSVTokenizer.TAB,
+   *                     CSVTokenizer.SPACE, etc.).
+   * @param theQuate     the quate (CSVTokenizer.SINGLE_QUATE, CSVTokenizer.DOUBLE_QUATE,
+   *                     etc.).
+   */
+  public CSVTokenizer (final String aString, final String theSeparator,
+                       final String theQuate)
+  {
+    if (aString == null)
+    {
+      throw new NullPointerException("The given string is null");
+    }
+    if (theSeparator == null)
+    {
+      throw new NullPointerException("The given separator is null");
+    }
+    if (theQuate == null)
+    {
+      throw new NullPointerException("The given quate is null");
+    }
+    this.record = aString.trim();
+    this.separator = theSeparator;
+    this.quate = theQuate;
+    this.currentIndex = 0;
+    this.beforeStart = true;
+  }
+
+  /**
+   * Constructs a csv tokenizer for the specified string. The characters in the
+   * <code>theSeparator</code> argument are the separator for separating tokens. Separator
+   * string themselves will not be treated as tokens.
+   *
+   * @param aString      a string to be parsed.
+   * @param theSeparator the separator (CSVTokenizer.SEPARATOR_COMMA, CSVTokenizer.TAB,
+   *                     CSVTokenizer.SPACE, etc.).
+   */
+  public CSVTokenizer (final String aString, final String theSeparator)
+  {
+    this(aString, theSeparator, CSVTokenizer.DOUBLE_QUATE);
+  }
+
+  /**
+   * Constructs a string tokenizer for the specified string. The tokenizer uses the
+   * default separator set, which is <code>CSVTokenizer.SEPARATOR_COMMA</code>. Separator
+   * string themselves will not be treated as tokens.
+   *
+   * @param aString a string to be parsed.
+   */
+  public CSVTokenizer (final String aString)
+  {
+    this(aString, CSVTokenizer.SEPARATOR_COMMA);
+  }
+
+  /**
+   * Tests if there are more tokens available from this tokenizer's string. If this method
+   * returns <tt>true</tt>, then a subsequent call to <tt>nextToken</tt> with no argument
+   * will successfully return a token.
+   *
+   * @return <code>true</code> if and only if there is at least one token in the string
+   *         after the current position; <code>false</code> otherwise.
+   */
+  public boolean hasMoreTokens ()
+  {
+    return (this.currentIndex < this.record.length());
+  }
+
+  /**
+   * Returns the next token from this string tokenizer.
+   *
+   * @return the next token from this string tokenizer.
+   *
+   * @throws NoSuchElementException   if there are no more tokens in this tokenizer's
+   *                                  string.
+   * @throws IllegalArgumentException if given parameter string format was wrong
+   */
+  public String nextToken ()
+          throws NoSuchElementException, IllegalArgumentException
+  {
+
+    if (!this.hasMoreTokens())
+    {
+      throw new NoSuchElementException();
+    }
+    String token;
+
+    if (beforeStart == false)
+    {
+      currentIndex += this.separator.length();
+    }
+    else
+    {
+      beforeStart = false;
+    }
+
+    if (this.record.startsWith(this.quate, this.currentIndex))
+    {
+      String rec = this.record.substring(this.currentIndex + this.quate.length());
+      token = "";
+      for (; ;)
+      {
+        final int end = rec.indexOf(this.quate);
+        if (end < 0)
+        {
+          throw new IllegalArgumentException("Illegal format");
+        }
+
+        if (!rec.startsWith(this.quate, end + 1))
+        {
+          token += rec.substring(0, end);
+          break;
+        }
+        token = token + rec.substring(0, end + 1);
+        rec = rec.substring(end + this.quate.length() * 2);
+        this.currentIndex++;
+      }
+
+      this.currentIndex += (token.length() + this.quate.length() * 2);
+    }
+    else
+    {
+      final int end = this.record.indexOf(this.separator, this.currentIndex);
+      if (end >= 0)
+      {
+        final int start = this.currentIndex;
+        token = this.record.substring(start, end);
+        this.currentIndex = end;
+      }
+      else
+      {
+        final int start = this.currentIndex;
+        token = this.record.substring(start);
+        this.currentIndex = this.record.length();
+      }
+    }
+
+    return token;
+  }
+
+  /**
+   * Returns the next token in this string tokenizer's string. First, the set of
+   * characters considered to be separator by this <tt>CSVTokenizer</tt> object is changed
+   * to be the characters in the string <tt>separator</tt>. Then the next token in the
+   * string after the current position is returned. The current position is advanced
+   * beyond the recognized token.  The new delimiter set remains the default after this
+   * call.
+   *
+   * @param theSeparator the new separator.
+   * @return the next token, after switching to the new delimiter set.
+   *
+   * @throws java.util.NoSuchElementException
+   *          if there are no more tokens in this tokenizer's string.
+   */
+  public String nextToken (final String theSeparator)
+  {
+    separator = theSeparator;
+    return nextToken();
+  }
+
+  /**
+   * Returns the same value as the <code>hasMoreTokens</code> method. It exists so that
+   * this class can implement the <code>Enumeration</code> interface.
+   *
+   * @return <code>true</code> if there are more tokens; <code>false</code> otherwise.
+   *
+   * @see java.util.Enumeration
+   * @see org.jfree.report.util.CSVTokenizer#hasMoreTokens()
+   */
+  public boolean hasMoreElements ()
+  {
+    return hasMoreTokens();
+  }
+
+  /**
+   * Returns the same value as the <code>nextToken</code> method, except that its declared
+   * return value is <code>Object</code> rather than <code>String</code>. It exists so
+   * that this class can implement the <code>Enumeration</code> interface.
+   *
+   * @return the next token in the string.
+   *
+   * @throws java.util.NoSuchElementException
+   *          if there are no more tokens in this tokenizer's string.
+   * @see java.util.Enumeration
+   * @see org.jfree.report.util.CSVTokenizer#nextToken()
+   */
+  public Object nextElement ()
+  {
+    return nextToken();
+  }
+
+  /**
+   * Calculates the number of times that this tokenizer's <code>nextToken</code> method
+   * can be called before it generates an exception. The current position is not
+   * advanced.
+   *
+   * @return the number of tokens remaining in the string using the current delimiter
+   *         set.
+   *
+   * @see org.jfree.report.util.CSVTokenizer#nextToken()
+   */
+  public int countTokens ()
+  {
+    int count = 0;
+
+    final int preserve = this.currentIndex;
+    final boolean preserveStart = this.beforeStart;
+    while (this.hasMoreTokens())
+    {
+      this.nextToken();
+      count++;
+    }
+    this.currentIndex = preserve;
+    this.beforeStart = preserveStart;
+
+    return count;
+  }
+
+  /**
+   * Returns the quate.
+   *
+   * @return char
+   */
+  public String getQuate ()
+  {
+    return this.quate;
+  }
+
+  /**
+   * Sets the quate.
+   *
+   * @param quate The quate to set
+   */
+  public void setQuate (final String quate)
+  {
+    this.quate = quate;
+  }
+}
diff --git a/source/org/jfree/report/util/CharacterEntityParser.java b/source/org/jfree/report/util/CharacterEntityParser.java
new file mode 100644
index 0000000..707498c
--- /dev/null
+++ b/source/org/jfree/report/util/CharacterEntityParser.java
@@ -0,0 +1,245 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CharacterEntityParser.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+/**
+ * The character entity parser replaces all known occurrences of an entity in the format
+ * &entityname;.
+ *
+ * @author Thomas Morgner
+ */
+public class CharacterEntityParser
+{
+  /**
+   * the entities, keyed by entity name.
+   */
+  private final Properties entities;
+
+  /**
+   * the reverse lookup entities, keyed by character.
+   */
+  private final Properties reverse;
+
+  /**
+   * Creates a new CharacterEntityParser and initializes the parser with the given set of
+   * entities.
+   *
+   * @param characterEntities the entities used for the parser
+   */
+  public CharacterEntityParser (final Properties characterEntities)
+  {
+    entities = characterEntities;
+    reverse = new Properties();
+    final Enumeration keys = entities.keys();
+    while (keys.hasMoreElements())
+    {
+      final String key = (String) keys.nextElement();
+      final String value = entities.getProperty(key);
+      reverse.setProperty(value, key);
+    }
+  }
+
+  /**
+   * create a new Character entity parser and initializes the parser with the entities
+   * defined in the XML standard.
+   *
+   * @return the CharacterEntityParser initialized with XML entities.
+   */
+  public static CharacterEntityParser createXMLEntityParser ()
+  {
+    final Properties entities = new Properties();
+    entities.setProperty("amp", "&");
+    entities.setProperty("quot", "\"");
+    entities.setProperty("lt", "<");
+    entities.setProperty("gt", ">");
+    entities.setProperty("apos", "\u0027");
+    return new CharacterEntityParser(entities);
+  }
+
+  /**
+   * returns the entities used in the parser.
+   *
+   * @return the properties for this parser.
+   */
+  private Properties getEntities ()
+  {
+    return entities;
+  }
+
+  /**
+   * returns the reverse-lookup table for the entities.
+   *
+   * @return the reverse-lookup properties for this parsers.
+   */
+  private Properties getReverse ()
+  {
+    return reverse;
+  }
+
+  /**
+   * Looks up the character for the entity name specified in <code>key</code>.
+   *
+   * @param key the entity name
+   * @return the character as string with a length of 1
+   */
+  private String lookupCharacter (final String key)
+  {
+    return getEntities().getProperty(key);
+  }
+
+  /**
+   * Performs a reverse lookup, to retrieve the entity name for a given character.
+   *
+   * @param character the character that should be translated into the entity
+   * @return the entity name for the character or the untranslated character.
+   */
+  private String lookupEntity (final String character)
+  {
+    final String val = getReverse().getProperty(character);
+    if (val == null)
+    {
+      return null;
+    }
+    else
+    {
+      return "&" + val + ";";
+    }
+  }
+
+  /**
+   * Encode the given String, so that all known entites are encoded. All characters
+   * represented by these entites are now removed from the string.
+   *
+   * @param value the original string
+   * @return the encoded string.
+   */
+  public String encodeEntities (final String value)
+  {
+    final StringBuffer writer = new StringBuffer();
+    for (int i = 0; i < value.length(); i++)
+    {
+      final String character = String.valueOf(value.charAt(i));
+      final String lookup = lookupEntity(character);
+      if (lookup == null)
+      {
+        writer.append(character);
+      }
+      else
+      {
+        writer.append(lookup);
+      }
+    }
+    return writer.toString();
+  }
+
+  /**
+   * Decode the string, all known entities are replaced by their resolved characters.
+   *
+   * @param value the string that should be decoded.
+   * @return the decoded string.
+   */
+  public String decodeEntities (final String value)
+  {
+    int parserIndex = 0;
+    int subStart = value.indexOf("&", parserIndex);
+    if (subStart == -1)
+    {
+      return value;
+    }
+    int subEnd = value.indexOf(";", subStart);
+    if (subEnd == -1)
+    {
+      return value;
+    }
+
+    final StringBuffer bufValue = new StringBuffer(value.substring(0, subStart));
+    do
+    {
+      // at this point we know, that there is at least one entity ..
+      if (value.charAt(subStart + 1) == '#')
+      {
+        final int subValue = TextUtilities.parseInt(value.substring(subStart + 2, subEnd), 0);
+        if ((subValue >= 1) && (subValue <= 65536))
+        {
+          final char[] chr = new char[1];
+          chr[0] = (char) subValue;
+          bufValue.append(chr);
+        }
+        else
+        {
+          // invalid entity, do not decode ..
+          bufValue.append(value.substring(subStart, subEnd));
+        }
+      }
+      else
+      {
+        final String entity = value.substring(subStart + 1, subEnd);
+        final String replaceString = lookupCharacter(entity);
+        if (replaceString != null)
+        {
+          bufValue.append(decodeEntities(replaceString));
+        }
+        else
+        {
+          bufValue.append("&");
+          bufValue.append(entity);
+          bufValue.append(";");
+        }
+      }
+      parserIndex = subEnd + 1;
+      subStart = value.indexOf("&", parserIndex);
+      if (subStart == -1)
+      {
+        bufValue.append(value.substring(parserIndex));
+        subEnd = -1;
+      }
+      else
+      {
+        subEnd = value.indexOf(";", subStart);
+        if (subEnd == -1)
+        {
+          bufValue.append(value.substring(parserIndex));
+        }
+        else
+        {
+          bufValue.append(value.substring(parserIndex, subStart));
+        }
+      }
+    }
+    while (subStart != -1 && subEnd != -1);
+
+    return bufValue.toString();
+  }
+}
+
diff --git a/source/org/jfree/report/util/ComponentDrawable.java b/source/org/jfree/report/util/ComponentDrawable.java
new file mode 100644
index 0000000..e188b95
--- /dev/null
+++ b/source/org/jfree/report/util/ComponentDrawable.java
@@ -0,0 +1,591 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ComponentDrawable.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Window;
+import java.awt.geom.Rectangle2D;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.RepaintManager;
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Creation-Date: 11.10.2005, 14:03:15
+ *
+ * @author Thomas Morgner
+ */
+public class ComponentDrawable
+{
+  private static final Log logger = LogFactory.getLog (ComponentDrawable.class);
+
+  /**
+   * A runnable that executes the drawing operation on the event-dispatcher thread.
+   */
+  private class PainterRunnable implements Runnable
+  {
+    /**
+     * The draw-area as defined by the drawable.
+     */
+    private Rectangle2D area;
+    /**
+     * The graphics-context to which the runnable draws to.
+     */
+    private Graphics2D graphics;
+
+    /**
+     * Default constructor.
+     */
+    protected PainterRunnable()
+    {
+    }
+
+    /**
+     * Returns the Graphics2D to which the drawable should be rendered.
+     *
+     * @return the graphics.
+     */
+    public Graphics2D getGraphics()
+    {
+      return graphics;
+    }
+
+    /**
+     * Defines the Graphics2D to which the drawable should be rendered.
+     *
+     * @param graphics the graphics.
+     */
+    public void setGraphics(final Graphics2D graphics)
+    {
+      this.graphics = graphics;
+    }
+
+    /**
+     * Returns the draw-area to which the drawable should be rendered.
+     *
+     * @return the graphics.
+     */
+    public Rectangle2D getArea()
+    {
+      return area;
+    }
+
+    /**
+     * Defines the draw-area to which the drawable should be rendered.
+     *
+     * @param area the graphics.
+     */
+    public void setArea(final Rectangle2D area)
+    {
+      this.area = area;
+    }
+
+    /**
+     * Draws the drawable.
+     */
+    public void run()
+    {
+      try
+      {
+        final Component component = getComponent();
+        if (component instanceof Window)
+        {
+          final Window w = (Window) component;
+          w.validate();
+        }
+        else if (isOwnPeerConnected())
+        {
+          final Window w = ComponentDrawable.getWindowAncestor(component);
+          if (w != null)
+          {
+            w.validate();
+          }
+        }
+        else
+        {
+          peerSupply.pack();
+          contentPane.add(component);
+        }
+
+        component.setBounds
+            ((int) area.getX(), (int) area.getY(),
+                (int) area.getWidth(), (int) area.getHeight());
+        component.validate();
+        component.paint(graphics);
+      }
+      finally
+      {
+        cleanUp();
+      }
+    }
+  }
+
+  /**
+   * A runnable that queries the preferred size. As this may involve font-computations, this has to be done on the
+   * EventDispatcher thread.
+   */
+  private class PreferredSizeRunnable implements Runnable
+  {
+    /**
+     * The return value.
+     */
+    private Dimension retval;
+
+    /**
+     * Default Constructor.
+     */
+    protected PreferredSizeRunnable()
+    {
+    }
+
+    /**
+     * Returns the dimension that has been computed.
+     *
+     * @return the preferred size.
+     */
+    public Dimension getRetval()
+    {
+      return retval;
+    }
+
+    /**
+     * Computes the preferred size on the EventDispatcherThread.
+     */
+    public void run()
+    {
+      retval = null;
+      try
+      {
+        final Component component = getComponent();
+        if (component instanceof Window == false && isOwnPeerConnected() == false)
+        {
+          peerSupply.pack();
+          contentPane.add(component);
+          contentPane.validate();
+          component.validate();
+        }
+        else if (isOwnPeerConnected())
+        {
+          retval = component.getSize();
+          return;
+        }
+        else
+        {
+          component.validate();
+        }
+        retval = component.getPreferredSize();
+      }
+      finally
+      {
+        cleanUp();
+      }
+    }
+  }
+
+  /**
+   * A runnable that queries the defined size. As this may involve font-computations, this has to be done on the
+   * EventDispatcher thread.
+   */
+  private class DefinedSizeRunnable implements Runnable
+  {
+    /**
+     * The return value.
+     */
+    private Dimension retval;
+
+    /**
+     * Default Constructor.
+     */
+    protected DefinedSizeRunnable()
+    {
+    }
+
+    /**
+     * Returns the dimension that has been computed.
+     *
+     * @return the declared size.
+     */
+    public Dimension getRetval()
+    {
+      return retval;
+    }
+
+    /**
+     * Computes the declared size on the EventDispatcherThread.
+     */
+    public void run()
+    {
+      retval = null;
+      try
+      {
+        final Component component = getComponent();
+        if (component instanceof Window == false && isOwnPeerConnected() == false)
+        {
+          peerSupply.pack();
+          contentPane.add(component);
+        }
+        retval = component.getSize();
+      }
+      finally
+      {
+        cleanUp();
+      }
+    }
+  }
+
+  /**
+   * A flag indicating whether the aspect ratio should be preserved by the layouter.
+   */
+  private boolean preserveAspectRatio;
+  /**
+   * The component that should be drawn.
+   */
+  private Component component;
+  /**
+   * The Frame that connects the component to the native Window-System.
+   */
+  private JFrame peerSupply;
+  /**
+   * The content pane of the frame.
+   */
+  private JPanel contentPane;
+  /**
+   * The runnable that paints the component.
+   */
+  private PainterRunnable runnable;
+  /**
+   * The runnable that computes the preferred size.
+   */
+  private PreferredSizeRunnable preferredSizeRunnable;
+  /**
+   * The runnable that computes the declared size.
+   */
+  private DefinedSizeRunnable sizeRunnable;
+  /**
+   * A flag indicating whether all paint-operations should be performed on the Event-Dispatcher thread.
+   */
+  private boolean paintSynchronized;
+  /**
+   * A flag indicating whether components are allowed to provide their own AWT-Window.
+   */
+  private boolean allowOwnPeer;
+
+  /**
+   * Default Constructor.
+   */
+  public ComponentDrawable()
+  {
+    this(new JFrame());
+  }
+
+  /**
+   * Creates a new ComponentDrawable with the given Frame as peer-supply.
+   *
+   * @param peerSupply the frame that should be used as peer-source.
+   */
+  public ComponentDrawable(final JFrame peerSupply)
+  {
+    if (peerSupply == null)
+    {
+      throw new NullPointerException();
+    }
+    this.peerSupply = peerSupply;
+    this.contentPane = new JPanel();
+    this.contentPane.setLayout(null);
+    peerSupply.setContentPane(contentPane);
+    this.runnable = new PainterRunnable();
+    this.preferredSizeRunnable = new PreferredSizeRunnable();
+    this.sizeRunnable = new DefinedSizeRunnable();
+  }
+
+  /**
+   * Returns, whether components are allowed to provide their own AWT-Window.
+   *
+   * @return true, if foreign peers are allowed, false otherwise.
+   */
+  public boolean isAllowOwnPeer()
+  {
+    return allowOwnPeer;
+  }
+
+  /**
+   * Defines, whether components are allowed to provide their own AWT-Window.
+   *
+   * @param allowOwnPeer true, if components can provide their own peers, false otherwise.
+   */
+  public void setAllowOwnPeer(final boolean allowOwnPeer)
+  {
+    this.allowOwnPeer = allowOwnPeer;
+  }
+
+  /**
+   * Returns, whether component operations will happen on the Event-Dispatcher threads. As the AWT is not synchronized,
+   * weird things can happen if AWT functionality is executed on user threads.
+   *
+   * @return true, if all operations will be done on the AWT-EventDispatcher thread, false if they should be done in the
+   *         local thread.
+   */
+  public boolean isPaintSynchronized()
+  {
+    return paintSynchronized;
+  }
+
+  /**
+   * Defines, whether component operations will happen on the Event-Dispatcher threads. As the AWT is not synchronized,
+   * weird things can happen if AWT functionality is executed on user threads.
+   *
+   * @param paintSynchronized true, if all operations will be done on the AWT-EventDispatcher thread, false if they
+   *                          should be done in the local thread.
+   */
+  public void setPaintSynchronized(final boolean paintSynchronized)
+  {
+    this.paintSynchronized = paintSynchronized;
+  }
+
+  /**
+   * A helper method that performs some cleanup and disconnects the component from the AWT and the Swing-Framework to
+   * avoid memory-leaks.
+   */
+  protected final void cleanUp()
+  {
+    if (component instanceof JComponent && isOwnPeerConnected() == false)
+    {
+      final JComponent jc = (JComponent) component;
+      RepaintManager.currentManager(jc).removeInvalidComponent(jc);
+      RepaintManager.currentManager(jc).markCompletelyClean(jc);
+    }
+    contentPane.removeAll();
+    RepaintManager.currentManager(contentPane).removeInvalidComponent(contentPane);
+    RepaintManager.currentManager(contentPane).markCompletelyClean(contentPane);
+    peerSupply.dispose();
+  }
+
+  /**
+   * Returns the component that should be drawn.
+   *
+   * @return the component.
+   */
+  public Component getComponent()
+  {
+    return component;
+  }
+
+  /**
+   * Defines the component that should be drawn.
+   *
+   * @param component the component.
+   */
+  public void setComponent(final Component component)
+  {
+    this.component = component;
+    prepareComponent(component);
+  }
+
+  /**
+   * Returns the preferred size of the drawable. If the drawable is aspect ratio aware, these bounds should be used to
+   * compute the preferred aspect ratio for this drawable.
+   * <p/>
+   * This calls {@link java.awt.Component#getPreferredSize()} on the given component.
+   *
+   * @return the preferred size.
+   */
+  public Dimension getPreferredSize()
+  {
+    if (component == null)
+    {
+      return new Dimension(0, 0);
+    }
+    if (SwingUtilities.isEventDispatchThread() || paintSynchronized == false)
+    {
+      preferredSizeRunnable.run();
+      return preferredSizeRunnable.getRetval();
+    }
+
+    try
+    {
+      SwingUtilities.invokeAndWait(preferredSizeRunnable);
+      return preferredSizeRunnable.getRetval();
+    }
+    catch (Exception e)
+    {
+      ComponentDrawable.logger.warn("Failed to compute the preferred size.");
+    }
+    return new Dimension(0, 0);
+  }
+
+  /**
+   * Returns the declared size of the drawable. If the drawable is aspect ratio aware, these bounds should be used to
+   * compute the declared aspect ratio for this drawable.
+   * <p/>
+   * This calls {@link java.awt.Component#getSize()} on the given component.
+   *
+   * @return the preferred size.
+   */
+  public Dimension getSize()
+  {
+    if (component == null)
+    {
+      return new Dimension(0, 0);
+    }
+    if (SwingUtilities.isEventDispatchThread() || paintSynchronized == false)
+    {
+      sizeRunnable.run();
+      return sizeRunnable.getRetval();
+    }
+
+    try
+    {
+      SwingUtilities.invokeAndWait(sizeRunnable);
+      return sizeRunnable.getRetval();
+    }
+    catch (Exception e)
+    {
+      ComponentDrawable.logger.warn("Failed to compute the defined size.");
+    }
+    return new Dimension(0, 0);
+  }
+
+  /**
+   * A private helper method that checks, whether the component provides an own peer.
+   *
+   * @return true, if the component has an own peer, false otherwise.
+   */
+  protected final boolean isOwnPeerConnected()
+  {
+    if (allowOwnPeer == false)
+    {
+      return false;
+    }
+    final Window windowAncestor = ComponentDrawable.getWindowAncestor(component);
+    return (windowAncestor != null && windowAncestor != peerSupply);
+  }
+
+  /**
+   * A private helper method that locates the Window to which the component is currently added.
+   *
+   * @param component the component for which the Window should be returned.
+   * @return the AWT-Window that is the (possibly indirect) parent of this component.
+   */
+  protected static Window getWindowAncestor(final Component component)
+  {
+    Component parent = component.getParent();
+    while (parent != null)
+    {
+      if (parent instanceof Window)
+      {
+        return (Window) parent;
+      }
+      parent = parent.getParent();
+    }
+    return null;
+  }
+
+  /**
+   * Defines whether the layouter should preserve the aspect ratio of the component's preferred size.
+   *
+   * @param preserveAspectRatio true, if the aspect ratio should be preserved, false otherwise.
+   */
+  public void setPreserveAspectRatio(final boolean preserveAspectRatio)
+  {
+    this.preserveAspectRatio = preserveAspectRatio;
+  }
+
+  /**
+   * Returns true, if this drawable will preserve an aspect ratio during the drawing.
+   *
+   * @return true, if an aspect ratio is preserved, false otherwise.
+   */
+  public boolean isPreserveAspectRatio()
+  {
+    return preserveAspectRatio;
+  }
+
+  /**
+   * Draws the component.
+   *
+   * @param g2  the graphics device.
+   * @param area  the area inside which the object should be drawn.
+   */
+  public void draw(final Graphics2D g2, final Rectangle2D area)
+  {
+    if (component == null)
+    {
+      return;
+    }
+
+    runnable.setArea(area);
+    runnable.setGraphics(g2);
+
+    if (SwingUtilities.isEventDispatchThread() || paintSynchronized == false)
+    {
+      runnable.run();
+    }
+    else
+    {
+      try
+      {
+        SwingUtilities.invokeAndWait(runnable);
+      }
+      catch (Exception e)
+      {
+        ComponentDrawable.logger.warn("Failed to redraw the component.");
+      }
+    }
+  }
+
+  /**
+   * Prepares the component for drawing. This recursively disables the double-buffering as this would interfere
+   * with the drawing.
+   *
+   * @param c the component that should be prepared.
+   */
+  private void prepareComponent(final Component c)
+  {
+    if (c instanceof JComponent)
+    {
+      final JComponent jc = (JComponent) c;
+      jc.setDoubleBuffered(false);
+      final Component[] childs = jc.getComponents();
+      for (int i = 0; i < childs.length; i++)
+      {
+        final Component child = childs[i];
+        prepareComponent(child);
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/util/DataSetUtility.java b/source/org/jfree/report/util/DataSetUtility.java
new file mode 100644
index 0000000..6bbe1e3
--- /dev/null
+++ b/source/org/jfree/report/util/DataSetUtility.java
@@ -0,0 +1,85 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DataSetUtility.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import org.jfree.report.DataSet;
+import org.jfree.report.DataSourceException;
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+/**
+ * Creation-Date: 17.04.2006, 11:43:04
+ *
+ * @author Thomas Morgner
+ */
+public class DataSetUtility
+{
+  private DataSetUtility()
+  {
+  }
+
+  public static Object getByName (DataSet ds, String column)
+          throws DataSourceException
+  {
+    return getByName(ds, column, null);
+  }
+
+  public static Object getByName (DataSet ds, String column, Object defaultVal)
+          throws DataSourceException
+  {
+    final int size = ds.getColumnCount();
+    for (int i = 0; i < size; i++)
+    {
+      final String columnName = ds.getColumnName(i);
+      if (ObjectUtilities.equal(column, columnName))
+      {
+        return ds.get(i);
+      }
+    }
+    return defaultVal;
+  }
+
+
+  public static boolean isColumnDefined (String name, DataSet params)
+          throws DataSourceException
+  {
+    final int size = params.getColumnCount();
+    for (int i = 0; i < size; i++)
+    {
+      final String columnName = params.getColumnName(i);
+      if (ObjectUtilities.equal(name, columnName))
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
+}
diff --git a/source/org/jfree/report/util/ImageUtils.java b/source/org/jfree/report/util/ImageUtils.java
new file mode 100644
index 0000000..ef0113b
--- /dev/null
+++ b/source/org/jfree/report/util/ImageUtils.java
@@ -0,0 +1,80 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ImageUtils.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+/**
+ * Provides utility methods for image creation and manipluation.
+ *
+ * @author Thomas Morgner
+ */
+public final class ImageUtils
+{
+  /**
+   * DefaultConstructor.
+   */
+  private ImageUtils ()
+  {
+  }
+
+  /**
+   * Creates a transparent image.  These can be used for aligning menu items.
+   *
+   * @param width  the width.
+   * @param height the height.
+   * @return the created transparent image.
+   */
+  public static BufferedImage createTransparentImage (final int width, final int height)
+  {
+    final BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
+    final int[] data = img.getRGB(0, 0, width, height, null, 0, width);
+    Arrays.fill(data, 0x00000000);
+    img.setRGB(0, 0, width, height, data, 0, width);
+    return img;
+  }
+
+  /**
+   * Creates a transparent icon. The Icon can be used for aligning menu items.
+   *
+   * @param width  the width of the new icon
+   * @param height the height of the new icon
+   * @return the created transparent icon.
+   */
+  public static Icon createTransparentIcon (final int width, final int height)
+  {
+    return new ImageIcon(createTransparentImage(width, height));
+  }
+}
diff --git a/source/org/jfree/report/util/InstanceID.java b/source/org/jfree/report/util/InstanceID.java
new file mode 100644
index 0000000..0ae7458
--- /dev/null
+++ b/source/org/jfree/report/util/InstanceID.java
@@ -0,0 +1,61 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: InstanceID.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.io.Serializable;
+
+/**
+ * This class can be used as ID to mark instances of objects. This allows to track and
+ * identify objects and their clones.
+ *
+ * @author Thomas Morgner
+ */
+public final class InstanceID implements Serializable
+{
+  /**
+   * DefaultConstructor.
+   */
+  public InstanceID ()
+  {
+  }
+
+  /**
+   * Returns a simple string representation of this object to make is identifiable by
+   * human users.
+   *
+   * @return the string representation.
+   */
+  public String toString ()
+  {
+    return "InstanceID[" + hashCode() + "]";
+  }
+}
diff --git a/source/org/jfree/report/util/IntegerCache.java b/source/org/jfree/report/util/IntegerCache.java
new file mode 100644
index 0000000..aadcf15
--- /dev/null
+++ b/source/org/jfree/report/util/IntegerCache.java
@@ -0,0 +1,61 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IntegerCache.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+/**
+ * Creation-Date: 03.03.2006, 12:36:07
+ *
+ * @author Thomas Morgner
+ */
+public class IntegerCache
+{
+  private static Integer[] cachedNumbers;
+
+  static
+  {
+    cachedNumbers = new Integer[1000];
+    for (int i = 0; i < cachedNumbers.length; i++)
+    {
+      cachedNumbers[i] = new Integer(i);
+    }
+  }
+
+  private IntegerCache()
+  {
+  }
+
+  public static Integer getInteger(int i)
+  {
+    if (i < 0) return new Integer(i);
+    if (i > 999) return new Integer(i);
+    return cachedNumbers[i];
+  }
+}
diff --git a/source/org/jfree/report/util/LazyNameMap.java b/source/org/jfree/report/util/LazyNameMap.java
new file mode 100644
index 0000000..ed14c3a
--- /dev/null
+++ b/source/org/jfree/report/util/LazyNameMap.java
@@ -0,0 +1,139 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LazyNameMap.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * Creation-Date: 06.03.2006, 20:20:17
+ *
+ * @author Thomas Morgner
+ */
+public class LazyNameMap implements Cloneable
+{
+  public static class NameCarrier
+  {
+    private int value;
+    private int counter;
+
+    public NameCarrier(final int value)
+    {
+      this.value = value;
+      this.counter = 1;
+    }
+
+    public int getValue()
+    {
+      return value;
+    }
+
+    public int getInstanceCount()
+    {
+      return counter;
+    }
+
+    public void increase()
+    {
+      this.counter += 1;
+    }
+
+    public void decrease()
+    {
+      this.counter -= 1;
+    }
+  }
+
+  private HashMap map;
+  private ArrayList names;
+  private boolean clean;
+
+  public LazyNameMap()
+  {
+    map = new HashMap();
+    names = new ArrayList();
+    clean = false;
+  }
+
+  public boolean isClean()
+  {
+    return clean;
+  }
+
+  public void setValue(final String key, final int value)
+  {
+    if (clean)
+    {
+      map = (HashMap) map.clone();
+      names = (ArrayList) names.clone();
+      clean = false;
+    }
+
+    map.put(key, new NameCarrier(value));
+  }
+
+  public NameCarrier get(String key)
+  {
+    return (NameCarrier) map.get(key);
+  }
+
+  public NameCarrier remove(final String key)
+  {
+    NameCarrier nc = (NameCarrier) map.get(key);
+    if (nc == null)
+    {
+      return null;
+    }
+
+    if (clean)
+    {
+      map = (HashMap) map.clone();
+      names = (ArrayList) names.clone();
+      clean = false;
+    }
+    return (NameCarrier) map.remove(key);
+  }
+
+  public Object clone()
+  {
+    try
+    {
+      LazyNameMap lm = (LazyNameMap) super.clone();
+      lm.clean = true;
+      clean = true;
+      return lm;
+    }
+    catch (CloneNotSupportedException e)
+    {
+      throw new IllegalStateException("Clone failed for some reason");
+    }
+  }
+}
diff --git a/source/org/jfree/report/util/MemoryByteArrayOutputStream.java b/source/org/jfree/report/util/MemoryByteArrayOutputStream.java
new file mode 100644
index 0000000..b3653d4
--- /dev/null
+++ b/source/org/jfree/report/util/MemoryByteArrayOutputStream.java
@@ -0,0 +1,192 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: MemoryByteArrayOutputStream.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * A string writer that is able to write large amounts of data. The original StringWriter contained in Java doubles
+ * its buffersize everytime the buffer overflows. This is nice with small amounts of data, but awfull for huge
+ * buffers.
+ *
+ * @author Thomas Morgner
+ */
+public class MemoryByteArrayOutputStream extends OutputStream
+{
+  private int initialBufferSize;
+  private int maximumBufferIncrement;
+  private int cursor;
+  private byte[] buffer;
+  private byte[] singleIntArray;
+
+  /**
+   * Create a new character-stream writer whose critical sections will synchronize on the writer itself.
+   */
+  public MemoryByteArrayOutputStream()
+  {
+    this(4096, 65536);
+  }
+
+  /**
+   * Create a new character-stream writer whose critical sections will synchronize on the writer itself.
+   */
+  public MemoryByteArrayOutputStream(final int bufferSize, final int maximumBufferIncrement)
+  {
+    this.initialBufferSize = bufferSize;
+    this.maximumBufferIncrement = maximumBufferIncrement;
+    this.buffer = new byte[bufferSize];
+    this.singleIntArray = new byte[1];
+  }
+
+
+  /**
+   * Write a portion of an array of characters.
+   *
+   * @param cbuf Array of characters
+   * @param off  Offset from which to start writing characters
+   * @param len  Number of characters to write
+   * @throws java.io.IOException If an I/O error occurs
+   */
+  public synchronized void write(final byte cbuf[], final int off, final int len) throws IOException
+  {
+    if (len < 0)
+    {
+      throw new IllegalArgumentException();
+    }
+    if (off < 0)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+    if (cbuf == null)
+    {
+      throw new NullPointerException();
+    }
+    if ((len + off) > cbuf.length)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+
+    ensureSize (cursor + len);
+
+    System.arraycopy(cbuf, off, this.buffer, cursor, len);
+    cursor += len;
+  }
+
+  /**
+   * Writes <code>b.length</code> bytes from the specified byte array to this output stream. The general contract for
+   * <code>write(b)</code> is that it should have exactly the same effect as the call <code>write(b, 0,
+   * b.length)</code>.
+   *
+   * @param b the data.
+   * @throws java.io.IOException if an I/O error occurs.
+   * @see java.io.OutputStream#write(byte[], int, int)
+   */
+  public void write(byte b[]) throws IOException
+  {
+    write(b, 0, b.length);
+  }
+
+  /**
+   * Writes the specified byte to this output stream. The general contract for <code>write</code> is that one byte is
+   * written to the output stream. The byte to be written is the eight low-order bits of the argument <code>b</code>.
+   * The 24 high-order bits of <code>b</code> are ignored.
+   * <p/>
+   * Subclasses of <code>OutputStream</code> must provide an implementation for this method.
+   *
+   * @param b the <code>byte</code>.
+   * @throws java.io.IOException if an I/O error occurs. In particular, an <code>IOException</code> may be thrown if the
+   *                             output stream has been closed.
+   */
+  public synchronized void write(final int b) throws IOException
+  {
+    this.singleIntArray[0] = (byte) (0xFF & b);
+    write(singleIntArray, 0, 1);
+  }
+
+  private void ensureSize(final int size)
+  {
+    if (this.buffer.length >= size)
+    {
+      return;
+    }
+
+    final int computedSize = (int) Math.min ((this.buffer.length + 1) * 1.5, this.buffer.length + maximumBufferIncrement);
+    final int newSize = Math.max (size, computedSize);
+    final byte[] newBuffer = new byte[newSize];
+    System.arraycopy(this.buffer, 0, newBuffer, 0, cursor);
+    this.buffer = newBuffer;
+  }
+
+  /**
+   * Flush the stream.  If the stream has saved any characters from the various write() methods in a buffer, write them
+   * immediately to their intended destination.  Then, if that destination is another character or byte stream, flush
+   * it.  Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.
+   * <p/>
+   * If the intended destination of this stream is an abstraction provided by the underlying operating system, for
+   * example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to
+   * the operating system for writing; it does not guarantee that they are actually written to a physical device such as
+   * a disk drive.
+   *
+   * @throws java.io.IOException If an I/O error occurs
+   */
+  public void flush() throws IOException
+  {
+  }
+
+  /**
+   * Close the stream, flushing it first.  Once a stream has been closed, further write() or flush() invocations will
+   * cause an IOException to be thrown.  Closing a previously-closed stream, however, has no effect.
+   *
+   * @throws java.io.IOException If an I/O error occurs
+   */
+  public void close() throws IOException
+  {
+  }
+
+  public synchronized byte[] toByteArray()
+  {
+    final byte[] retval = new byte[cursor];
+    System.arraycopy(buffer, 0, retval, 0, cursor);
+    return retval;
+  }
+
+  public int getLength()
+  {
+    return cursor;
+  }
+
+  public byte[] getRaw()
+  {
+    return buffer;
+  }
+}
diff --git a/source/org/jfree/report/util/MemoryStringWriter.java b/source/org/jfree/report/util/MemoryStringWriter.java
new file mode 100644
index 0000000..c8d5806
--- /dev/null
+++ b/source/org/jfree/report/util/MemoryStringWriter.java
@@ -0,0 +1,140 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: MemoryStringWriter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * A string writer that is able to write large amounts of data. The original StringWriter contained in Java doubles
+ * its buffersize everytime the buffer overflows. This is nice with small amounts of data, but awfull for huge
+ * buffers.
+ *
+ * @author Thomas Morgner
+ */
+public class MemoryStringWriter extends Writer
+{
+  private int bufferIncrement;
+  private int cursor;
+  private char[] buffer;
+
+  /**
+   * Create a new character-stream writer whose critical sections will synchronize on the writer itself.
+   */
+  public MemoryStringWriter()
+  {
+    this(4096);
+  }
+
+  /**
+   * Create a new character-stream writer whose critical sections will synchronize on the writer itself.
+   */
+  public MemoryStringWriter(final int bufferSize)
+  {
+    this.bufferIncrement = bufferSize;
+    this.buffer = new char[bufferSize];
+  }
+
+  /**
+   * Write a portion of an array of characters.
+   *
+   * @param cbuf Array of characters
+   * @param off  Offset from which to start writing characters
+   * @param len  Number of characters to write
+   * @throws java.io.IOException If an I/O error occurs
+   */
+  public synchronized void write(char cbuf[], int off, int len) throws IOException
+  {
+    if (len < 0) throw new IllegalArgumentException();
+    if (off < 0)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+    if (cbuf == null)
+    {
+      throw new NullPointerException();
+    }
+    if ((len + off) > cbuf.length)
+    {
+      throw new IndexOutOfBoundsException();
+    }
+
+    ensureSize (cursor + len);
+
+    System.arraycopy(cbuf, off, this.buffer, cursor, len);
+    cursor += len;
+  }
+
+  private void ensureSize(final int size)
+  {
+    if (this.buffer.length >= size)
+    {
+      return;
+    }
+
+    final int newSize = Math.max (size, this.buffer.length + bufferIncrement);
+    final char[] newBuffer = new char[newSize];
+    System.arraycopy(this.buffer, 0, newBuffer, 0, cursor);
+  }
+
+  /**
+   * Flush the stream.  If the stream has saved any characters from the various write() methods in a buffer, write them
+   * immediately to their intended destination.  Then, if that destination is another character or byte stream, flush
+   * it.  Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.
+   * <p/>
+   * If the intended destination of this stream is an abstraction provided by the underlying operating system, for
+   * example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to
+   * the operating system for writing; it does not guarantee that they are actually written to a physical device such as
+   * a disk drive.
+   *
+   * @throws java.io.IOException If an I/O error occurs
+   */
+  public void flush() throws IOException
+  {
+
+  }
+
+  /**
+   * Close the stream, flushing it first.  Once a stream has been closed, further write() or flush() invocations will
+   * cause an IOException to be thrown.  Closing a previously-closed stream, however, has no effect.
+   *
+   * @throws java.io.IOException If an I/O error occurs
+   */
+  public void close() throws IOException
+  {
+  }
+
+  public String toString ()
+  {
+    return new String (buffer, 0, cursor);
+  }
+}
diff --git a/source/org/jfree/report/util/MessageFormatSupport.java b/source/org/jfree/report/util/MessageFormatSupport.java
new file mode 100644
index 0000000..1044044
--- /dev/null
+++ b/source/org/jfree/report/util/MessageFormatSupport.java
@@ -0,0 +1,336 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: MessageFormatSupport.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.text.Format;
+import java.text.MessageFormat;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Locale;
+
+import org.jfree.report.DataRow;
+import org.jfree.report.DataSourceException;
+
+public class MessageFormatSupport implements Serializable, Cloneable
+{
+  protected static class MessageCompiler extends PropertyLookupParser
+  {
+    private ArrayList fields;
+    private ArrayList completeFormatString;
+
+    public MessageCompiler()
+    {
+      this.fields = new ArrayList();
+      this.completeFormatString = new ArrayList();
+      setMarkerChar('$');
+      setOpeningBraceChar('(');
+      setClosingBraceChar(')');
+    }
+
+    protected String lookupVariable(final String name)
+    {
+      final CSVTokenizer tokenizer = new CSVTokenizer(name, ",", "\"");
+      if (tokenizer.hasMoreTokens() == false)
+      {
+        return null;
+      }
+      final String varName = tokenizer.nextToken();
+/*    // we have to collect every occurence, even if it is included twice
+      // to allow the null-value-processing later ..
+      final int index = fields.indexOf(varName);
+      if (index != -1)
+      {
+        return (String) completeFormatString.get(index);
+      }
+*/
+      final StringBuffer b = new StringBuffer();
+      b.append("{");
+      b.append(String.valueOf(fields.size()));
+      while (tokenizer.hasMoreTokens())
+      {
+        b.append(",");
+        b.append(tokenizer.nextToken());
+      }
+      b.append("}");
+      final String formatString = b.toString();
+      completeFormatString.add(formatString);
+      fields.add(varName);
+      return formatString;
+    }
+
+    public String[] getFields()
+    {
+      return (String[]) fields.toArray(new String[fields.size()]);
+    }
+  }
+
+  private String[] fields;
+  private MessageFormat format;
+  private String formatString;
+  private String compiledFormat;
+  private String nullString;
+
+  public MessageFormatSupport()
+  {
+  }
+
+  public String getFormatString()
+  {
+    return formatString;
+  }
+
+  public void setFormatString(final String formatString)
+  {
+    final MessageCompiler compiler = new MessageCompiler();
+    if (formatString == null)
+    {
+      throw new NullPointerException("Format must not be null");
+    }
+    compiledFormat = compiler.translateAndLookup(formatString);
+    fields = compiler.getFields();
+    format = new MessageFormat(compiledFormat);
+    this.formatString = formatString;
+  }
+
+  public String performFormat(final DataRow dataRow) throws DataSourceException
+  {
+    return formatWithReplace(dataRow, format, fields, nullString);
+  }
+
+  public Locale getLocale()
+  {
+    return format.getLocale();
+  }
+
+  public String getCompiledFormat()
+  {
+    return compiledFormat;
+  }
+
+  public void setLocale(final Locale locale)
+  {
+    format.setLocale(locale);
+    format.applyPattern(compiledFormat);
+  }
+
+  public String getNullString()
+  {
+    return nullString;
+  }
+
+  public void setNullString(String nullString)
+  {
+    this.nullString = nullString;
+  }
+
+  public Object clone()
+          throws CloneNotSupportedException
+  {
+    MessageFormatSupport support = (MessageFormatSupport) super.clone();
+    if (format != null)
+    {
+      support.format = (MessageFormat) format.clone();
+    }
+    return support;
+  }
+
+  public String[] getFields()
+  {
+    return (String[]) fields.clone();
+  }
+
+
+  public static String formatWithReplace(final DataRow dataRow,
+                                         final MessageFormat format,
+                                         final String[] fields,
+                                         final String nullString)
+          throws DataSourceException
+  {
+    if (fields == null || format == null)
+    {
+      return null;
+    }
+
+    boolean fastProcessingPossible = (nullString == null);
+
+    final Format[] formats = format.getFormats();
+    boolean fastProcessing = true;
+    final Object[] parameters = new Object[fields.length];
+    final boolean[] replaced = new boolean[fields.length];
+    for (int i = 0; i < parameters.length; i++)
+    {
+      final Object value = dataRow.get(fields[i]);
+      final Format currentFormat = formats[i];
+      if (value == null)
+      {
+        parameters[i] = nullString;
+        replaced[i] = currentFormat != null;
+        fastProcessing = (fastProcessing && fastProcessingPossible && replaced[i] == false);
+      }
+      else
+      {
+        if (currentFormat instanceof DateFormat)
+        {
+          if (value instanceof Date)
+          {
+            parameters[i] = value;
+            replaced[i] = false;
+          }
+          else
+          {
+            parameters[i] = nullString;
+            replaced[i] = true;
+            fastProcessing = (fastProcessing && fastProcessingPossible && replaced[i] == false);
+          }
+        }
+        else if (currentFormat instanceof NumberFormat)
+        {
+          if (value instanceof Number)
+          {
+            parameters[i] = value;
+            replaced[i] = false;
+          }
+          else
+          {
+            parameters[i] = nullString;
+            replaced[i] = true;
+            fastProcessing = (fastProcessing && fastProcessingPossible && replaced[i] == false);
+          }
+        }
+        else
+        {
+          parameters[i] = value;
+          replaced[i] = false;
+        }
+      }
+    }
+    if (fastProcessing)
+    {
+      return format.format(parameters);
+    }
+
+    final MessageFormat effectiveFormat = (MessageFormat) format.clone();
+    for (int i = 0; i < replaced.length; i++)
+    {
+      boolean b = replaced[i];
+      if (b)
+      {
+        effectiveFormat.setFormat(i, null);
+      }
+    }
+    return effectiveFormat.format(parameters);
+  }
+
+
+  public static String formatWithReplace(final MessageFormat format,
+                                         final Object[] inputValues,
+                                         final String nullString)
+  {
+    if (inputValues == null || format == null)
+    {
+      return null;
+    }
+
+    Object[] values = (Object[]) inputValues.clone();
+
+    boolean fastProcessingPossible = (nullString == null);
+
+    final Format[] formats = format.getFormats();
+    boolean fastProcessing = true;
+    final boolean[] replaced = new boolean[values.length];
+    for (int i = 0; i < values.length; i++)
+    {
+      final Object value = values[i];
+      final Format currentFormat = formats[i];
+      if (value == null)
+      {
+        values[i] = nullString;
+        replaced[i] = currentFormat != null;
+        fastProcessing = (fastProcessing && fastProcessingPossible && replaced[i] == false);
+      }
+      else
+      {
+        if (currentFormat instanceof DateFormat)
+        {
+          if (value instanceof Date)
+          {
+            values[i] = value;
+            replaced[i] = false;
+          }
+          else
+          {
+            values[i] = nullString;
+            replaced[i] = true;
+            fastProcessing = (fastProcessing && fastProcessingPossible && replaced[i] == false);
+          }
+        }
+        else if (currentFormat instanceof NumberFormat)
+        {
+          if (value instanceof Number)
+          {
+            values[i] = value;
+            replaced[i] = false;
+          }
+          else
+          {
+            values[i] = nullString;
+            replaced[i] = true;
+            fastProcessing = (fastProcessing && fastProcessingPossible && replaced[i] == false);
+          }
+        }
+        else
+        {
+          values[i] = value;
+          replaced[i] = false;
+        }
+      }
+    }
+    if (fastProcessing)
+    {
+      return format.format(values);
+    }
+
+    final MessageFormat effectiveFormat = (MessageFormat) format.clone();
+    for (int i = 0; i < replaced.length; i++)
+    {
+      boolean b = replaced[i];
+      if (b)
+      {
+        effectiveFormat.setFormat(i, null);
+      }
+    }
+    return effectiveFormat.format(values);
+  }
+
+}
diff --git a/source/org/jfree/report/util/NoCloseOutputStream.java b/source/org/jfree/report/util/NoCloseOutputStream.java
new file mode 100644
index 0000000..00ccefa
--- /dev/null
+++ b/source/org/jfree/report/util/NoCloseOutputStream.java
@@ -0,0 +1,77 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: NoCloseOutputStream.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * A Wrapper stream that does never calls close on its parent. This implementation is
+ * needed when creating ZipOutputStream, as the final ZipDirectory is written when close
+ * is called on the ZipOutputSteam.
+ *
+ * @author Thomas Morgner
+ */
+public class NoCloseOutputStream extends FilterOutputStream
+{
+  /**
+   * Create a new NoCloseOutputStream with the given output stream a parent.
+   *
+   * @param out the parent stream
+   */
+  public NoCloseOutputStream (final OutputStream out)
+  {
+    super(out);
+    if (out == null)
+    {
+      throw new NullPointerException("Given Output Stream is null!");
+    }
+  }
+
+  /**
+   * Closes this output stream and releases any system resources associated with the
+   * stream, but does not close the underlying output stream.
+   * <p/>
+   * The <code>close</code> method of <code>FilterOutputStream</code> calls its
+   * <code>flush</code> method.
+   *
+   * @throws IOException if an I/O error occurs.
+   * @see FilterOutputStream#flush()
+   * @see FilterOutputStream#out
+   */
+  public void close ()
+          throws IOException
+  {
+    flush();
+    // do not close the parent stream ... !
+  }
+}
diff --git a/source/org/jfree/report/util/ObjectStreamResolveException.java b/source/org/jfree/report/util/ObjectStreamResolveException.java
new file mode 100644
index 0000000..41e9d72
--- /dev/null
+++ b/source/org/jfree/report/util/ObjectStreamResolveException.java
@@ -0,0 +1,59 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ObjectStreamResolveException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.io.ObjectStreamException;
+
+/**
+ * The <code>ObjectStreamResolveException</code> this thrown, when the object resolving
+ * operation for serialized objects failed.
+ *
+ * @author Thomas Morgner
+ */
+public class ObjectStreamResolveException extends ObjectStreamException
+{
+  /**
+   * Create an ObjectStreamException with the specified argument.
+   *
+   * @param classname the detailed message for the exception
+   */
+  public ObjectStreamResolveException (final String classname)
+  {
+    super(classname);
+  }
+
+  /**
+   * Create an ObjectStreamException.
+   */
+  public ObjectStreamResolveException ()
+  {
+  }
+}
diff --git a/source/org/jfree/report/util/PropertyLookupParser.java b/source/org/jfree/report/util/PropertyLookupParser.java
new file mode 100644
index 0000000..342a53a
--- /dev/null
+++ b/source/org/jfree/report/util/PropertyLookupParser.java
@@ -0,0 +1,264 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: PropertyLookupParser.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.io.Serializable;
+
+/**
+ * The property lookup parser is used to resolve embedded references to
+ * properties within strings.
+ * <p>
+ * The default format of the property specification is:
+ * <code>${property-name}</code> where 'property-name is the name of the
+ * property. If this construct is found within the text, it is replaced with
+ * the value returned from a call to "lookupVariable".
+ *
+ * @author Thomas Morgner
+ */
+public abstract class PropertyLookupParser implements Serializable
+{
+  /** A parse state indicator signaling that the parser is outside a property. */
+  private static final int EXPECT_DOLLAR = 0;
+  /** A parse state indicator signaling that an open brace is expected. */
+  private static final int EXPECT_OPEN_BRACE = 1;
+
+  /**
+   * A parse state indicator signaling that a closed brace is expected. All chars
+   * received, which are not equal to the closed brace, count as property name.
+   */
+  private static final int EXPECT_CLOSE_BRACE = 2;
+  /** The initial marker char, a $ by default. */
+  private char markerChar;
+  /** The closing brace char. */
+  private char closingBraceChar;
+  /** The opening brace char. */
+  private char openingBraceChar;
+  /** The escape char. */
+  private char escapeChar;
+
+  /**
+   * Initializes the parser to the default format of "${..}". The
+   * escape char will be a backslash.
+   */
+  protected PropertyLookupParser ()
+  {
+    markerChar = '$';
+    closingBraceChar = '}';
+    openingBraceChar = '{';
+    escapeChar = '\\';
+  }
+
+  /**
+   * Returns the currently defined closed-brace char.
+   *
+   * @return the closed-brace char.
+   */
+  public char getClosingBraceChar ()
+  {
+    return closingBraceChar;
+  }
+
+  /**
+   * Defines the closing brace character.
+   * @param closingBraceChar the closed-brace character.
+   */
+  public void setClosingBraceChar (final char closingBraceChar)
+  {
+    this.closingBraceChar = closingBraceChar;
+  }
+
+  /**
+   * Returns the escape char.
+   * @return the escape char.
+   */
+  public char getEscapeChar ()
+  {
+    return escapeChar;
+  }
+
+  /**
+   * Defines the escape char.
+   *
+   * @param escapeChar the escape char
+   */
+  public void setEscapeChar (final char escapeChar)
+  {
+    this.escapeChar = escapeChar;
+  }
+
+  /**
+   * Returns the currently defined opening-brace char.
+   *
+   * @return the opening-brace char.
+   */
+  public char getOpeningBraceChar ()
+  {
+    return openingBraceChar;
+  }
+
+  /**
+   * Defines the opening brace character.
+   * @param openingBraceChar the opening-brace character.
+   */
+  public void setOpeningBraceChar (final char openingBraceChar)
+  {
+    this.openingBraceChar = openingBraceChar;
+  }
+
+  /**
+   * Returns initial property marker char.
+   * @return the initial property marker character.
+   */
+  public char getMarkerChar ()
+  {
+    return markerChar;
+  }
+
+  /**
+   * Defines initial property marker char.
+   * @param markerChar the initial property marker character.
+   */
+  public void setMarkerChar (final char markerChar)
+  {
+    this.markerChar = markerChar;
+  }
+
+  /**
+   * Translates the given string and resolves the embedded property references.
+   *
+   * @param value the raw value,
+   * @return the fully translated string.
+   */
+  public String translateAndLookup (final String value)
+  {
+    if (value == null)
+    {
+      return null;
+    }
+
+    final char[] chars = value.toCharArray();
+    final StringBuffer result = new StringBuffer(chars.length);
+    boolean haveEscape = false;
+    int state = EXPECT_DOLLAR;
+    final StringBuffer propertyName = new StringBuffer();
+
+    for (int i = 0; i < chars.length; i++)
+    {
+      final char c = chars[i];
+
+      if (haveEscape)
+      {
+        haveEscape = false;
+        if (state == EXPECT_CLOSE_BRACE)
+        {
+          propertyName.append(c);
+        }
+        else
+        {
+          result.append(c);
+        }
+        continue;
+      }
+
+      if (state == EXPECT_DOLLAR && c == markerChar)
+      {
+        state = EXPECT_OPEN_BRACE;
+        continue;
+      }
+      if (state == EXPECT_OPEN_BRACE)
+      {
+        if (c == openingBraceChar)
+        {
+          state = EXPECT_CLOSE_BRACE;
+          continue;
+        }
+        else
+        {
+          result.append(markerChar);
+          state = 0;
+        }
+      }
+      if (state == EXPECT_CLOSE_BRACE && c == closingBraceChar)
+      {
+        final String s = lookupVariable(propertyName.toString());
+        if (s == null)
+        {
+          result.append(markerChar);
+          result.append(openingBraceChar);
+          result.append(propertyName);
+          result.append(closingBraceChar);
+        }
+        else
+        {
+          result.append(s);
+        }
+        propertyName.delete(0, propertyName.length());
+        state = 0;
+        continue;
+      }
+
+      if (c == escapeChar)
+      {
+        haveEscape = true;
+        continue;
+      }
+
+      if (state == EXPECT_CLOSE_BRACE)
+      {
+        propertyName.append(c);
+      }
+      else
+      {
+        result.append(c);
+      }
+    }
+
+    if (state >= EXPECT_OPEN_BRACE)
+    {
+      result.append(markerChar);
+      if (state >= EXPECT_CLOSE_BRACE)
+      {
+        result.append(openingBraceChar);
+        result.append(propertyName);
+      }
+    }
+    return result.toString();
+  }
+
+  /**
+   * Looks up the property with the given name.
+   *
+   * @param property the name of the property to look up.
+   * @return the translated value.
+   */
+  protected abstract String lookupVariable (String property);
+}
diff --git a/source/org/jfree/report/util/ReportParameters.java b/source/org/jfree/report/util/ReportParameters.java
new file mode 100644
index 0000000..7567722
--- /dev/null
+++ b/source/org/jfree/report/util/ReportParameters.java
@@ -0,0 +1,188 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ReportParameters.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.io.Serializable;
+import java.util.HashMap;
+
+/**
+ * The report parameters collection is a map with string keys. The parameters
+ * can be used in a query and will appear as part of the datarow.
+ *
+ * @author Thomas Morgner
+ */
+public final class ReportParameters implements Serializable, Cloneable
+{
+  /**
+   * Storage for the properties.
+   */
+  private HashMap properties;
+
+  /**
+   * Copy constructor.
+   *
+   * @param props an existing ReportProperties instance.
+   */
+  public ReportParameters (final ReportParameters props)
+  {
+    this.properties = new HashMap(props.properties);
+  }
+
+  /**
+   * Default constructor.
+   */
+  public ReportParameters ()
+  {
+    this.properties = new HashMap();
+  }
+
+  /**
+   * Adds a property to this properties collection. If a property with the given name
+   * exist, the property will be replaced with the new value. If the value is null, the
+   * property will be removed.
+   *
+   * @param key   the property key.
+   * @param value the property value.
+   */
+  public void put (final String key, final Object value)
+  {
+    if (key == null)
+    {
+      throw new NullPointerException
+              ("ReportProperties.put (..): Parameter 'key' must not be null");
+    }
+    if (value == null)
+    {
+      this.properties.remove(key);
+    }
+    else
+    {
+      this.properties.put(key, value);
+    }
+  }
+
+  /**
+   * Retrieves the value stored for a key in this properties collection.
+   *
+   * @param key the property key.
+   * @return The stored value, or <code>null</code> if the key does not exist in this
+   *         collection.
+   */
+  public Object get (final String key)
+  {
+    if (key == null)
+    {
+      throw new NullPointerException
+              ("ReportProperties.get (..): Parameter 'key' must not be null");
+    }
+    return this.properties.get(key);
+  }
+
+  /**
+   * Retrieves the value stored for a key in this properties collection, and returning the
+   * default value if the key was not stored in this properties collection.
+   *
+   * @param key          the property key.
+   * @param defaultValue the default value to be returned when the key is not stored in
+   *                     this properties collection.
+   * @return The stored value, or the default value if the key does not exist in this
+   *         collection.
+   */
+  public Object get (final String key, final Object defaultValue)
+  {
+    if (key == null)
+    {
+      throw new NullPointerException
+              ("ReportProperties.get (..): Parameter 'key' must not be null");
+    }
+    final Object o = this.properties.get(key);
+    if (o == null)
+    {
+      return defaultValue;
+    }
+    return o;
+  }
+
+  /**
+   * Returns all property keys as array.
+   *
+   * @return an enumeration of the property keys.
+   */
+  public String[] keys ()
+  {
+    return (String[]) this.properties.keySet().toArray(new String[properties.size()]);
+  }
+
+  /**
+   * Removes all properties stored in this collection.
+   */
+  public void clear ()
+  {
+    this.properties.clear();
+  }
+
+  /**
+   * Checks whether the given key is stored in this collection of ReportProperties.
+   *
+   * @param key the property key.
+   * @return true, if the given key is known.
+   */
+  public boolean containsKey (final String key)
+  {
+    if (key == null)
+    {
+      throw new NullPointerException
+              ("ReportProperties.containsKey (..): Parameter key must not be null");
+    }
+    return this.properties.containsKey(key);
+  }
+
+  /**
+   * Clones the properties.
+   *
+   * @return a copy of this ReportProperties object.
+   *
+   * @throws CloneNotSupportedException this should never happen.
+   */
+  public Object clone ()
+          throws CloneNotSupportedException
+  {
+    final ReportParameters p = (ReportParameters) super.clone();
+    p.properties = (HashMap) this.properties.clone();
+    return p;
+  }
+
+  public int size()
+  {
+    return properties.size();
+  }
+}
diff --git a/source/org/jfree/report/util/ScalingDrawable.java b/source/org/jfree/report/util/ScalingDrawable.java
new file mode 100644
index 0000000..d9c9507
--- /dev/null
+++ b/source/org/jfree/report/util/ScalingDrawable.java
@@ -0,0 +1,128 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ScalingDrawable.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+
+import org.pentaho.reporting.libraries.resourceloader.factory.drawable.DrawableWrapper;
+
+/**
+ * Creation-Date: 20.01.2006, 19:46:10
+ *
+ * @author Thomas Morgner
+ */
+public class ScalingDrawable  extends DrawableWrapper
+{
+  /**
+   * The horizontal scale factor.
+   */
+  private float scaleX;
+  /**
+   * The vertical scale factor.
+   */
+  private float scaleY;
+
+
+  /**
+   * Default constructor. Initializes the scaling to 1.
+   * @param drawable the drawable object
+   */
+  public ScalingDrawable(final Object drawable)
+  {
+    super(drawable);
+    scaleX = 1;
+    scaleY = 1;
+  }
+
+  /**
+   * Returns the vertical scale factor.
+   *
+   * @return the scale factor.
+   */
+  public float getScaleY()
+  {
+    return scaleY;
+  }
+
+  /**
+   * Defines the vertical scale factor.
+   *
+   * @param scaleY the scale factor.
+   */
+  public void setScaleY(final float scaleY)
+  {
+    this.scaleY = scaleY;
+  }
+
+  /**
+   * Returns the horizontal scale factor.
+   *
+   * @return the scale factor.
+   */
+  public float getScaleX()
+  {
+    return scaleX;
+  }
+
+  /**
+   * Defines the horizontal scale factor.
+   *
+   * @param scaleX the scale factor.
+   */
+  public void setScaleX(final float scaleX)
+  {
+    this.scaleX = scaleX;
+  }
+
+  /**
+   * Draws the object.
+   *
+   * @param g2   the graphics device.
+   * @param area the area inside which the object should be drawn.
+   */
+  public void draw(final Graphics2D g2, final Rectangle2D area)
+  {
+    final Object drawable = getBackend();
+    if (drawable == null)
+    {
+      return;
+    }
+
+    final Graphics2D derived = (Graphics2D) g2.create();
+    derived.scale(scaleX, scaleY);
+    final Rectangle2D scaledArea = (Rectangle2D) area.clone();
+    scaledArea.setRect(scaledArea.getX() * scaleX, scaledArea.getY() * scaleY,
+            scaledArea.getWidth() * scaleX, scaledArea.getHeight() * scaleY);
+    super.draw(derived, scaledArea);
+    derived.dispose();
+  }
+}
diff --git a/source/org/jfree/report/util/ScalingExtendedDrawable.java b/source/org/jfree/report/util/ScalingExtendedDrawable.java
new file mode 100644
index 0000000..39db431
--- /dev/null
+++ b/source/org/jfree/report/util/ScalingExtendedDrawable.java
@@ -0,0 +1,128 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ScalingExtendedDrawable.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util;
+
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+
+import org.pentaho.reporting.libraries.resourceloader.factory.drawable.DrawableWrapper;
+
+/**
+ * Creation-Date: 20.01.2006, 19:46:10
+ *
+ * @author Thomas Morgner
+ */
+public class ScalingExtendedDrawable extends DrawableWrapper 
+{
+  /**
+   * The horizontal scale factor.
+   */
+  private float scaleX;
+  /**
+   * The vertical scale factor.
+   */
+  private float scaleY;
+
+
+  /**
+   * Default constructor. Initializes the scaling to 1.
+   * @param drawable the drawable object
+   */
+  public ScalingExtendedDrawable(final Object drawable)
+  {
+    super(drawable);
+    scaleX = 1;
+    scaleY = 1;
+  }
+
+  /**
+   * Returns the vertical scale factor.
+   *
+   * @return the scale factor.
+   */
+  public float getScaleY()
+  {
+    return scaleY;
+  }
+
+  /**
+   * Defines the vertical scale factor.
+   *
+   * @param scaleY the scale factor.
+   */
+  public void setScaleY(final float scaleY)
+  {
+    this.scaleY = scaleY;
+  }
+
+  /**
+   * Returns the horizontal scale factor.
+   *
+   * @return the scale factor.
+   */
+  public float getScaleX()
+  {
+    return scaleX;
+  }
+
+  /**
+   * Defines the horizontal scale factor.
+   *
+   * @param scaleX the scale factor.
+   */
+  public void setScaleX(final float scaleX)
+  {
+    this.scaleX = scaleX;
+  }
+
+  /**
+   * Draws the object.
+   *
+   * @param g2   the graphics device.
+   * @param area the area inside which the object should be drawn.
+   */
+  public void draw(final Graphics2D g2, final Rectangle2D area)
+  {
+    final Object drawable = getBackend();
+    if (drawable == null)
+    {
+      return;
+    }
+
+    final Graphics2D derived = (Graphics2D) g2.create();
+    derived.scale(scaleX, scaleY);
+    final Rectangle2D scaledArea = (Rectangle2D) area.clone();
+    scaledArea.setRect(scaledArea.getX() * scaleX, scaledArea.getY() * scaleY,
+            scaledArea.getWidth() * scaleX, scaledArea.getHeight() * scaleY);
+    super.draw(derived, scaledArea);
+    derived.dispose();
+  }
+}
diff --git a/source/org/jfree/report/util/TextUtilities.java b/source/org/jfree/report/util/TextUtilities.java
new file mode 100644
index 0000000..bdbd73e
--- /dev/null
+++ b/source/org/jfree/report/util/TextUtilities.java
@@ -0,0 +1,69 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TextUtilities.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+/**
+ * Todo: Document me!
+ *
+ * @author Thomas Morgner
+ * @since 30.03.2007
+ */
+public class TextUtilities
+{
+  private TextUtilities()
+  {
+  }
+
+  /**
+   * Parses the given string and returns the parsed integer value or the given default if
+   * the parsing failed.
+   *
+   * @param value        the to be parsed string
+   * @param defaultValue the default value
+   * @return the parsed string.
+   */
+  public static int parseInt (final String value, final int defaultValue)
+  {
+    if (value == null)
+    {
+      return defaultValue;
+    }
+    try
+    {
+      return Integer.parseInt(value);
+    }
+    catch (Exception e)
+    {
+      return defaultValue;
+    }
+  }
+}
diff --git a/source/org/jfree/report/util/WeakReferenceList.java b/source/org/jfree/report/util/WeakReferenceList.java
new file mode 100644
index 0000000..b0fc61f
--- /dev/null
+++ b/source/org/jfree/report/util/WeakReferenceList.java
@@ -0,0 +1,344 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: WeakReferenceList.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+
+/**
+ * The WeakReference list uses <code>java.lang.ref.WeakReference</code>s to store its
+ * contents. In contrast to the WeakHashtable, this list knows how to restore missing
+ * content, so that garbage collected elements can be restored when they are accessed.
+ * <p/>
+ * By default this list can contain 25 elements, where the first element is stored using a
+ * strong reference, which is not garbage collected.
+ * <p/>
+ * Restoring the elements is not implemented, concrete implementations will have to
+ * override the <code>restoreChild(int)</code> method. The <code>getMaxChildCount</code>
+ * method defines the maxmimum number of children in the list. When more than
+ * <code>maxChildCount</code> elements are contained in this list, add will always return
+ * false to indicate that adding the element failed.
+ * <p/>
+ * To customize the list, override createReference to create a different kind of
+ * reference.
+ * <p/>
+ * This list is able to add or clearFromParent elements, but inserting or removing of elements is
+ * not possible.
+ * <p/>
+ *
+ * @author Thomas Morgner
+ */
+public abstract class WeakReferenceList implements Serializable, Cloneable
+{
+  /**
+   * The master element.
+   */
+  private Object master;
+
+  /**
+   * Storage for the references.
+   */
+  private Reference[] childs;
+
+  /**
+   * The current number of elements.
+   */
+  private int size;
+
+  /**
+   * The maximum number of elements.
+   */
+  private final int maxChilds;
+
+  /**
+   * Creates a new weak reference list. The storage of the list is limited to
+   * getMaxChildCount() elements.
+   *
+   * @param maxChildCount the maximum number of elements.
+   */
+  protected WeakReferenceList (final int maxChildCount)
+  {
+    this.maxChilds = maxChildCount;
+    this.childs = new Reference[maxChildCount - 1];
+  }
+
+  /**
+   * Returns the maximum number of children in this list.
+   *
+   * @return the maximum number of elements in this list.
+   */
+  protected final int getMaxChildCount ()
+  {
+    return maxChilds;
+  }
+
+  /**
+   * Returns the master element of this list. The master element is the element stored by
+   * a strong reference and cannot be garbage collected.
+   *
+   * @return the master element
+   */
+  protected Object getMaster ()
+  {
+    return master;
+  }
+
+  /**
+   * Attempts to restore the child stored on the given index.
+   *
+   * @param index the index.
+   * @return null if the child could not be restored or the restored child.
+   */
+  protected abstract Object restoreChild (int index);
+
+  /**
+   * Returns the child stored at the given index. If the child has been garbage collected,
+   * it gets restored using the restoreChild function.
+   *
+   * @param index the index.
+   * @return the object.
+   */
+  public Object get (final int index)
+  {
+    if (isMaster(index))
+    {
+      return master;
+    }
+    else
+    {
+      final Reference ref = childs[getChildPos(index)];
+      if (ref == null)
+      {
+        throw new IllegalStateException("State: " + index);
+      }
+      Object ob = ref.get();
+      if (ob == null)
+      {
+        ob = restoreChild(index);
+        childs[getChildPos(index)] = createReference(ob);
+      }
+      return ob;
+    }
+  }
+
+  /**
+   * Replaces the child stored at the given index with the new child which can be null.
+   *
+   * @param report the object.
+   * @param index  the index.
+   */
+  public void set (final Object report, final int index)
+  {
+    if (isMaster(index))
+    {
+      master = report;
+    }
+    else
+    {
+      childs[getChildPos(index)] = createReference(report);
+    }
+  }
+
+  /**
+   * Creates a new reference for the given object.
+   *
+   * @param o the object.
+   * @return a WeakReference for the object o without any ReferenceQueue attached.
+   */
+  private Reference createReference (final Object o)
+  {
+    return new WeakReference(o);
+  }
+
+  /**
+   * Adds the element to the list. If the maximum size of the list is exceeded, this
+   * function returns false to indicate that adding failed.
+   *
+   * @param rs the object.
+   * @return true, if the object was successfully added to the list, false otherwise
+   */
+  public boolean add (final Object rs)
+  {
+    if (size == 0)
+    {
+      master = rs;
+      size = 1;
+      return true;
+    }
+    else
+    {
+      if (size < getMaxChildCount())
+      {
+        childs[size - 1] = createReference(rs);
+        size++;
+        return true;
+      }
+      else
+      {
+        // was not able to add this to this list, maximum number of entries reached.
+        return false;
+      }
+    }
+  }
+
+  /**
+   * Returns true, if the given index denotes a master index of this list.
+   *
+   * @param index the index.
+   * @return true if the index is a master index.
+   */
+  protected boolean isMaster (final int index)
+  {
+    return index % getMaxChildCount() == 0;
+  }
+
+  /**
+   * Returns the internal storage position for the child.
+   *
+   * @param index the index.
+   * @return the internal storage index.
+   */
+  protected int getChildPos (final int index)
+  {
+    return index % getMaxChildCount() - 1;
+  }
+
+  /**
+   * Returns the size of the list.
+   *
+   * @return the size.
+   */
+  public int getSize ()
+  {
+    return size;
+  }
+
+  /**
+   * Serialisation support. The transient child elements are not saved.
+   *
+   * @param out the output stream.
+   * @throws IOException if there is an I/O error.
+   */
+  private void writeObject (final java.io.ObjectOutputStream out)
+          throws IOException
+  {
+    final Reference[] orgChilds = childs;
+    try
+    {
+      childs = null;
+      out.defaultWriteObject();
+    }
+    finally
+    {
+      childs = orgChilds;
+    }
+  }
+
+  /**
+   * Serialisation support. The transient child elements were not saved.
+   *
+   * @param in the input stream.
+   * @throws IOException            if there is an I/O error.
+   * @throws ClassNotFoundException if a serialized class is not defined on this system.
+   */
+  private void readObject (final java.io.ObjectInputStream in)
+          throws IOException, ClassNotFoundException
+  {
+    in.defaultReadObject();
+    childs = new Reference[getMaxChildCount() - 1];
+    for (int i = 0; i < childs.length; i++)
+    {
+      childs[i] = createReference(null);
+    }
+  }
+
+  /**
+   * Creates and returns a copy of this object.  The precise meaning of "copy" may depend
+   * on the class of the object. The general intent is that, for any object <tt>x</tt>,
+   * the expression: <blockquote>
+   * <pre>
+   * x.clone() != x</pre></blockquote>
+   * will be true, and that the expression: <blockquote>
+   * <pre>
+   * x.clone().getClass() == x.getClass()</pre></blockquote>
+   * will be <tt>true</tt>, but these are not absolute requirements. While it is typically
+   * the case that: <blockquote>
+   * <pre>
+   * x.clone().equals(x)</pre></blockquote>
+   * will be <tt>true</tt>, this is not an absolute requirement.
+   * <p/>
+   * By convention, the returned object should be obtained by calling
+   * <tt>super.clone</tt>.  If a class and all of its superclasses (except
+   * <tt>Object</tt>) obey this convention, it will be the case that
+   * <tt>x.clone().getClass() == x.getClass()</tt>.
+   * <p/>
+   * By convention, the object returned by this method should be independent of this
+   * object (which is being cloned).  To achieve this independence, it may be necessary to
+   * modify one or more fields of the object returned by <tt>super.clone</tt> before
+   * returning it.  Typically, this means copying any mutable objects that comprise the
+   * internal "deep structure" of the object being cloned and replacing the references to
+   * these objects with references to the copies.  If a class contains only primitive
+   * fields or references to immutable objects, then it is usually the case that no fields
+   * in the object returned by <tt>super.clone</tt> need to be modified.
+   * <p/>
+   * The method <tt>clone</tt> for class <tt>Object</tt> performs a specific cloning
+   * operation. First, if the class of this object does not implement the interface
+   * <tt>Cloneable</tt>, then a <tt>CloneNotSupportedException</tt> is thrown. Note that
+   * all arrays are considered to implement the interface <tt>Cloneable</tt>. Otherwise,
+   * this method creates a new instance of the class of this object and initializes all
+   * its fields with exactly the contents of the corresponding fields of this object, as
+   * if by assignment; the contents of the fields are not themselves cloned. Thus, this
+   * method performs a "shallow copy" of this object, not a "deep copy" operation.
+   * <p/>
+   * The class <tt>Object</tt> does not itself implement the interface <tt>Cloneable</tt>,
+   * so calling the <tt>clone</tt> method on an object whose class is <tt>Object</tt> will
+   * result in throwing an exception at run time.
+   *
+   * @return a clone of this instance.
+   *
+   * @throws CloneNotSupportedException if the object's class does not support the
+   *                                    <code>Cloneable</code> interface. Subclasses that
+   *                                    override the <code>clone</code> method can also
+   *                                    throw this exception to indicate that an instance
+   *                                    cannot be cloned.
+   * @see Cloneable
+   */
+  protected Object clone ()
+          throws CloneNotSupportedException
+  {
+    final WeakReferenceList list = (WeakReferenceList) super.clone();
+    list.childs = (Reference[]) childs.clone();
+    return list;
+  }
+}
diff --git a/source/org/jfree/report/util/Worker.java b/source/org/jfree/report/util/Worker.java
new file mode 100644
index 0000000..4ee3674
--- /dev/null
+++ b/source/org/jfree/report/util/Worker.java
@@ -0,0 +1,202 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: Worker.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+import org.pentaho.reporting.libraries.base.util.DebugLog;
+
+/**
+ * A simple worker implementation. The worker executes a assigned workload and then sleeps
+ * until another workload is set or the worker is killed.
+ *
+ * @author Thomas Morgner
+ */
+public final class Worker extends Thread
+{
+  /**
+   * the worker's task.
+   */
+  private Runnable workload;
+
+  /**
+   * a flag whether the worker should exit after the processing.
+   */
+  private volatile boolean finish;
+
+  /**
+   * The worker pool, to which this worker is assigned. May be null.
+   */
+  private WorkerPool workerPool;
+
+  /**
+   * Creates a new worker.
+   */
+  public Worker ()
+  {
+    this.setDaemon(true);
+    start();
+  }
+
+  /**
+   * Set the next workload for this worker.
+   *
+   * @param r the next workload for the worker.
+   * @throws IllegalStateException if the worker is not idle.
+   */
+  public void setWorkload (final Runnable r)
+  {
+    if (workload != null)
+    {
+      throw new IllegalStateException("This worker is not idle.");
+    }
+    //Log.debug("Workload set...");
+    synchronized (this)
+    {
+      workload = r;
+      //Log.debug("Workload assigned: Notified " + getName());
+      this.notifyAll();
+    }
+  }
+
+  /**
+   * Returns the workload object.
+   *
+   * @return the runnable executed by this worker thread.
+   */
+  public synchronized Runnable getWorkload()
+  {
+    return workload;
+  }
+
+  /**
+   * Kills the worker after he completed his work. Awakens the worker if he's sleeping, so
+   * that the worker dies without delay.
+   */
+  public void finish ()
+  {
+    finish = true;
+    // we are evil ..
+    try
+    {
+      this.interrupt();
+      this.notifyAll();
+    }
+    catch (SecurityException se)
+    {
+      // ignored
+    }
+    if (workerPool != null)
+    {
+      workerPool.workerFinished(this);
+    }
+  }
+
+  /**
+   * Checks, whether this worker has some work to do.
+   *
+   * @return true, if this worker has no more work and is currently sleeping.
+   */
+  public boolean isAvailable ()
+  {
+    return (workload == null);
+  }
+
+  /**
+   * If a workload is set, process it. After the workload is processed, this worker starts
+   * to sleep until a new workload is set for the worker or the worker got the finish()
+   * request.
+   */
+  public synchronized void run ()
+  {
+    while (!finish)
+    {
+      if (workload != null)
+      {
+        try
+        {
+          workload.run();
+        }
+        catch (Exception e)
+        {
+          DebugLog.log("Worker caught exception on run: ", e);
+        }
+        workload = null;
+        if (workerPool != null)
+        {
+          workerPool.workerAvailable(this);
+        }
+      }
+
+      synchronized (this)
+      {
+        try
+        {
+          this.wait();
+        }
+        catch (InterruptedException ie)
+        {
+          // ignored
+        }
+      }
+    }
+  }
+
+  /**
+   * Checks whether this worker has received the signal to finish and die.
+   *
+   * @return true, if the worker should finish the work and end the thread.
+   */
+  public boolean isFinish ()
+  {
+    return finish;
+  }
+
+  /**
+   * Returns the worker's assigned pool.
+   *
+   * @return the worker pool (or null, if the worker is not assigned to a pool).
+   */
+  public WorkerPool getWorkerPool ()
+  {
+    return workerPool;
+  }
+
+  /**
+   * Defines the worker's assigned pool.
+   *
+   * @param workerPool the worker pool (or null, if the worker is not assigned to a
+   *                   pool).
+   */
+  public void setWorkerPool (final WorkerPool workerPool)
+  {
+    this.workerPool = workerPool;
+  }
+}
diff --git a/source/org/jfree/report/util/WorkerHandle.java b/source/org/jfree/report/util/WorkerHandle.java
new file mode 100644
index 0000000..1816fb2
--- /dev/null
+++ b/source/org/jfree/report/util/WorkerHandle.java
@@ -0,0 +1,64 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: WorkerHandle.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+/**
+ * The worker handle is a control structure which allows control over the worker without
+ * exposing the thread object.
+ *
+ * @author Thomas Morgner
+ */
+public class WorkerHandle
+{
+  /**
+   * The worker for this handle.
+   */
+  private final Worker worker;
+
+  /**
+   * Creates a new handle for the given worker.
+   *
+   * @param worker the worker.
+   */
+  public WorkerHandle (final Worker worker)
+  {
+    this.worker = worker;
+  }
+
+  /**
+   * Finishes the worker.
+   */
+  public void finish ()
+  {
+    worker.finish();
+  }
+}
diff --git a/source/org/jfree/report/util/WorkerPool.java b/source/org/jfree/report/util/WorkerPool.java
new file mode 100644
index 0000000..e5faeb7
--- /dev/null
+++ b/source/org/jfree/report/util/WorkerPool.java
@@ -0,0 +1,247 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: WorkerPool.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.util;
+
+/**
+ * A simple static workpool. Worker threads are created when necessary.
+ *
+ * @author Thomas Morgner
+ */
+public class WorkerPool
+{
+  /**
+   * The worker array.
+   */
+  private Worker[] workers;
+  /**
+   * A flag indicating whether idle workers are available.
+   */
+  private boolean workersAvailable;
+  /**
+   * the name prefix for all workers of this pool.
+   */
+  private String namePrefix;
+
+  /**
+   * Creates a new worker pool with the default size of 10 workers and the default name.
+   */
+  public WorkerPool ()
+  {
+    this(10);
+  }
+
+  /**
+   * Creates a new workerpool with the given number of workers and the default name.
+   *
+   * @param size the maximum number of workers available.
+   */
+  public WorkerPool (final int size)
+  {
+    this(size, "WorkerPool-worker");
+  }
+
+  /**
+   * Creates a new worker pool for the given number of workers and with the given name
+   * prefix.
+   *
+   * @param size       the size of the worker pool.
+   * @param namePrefix the name prefix for all created workers.
+   */
+  public WorkerPool (final int size, final String namePrefix)
+  {
+    if (size <= 0)
+    {
+      throw new IllegalArgumentException("Size must be > 0");
+    }
+    workers = new Worker[size];
+    workersAvailable = true;
+    this.namePrefix = namePrefix;
+  }
+
+  /**
+   * Checks, whether workers are available.
+   *
+   * @return true, if at least one worker is idle, false otherwise.
+   */
+  public synchronized boolean isWorkerAvailable ()
+  {
+    return workersAvailable;
+  }
+
+  /**
+   * Updates the workersAvailable flag after a worker was assigned.
+   */
+  private void updateWorkersAvailable ()
+  {
+    for (int i = 0; i < workers.length; i++)
+    {
+      if (workers[i] == null)
+      {
+        workersAvailable = true;
+        return;
+      }
+      if (workers[i].isAvailable() == true)
+      {
+        workersAvailable = true;
+        return;
+      }
+    }
+    workersAvailable = false;
+  }
+
+  /**
+   * Waits until a worker will be available.
+   */
+  private synchronized void waitForWorkerAvailable ()
+  {
+    while (isWorkerAvailable() == false)
+    {
+      try
+      {
+        // remove lock
+        this.wait(5000);
+      }
+      catch (InterruptedException ie)
+      {
+        // ignored
+      }
+    }
+  }
+
+  /**
+   * Returns a workerhandle for the given workload. This method will wait until an idle
+   * worker is found.
+   *
+   * @param r the workload for the worker
+   * @return a handle to the worker.
+   */
+  public synchronized WorkerHandle getWorkerForWorkload (final Runnable r)
+  {
+    waitForWorkerAvailable();
+
+    int emptySlot = -1;
+    for (int i = 0; i < workers.length; i++)
+    {
+      if (workers[i] == null)
+      {
+        // in the first run, try to avoid to create new threads...
+        // reuse the already available threads
+        if (emptySlot == -1)
+        {
+          emptySlot = i;
+        }
+        continue;
+      }
+      if (workers[i].isAvailable() == true)
+      {
+        workers[i].setWorkload(r);
+        updateWorkersAvailable();
+        return new WorkerHandle(workers[i]);
+      }
+    }
+    if (emptySlot != -1)
+    {
+      workers[emptySlot] = new Worker();
+      workers[emptySlot].setName(namePrefix + "-" + emptySlot);
+      workers[emptySlot].setWorkerPool(this);
+      workers[emptySlot].setWorkload(r);
+      updateWorkersAvailable();
+      return new WorkerHandle(workers[emptySlot]);
+    }
+    throw new IllegalStateException
+            ("At this point, a worker should already have been assigned.");
+  }
+
+  /**
+   * Marks the given worker as finished. The worker will be removed from the list of the
+   * available workers.
+   *
+   * @param worker the worker which was finished.
+   */
+  public void workerFinished (final Worker worker)
+  {
+    if (worker.isFinish() == false)
+    {
+      throw new IllegalArgumentException("This worker is not in the finish state.");
+    }
+    for (int i = 0; i < workers.length; i++)
+    {
+      if (workers[i] == worker)
+      {
+        synchronized (this)
+        {
+          workers[i] = null;
+          workersAvailable = true;
+          this.notifyAll();
+        }
+        return;
+      }
+    }
+    return;
+  }
+
+  /**
+   * Marks the given worker as available.
+   *
+   * @param worker the worker which was available.
+   */
+  public synchronized void workerAvailable (final Worker worker)
+  {
+    for (int i = 0; i < workers.length; i++)
+    {
+      if (workers[i] == worker)
+      {
+        synchronized (this)
+        {
+          workersAvailable = true;
+          this.notifyAll();
+        }
+        return;
+      }
+    }
+    return;
+  }
+
+  /**
+   * Finishes all worker of this pool.
+   */
+  public void finishAll ()
+  {
+    for (int i = 0; i < workers.length; i++)
+    {
+      if (workers[i] != null)
+      {
+        workers[i].finish();
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/util/beans/ArrayValueConverter.java b/source/org/jfree/report/util/beans/ArrayValueConverter.java
new file mode 100644
index 0000000..36ec273
--- /dev/null
+++ b/source/org/jfree/report/util/beans/ArrayValueConverter.java
@@ -0,0 +1,119 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ArrayValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+
+import org.jfree.report.util.CSVTokenizer;
+
+/**
+ * An ValueConverter that handles Arrays. Conversion to arrays is done
+ * using a CSV string.
+ *
+ * @author Thomas Morgner
+ */
+public class ArrayValueConverter implements ValueConverter
+{
+  /** The converter for the array elements. */
+  private ValueConverter elementConverter;
+  /** The element type. */
+  private Class elementType;
+
+  /**
+   * Creates a new ArrayValueConverter for the given element type and
+   * array type.
+   * @param arrayClass the array type
+   * @param elementConverter the value converter for the array elements.
+   */
+  public ArrayValueConverter (final Class arrayClass,
+                              final ValueConverter elementConverter)
+  {
+    if (elementConverter == null)
+    {
+      throw new NullPointerException("elementConverter must not be null");
+    }
+    if (arrayClass == null)
+    {
+      throw new NullPointerException("arrayClass must not be null");
+    }
+    this.elementType = arrayClass;
+    this.elementConverter = elementConverter;
+  }
+
+  /**
+   * Converts an object to an attribute value.
+   *
+   * @param o the object.
+   * @return the attribute value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public String toAttributeValue (final Object o) throws BeanException
+  {
+    final int size = Array.getLength(o);
+    final StringBuffer buffer = new StringBuffer();
+    for (int i = 0; i < size; i++)
+    {
+      if (i != 0)
+      {
+        buffer.append(",");
+      }
+      buffer.append(elementConverter.toAttributeValue(Array.get(o, i)));
+    }
+    return buffer.toString();
+  }
+
+  /**
+   * Converts a string to a property value.
+   *
+   * @param s the string.
+   * @return a property value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public Object toPropertyValue (final String s) throws BeanException
+  {
+    final CSVTokenizer tokenizer = new CSVTokenizer(s);
+    final ArrayList elements = new ArrayList();
+    while (tokenizer.hasMoreTokens())
+    {
+      final String token = tokenizer.nextToken();
+      elements.add(elementConverter.toPropertyValue(token));
+    }
+    final Object retval =
+            Array.newInstance(elementType, elements.size());
+    for (int i = 0; i < elements.size(); i++)
+    {
+      final Object o = elements.get(i);
+      Array.set(retval, i, o);
+    }
+    return retval;
+  }
+}
diff --git a/source/org/jfree/report/util/beans/BeanException.java b/source/org/jfree/report/util/beans/BeanException.java
new file mode 100644
index 0000000..e9a75c1
--- /dev/null
+++ b/source/org/jfree/report/util/beans/BeanException.java
@@ -0,0 +1,71 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BeanException.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import org.pentaho.reporting.libraries.base.util.StackableException;
+
+
+/**
+ * The BeanException class signals errors when setting or reading bean
+ * properties.
+ *
+ * @author Thomas Morgner
+ */
+public class BeanException extends StackableException
+{
+  /**
+   * DefaultConstructor.
+   */
+  public BeanException ()
+  {
+  }
+
+  /**
+   * Creates a new BeanException with the given message and parent exception.
+   *
+   * @param message the message text
+   * @param ex the parent exception
+   */
+  public BeanException (final String message, final Exception ex)
+  {
+    super(message, ex);
+  }
+
+  /**
+   * Creates a new BeanException with the given message.
+   *
+   * @param message the message.
+   */
+  public BeanException (final String message)
+  {
+    super(message);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/BeanPropertyLookupParser.java b/source/org/jfree/report/util/beans/BeanPropertyLookupParser.java
new file mode 100644
index 0000000..6b3f4fb
--- /dev/null
+++ b/source/org/jfree/report/util/beans/BeanPropertyLookupParser.java
@@ -0,0 +1,97 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BeanPropertyLookupParser.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import org.jfree.report.util.CSVTokenizer;
+import org.jfree.report.util.PropertyLookupParser;
+
+public abstract class BeanPropertyLookupParser extends PropertyLookupParser
+{
+  public BeanPropertyLookupParser ()
+  {
+  }
+
+  /**
+   *
+   * @param name
+   * @return
+   */
+  protected abstract Object performInitialLookup (String name);
+
+  protected String lookupVariable (final String entity)
+  {
+    // first, split the entity into separate strings (separator is '.').
+
+    final CSVTokenizer tokenizer = new CSVTokenizer(entity, ".");
+    if (tokenizer.hasMoreTokens())
+    {
+      final String name = tokenizer.nextToken();
+      final Object base = performInitialLookup(name);
+      try
+      {
+        if (tokenizer.hasMoreTokens())
+        {
+          return continueLookupVariable(tokenizer, base);
+        }
+        else
+        {
+          return ConverterRegistry.toAttributeValue(base);
+        }
+      }
+      catch (BeanException e)
+      {
+        return entity;
+      }
+    }
+    return entity;
+  }
+
+  private static String continueLookupVariable (final CSVTokenizer tokenizer,
+                                                final Object parent)
+          throws BeanException
+  {
+    if (tokenizer.hasMoreTokens())
+    {
+      final String name = tokenizer.nextToken();
+      final Object base = ConverterRegistry.toPropertyValue(name, parent.getClass());
+      if (tokenizer.hasMoreTokens())
+      {
+        return continueLookupVariable(tokenizer, base);
+      }
+      else
+      {
+        return ConverterRegistry.toAttributeValue(base);
+      }
+    }
+    return null;
+  }
+
+}
diff --git a/source/org/jfree/report/util/beans/BeanUtility.java b/source/org/jfree/report/util/beans/BeanUtility.java
new file mode 100644
index 0000000..642c45e
--- /dev/null
+++ b/source/org/jfree/report/util/beans/BeanUtility.java
@@ -0,0 +1,548 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BeanUtility.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.beans.BeanInfo;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * The BeanUtility class enables access to bean properties using the reflection
+ * API.
+ *
+ * @author Thomas Morgner
+ */
+public final class BeanUtility
+{
+  /**
+   * A property specification parses a compound property name into segments
+   * and allows access to the next property.
+   */
+  private static class PropertySpecification
+  {
+    /** The raw value of the property name. */
+    private String raw;
+    /** The next direct property that should be accessed. */
+    private String name;
+    /** The index, if the named property points to an indexed property. */
+    private String index;
+
+    /**
+     * Creates a new PropertySpecification object for the given property string.
+     *
+     * @param raw the property string, posssibly with index specifications.
+     */
+    public PropertySpecification (final String raw)
+    {
+      this.raw = raw;
+      this.name = getNormalizedName(raw);
+      this.index = getIndex(raw);
+    }
+
+    /**
+     * Returns the name of the property without any index information.
+     *
+     * @param property the raw name
+     * @return the normalized name.
+     */
+    private String getNormalizedName (final String property)
+    {
+      final int idx = property.indexOf('[');
+      if (idx < 0)
+      {
+        return property;
+      }
+      return property.substring(0, idx);
+    }
+
+    /**
+     * Extracts the first index from the given raw property.
+     *
+     * @param property the raw name
+     * @return the index as String.
+     */
+    private String getIndex (final String property)
+    {
+      final int idx = property.indexOf('[');
+      if (idx < 0)
+      {
+        return null;
+      }
+      final int end = property.indexOf(']', idx + 1);
+      if (end < 0)
+      {
+        return null;
+      }
+      return property.substring(idx + 1, end);
+    }
+
+    public String getRaw ()
+    {
+      return raw;
+    }
+
+    public String getName ()
+    {
+      return name;
+    }
+
+    public String getIndex ()
+    {
+      return index;
+    }
+
+    public String toString ()
+    {
+      final StringBuffer b = new StringBuffer("PropertySpecification={");
+      b.append("raw=");
+      b.append(raw);
+      b.append("}");
+      return b.toString();
+    }
+  }
+
+  private BeanInfo beanInfo;
+  private Object bean;
+  private HashMap properties;
+
+  private BeanUtility()
+  {
+  }
+
+  public BeanUtility (final Object o)
+          throws IntrospectionException
+  {
+    bean = o;
+
+    beanInfo = Introspector.getBeanInfo(o.getClass());
+    properties = new HashMap();
+    final PropertyDescriptor[] propertyDescriptors =
+            beanInfo.getPropertyDescriptors();
+    for (int i = 0; i < propertyDescriptors.length; i++)
+    {
+      properties.put(propertyDescriptors[i].getName(), propertyDescriptors[i]);
+    }
+  }
+
+
+
+  public BeanUtility derive (final Object o)
+  {
+    if (o.getClass().equals(bean.getClass()) == false)
+    {
+      throw new IllegalArgumentException();
+    }
+    final BeanUtility bu = new BeanUtility();
+    bu.bean = o;
+    return bu;
+  }
+
+  public PropertyDescriptor[] getPropertyInfos ()
+  {
+    return beanInfo.getPropertyDescriptors();
+  }
+
+  public Object getProperty (final String name)
+          throws BeanException
+  {
+    return getPropertyForSpecification(new PropertySpecification(name));
+  }
+
+  private Object getPropertyForSpecification (final PropertySpecification name)
+          throws BeanException
+  {
+    final PropertyDescriptor pd = (PropertyDescriptor) properties.get(name.getName());
+    if (pd == null)
+    {
+      throw new BeanException("No such property:" + name);
+    }
+
+    if (pd instanceof IndexedPropertyDescriptor && name.getIndex() != null)
+    {
+      final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+      final Method readMethod = ipd.getIndexedReadMethod();
+      if (readMethod == null)
+      {
+        throw new BeanException("Property is not readable: " + name);
+      }
+      try
+      {
+        return readMethod.invoke(bean, new Object[]{new Integer(name.getIndex())});
+      }
+      catch (Exception e)
+      {
+        throw new BeanException("InvokationError", e);
+      }
+    }
+    else
+    {
+      final Method readMethod = pd.getReadMethod();
+      if (readMethod == null)
+      {
+        throw new BeanException("Property is not readable: " + name);
+      }
+      if (name.getIndex() != null)
+      {
+        // handle access to array-only properties ..
+        try
+        {
+          //System.out.println(readMethod);
+          final Object value = readMethod.invoke(bean, (Object[]) null);
+          // we have (possibly) an array.
+          if (value == null)
+          {
+            throw new IndexOutOfBoundsException("No such index, property is null");
+          }
+          if (value.getClass().isArray() == false)
+          {
+            throw new BeanException("The property contains no array.");
+          }
+          final int index = Integer.parseInt(name.getIndex());
+          return Array.get(value, index);
+        }
+        catch(BeanException be)
+        {
+          throw be;
+        }
+        catch(IndexOutOfBoundsException iob)
+        {
+          throw iob;
+        }
+        catch(Exception e)
+        {
+          throw new BeanException("Failed to read indexed property.");
+        }
+      }
+
+      try
+      {
+        return readMethod.invoke(bean, (Object[]) null);
+      }
+      catch (Exception e)
+      {
+        throw new BeanException("InvokationError", e);
+      }
+    }
+  }
+
+  public String getPropertyAsString (final String name)
+          throws BeanException
+  {
+    final PropertySpecification ps = new PropertySpecification(name);
+    final PropertyDescriptor pd = (PropertyDescriptor) properties.get(ps.getName());
+    if (pd == null)
+    {
+      throw new BeanException("No such property:" + name);
+    }
+    final Object o = getPropertyForSpecification(ps);
+    if (o == null)
+    {
+      return null;
+    }
+
+    final ValueConverter vc =
+            ConverterRegistry.getInstance().getValueConverter(o.getClass());
+    if (vc == null)
+    {
+      throw new BeanException("Unable to handle property of type " + o.getClass()
+              .getName());
+    }
+    return vc.toAttributeValue(o);
+  }
+
+  public void setProperty (final String name, final Object o)
+          throws BeanException
+  {
+    if (name == null)
+    {
+      throw new NullPointerException("Name must not be null");
+    }
+    setProperty(new PropertySpecification(name), o);
+  }
+
+  private void setProperty (final PropertySpecification name, final Object o)
+          throws BeanException
+  {
+    final PropertyDescriptor pd = (PropertyDescriptor) properties.get(name.getName());
+    if (pd == null)
+    {
+      throw new BeanException("No such property:" + name);
+    }
+
+    if (pd instanceof IndexedPropertyDescriptor && name.getIndex() != null)
+    {
+      final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+      final Method writeMethod = ipd.getIndexedWriteMethod();
+      if (writeMethod != null)
+      {
+        try
+        {
+          writeMethod.invoke(bean, new Object[]{new Integer(name.getIndex()), o});
+        }
+        catch (Exception e)
+        {
+          throw new BeanException("InvokationError", e);
+        }
+        // we've done the job ...
+        return;
+      }
+    }
+
+    final Method writeMethod = pd.getWriteMethod();
+    if (writeMethod == null)
+    {
+      throw new BeanException("Property is not writeable: " + name);
+    }
+
+    if (name.getIndex() != null)
+    {
+      // this is a indexed access, but no indexWrite method was found ...
+      updateArrayProperty(pd, name, o);
+    }
+    else
+    {
+      try
+      {
+        writeMethod.invoke(bean, new Object[]{o});
+      }
+      catch (Exception e)
+      {
+        throw new BeanException("InvokationError", e);
+      }
+    }
+  }
+
+  private void updateArrayProperty (final PropertyDescriptor pd,
+                                    final PropertySpecification name,
+                                    final Object o)
+          throws BeanException
+  {
+    final Method readMethod = pd.getReadMethod();
+    if (readMethod == null)
+    {
+      throw new BeanException("Property is not readable, cannot perform array update: " + name);
+    }
+    try
+    {
+      //System.out.println(readMethod);
+      final Object value = readMethod.invoke(bean, (Object[]) null);
+      // we have (possibly) an array.
+      final int index = Integer.parseInt(name.getIndex());
+      final Object array = validateArray(getPropertyType(pd), value, index);
+      Array.set(array, index, o);
+
+      final Method writeMethod = pd.getWriteMethod();
+      writeMethod.invoke(bean, new Object[]{array});
+    }
+    catch(BeanException e)
+    {
+      throw e;
+    }
+    catch(Exception e)
+    {
+      e.printStackTrace();
+      throw new BeanException("Failed to read property, cannot perform array update: " + name);
+    }
+  }
+
+  private Object validateArray (final Class propertyType,
+                                final Object o, final int size)
+          throws BeanException
+  {
+
+    if (propertyType.isArray() == false)
+    {
+      throw new BeanException("The property's value is no array.");
+    }
+
+    if (o == null)
+    {
+      return Array.newInstance(propertyType.getComponentType(), size + 1);
+    }
+
+    if (o.getClass().isArray() == false)
+    {
+      throw new BeanException("The property's value is no array.");
+    }
+
+    final int length = Array.getLength(o);
+    if (length > size)
+    {
+      return o;
+    }
+    // we have to copy the array ..
+    final Object retval = Array.newInstance(o.getClass().getComponentType(), size + 1);
+    System.arraycopy(o, 0, retval, 0, length);
+    return o;
+  }
+
+  public void setPropertyAsString (final String name, final String txt)
+          throws BeanException
+  {
+    if (name == null)
+    {
+      throw new NullPointerException("Name must not be null");
+    }
+    if (txt == null)
+    {
+      throw new NullPointerException("Text must not be null");
+    }
+    final PropertySpecification ps = new PropertySpecification(name);
+    final PropertyDescriptor pd = (PropertyDescriptor) properties.get(ps.getName());
+    if (pd == null)
+    {
+      throw new BeanException("No such property:" + name);
+    }
+
+    setPropertyAsString(name, getPropertyType(pd), txt);
+  }
+
+  public Class getPropertyType (final String name) throws BeanException
+  {
+    if (name == null)
+    {
+      throw new NullPointerException("Name must not be null");
+    }
+    final PropertySpecification ps = new PropertySpecification(name);
+    final PropertyDescriptor pd = (PropertyDescriptor) properties.get(ps.getName());
+    if (pd == null)
+    {
+      throw new BeanException("No such property:" + name);
+    }
+    return getPropertyType(pd);
+  }
+
+  public static Class getPropertyType (final PropertyDescriptor pd)
+          throws BeanException
+  {
+    final Class typeFromDescriptor = pd.getPropertyType();
+    if (typeFromDescriptor != null)
+    {
+      return typeFromDescriptor;
+    }
+    if (pd instanceof IndexedPropertyDescriptor)
+    {
+      final IndexedPropertyDescriptor idx = (IndexedPropertyDescriptor) pd;
+      return idx.getIndexedPropertyType();
+    }
+    throw new BeanException("Unable to determine the property type.");
+  }
+
+  public void setPropertyAsString (final String name, final Class type, final String txt)
+          throws BeanException
+  {
+    if (name == null)
+    {
+      throw new NullPointerException("Name must not be null");
+    }
+    if (type == null)
+    {
+      throw new NullPointerException("Type must not be null");
+    }
+    if (txt == null)
+    {
+      throw new NullPointerException("Text must not be null");
+    }
+    final PropertySpecification ps = new PropertySpecification(name);
+    final ValueConverter vc;
+    if (ps.getIndex() != null && type.isArray())
+    {
+      vc = ConverterRegistry.getInstance().getValueConverter(type.getComponentType());
+    }
+    else
+    {
+      vc = ConverterRegistry.getInstance().getValueConverter(type);
+    }
+    if (vc == null)
+    {
+      throw new BeanException
+              ("Unable to handle '" + type + "' for property '" + name + "'");
+    }
+    final Object o = vc.toPropertyValue(txt);
+    setProperty(ps, o);
+  }
+
+  public String[] getProperties ()
+          throws BeanException
+  {
+    final ArrayList propertyNames = new ArrayList();
+    final PropertyDescriptor[] pd = getPropertyInfos();
+    for (int i = 0; i < pd.length; i++)
+    {
+      final PropertyDescriptor property = pd[i];
+      if (property.isHidden())
+      {
+        continue;
+      }
+      if (property.getReadMethod() == null ||
+              property.getWriteMethod() == null)
+      {
+        // it will make no sense to write a property now, that
+        // we can't read in later...
+        continue;
+      }
+      if (getPropertyType(property).isArray())
+      {
+        final int max = findMaximumIndex(property);
+        for (int idx = 0; idx < max; idx++)
+        {
+          propertyNames.add(property.getName() + "[" + idx + "]");
+        }
+      }
+      else
+      {
+        propertyNames.add(property.getName());
+      }
+    }
+    return (String[]) propertyNames.toArray(new String[propertyNames.size()]);
+  }
+
+  private int findMaximumIndex (final PropertyDescriptor id)
+  {
+    try
+    {
+      final Object o = getPropertyForSpecification
+              (new PropertySpecification(id.getName()));
+      return Array.getLength(o);
+    }
+    catch (Exception e)
+    {
+      // ignore, we run 'til we encounter an index out of bounds Ex.
+    }
+    return 0;
+  }
+}
diff --git a/source/org/jfree/report/util/beans/BigDecimalValueConverter.java b/source/org/jfree/report/util/beans/BigDecimalValueConverter.java
new file mode 100644
index 0000000..17a0305
--- /dev/null
+++ b/source/org/jfree/report/util/beans/BigDecimalValueConverter.java
@@ -0,0 +1,77 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BigDecimalValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.math.BigDecimal;
+
+/**
+ * A class that handles the conversion of {@link BigDecimal} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class BigDecimalValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public BigDecimalValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link BigDecimal} expected).
+   * @return A string representing the {@link BigDecimal} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Integer)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link BigDecimal}.
+   *
+   * @param s the string.
+   * @return a {@link BigDecimal}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new BigDecimal(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/BigIntegerValueConverter.java b/source/org/jfree/report/util/beans/BigIntegerValueConverter.java
new file mode 100644
index 0000000..3577d53
--- /dev/null
+++ b/source/org/jfree/report/util/beans/BigIntegerValueConverter.java
@@ -0,0 +1,77 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BigIntegerValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.math.BigInteger;
+
+/**
+ * A class that handles the conversion of {@link java.math.BigInteger} attributes to and
+ * from their {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class BigIntegerValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public BigIntegerValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link java.math.BigInteger} expected).
+   * @return A string representing the {@link java.math.BigInteger} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Integer)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link java.math.BigInteger}.
+   *
+   * @param s the string.
+   * @return a {@link java.math.BigInteger}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new BigInteger(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/BooleanValueConverter.java b/source/org/jfree/report/util/beans/BooleanValueConverter.java
new file mode 100644
index 0000000..61c04f9
--- /dev/null
+++ b/source/org/jfree/report/util/beans/BooleanValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: BooleanValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Boolean} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class BooleanValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public BooleanValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Boolean} expected).
+   * @return A string representing the {@link Boolean} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Boolean)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Boolean}.
+   *
+   * @param s the string.
+   * @return a {@link Boolean}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return Boolean.valueOf(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/ByteValueConverter.java b/source/org/jfree/report/util/beans/ByteValueConverter.java
new file mode 100644
index 0000000..3c76882
--- /dev/null
+++ b/source/org/jfree/report/util/beans/ByteValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ByteValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Byte} attributes to and from their {@link
+ * String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class ByteValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public ByteValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Byte} expected).
+   * @return A string representing the {@link Byte} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Byte)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Byte}.
+   *
+   * @param s the string.
+   * @return a {@link Byte}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new Byte(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/CharacterValueConverter.java b/source/org/jfree/report/util/beans/CharacterValueConverter.java
new file mode 100644
index 0000000..facdb79
--- /dev/null
+++ b/source/org/jfree/report/util/beans/CharacterValueConverter.java
@@ -0,0 +1,79 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: CharacterValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Character} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class CharacterValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public CharacterValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Character} expected).
+   * @return A string representing the {@link Character} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Character)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Character}.
+   *
+   * @param s the string.
+   * @return a {@link Character}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    if (s.length() == 0)
+    {
+      throw new RuntimeException("Ugly, no char set!");
+    }
+    return new Character(s.charAt(0));
+  }
+}
diff --git a/source/org/jfree/report/util/beans/ClassValueConverter.java b/source/org/jfree/report/util/beans/ClassValueConverter.java
new file mode 100644
index 0000000..275b7f4
--- /dev/null
+++ b/source/org/jfree/report/util/beans/ClassValueConverter.java
@@ -0,0 +1,70 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ClassValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
+
+
+/**
+ * A class that handles the conversion of {@link Integer} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class ClassValueConverter implements ValueConverter
+{
+  public ClassValueConverter ()
+  {
+  }
+
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Class)
+    {
+      final Class c = (Class) o;
+      return c.getName();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  public Object toPropertyValue (final String s)
+  {
+    try
+    {
+      final ClassLoader loader = ObjectUtilities.getClassLoader(ClassValueConverter.class);
+      return loader.loadClass(s);
+    }
+    catch (ClassNotFoundException e)
+    {
+      throw new IllegalArgumentException("No such class.");
+    }
+  }
+}
diff --git a/source/org/jfree/report/util/beans/ColorValueConverter.java b/source/org/jfree/report/util/beans/ColorValueConverter.java
new file mode 100644
index 0000000..421dbcd
--- /dev/null
+++ b/source/org/jfree/report/util/beans/ColorValueConverter.java
@@ -0,0 +1,144 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ColorValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.awt.Color;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+/**
+ * A class that handles the conversion of {@link Integer} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class ColorValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public ColorValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Integer} expected).
+   * @return A string representing the {@link Integer} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (!(o instanceof Color))
+    {
+      throw new ClassCastException("Is no instance of java.awt.Color");
+    }
+    final Color c = (Color) o;
+
+    try
+    {
+      final Field[] fields = Color.class.getFields();
+      for (int i = 0; i < fields.length; i++)
+      {
+        final Field f = fields[i];
+        if (Modifier.isPublic(f.getModifiers())
+                && Modifier.isFinal(f.getModifiers())
+                && Modifier.isStatic(f.getModifiers()))
+        {
+          final String name = f.getName();
+          final Object oColor = f.get(null);
+          if (oColor instanceof Color)
+          {
+            if (c.equals(oColor))
+            {
+              return name;
+            }
+          }
+        }
+      }
+    }
+    catch (Exception e)
+    {
+      //
+    }
+
+    // no defined constant color, so this must be a user defined color
+    final String color = Integer.toHexString(c.getRGB() & 0x00ffffff);
+    final StringBuffer retval = new StringBuffer(7);
+    retval.append("#");
+
+    final int fillUp = 6 - color.length();
+    for (int i = 0; i < fillUp; i++)
+    {
+      retval.append("0");
+    }
+
+    retval.append(color);
+    return retval.toString();
+  }
+
+  /**
+   * Converts a string to a {@link Integer}.
+   *
+   * @param value the string.
+   * @return a {@link Integer}.
+   */
+  public Object toPropertyValue (final String value)
+  {
+    if (value == null)
+    {
+      return Color.black;
+    }
+    try
+    {
+      // get color by hex or octal value
+      return Color.decode(value);
+    }
+    catch (NumberFormatException nfe)
+    {
+      // if we can't decode lets try to get it by name
+      try
+      {
+        // try to get a color by name using reflection
+        final Field f = Color.class.getField(value);
+
+        return (Color) f.get(null);
+      }
+      catch (Exception ce)
+      {
+        throw new IllegalArgumentException
+                ("The color string '" + value + "' is not recognized.");
+      }
+    }
+  }
+}
diff --git a/source/org/jfree/report/util/beans/ConverterRegistry.java b/source/org/jfree/report/util/beans/ConverterRegistry.java
new file mode 100644
index 0000000..cac7215
--- /dev/null
+++ b/source/org/jfree/report/util/beans/ConverterRegistry.java
@@ -0,0 +1,142 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ConverterRegistry.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.awt.Color;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.HashMap;
+
+public final class ConverterRegistry
+{
+  private static ConverterRegistry instance;
+  private HashMap registeredClasses;
+
+  public synchronized static ConverterRegistry getInstance ()
+  {
+    if (instance == null)
+    {
+      instance = new ConverterRegistry();
+    }
+    return instance;
+  }
+
+  private ConverterRegistry ()
+  {
+    registeredClasses = new HashMap();
+    registeredClasses.put(BigDecimal.class, new BigDecimalValueConverter());
+    registeredClasses.put(BigInteger.class, new BigIntegerValueConverter());
+    registeredClasses.put(Boolean.class, new BooleanValueConverter());
+    registeredClasses.put(Boolean.TYPE, new BooleanValueConverter());
+    registeredClasses.put(Byte.class, new ByteValueConverter());
+    registeredClasses.put(Byte.TYPE, new ByteValueConverter());
+    registeredClasses.put(Character.class, new CharacterValueConverter());
+    registeredClasses.put(Character.TYPE, new CharacterValueConverter());
+    registeredClasses.put(Color.class, new ColorValueConverter());
+    registeredClasses.put(Double.class, new DoubleValueConverter());
+    registeredClasses.put(Double.TYPE, new DoubleValueConverter());
+    registeredClasses.put(Float.class, new FloatValueConverter());
+    registeredClasses.put(Float.TYPE, new FloatValueConverter());
+    registeredClasses.put(Integer.class, new IntegerValueConverter());
+    registeredClasses.put(Integer.TYPE, new IntegerValueConverter());
+    registeredClasses.put(Long.class, new LongValueConverter());
+    registeredClasses.put(Long.TYPE, new LongValueConverter());
+    registeredClasses.put(Short.class, new ShortValueConverter());
+    registeredClasses.put(Short.TYPE, new ShortValueConverter());
+    registeredClasses.put(String.class, new StringValueConverter());
+    registeredClasses.put(Number.class, new BigDecimalValueConverter());
+    registeredClasses.put(Class.class, new ClassValueConverter());
+  }
+
+  public ValueConverter getValueConverter (final Class c)
+  {
+    final ValueConverter plain = (ValueConverter) registeredClasses.get(c);
+    if (plain != null)
+    {
+      return plain;
+    }
+    if (c.isArray())
+    {
+      final Class componentType = c.getComponentType();
+      final ValueConverter componentConverter = getValueConverter(componentType);
+      if (componentConverter != null)
+      {
+        return new ArrayValueConverter(componentType, componentConverter);
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Converts an object to an attribute value.
+   *
+   * @param o the object.
+   * @return the attribute value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public static String toAttributeValue (final Object o) throws BeanException
+  {
+    if (o == null)
+    {
+      return null;
+    }
+    final ValueConverter vc =
+            ConverterRegistry.getInstance().getValueConverter(o.getClass());
+    if (vc == null)
+    {
+      return null;
+    }
+    return vc.toAttributeValue(o);
+  }
+
+  /**
+   * Converts a string to a property value.
+   *
+   * @param s the string.
+   * @return a property value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public static Object toPropertyValue (final String s, final Class c) throws BeanException
+  {
+    if (s == null)
+    {
+      return null;
+    }
+    final ValueConverter vc =
+            ConverterRegistry.getInstance().getValueConverter(c);
+    if (vc == null)
+    {
+      return null;
+    }
+    return vc.toPropertyValue(s);
+  }
+
+}
diff --git a/source/org/jfree/report/util/beans/DoubleValueConverter.java b/source/org/jfree/report/util/beans/DoubleValueConverter.java
new file mode 100644
index 0000000..b7ddb84
--- /dev/null
+++ b/source/org/jfree/report/util/beans/DoubleValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: DoubleValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Double} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class DoubleValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public DoubleValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Double} expected).
+   * @return A string representing the {@link Double} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Double)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Double}.
+   *
+   * @param s the string.
+   * @return a {@link Double}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new Double(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/FloatValueConverter.java b/source/org/jfree/report/util/beans/FloatValueConverter.java
new file mode 100644
index 0000000..25d8ab5
--- /dev/null
+++ b/source/org/jfree/report/util/beans/FloatValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: FloatValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Float} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class FloatValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public FloatValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Float} expected).
+   * @return A string representing the {@link Float} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Float)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Float}.
+   *
+   * @param s the string.
+   * @return a {@link Float}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new Float(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/GenericValueConverter.java b/source/org/jfree/report/util/beans/GenericValueConverter.java
new file mode 100644
index 0000000..a8e5b68
--- /dev/null
+++ b/source/org/jfree/report/util/beans/GenericValueConverter.java
@@ -0,0 +1,110 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: GenericValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.beans.PropertyEditor;
+
+/**
+ * A class that handles the conversion of {@link Integer} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class GenericValueConverter implements ValueConverter
+{
+  private PropertyDescriptor propertyDescriptor;
+  private PropertyEditor propertyEditor;
+
+  /**
+   * Creates a new value converter.
+   */
+  public GenericValueConverter (final PropertyDescriptor pd)
+          throws IntrospectionException
+  {
+    if (pd == null)
+    {
+      throw new NullPointerException("PropertyDescriptor must not be null.");
+    }
+    if (pd.getPropertyEditorClass() == null)
+    {
+      throw new IntrospectionException("Property has no editor.");
+    }
+    this.propertyDescriptor = pd;
+    this.propertyEditor = createPropertyEditor(pd);
+  }
+
+  private PropertyEditor createPropertyEditor (final PropertyDescriptor pi)
+          throws IntrospectionException
+  {
+    final Class c = pi.getPropertyEditorClass();
+    try
+    {
+      return (PropertyEditor) c.newInstance();
+    }
+    catch (Exception e)
+    {
+      throw new IntrospectionException("Unable to create PropertyEditor.");
+    }
+  }
+
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Integer} expected).
+   * @return A string representing the {@link Integer} value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public String toAttributeValue (final Object o) throws BeanException
+  {
+    if (BeanUtility.getPropertyType(propertyDescriptor).isInstance(o) == false)
+    {
+      throw new ClassCastException("Give me a real type.");
+    }
+
+    propertyEditor.setValue(o);
+    return propertyEditor.getAsText();
+  }
+
+  /**
+   * Converts a string to a {@link Integer}.
+   *
+   * @param s the string.
+   * @return a {@link Integer}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    propertyEditor.setAsText(s);
+    return propertyEditor.getValue();
+  }
+}
diff --git a/source/org/jfree/report/util/beans/IntegerValueConverter.java b/source/org/jfree/report/util/beans/IntegerValueConverter.java
new file mode 100644
index 0000000..e2f3d01
--- /dev/null
+++ b/source/org/jfree/report/util/beans/IntegerValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: IntegerValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Integer} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class IntegerValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public IntegerValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Integer} expected).
+   * @return A string representing the {@link Integer} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Integer)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Integer}.
+   *
+   * @param s the string.
+   * @return a {@link Integer}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new Integer(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/LocaleValueConverter.java b/source/org/jfree/report/util/beans/LocaleValueConverter.java
new file mode 100644
index 0000000..3fb8200
--- /dev/null
+++ b/source/org/jfree/report/util/beans/LocaleValueConverter.java
@@ -0,0 +1,98 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LocaleValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.util.Locale;
+import java.util.StringTokenizer;
+
+/**
+ * Creation-Date: 24.01.2006, 19:19:03
+ *
+ * @author Thomas Morgner
+ */
+public class LocaleValueConverter implements ValueConverter
+{
+  public LocaleValueConverter()
+  {
+  }
+
+  /**
+   * Converts an object to an attribute value.
+   *
+   * @param o the object.
+   * @return the attribute value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public String toAttributeValue(Object o) throws BeanException
+  {
+    Locale l = (Locale) o;
+    if (l.getCountry().equals(""))
+    {
+      return l.getLanguage();
+    }
+    else if (l.getVariant().equals(""))
+    {
+      return l.getLanguage() + "_" + l.getCountry();
+    }
+    else
+    {
+      return l.getLanguage() + "_" + l.getCountry() + "_" + l.getVariant();
+    }
+  }
+
+  /**
+   * Converts a string to a property value.
+   *
+   * @param s the string.
+   * @return a property value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public Object toPropertyValue(String s) throws BeanException
+  {
+    StringTokenizer strtok = new StringTokenizer(s.trim(), "_");
+    if (strtok.hasMoreElements() == false)
+    {
+      throw new BeanException("This is no valid locale specification.");
+    }
+    String language = strtok.nextToken();
+    String country = "";
+    if (strtok.hasMoreTokens())
+    {
+      country = strtok.nextToken();
+    }
+    String variant = "";
+    if (strtok.hasMoreTokens())
+    {
+      variant = strtok.nextToken();
+    }
+    return new Locale(language, country, variant);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/LongValueConverter.java b/source/org/jfree/report/util/beans/LongValueConverter.java
new file mode 100644
index 0000000..1eb3a90
--- /dev/null
+++ b/source/org/jfree/report/util/beans/LongValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: LongValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Integer} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class LongValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public LongValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Integer} expected).
+   * @return A string representing the {@link Integer} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Long)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Integer}.
+   *
+   * @param s the string.
+   * @return a {@link Integer}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new Long(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/ShortValueConverter.java b/source/org/jfree/report/util/beans/ShortValueConverter.java
new file mode 100644
index 0000000..79bea5a
--- /dev/null
+++ b/source/org/jfree/report/util/beans/ShortValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ShortValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Integer} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class ShortValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public ShortValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Integer} expected).
+   * @return A string representing the {@link Integer} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof Short)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Integer}.
+   *
+   * @param s the string.
+   * @return a {@link Integer}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return new Short(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/StringValueConverter.java b/source/org/jfree/report/util/beans/StringValueConverter.java
new file mode 100644
index 0000000..06e0f33
--- /dev/null
+++ b/source/org/jfree/report/util/beans/StringValueConverter.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StringValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A class that handles the conversion of {@link Integer} attributes to and from their
+ * {@link String} representation.
+ *
+ * @author Thomas Morgner
+ */
+public class StringValueConverter implements ValueConverter
+{
+
+  /**
+   * Creates a new value converter.
+   */
+  public StringValueConverter ()
+  {
+    super();
+  }
+
+  /**
+   * Converts the attribute to a string.
+   *
+   * @param o the attribute ({@link Integer} expected).
+   * @return A string representing the {@link Integer} value.
+   */
+  public String toAttributeValue (final Object o)
+  {
+    if (o instanceof String)
+    {
+      return o.toString();
+    }
+    throw new ClassCastException("Give me a real type.");
+  }
+
+  /**
+   * Converts a string to a {@link Integer}.
+   *
+   * @param s the string.
+   * @return a {@link Integer}.
+   */
+  public Object toPropertyValue (final String s)
+  {
+    return s;
+  }
+}
diff --git a/source/org/jfree/report/util/beans/TimeZoneValueConverter.java b/source/org/jfree/report/util/beans/TimeZoneValueConverter.java
new file mode 100644
index 0000000..64d0688
--- /dev/null
+++ b/source/org/jfree/report/util/beans/TimeZoneValueConverter.java
@@ -0,0 +1,70 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: TimeZoneValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+import java.util.TimeZone;
+
+/**
+ * Creation-Date: 24.01.2006, 19:19:03
+ *
+ * @author Thomas Morgner
+ */
+public class TimeZoneValueConverter implements ValueConverter
+{
+  public TimeZoneValueConverter()
+  {
+  }
+
+  /**
+   * Converts an object to an attribute value.
+   *
+   * @param o the object.
+   * @return the attribute value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public String toAttributeValue(Object o) throws BeanException
+  {
+    TimeZone tz = (TimeZone) o;
+    return tz.getID();
+  }
+
+  /**
+   * Converts a string to a property value.
+   *
+   * @param s the string.
+   * @return a property value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public Object toPropertyValue(String s) throws BeanException
+  {
+    return TimeZone.getTimeZone(s);
+  }
+}
diff --git a/source/org/jfree/report/util/beans/ValueConverter.java b/source/org/jfree/report/util/beans/ValueConverter.java
new file mode 100644
index 0000000..1685f73
--- /dev/null
+++ b/source/org/jfree/report/util/beans/ValueConverter.java
@@ -0,0 +1,58 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: ValueConverter.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+package org.jfree.report.util.beans;
+
+/**
+ * A value converter is an object that can transform an object into a string or vice
+ * versa.
+ *
+ * @author Thomas Morgner
+ */
+public interface ValueConverter
+{
+  /**
+   * Converts an object to an attribute value.
+   *
+   * @param o the object.
+   * @return the attribute value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public String toAttributeValue (Object o) throws BeanException;
+
+  /**
+   * Converts a string to a property value.
+   *
+   * @param s the string.
+   * @return a property value.
+   * @throws BeanException if there was an error during the conversion.
+   */
+  public Object toPropertyValue (String s) throws BeanException;
+}
diff --git a/source/org/jfree/report/util/beans/package.html b/source/org/jfree/report/util/beans/package.html
new file mode 100644
index 0000000..46321e4
--- /dev/null
+++ b/source/org/jfree/report/util/beans/package.html
@@ -0,0 +1,8 @@
+<html>
+<head>
+  <title></title>
+</head>
+<body>
+  Bean and property support classes.
+</body>
+</html>
\ No newline at end of file
diff --git a/source/org/jfree/report/util/package.html b/source/org/jfree/report/util/package.html
new file mode 100644
index 0000000..a8c63ce
--- /dev/null
+++ b/source/org/jfree/report/util/package.html
@@ -0,0 +1,7 @@
+<html>
+<head>
+</head>
+<body>
+Common utility classes.
+</body>
+</html>
\ No newline at end of file
diff --git a/source/overview.html b/source/overview.html
new file mode 100644
index 0000000..2aa362d
--- /dev/null
+++ b/source/overview.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<body bgcolor="white">
+<b>JFreeReport</b> is a free report library for Java, designed to work
+with <code>TableModel</code> data, providing on-screen print preview,
+printing, export to PDF, HTML, text, Excel and CSV format.
+<p>
+Please visit <a
+href="http://jfreereport.pentah.org.org/">http://jfreereport.pentaho.org/</a>
+for the latest information about JFreeReport.
+</body>
+</html>
diff --git a/test/org/jfree/report/Pre397Test.java b/test/org/jfree/report/Pre397Test.java
new file mode 100644
index 0000000..e80d15f
--- /dev/null
+++ b/test/org/jfree/report/Pre397Test.java
@@ -0,0 +1,41 @@
+package org.jfree.report;
+
+import junit.framework.TestCase;
+import org.jfree.report.data.FastGlobalView;
+
+/**
+ * Todo: Document Me
+ *
+ * @author Thomas Morgner
+ */
+public class Pre397Test extends TestCase
+{
+  public Pre397Test()
+  {
+  }
+
+  public Pre397Test(final String s)
+  {
+    super(s);
+  }
+
+  protected void setUp() throws Exception
+  {
+    JFreeReportBoot.getInstance().start();
+  }
+
+  public void testPre397() throws DataSourceException
+  {
+    final FastGlobalView fgv = new FastGlobalView();
+    fgv.putField("col1", "A", false);
+    fgv.putField("col2", "A", false);
+    fgv.putField("col3", "A", false);
+    final FastGlobalView globalView = fgv.advance();
+    globalView.putField("col1", "A", true);
+    globalView.putField("col2", "B", true);
+    globalView.putField("col3", "B", true);
+    assertFalse("Col1 no change", globalView.getFlags("col1").isChanged());
+    assertTrue("Col2 has change", globalView.getFlags("col2").isChanged());
+    assertTrue("Col3 has change", globalView.getFlags("col3").isChanged());
+  }
+}
diff --git a/test/org/jfree/report/TableReportDataTest.java b/test/org/jfree/report/TableReportDataTest.java
new file mode 100644
index 0000000..2a5967d
--- /dev/null
+++ b/test/org/jfree/report/TableReportDataTest.java
@@ -0,0 +1,77 @@
+package org.jfree.report;
+
+import javax.swing.table.DefaultTableModel;
+
+/**
+ * Creation-Date: 10.06.2007, 17:13:33
+ *
+ * @author Thomas Morgner
+ */
+public class TableReportDataTest
+{
+  public void testSingleLineData()
+      throws ReportDataFactoryException, DataSourceException
+  {
+    final TableReportDataFactory factory = new TableReportDataFactory();
+    factory.addTable("default", new DefaultTableModel(1, 1));
+
+    final ReportData reportData = factory.queryData("default", null);
+    if (reportData.isReadable())
+    {
+      throw new IllegalStateException();
+    }
+    if (reportData.isAdvanceable() == false)
+    {
+      throw new IllegalStateException();
+    }
+
+    final boolean b = reportData.next();
+    if (b == false)
+    {
+      throw new IllegalStateException();
+    }
+
+    if (reportData.isReadable() == false)
+    {
+      throw new IllegalStateException();
+    }
+    if (reportData.isAdvanceable())
+    {
+      throw new IllegalStateException();
+    }
+
+    if (reportData.next())
+    {
+      throw new IllegalStateException();
+    }
+  }
+
+  public void testEmptyData()
+      throws ReportDataFactoryException, DataSourceException
+  {
+    final TableReportDataFactory factory = new TableReportDataFactory();
+    factory.addTable("default", new DefaultTableModel(0, 0));
+
+    final ReportData reportData = factory.queryData("default", null);
+    if (reportData.isReadable())
+    {
+      throw new IllegalStateException();
+    }
+    if (reportData.isAdvanceable())
+    {
+      throw new IllegalStateException();
+    }
+
+    final boolean b = reportData.next();
+    if (b)
+    {
+      throw new IllegalStateException();
+    }
+  }
+
+  public static void main(String[] args)
+      throws ReportDataFactoryException, DataSourceException
+  {
+    new TableReportDataTest().testEmptyData();
+  }
+}
diff --git a/test/org/jfree/report/modules/data/beans/StaticReportDataFactoryTest.java b/test/org/jfree/report/modules/data/beans/StaticReportDataFactoryTest.java
new file mode 100644
index 0000000..89ab424
--- /dev/null
+++ b/test/org/jfree/report/modules/data/beans/StaticReportDataFactoryTest.java
@@ -0,0 +1,110 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticReportDataFactoryTest.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.data.beans;
+
+import javax.swing.table.TableModel;
+import javax.swing.table.DefaultTableModel;
+
+import junit.framework.TestCase;
+import org.jfree.report.ReportDataFactoryException;
+import org.jfree.report.testcore.SimpleDataSet;
+
+/**
+ * Creation-Date: Jan 18, 2007, 6:08:26 PM
+ *
+ * @author Thomas Morgner
+ */
+public class StaticReportDataFactoryTest extends TestCase
+{
+  public StaticReportDataFactoryTest(String string)
+  {
+    super(string);
+  }
+
+  public void testDataFactory () throws ReportDataFactoryException
+  {
+    SimpleDataSet sdr = new SimpleDataSet();
+    sdr.add("parameter1", "test");
+    sdr.add("parameter2", new Integer(5));
+
+    assertNotNull(sdr.get("parameter1"));
+    assertNotNull(sdr.get("parameter2"));
+
+    StaticReportDataFactory sfd = new StaticReportDataFactory();
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTest#createSimpleTableModel", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTest#createSimpleTableModel()", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTest#createParametrizedTableModel(parameter2,parameter1)", sdr));
+
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport#createSimpleTableModel", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport#createSimpleTableModel()", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport#createParametrizedTableModel(parameter2,parameter1)", sdr));
+
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport()", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport()#createSimpleTableModel", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport()#createSimpleTableModel()", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport()#createParametrizedTableModel(parameter2,parameter1)", sdr));
+
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport(parameter1,parameter2)", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport(parameter1,parameter2)#createSimpleTableModel", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport(parameter1,parameter2)#createSimpleTableModel()", sdr));
+    assertNotNull(sfd.queryData
+        ("org.jfree.report.modules.data.beans.StaticReportDataFactoryTestSupport(parameter1,parameter2)#createParametrizedTableModel(parameter2,parameter1)", sdr));
+  }
+
+  public static TableModel createParametrizedTableModel (int i1, String s1)
+  {
+    assertEquals("Passing primitive parameters failed", 5, i1);
+    assertEquals("Passing object parameters failed", "test", s1);
+    return new DefaultTableModel();
+  }
+
+  public static TableModel createSimpleTableModel ()
+  {
+    return new DefaultTableModel();
+  }
+
+}
diff --git a/test/org/jfree/report/modules/data/beans/StaticReportDataFactoryTestSupport.java b/test/org/jfree/report/modules/data/beans/StaticReportDataFactoryTestSupport.java
new file mode 100644
index 0000000..cce81ce
--- /dev/null
+++ b/test/org/jfree/report/modules/data/beans/StaticReportDataFactoryTestSupport.java
@@ -0,0 +1,75 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: StaticReportDataFactoryTestSupport.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.modules.data.beans;
+
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+
+import junit.framework.TestCase;
+
+/**
+ * Creation-Date: Jan 18, 2007, 6:10:41 PM
+ *
+ * @author Thomas Morgner
+ */
+public class StaticReportDataFactoryTestSupport extends DefaultTableModel
+{
+  /**
+   * Constructs a default <code>DefaultTableModel</code> which is a table of
+   * zero columns and zero rows.
+   */
+  public StaticReportDataFactoryTestSupport()
+  {
+  }
+
+  public StaticReportDataFactoryTestSupport(String parameter, int parameter2)
+  {
+    if ("test".equals(parameter) == false || parameter2 != 5)
+    {
+      throw new IllegalStateException();
+    }
+  }
+
+
+  public TableModel createParametrizedTableModel (int i1, String s1)
+  {
+    TestCase.assertEquals("Passing primitive parameters failed", 5, i1);
+    TestCase.assertEquals("Passing object parameters failed", "test", s1);
+    return new DefaultTableModel();
+  }
+
+  public TableModel createSimpleTableModel ()
+  {
+    return new DefaultTableModel();
+  }
+
+}
diff --git a/test/org/jfree/report/testcore/SimpleDataSet.java b/test/org/jfree/report/testcore/SimpleDataSet.java
new file mode 100644
index 0000000..3734d9a
--- /dev/null
+++ b/test/org/jfree/report/testcore/SimpleDataSet.java
@@ -0,0 +1,136 @@
+/**
+ * ========================================
+ * JFreeReport : a free Java report library
+ * ========================================
+ *
+ * Project Info:  http://reporting.pentaho.org/
+ *
+ * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
+ * in the United States and other countries.]
+ *
+ * ------------
+ * $Id: SimpleDataSet.java 10756 2009-12-02 15:58:24Z tmorgner $
+ * ------------
+ * (C) Copyright 2000-2005, by Object Refinery Limited.
+ * (C) Copyright 2005-2007, by Pentaho Corporation.
+ */
+
+package org.jfree.report.testcore;
+
+import java.util.ArrayList;
+
+import org.jfree.report.DataSet;
+
+/**
+ * Creation-Date: Jan 18, 2007, 6:09:26 PM
+ *
+ * @author Thomas Morgner
+ */
+public class SimpleDataSet implements DataSet
+{
+  private ArrayList names;
+  private ArrayList values;
+
+  public SimpleDataSet ()
+  {
+    names = new ArrayList();
+    values = new ArrayList();
+  }
+
+  /**
+   * Returns the column position of the column, expression or function with the given name
+   * or -1 if the given name does not exist in this DataRow.
+   *
+   * @param name the item name.
+   * @return the item index.
+   */
+  public int findColumn (String name)
+  {
+    return names.indexOf(name);
+  }
+
+  /**
+   * Returns the value of the expression or column in the tablemodel using the given
+   * column number as index. For functions and expressions, the <code>getValue()</code>
+   * method is called and for columns from the tablemodel the tablemodel method
+   * <code>getValueAt(row, column)</code> gets called.
+   *
+   * @param col the item index.
+   * @return the value.
+   *
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get (int col)
+  {
+    return values.get(col);
+  }
+
+  /**
+   * Returns the value of the function, expression or column using its specific name. The
+   * given name is translated into a valid column number and the the column is queried.
+   * For functions and expressions, the <code>getValue()</code> method is called and for
+   * columns from the tablemodel the tablemodel method <code>getValueAt(row,
+   * column)</code> gets called.
+   *
+   * @param col the item index.
+   * @return the value.
+   *
+   * @throws IllegalStateException if the datarow detected a deadlock.
+   */
+  public Object get (String col)
+          throws IllegalStateException
+  {
+    // todo implement me
+    int index = names.indexOf(col);
+    if (index == -1)
+    {
+      return null;
+    }
+    return values.get(index);
+  }
+
+  /**
+   * Returns the number of columns, expressions and functions and marked ReportProperties
+   * in the report.
+   *
+   * @return the item count.
+   */
+  public int getColumnCount ()
+  {
+    return values.size();
+  }
+
+  /**
+   * Returns the name of the column, expression or function. For columns from the
+   * tablemodel, the tablemodels <code>getColumnName</code> method is called. For
+   * functions, expressions and report properties the assigned name is returned.
+   *
+   * @param col the item index.
+   * @return the name.
+   */
+  public String getColumnName (int col)
+  {
+    return (String) names.get(col);
+  }
+
+  public void add (String name, Object value)
+  {
+    names.add(name);
+    values.add(value);
+  }
+
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/pentaho-reporting-flow-engine.git



More information about the pkg-java-commits mailing list