data source to retrieve the value for each report field.
10.3 Customizing Viewers
The JasperReports library comes with built-in viewers that allow you to display the reports stored in the
library's proprietary format or to preview your report designs when you create them.
These viewers are represented by the following two classes:
_ dori.jasper.view.JasperViewer : You use this class to view generated reports, either as
in-memory objects or serialized objects on disk or even stored in XML format.
_ dori.jasper.view.JasperDesignViewer : This class can be used to preview report
designs, either in XML form or compiled form.
But these default viewers might not suit everybody's needs and therefore you might consider
customizing them so they adapt to certain application requirements.
In order to do that, you should be aware that these viewers use in fact other, more basic visual
components that come with the JasperReports library.
The report viewer mentioned above use the visual component represented by the
dori.jasper.view.JRViewer class and its companions. It is in fact a special
javax.swing.JPanel component that is capable of displaying generated reports and that can be
easily incorporated in other Java Swing based applications or applets.
If the functionality of this basic visual component is not sufficient for what you need, you can adapt it
by subclassing it. If for example you would want to have an extra button on the toolbar of this viewer,
you might consider extending the component and add that button yourself in the new visual component
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-30468-70.html