reportHeader.getStyle().setStyleProperty( TextStyleKeys.BOLD, true );
public void configureDesignTimeDefaults( final ReportElement element, final Locale locale ) { element.getStyle().setStyleProperty( ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.TRUE ); element.getStyle().setStyleProperty( ElementStyleKeys.SCALE, Boolean.TRUE ); element.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 50f ); element.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 50f ); }
public void configureDesignTimeDefaults( final ReportElement element, final Locale locale ) { element.getStyle().setStyleProperty( ElementStyleKeys.SCALE, Boolean.TRUE ); element.getStyle().setStyleProperty( ElementStyleKeys.DRAW_SHAPE, Boolean.TRUE ); element.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, new Float( 0f ) ); } }
private void configureBand( final javax.swing.text.Element textElement, final Band band ) { if ( "paragraph".equals( textElement.getName() ) || "section".equals( textElement.getName() ) ) { band.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, "block" ); band.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, new Float( -100 ) ); } else { band.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, "inline" ); } } }
public static Element createHorizontalLine( final float y, final Color color, final Stroke stroke ) { final Element element = createHorizontalLine( y ); element.getStyle().setStyleProperty( ElementStyleKeys.PAINT, color ); element.getStyle().setStyleProperty( ElementStyleKeys.STROKE, stroke ); return element; }
protected CrosstabCell createDetailsCell() { final CrosstabCell cell = new CrosstabCell(); cell.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, -100f ); cell.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_ROW ); for ( int i = 0; i < details.size(); i += 1 ) { final CrosstabDetail crosstabDetail = details.get( i ); cell.addElement( createDetailCellContent( crosstabDetail ) ); } return cell; }
/** * Constructs a new band (initially empty). */ public DetailsFooter() { setElementType( new DetailsFooterType() ); getStyle().setStyleProperty( ElementStyleKeys.AVOID_PAGEBREAK_INSIDE, Boolean.TRUE ); }
public static Band createRow( final Element... boxes ) { final Band tableRow = new Band(); tableRow.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_TABLE_ROW ); tableRow.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 100f ); tableRow.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 200f ); for ( int i = 0; i < boxes.length; i++ ) { tableRow.addElement( boxes[i] ); } return tableRow; }
private void handleFixedPosition( final PropertyAttributes attr ) throws SAXException { final String fixedPos = attr.getValue( getUri(), RootLevelBandReadHandler.FIXED_POSITION_ATTRIBUTE ); if ( fixedPos != null ) { final float fixedPosValue = ParserUtil.parseFloat( fixedPos, "FixedPosition is invalid!", getLocator() ); getBand().getStyle().setStyleProperty( BandStyleKeys.FIXED_POSITION, new Float( fixedPosValue ) ); } }
private void handlePagebreakAttr( final PropertyAttributes attr ) throws SAXException { final String ownPageAttr = attr.getValue( getUri(), "pagebreak" ); if ( ownPageAttr != null ) { GroupFooterReadHandler.logger.warn( "The 'pagebreak' attribute of the <group-footer> tag is deprecated. " + "Use the 'pagebreak-after' attribute instead." ); final Boolean ownPage = ParserUtil.parseBoolean( ownPageAttr, getLocator() ); getBand().getStyle().setStyleProperty( BandStyleKeys.PAGEBREAK_AFTER, ownPage ); } } }
private void handleHeight( final PropertyAttributes attr ) throws ParseException { final String height = attr.getValue( getUri(), RootLevelBandReadHandler.HEIGHT_ATTRIBUTE ); if ( height != null ) { final float heightValue = ParserUtil.parseFloat( height, "Height is invalid.", getLocator() ); getBand().getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, new Float( heightValue ) ); } }
public static Band createCell( final float width, final float height, final int rowSpan, final int colSpan ) { final Band tableCell = new Band(); tableCell.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_TABLE_CELL ); tableCell.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, width ); tableCell.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, height ); tableCell.setAttribute( AttributeNames.Table.NAMESPACE, AttributeNames.Table.ROWSPAN, rowSpan ); tableCell.setAttribute( AttributeNames.Table.NAMESPACE, AttributeNames.Table.COLSPAN, colSpan ); return tableCell; } }
@Test( expected = NullPointerException.class ) public void setStyleProperty_RejectsNullKeys() { ElementStyleSheet sheet = new ElementStyleSheet(); sheet.setStyleProperty( null, "" ); }
protected boolean evaluateElement( final ReportElement e ) { if ( ObjectUtilities.equal( e.getName(), getElement() ) ) { e.getStyle().setStyleProperty( ElementStyleKeys.VISIBLE, isDataAvailable() ); return true; } return false; }
public static Band createCell( final Element dataItem, final int rowSpan, final int colSpan ) { final Band tableCell = new Band(); tableCell.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_TABLE_CELL ); tableCell.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 150f ); tableCell.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 200f ); tableCell.setAttribute( AttributeNames.Table.NAMESPACE, AttributeNames.Table.ROWSPAN, rowSpan ); tableCell.setAttribute( AttributeNames.Table.NAMESPACE, AttributeNames.Table.COLSPAN, colSpan ); tableCell.addElement( dataItem ); return tableCell; }
public static Element generateDetailsElement( final String fieldName, final ElementType targetType ) { final Element detailsElement = new Element(); detailsElement.getStyle().setStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE ); detailsElement.setElementType( targetType ); detailsElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, fieldName ); detailsElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING, Boolean.TRUE ); detailsElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.TRUE ); return detailsElement; }
public static Element createDataItem( final String text, final float width, final float height ) { final Element label = new Element(); label.setElementType( LabelType.INSTANCE ); label.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text ); label.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, width ); label.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, height ); return label; }
private void handleRepeat( final PropertyAttributes attr ) throws SAXException { final String repeat = attr.getValue( getUri(), "repeat" ); final Boolean repeatVal = ParserUtil.parseBoolean( repeat, getLocator() ); getBand().getStyle().setStyleProperty( BandStyleKeys.REPEAT_HEADER, repeatVal ); }
@Test public void isLocalKey_KeyIsTreatedAsLocal_AfterBeingSetExplicitly() { List<StyleKey> keys = StyleKey.getDefinedStyleKeysList(); StyleKey key1 = keys.get( 0 ); StyleKey key2 = keys.get( 1 ); ElementStyleSheet sheet = new ElementStyleSheet(); sheet.setStyleProperty( key1, valueFor( key1 ) ); assertTrue( "First key was set, should be 'local'", sheet.isLocalKey( key1 ) ); assertFalse( "Second key was not set, should not be 'local'", sheet.isLocalKey( key2 ) ); }
@Test public void getStyleProperty_ReturnsSetValue() { List<StyleKey> keys = StyleKey.getDefinedStyleKeysList(); StyleKey key = keys.get( 0 ); ElementStyleSheet sheet = new ElementStyleSheet(); sheet.setStyleProperty( key, valueFor( key ) ); Object property = sheet.getStyleProperty( key, 2f ); assertEquals( valueFor( key ), property ); }