InetSoft Reporting Software: Report Adapters

To allow easy construction of reports, the InetSoft package includes a number of adapters. The adapters are used to wrap an object so that it conforms to the predefined API. The adapter classes in Style Intelligence play the role of the model in the MVC model, and are called Lenses.

By using an adapter, existing tables in an application can be added to a report without having to recreate the table in the report. The adapter extracts table information, including table contents and attributes and passes that to the report.

The InetSoft package includes built-in adapters for the JFC Swing JTable, Tea Set grids and contributed adapters for KLG table and Protoview table. The collection of adapters will grow in later versions to support direct printing of other third party components.

Report Table Decorator

The decorator design pattern is a powerful way to add or modify the attributes of an object. The InetSoft package uses a slightly modified version of the decorator pattern to provide pre-defined table styles. A table style defines the look-and-feel attributes of a table, including color, border, font, etc. A style decorator modifies the attributes of a table to make the printing conform to the style defined in the decorator.

Style Report provides over 80 built-in styles, and you are free to define new styles as desired.

Factory Design Patterns

The factory design pattern is used by InetSoft to provide platform and JDK version independent ways to create certain types of objects. A factory method always returns a common base class or interface and hides the actual type of the object from the user. This allows a different implementation of the same API to be selected at runtime according to the runtime environment.

Programs should use a factory method whenever possible instead of creating directly from a concrete class. The latter ties the program to a particular platform and configuration.

Builder Design Patterns

The builder design pattern is used in Style Intelligence for importing and exporting reports to and from external formats. The builder interface provides a uniform API to handle multiple external formats.

Singleton Report Object

A singleton is a type of object that always has one instance in every Java virtual machine. Users of the object share the same instance across a single process. The singleton object is normally created lazily, i.e. the object is only created when it is needed. Subsequent references to the singleton reuse the already created object.

The XSessionManager, which provides the query execution engine, is a singleton object. Each application only needs to create one query engine. This is necessary because creating a query engine is a relatively expensive operation and sharing the engine greatly improves the performance of the application.