protected void setWhenNoDataBand ( ) { log . debug ( "setting up WHEN NO DATA band" ) ; String whenNoDataText = getReport ( ) . getWhenNoDataText ( ) ; Style style = getReport ( ) . getWhenNoDataStyle ( ) ; if ( whenNoDataText == null || "" . equals ( whenNoDataText ) ) return ; JRDesignBand band = new JRDesignBand ( ) ; getDesign ( ) . setNoData ( band ) ; JRDesignTextField text = new JRDesignTextField ( ) ; JRDesignExpression expression = ExpressionUtils . createStringExpression ( "\"" + whenNoDataText + "\"" ) ; text . setExpression ( expression ) ; if ( style == null ) { style = getReport ( ) . getOptions ( ) . getDefaultDetailStyle ( ) ; } if ( getReport ( ) . isWhenNoDataShowTitle ( ) ) { LayoutUtils . copyBandElements ( band , getDesign ( ) . getTitle ( ) ) ; LayoutUtils . copyBandElements ( band , getDesign ( ) . getPageHeader ( ) ) ; } if ( getReport ( ) . isWhenNoDataShowColumnHeader ( ) ) LayoutUtils . copyBandElements ( band , getDesign ( ) . getColumnHeader ( ) ) ; int offset = LayoutUtils . findVerticalOffset ( band ) ; text . setY ( offset ) ; applyStyleToElement ( style , text ) ; text . setWidth ( getReport ( ) . getOptions ( ) . getPrintableWidth ( ) ) ; text . setHeight ( 50 ) ; band . addElement ( text ) ; log . debug ( "OK setting up WHEN NO DATA band" ) ; }
Creates the graphic element to be shown when the datasource is empty