rowBand.addElement( label ); TextFieldElementFactory textFactory = new TextFieldElementFactory(); textFactory.setFieldname( fieldName ); textFactory.setAbsolutePosition( new Point( labelWidth, pagePosition ) ); textFactory.setMinimumWidth( (float) textWidth ); textFactory.setMinimumHeight( fontHeight ); textFactory.setOverflowY( false ); textFactory.setDynamicHeight( true ); Element element = textFactory.createElement(); element.setDynamicContent( true ); rowBand.addElement( element );
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 ); }
final ElementAlignment alignment, final ElementAlignment valign, final FontDefinition font, final String nullString, final String field ) { final TextFieldElementFactory factory = new TextFieldElementFactory(); factory.setX( new Float( bounds.getX() ) ); factory.setY( new Float( bounds.getY() ) ); factory.setMinimumWidth( new Float( bounds.getWidth() ) ); factory.setMinimumHeight( new Float( bounds.getHeight() ) ); factory.setName( name ); factory.setColor( paint ); factory.setHorizontalAlignment( alignment ); factory.setVerticalAlignment( valign ); factory.setFontName( font.getFontName() ); factory.setFontSize( new Integer( font.getFontSize() ) ); factory.setBold( ElementFactory.getBooleanValue( font.isBold() ) ); factory.setItalic( ElementFactory.getBooleanValue( font.isItalic() ) ); factory.setEncoding( font.getFontEncoding( null ) ); factory.setUnderline( ElementFactory.getBooleanValue( font.isUnderline() ) ); factory.setStrikethrough( ElementFactory.getBooleanValue( font.isStrikeThrough() ) ); factory.setEmbedFont( ElementFactory.getBooleanValue( font.isEmbeddedFont() ) ); factory.setFieldname( field ); factory.setNullString( nullString ); return factory.createElement();
/** * Starts parsing. * * @param atts * the attributes. * @throws org.xml.sax.SAXException * if there is a parsing error. */ protected void startParsing( final PropertyAttributes atts ) throws SAXException { super.startParsing( atts ); textFieldElementFactory.setNullString( atts.getValue( getUri(), "nullstring" ) ); final String fieldName = atts.getValue( getUri(), "fieldname" ); if ( fieldName != null ) { textFieldElementFactory.setFieldname( fieldName ); } else { final String formula = atts.getValue( getUri(), "formula" ); if ( formula == null ) { throw new ParseException( "Either 'fieldname' or 'formula' attribute must be given.", getLocator() ); } textFieldElementFactory.setFormula( formula ); } }
public StringFieldReadHandler() { textFieldElementFactory = new TextFieldElementFactory(); }
/** * Creates the resource field element based on the set properties. * * @return the generated element. * @see org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory#createElement() */ public Element createElement() { final Element element = super.createElement(); element.setElementType( new ResourceFieldType() ); element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.RESOURCE_IDENTIFIER, getResourceBase() ); return element; }
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(); }
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 );