InetSoft Reporting Software: Painter Scaling

Painter size is determined by two factors. If an explicit size is supplied, the painter is always painted in that exact size on the output. If the explicit size is different from the painter's preferred size, how the painter is printed is determined by whether the painter is scalable.

If the painter's isScalable() method returns true, the painter is scalable. This means that if the final size of the painter is different from its preferred size, the Painter.paint() method handles the scaling automatically and the painter will behave correctly in the new size. In this case, the size passed into the paint() method of painter is the exact size of the painter on the output media.

If the painter's isScalable() is false, the painter is not scalable. This means the Painter.paint() method only paints correctly at its preferred size. If the final size of the painter is different from its preferred size, in order to ensure the painter behaves correctly the ReportSheet creates a buffer of the painter's preferred size.

The size passed to the paint() method of the painter is always the preferred size of the painter. The buffer (with painter's preferred size) is later scaled in the output media to the actual size.

The Image and Component elements are painted as non-scalable painters. Chart and TextBox elements are scalable painters.

If you are implementing your own painter, return the scalable property to true if your paint() method checks the width and height and paints correctly according to the true size. If your paint() method always paints at one size, return the scalable property to false to let ReportSheet perform the scaling to satisfy your preferred size.

#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

Summary of Java-based API Printing

We have shown how to quickly generate a report from screen. By combining table styles and table adapters, printing a professional looking report is as easy as writing a few function calls. Style Intelligence goes further than simply printing tables. In the next few chapters, we will demonstrate how to add other elements to a report, including headers and footers, and will discuss advanced features available in the printing of tables.

Difference from Report Writers

The InetSoft package is a report generation tool, written in Java, designed to produce business reports. It differs from report writers in a number of important aspects:

• Style Intelligence allows a Java program to create a report dynamically, using a variety of data sources. Traditional report writers only provide a visual interface to create a report and normally work directly with databases.

• Style Intelligence can be easily extended with new styles and rendering methods. Traditional report writers normally have a fixed set of features and do not provide an API to extend their functionality.

• Style Intelligence is tightly integrated with the application, both from a programming point of view and from an end user point of view. No separate application is needed to generate a report. Traditional report writers, on the other hand, normally require users to start another application separate from the main application.

With the infrastructure provided by InetSoft products, we envision a wide range of different applications for the report. Since the number of possible combinations of table attributes is very large, it is likely that users will create new styles to suit their specific needs. We welcome the submission of new styles or adapters if you feel that what you create is very generic and can be used by other people.

Previous: Changing Report Table Attributes