protected void applyBanners ( ) { DynamicReportOptions options = getReport ( ) . getOptions ( ) ; if ( options . getFirstPageImageBanners ( ) . isEmpty ( ) && options . getImageBanners ( ) . isEmpty ( ) ) { return ; } /* First create image banners for the first page only */ JRDesignBand title = ( JRDesignBand ) getDesign ( ) . getTitle ( ) ; //if there is no title band, but there are banner images for the first page, we create a title band if ( title == null && ! options . getFirstPageImageBanners ( ) . isEmpty ( ) ) { title = new JRDesignBand ( ) ; getDesign ( ) . setTitle ( title ) ; } applyImageBannersToBand ( title , options . getFirstPageImageBanners ( ) . values ( ) , null , true ) ; /* Now create image banner for the rest of the pages */ JRDesignBand pageHeader = ( JRDesignBand ) getDesign ( ) . getPageHeader ( ) ; //if there is no title band, but there are banner images for the first page, we create a title band if ( pageHeader == null && ! options . getImageBanners ( ) . isEmpty ( ) ) { pageHeader = new JRDesignBand ( ) ; getDesign ( ) . setPageHeader ( pageHeader ) ; } JRDesignExpression printWhenExpression = null ; if ( ! options . getFirstPageImageBanners ( ) . isEmpty ( ) ) { printWhenExpression = new JRDesignExpression ( ) ; printWhenExpression . setValueClass ( Boolean . class ) ; printWhenExpression . setText ( EXPRESSION_TRUE_WHEN_NOT_FIRST_PAGE ) ; } applyImageBannersToBand ( pageHeader , options . getImageBanners ( ) . values ( ) , printWhenExpression , true ) ; }
Create the image elements for the banners tha goes into the title and header bands depending on the case