boolean labelUnderline, boolean labelBold, boolean labelItalic ) { ItemBand rowBand = new ItemBand(); rowBand.setLayout( BandStyleKeys.LAYOUT_ROW ); labelElementFactory.setDynamicHeight( true ); Element label = labelElementFactory.createElement(); rowBand.addElement( label ); Element element = textFactory.createElement(); element.setDynamicContent( true ); rowBand.addElement( element ); details.addElement( rowBand );
group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand(); itemBand.setVisible( true ); itemBand.setLayout( BandStyleKeys.LAYOUT_AUTO ); groupData.setItemBand( itemBand ); group.setBody( groupData ); imageElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.IMAGE_ENCODING_TYPE, "PNG" ); ItemBand imageBand = new ItemBand(); imageBand.setLayout( BandStyleKeys.LAYOUT_ROW ); imageBand.addElement( imageElement ); itemBand.addElement( imageBand );
public void testFindElement() { final Band noLate = new Band(); noLate.setName( "noLate" ); final Band landScape = new Band(); landScape.setName( "landscape" ); landScape.addElement( noLate ); final ItemBand band = new ItemBand(); band.addElement( landScape ); assertEquals( noLate, FunctionUtilities.findElement( band, "noLate" ) ); } }
@Test public void testSetItemBand() { ItemBand itemBand = mock( ItemBand.class ); body.setItemBand( itemBand ); assertThat( body.getItemBand(), is( equalTo( itemBand ) ) ); assertThat( (GroupDataBody) body.getItemBand().getParentSection(), is( equalTo( body ) ) ); ItemBand band = new ItemBand(); band.setParent( body ); body.setItemBand( band ); assertThat( body.getItemBand(), is( equalTo( itemBand ) ) ); }
band.setLayout( "row" ); band.getStyle().setStyleProperty( ElementStyleKeys.INVISIBLE_CONSUMES_SPACE, true ); band.addElement( createLabel( "D: ", 120 ) ); if ( headerPrinted ) { band.addElement( createLabel( "Details" ) ); band.addElement( createFieldItem( relationalDetail.getField(), null, relationalDetail.getBackground() ) );
public void testRemoveElement() { final MasterReport report = new MasterReport(); report.setName( "A Very Simple Report" ); TextFieldElementFactory factory = new TextFieldElementFactory(); factory.setName( "T1" ); factory.setAbsolutePosition( new Point2D.Float( 0, 0 ) ); factory.setMinimumSize( new FloatDimension( 150, 20 ) ); factory.setColor( Color.black ); factory.setHorizontalAlignment( ElementAlignment.LEFT ); factory.setVerticalAlignment( ElementAlignment.MIDDLE ); factory.setNullString( "-" ); factory.setFieldname( "Column1" ); final Element element1 = factory.createElement(); report.getItemBand().addElement( element1 ); factory = new TextFieldElementFactory(); factory.setName( "T2" ); factory.setAbsolutePosition( new Point2D.Float( 200, 0 ) ); factory.setMinimumSize( new FloatDimension( 150, 20 ) ); factory.setColor( Color.black ); factory.setHorizontalAlignment( ElementAlignment.LEFT ); factory.setVerticalAlignment( ElementAlignment.MIDDLE ); factory.setNullString( "-" ); factory.setFieldname( "Column2" ); final Element element2 = factory.createElement(); report.getItemBand().addElement( element2 ); // report.getStyleSheetCollection().debug(); report.getItemBand().removeElement( element1 ); report.getItemBand().removeElement( element2 ); // report.getStyleSheetCollection().debug(); }
protected void removeElement( final Element element ) { if ( element == null ) { throw new NullPointerException(); } if ( element == itemBand ) { this.itemBand.setParent( null ); this.itemBand = new ItemBand(); this.itemBand.setParent( this ); notifyNodeChildRemoved( element ); notifyNodeChildAdded( this.itemBand ); } else if ( element == noDataBand ) { this.noDataBand.setParent( null ); this.noDataBand = new NoDataBand(); this.noDataBand.setParent( this ); notifyNodeChildRemoved( element ); notifyNodeChildAdded( this.noDataBand ); } else if ( element == detailsHeader ) { this.detailsHeader.setParent( null ); this.detailsHeader = new DetailsHeader(); this.detailsHeader.setParent( this ); notifyNodeChildRemoved( element ); notifyNodeChildAdded( this.detailsHeader ); } else if ( element == detailsFooter ) { this.detailsFooter.setParent( null ); this.detailsFooter = new DetailsFooter(); this.detailsFooter.setParent( this ); notifyNodeChildRemoved( element ); notifyNodeChildAdded( this.detailsFooter ); } }
public ReportElement create() { return new ItemBand(); }
public void setItemBand( final ItemBand itemBand ) { if ( itemBand == null ) { throw new NullPointerException( "The itemBand must not be null" ); } validateLooping( itemBand ); if ( unregisterParent( itemBand ) ) { return; } final ItemBand oldElement = this.itemBand; this.itemBand.setParent( null ); this.itemBand = itemBand; this.itemBand.setParent( this ); notifyNodeChildRemoved( oldElement ); notifyNodeChildAdded( this.itemBand ); }
final ItemBand itemBand = element.getItemBand(); final CrosstabCell cell = new CrosstabCell(); itemBand.copyInto( cell ); cell.addElements( Arrays.asList( itemBand.getElementArray() ) );
public GroupDataBody derive( final boolean preserveElementInstanceIds ) { final GroupDataBody dataBody = (GroupDataBody) super.derive( preserveElementInstanceIds ); dataBody.itemBand = (ItemBand) itemBand.derive( preserveElementInstanceIds ); dataBody.noDataBand = (NoDataBand) noDataBand.derive( preserveElementInstanceIds ); dataBody.detailsHeader = (DetailsHeader) detailsHeader.derive( preserveElementInstanceIds ); dataBody.detailsFooter = (DetailsFooter) detailsFooter.derive( preserveElementInstanceIds ); dataBody.registerAsChild( dataBody.itemBand ); dataBody.registerAsChild( dataBody.noDataBand ); dataBody.registerAsChild( dataBody.detailsHeader ); dataBody.registerAsChild( dataBody.detailsFooter ); return dataBody; } }
/** * Clones this Element, the datasource and the private stylesheet of this Element. The clone does no longer have a * parent, as the old parent would not recognize that new object anymore. * * @return a clone of this Element. */ public GroupDataBody clone() { final GroupDataBody dataBody = (GroupDataBody) super.clone(); dataBody.itemBand = (ItemBand) itemBand.clone(); dataBody.noDataBand = (NoDataBand) noDataBand.clone(); dataBody.detailsHeader = (DetailsHeader) detailsHeader.clone(); dataBody.detailsFooter = (DetailsFooter) detailsFooter.clone(); dataBody.registerAsChild( dataBody.itemBand ); dataBody.registerAsChild( dataBody.noDataBand ); dataBody.registerAsChild( dataBody.detailsHeader ); dataBody.registerAsChild( dataBody.detailsFooter ); return dataBody; }
group.setName( "a" ); GroupDataBody groupBody = new GroupDataBody(); ItemBand ib = new ItemBand(); Mockito.doReturn( schema ).when( fc ).getDataSchema(); Mockito.doReturn( new String[] { "a" } ).when( schema ).getNames(); try { element.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, o1 ); ib.addElement( element ); groupBody.setElementAt(1, ib ); group.setElementAt(1, groupBody );
report.getItemBand().addElement( element1 ); report.getItemBand().addElement( element2 ); report.getItemBand().removeElement( element1 ); report.getItemBand().removeElement( element2 );
public GroupDataBody() { setElementType( new GroupDataBodyType() ); this.noDataBand = new NoDataBand(); this.itemBand = new ItemBand(); this.detailsHeader = new DetailsHeader(); this.detailsFooter = new DetailsFooter(); registerAsChild( noDataBand ); registerAsChild( itemBand ); registerAsChild( detailsHeader ); registerAsChild( detailsFooter ); }
public void testRemoveBandElement() { final MasterReport report = new MasterReport(); report.setName( "A Very Simple Report" ); TextFieldElementFactory factory = new TextFieldElementFactory(); factory.setName( "T1" ); factory.setAbsolutePosition( new Point2D.Float( 0, 0 ) ); factory.setMinimumSize( new FloatDimension( 150, 20 ) ); factory.setColor( Color.black ); factory.setHorizontalAlignment( ElementAlignment.LEFT ); factory.setVerticalAlignment( ElementAlignment.MIDDLE ); factory.setNullString( "-" ); factory.setFieldname( "Column1" ); final Element element1 = factory.createElement(); report.getItemBand().addElement( element1 ); factory = new TextFieldElementFactory(); factory.setName( "T2" ); factory.setAbsolutePosition( new Point2D.Float( 200, 0 ) ); factory.setMinimumSize( new FloatDimension( 150, 20 ) ); factory.setColor( Color.black ); factory.setHorizontalAlignment( ElementAlignment.LEFT ); factory.setVerticalAlignment( ElementAlignment.MIDDLE ); factory.setNullString( "-" ); factory.setFieldname( "Column2" ); final Element element2 = factory.createElement(); report.getItemBand().addElement( element2 ); // report.getStyleSheetCollection().debug(); report.getItemBand().removeElement( element1 ); // report.getStyleSheetCollection().debug(); DebugReportRunner.execGraphics2D( report ); }