Package net.sf.jasperreports.components.barbecue

Contains classes for the built-in Barbecue component.

The Barbecue Component

This component uses the Barbecue library (http://barbecue.sourceforge.net). Its barcodes can be embedded in reports via a uniform component element that specifies common attributes and determines the barcode type via a special attribute.

The JRXML structure of a barcode component is listed in the JasperReports components schema. The XML element belongs to the http://jasperreports.sourceforge.net/jasperreports/components namespace, which is the namespace of the component elements built into JasperReports.

The type of the barcode is given by the mandatory type attribute. The supported types are listed in the JRXML structure as values allowed for this attribute. For the most part, they correspond to the Barbecue barcode factory methods.

The data/text to be encoded in a barcode is provided by the code expression, which is expected to evaluate to a java.lang.String object. If the expression evaluates to null and the barcode does not have delayed evaluation, the element will not generate an image in the filled report.

A second expression is used to provide an application identifier for the generic UCC 128 barcode type. The expression should not be used for any other barcode type. Note that the list of supported barcode types includes types for specific UCC 128 application domains: EAN 128, USPS, Shipment Identification Number, SSCC 18, SCC 14, and Global Trade Item Number.

Further attributes influence which barcode is displayed and how it is displayed. The drawText attribute specifies whether or not the encoded data should be shown underneath the barcode; the barWidth attribute can be used to set a desired width of the thinnest bar, the barHeight attribute can specify the height of the bars, and the checksumRequired attribute determines whether a check digit is to be included in the barcode for the types that support it.

The evaluationTime and evaluationGroup attributes allow the barcode to be evaluated after the band on which it is placed has been rendered. This attribute functions in the same way as for text fields and images, with the exception that Auto evaluation type is not supported.

On the API side, the Barbecue component is represented by the BarbecueComponent interface, whose default implementation is StandardBarbecueComponent.

When the report is filled, a barcode renderer of type BarbecueRenderer is created. It is used for the image included in the generated report. The image takes its scale type from the RetainShape attribute and its size from the size defined for the barcode element in the report.