Class ElementKeyExporterFilter

  • All Implemented Interfaces:
    ExporterFilter

    public class ElementKeyExporterFilter
    extends java.lang.Object
    implements ExporterFilter
    An exporter filter that excludes elements based on their keys. The filter uses a fixed set of elements keys to exclude.

    Element keys are set at report design time and are propagated into generated reports. Each element in a filled report has the same key as the element from the report template that generated it.

    To trigger an element key filter, the report designer needs to define one or more report properties that start with <exporter_property_prefix>.exclude.key. Each such property matches a single element key which is to be excluded by the filter. The element key is given by the property value, or if no value is set for the property, by the property suffix.

    The following example shows how to specify element keys which are to be excluded from specific export outputs:

     <jasperReport ...>
       <!-- exclude elements with keys Image1 and Text4 from HTML export -->
       <property name="net.sf.jasperreports.export.html.exclude.key.Image1"/>
       <property name="net.sf.jasperreports.export.html.exclude.key.Text4"/>
       <!-- exclude elements with keys Image5 from PDF export -->
       <property name="net.sf.jasperreports.export.pdf.exclude.key.the.image" value="Image5"/>
       ...
     </jasperReport>
     
    Author:
    Lucian Chirita (lucianc@users.sourceforge.net)
    • Constructor Summary

      Constructors 
      Constructor Description
      ElementKeyExporterFilter​(java.util.Set<java.lang.String> excludedKeys)
      Creates a filter instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isToExport​(JRPrintElement element)
      Excludes elements whose keys match any of the excluded keys.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EXCEPTION_MESSAGE_KEY_EXCLUDED_NULL_KEYS_SET

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_EXCLUDED_NULL_KEYS_SET
        See Also:
        Constant Field Values
    • Constructor Detail

      • ElementKeyExporterFilter

        public ElementKeyExporterFilter​(java.util.Set<java.lang.String> excludedKeys)
        Creates a filter instance.
        Parameters:
        excludedKeys - the set of keys to exclude
    • Method Detail

      • isToExport

        public boolean isToExport​(JRPrintElement element)
        Excludes elements whose keys match any of the excluded keys. Elements with no keys are not excluded.
        Specified by:
        isToExport in interface ExporterFilter