Report Table Adapters

One of the most important concepts in Style Intelligence is the table adapter. Table adapters allow printing of table based components or data structures automatically and completely eliminate the need for an application to manually setup the table in a report. In addition to their use in displaying visual components, adapters can also be built for other objects to retrieve table contents and attributes.

There are currently two component packages that are supported officially by Style Intelligence: JFC Swing and Tea Set Widgets. This chapter covers the adapters for the Swing JTable and the Tea Set Grid/SuperGrid.

view demo icon
View a 2-minute demonstration of InetSoft's easy, agile, and robust BI software.

Swing JTable Adapters

There are three versions of adapters for the JTable: JTableLens, JTableRendererLens and TableModelLens. The main difference among the adapters is the level of detail that the adapters capture.

The JTableLens captures the table contents as objects and also captures the table attributes such as the column width, row height, border, etc. It is appropriate for most situations when printing from an on-screen JTable component. The JTableLens has been used in our examples so far.

 ReportSheet report = new StyleSheet();
 StyleSheet layout = (StyleSheet)report;
 ...
 layout.addTable(new inetsoft.report.lens.swing.JTableLens(jtable)); 

The Swing JTable supports cell renderers, which are classes that know how to paint a particular type of object. This can cause a problem when using the JTableLens. Because the JTableLens returns the cell contents as object values, the information on how to present the values graphically is lost.

For example, if a cell has a Boolean value, the JTable uses a checkbox component to render the value. When the JTableLens is used to add the table to a report, the cell values are returned as Boolean objects. By default, object values are printed in the way that their text representation is returned by the toString() method of the object. In this case, the Boolean values are printed as 'True' or 'False'.

To allow the most accurate capturing of a JTable component, the JTableRendererLens adapter is added. Instead of returning the table contents as object values, the JTableRendererLens returns each cell value as a painter that paints the cell value in the report, in the same way that its painted by the JTable.

 layout.addTable(new inetsoft.report.lens.swing.JTableRendererLens(jtable));

The main strength of the JTableRendererLens adapter is also its biggest disadvantage. Because the table adapter controls exactly how the cells are painted, it does not work well with table styles. To accommodate this problem, we will demonstrate how to manage the painting of classes of objects through the use of Presenters, a more suitable method when using table style classes.

The Table Model Lens is a very simple adapter for the Swing table lens objects. It returns the contents of a table lens and provides default values for the attributes. It is best used with a table style to provide the visual settings.

view gallery
View live interactive examples in InetSoft's dashboard and visualization gallery.

Report Table Adapters for Different Swing Versions

The swing package has different versions. In addition to implementation differences in these versions, Swing 1.1 also introduced a new Swing package name. To cope with these differences, there are three Swing table lens packages:

  • inetsoft.report.lens.swing10 This package contains table adapters for the Swing 1.0.x packages. The Swing package name in these classes is com.sun.java.swing.
  • inetsoft.report.lens.swing11 This package contains table adapters for the Swing 1.1 package. The Swing package name in these classes is javax.swing.
  • inetsoft.report.lens.swing This package always points to the adapters for the latest Swing version.

If your application is fixed on one version of Swing, you should choose to use the adapter package for that particular Swing version. If you intend to upgrade Swing when new versions are available, then simply use the inetsoft.report.lens.swing package. This package will always be compatible with the latest Swing version.

More Articles About Reporting

Ad-Hoc Batch Report Generator Software - An "ad hoc" report displays information that has not already been integrated into a regularly scheduled report. It is so named because it is generated to address an ad hoc informational need, or to answer a question "as it comes". InetSoft's batch report generator software also allows for the ad hoc creation and modification of interactive reports, to help decision makers explore data and find new patterns. The interactivity in InetSoft generated ad hoc reports provide a cost efficient and quick way to analyze data. Data can be explored through filtering by dragging and dropping components such as selection lists, crosstabs, and charts onto interactive reports, all in a web-based interface that can be accessed by anyone...

Automation of Scheduled Report Distribution - We have shown an example of writing a report from scratch, inserting a pivot table and a chart. We have seen sample reports where you can automatically refresh the data and filter the data. And lastly, wouldn't it be great if there were a handful of reports that you simply wanted to run on a weekly basis or a daily basis and have them automatically run and either emailed to you or printed or saved? Well, you can do that, too, with automated scheduled report distribution. Within the business intelligence suite, in addition to the query and analysis tools, there's also a report scheduling tool. So let's say you want to create a handful of reports to run every Friday. How would you do that? You simple click on the add task button at the top. Give it a name. We'll call it Friday reports. Come down to the right, and click the little plus, and this is where it's going to say what format do you want to send it in...

Configuring the Report Log - Configuring the report log is easy with InetSoft's Style Intelligence, a powerful business intelligence platform that allows users to make custom log changes. View the example below to learn more about this powerful reporting software solution. Enterprise Manager provides the ability to log messages generated during server execution. Logged messages are appended to a text file (sree.log, by default) and optionally sent to "stderr". Detail level Description Finest Very fine-grained performance information. Fine Debugging messages. Info Non-critical information messages. Warning Non-fatal errors and critical messages. Severe Fatal errors...

How To Enable Report Auditing - The audit tool tracks report and data access, as well as asset dependencies. When the audit function is enabled, all report and database access is logged in the audit database. Please note that for auditing to be turned on, a database has to be configured in the Enterprise Manager, and a security provider must be specified. Auditing can be turned on and off using the 'Enable Audit' checkbox on the 'Repository' > 'Audit' page under the Server tab. To turn on auditing: Go to the 'Repository' > 'Audit' page under the Server tab...

Microservice for Report Generation - A microservice for report generation is a specialized, self-contained service that focuses on the automated creation of reports within a larger software architecture. In a microservices architecture, applications are broken down into small, independent services that handle specific tasks. A report generation microservice is dedicated to processing data, generating reports in various formats, and delivering them to users or other systems...

What Assets Are Contained in InetSoft's Report Repository? - InetSoft's report repository contains various assets essential for report management, collaboration, and deployment within the reporting platform. While the specifics may vary based on the version and configuration of the software, here are the common assets you will find in InetSoft's report repository: Report Definitions: The core assets in the repository are the report definitions themselves. These definitions include metadata such as report name, description, parameters, data sources, and the layout of the report (e.g., tables, charts, graphs). Report definitions specify how data should be queried, aggregated, and displayed to users when the report is executed. Data Sources: InetSoft's report repository contains configurations for connecting to various data sources, including relational databases, OLAP cubes, web services, flat files, and more. These configurations typically include connection details, credentials, and other settings necessary for accessing and querying data for report generation...

Previous: Java2D Based Print Previewer
We will help you get started Contact us