Package net.sf.jasperreports.components

Contains classes for built-in components.

See: Description

Package net.sf.jasperreports.components Description

Contains classes for built-in components.

In addition to the standard report elements, such as text fields, images, charts, subreports and crosstabs JasperReports has an increasing number of core components that can be used to add content to generated reports. Some of them are used for greatly simplifying the creation of complex layouts, others are used to embed highly specialized visualization packages, such as barcodes and other types of graphics, or to generate report interactivity, like the Header Toolbar component.

The purpose of this feature is to allow users to extend the functionality of the JasperReports engine by plugging-in custom-made visual components that would take data as input and produce content that is embedded into the resulting documents. Custom made components can be anything from simple barcodes to tables, and professional charting packages.

The custom component support is relying on two other major features of the JasperReports library: extension support and generic elements and you need to be familiar with them before delving into custom components.

A custom component is a custom report element that has a defined structure and produces some output in generated reports, just like usual report elements do. Just like a normal chart element in a report template will produce an image element in the generated document, or just like a crosstab element present in the report template will produce a series of frames and text fields that makes up a tabular structure in the generated documents, generic custom components declared in a report template could generate any combination of simple elements and generic elements as the output of their built-in calculation and layout logic.

Custom components are supposed to come in bundles. A component bundle is a package comprising of one or several components that share the same XML namespace and schema. For example, a chart component bundle can contain multiple chart components, one for each type of chart (pie chart component, bar chart component and so on).

Custom Components Use Cases Examples

In the following use case example, we consider a JasperReports user that wants to replace the JFreeChart library (bundled with JasperReports by default for the built-in charting support) with some other charting package.

Following are the few steps required to achieve it:

Custom Component Implementation Overview

A typical implementation of a custom component would involve the following:

When implementing custom components, the most helpful information can be found in the form of JasperReports API Javadoc and samples. The following samples found in the /demo/samples folder of the JasperReports project distribution package show custom components:

© 2001 - 2016 TIBCO Software Inc. www.jaspersoft.com