Java Code Examples for org.pentaho.reporting.engine.classic.core.Element#setAttribute()

The following examples show how to use org.pentaho.reporting.engine.classic.core.Element#setAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceMessageElementFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Generates the element based on the defined properties.
 *
 * @return the generated element.
 * @throws NullPointerException
 *           if the resource class name is null.
 * @throws IllegalStateException
 *           if the resource key is not defined.
 * @see ElementFactory#createElement()
 */
public Element createElement() {
  if ( getFormatKey() == null ) {
    throw new IllegalStateException( "ResourceKey is not set." );
  }

  final Element element = new Element();
  applyElementName( element );
  applyStyle( element.getStyle() );
  element.setElementType( new ResourceMessageType() );
  element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.RESOURCE_IDENTIFIER, getResourceBase() );
  element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getFormatKey() );
  element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE, getNullString() );
  element
      .setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.MESSAGE_NULL_VALUE, getMessageNullString() );
  return element;
}
 
Example 2
Source File: AbstractRenderComponent.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void selectionAdded( final ReportSelectionEvent event ) {
  final Object element = event.getElement();
  if ( element instanceof Element == false ) {
    return;
  }

  final Element velement = (Element) element;
  ReportElement parentSearch = velement;
  final Section rootBand = getElementRenderer().getElement();
  final ZoomModel zoomModel = getRenderContext().getZoomModel();
  while ( parentSearch != null ) {
    if ( parentSearch == rootBand ) {
      final SelectionOverlayInformation renderer = new SelectionOverlayInformation( velement );
      renderer.validate( zoomModel.getZoomAsPercentage() );
      velement
        .setAttribute( ReportDesignerBoot.DESIGNER_NAMESPACE, ReportDesignerBoot.SELECTION_OVERLAY_INFORMATION,
          renderer, false );
      repaintConditionally();
      return;
    }
    parentSearch = parentSearch.getParentSection();
  }
}
 
Example 3
Source File: AutoGeneratorUtility.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static Element generateFooterElement( final Class aggregationType, final ElementType targetType,
    final String group, final String fieldName ) {
  if ( aggregationType == null ) {
    final Element footerValueElement = new Element();
    footerValueElement.setElementType( new LabelType() );
    footerValueElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "" );
    footerValueElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING,
        Boolean.TRUE );
    footerValueElement.setAttribute( AttributeNames.Wizard.NAMESPACE,
        AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.FALSE );
    return footerValueElement;
  }

  final Element element = generateDetailsElement( fieldName, targetType );
  element.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, aggregationType );
  element.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP, group );
  return element;
}
 
Example 4
Source File: DefaultReportElementDragHandler.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected Element createElement( final ElementMetaData elementMetaData,
                                 final String fieldName,
                                 final ReportDocumentContext context ) throws InstantiationException {
  final ElementType type = elementMetaData.create();
  final Element visualElement = (Element) type.create();

  final ElementStyleSheet styleSheet = visualElement.getStyle();
  styleSheet.setStyleProperty( ElementStyleKeys.MIN_WIDTH, DEFAULT_WIDTH );
  styleSheet.setStyleProperty( ElementStyleKeys.MIN_HEIGHT, DEFAULT_HEIGHT );

  type.configureDesignTimeDefaults( visualElement, Locale.getDefault() );
  if ( elementMetaData.getAttributeDescription( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD ) != null ) {
    visualElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, fieldName );
  }

  configureWizardProperties( fieldName, context, visualElement );

  return visualElement;
}
 
Example 5
Source File: Prd5262IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testMessageFieldsAcceptLocaleAndTimeZone() throws Exception {
  Element element = new Element();
  element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE,
      "$(date,date,yyyy-MM-dd'T'HH:mm:ss,SSSZZZ)" );

  MessageType t = new MessageType();
  Assert.assertEquals( "2009-02-13T15:31:30,123-0800", t.getValue( runtime, element ) );
}
 
Example 6
Source File: Prd3514IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testLineBreaksOnStart() throws ReportProcessingException, ContentProcessingException {
  Element textField = new Element();
  textField.setName( "textField" );
  textField.getStyle().setStyleProperty( TextStyleKeys.FONT, "Arial" );
  textField.getStyle().setStyleProperty( TextStyleKeys.FONTSIZE, 14 );
  textField.getStyle().setStyleProperty( TextStyleKeys.TEXT_WRAP, TextWrap.NONE );
  textField.getStyle().setStyleProperty( TextStyleKeys.TRIM_TEXT_CONTENT, false );
  textField.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 97f );
  textField.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 20f );
  textField.getStyle().setStyleProperty( ElementStyleKeys.POS_X, 0f );
  textField.getStyle().setStyleProperty( ElementStyleKeys.POS_Y, 0f );
  textField.setElementType( LabelType.INSTANCE );
  textField.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "\nClassic Cars" );

  final MasterReport report = new MasterReport();
  report.getReportHeader().addElement( textField );
  report.setCompatibilityLevel( null );
  report.getReportConfiguration().setConfigProperty( ClassicEngineCoreModule.COMPLEX_TEXT_CONFIG_OVERRIDE_KEY,
      "false" );

  LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand( report, report.getReportHeader(), false, false );
  ModelPrinter.INSTANCE.print( logicalPageBox );

  RenderNode textFieldBox = MatchFactory.findElementByName( logicalPageBox, "textField" );
  assertNotNull( textFieldBox );

  assertEquals( 0, textFieldBox.getY() );

  // box only contains one line, and min-size is set to 8, max size = 20, so the line-height of 14.024 is used.
  assertEquals( StrictGeomUtility.toInternalValue( 28 ), textFieldBox.getHeight() );
}
 
Example 7
Source File: RelationalReportBuilder.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Element createLabel( final String text, float width ) {
  final Element element = new Element();
  element.setElementType( LabelType.INSTANCE );
  element.getElementType().configureDesignTimeDefaults( element, Locale.getDefault() );

  element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text );
  element.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, width );
  element.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 20f );
  return element;
}
 
Example 8
Source File: AggregateFieldPreProcessorTest.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void configureRelationalAggreation() {
  DefaultFlowController fc = Mockito.mock( DefaultFlowController.class );
  DataSchema schema = Mockito.mock( DataSchema.class );
  SubReport section = new SubReport();
  AggregateFieldPreProcessor afpp = Mockito.spy( AggregateFieldPreProcessor.class );
  Element element = new Element();
  RelationalGroup group = Mockito.spy( new RelationalGroup() );
  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();

  AggregationFunction o = Mockito.mock( AggregationFunction.class );
  Object o1 = ItemSumFunction.class;
  try {
    element.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, o1 );
    ib.addElement( element );
    groupBody.setElementAt(1, ib );
    group.setElementAt(1, groupBody );
    section.setElementAt( 2, group );
    SubReport result = afpp.performPreProcessing( section, fc );
    Mockito.verify( group, Mockito.times( 1 ) ).getGeneratedName();
    String name = ( (ItemSumFunction) result.getExpressions().getExpression( 0 ) ).getGroup();
    Assert.assertEquals( name, group.getGeneratedName() );
  } catch ( Exception e ) {
    e.printStackTrace();
    Assert.fail();
  }
}
 
Example 9
Source File: StyleInheritanceIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Element createLabel( final String text ) {
  final Element element = new Element();
  element.setName( text );
  element.setElementType( LabelType.INSTANCE );
  element.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, new Float( 20 ) );
  element.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, new Float( 200 ) );
  element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text );
  return element;
}
 
Example 10
Source File: ModelUtility.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static CachedLayoutData getCachedLayoutData( final Element element ) {
  final Object attribute = element.getAttribute( ReportDesignerParserModule.NAMESPACE, CACHED_LAYOUT_DATA );
  if ( attribute instanceof CachedLayoutData ) {
    return (CachedLayoutData) attribute;
  }

  final CachedLayoutData retval = new CachedLayoutData();
  element.setAttribute( ReportDesignerParserModule.NAMESPACE, CACHED_LAYOUT_DATA, retval, false );
  return retval;
}
 
Example 11
Source File: Prd2259IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void addLabel( final String text, final Band band, final float height ) {
  final Element e = new Element();
  e.setId( text );
  e.setElementType( LabelType.INSTANCE );
  e.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text );
  e.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, new Float( height ) );
  e.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, new Float( 100 ) );
  band.addElement( e );
}
 
Example 12
Source File: CrosstabDataIT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Element createDataItem( final String text ) {
  final Element label = new Element();
  label.setElementType( LabelType.INSTANCE );
  label.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text );
  label.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 100f );
  label.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 200f );
  return label;
}
 
Example 13
Source File: PentahoServlet.java    From pentaho-8-reporting-for-java-developers with Apache License 2.0 5 votes vote down vote up
public static Element createDataItem ( 
   String text)
 { 
   Element label = new Element(); 
label.setElementType( LabelType.INSTANCE ); 
label.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text ); 
label.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH,  100f ); 
label.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 20f ); 
return label; 
 }
 
Example 14
Source File: AutoGeneratorUtility.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
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;
}
 
Example 15
Source File: AutoGeneratorUtility.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Element generateHeaderElement( final String fieldName ) {
  final Element headerElement = new Element();
  headerElement.getStyle().setStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE );
  headerElement.setElementType( new LabelType() );
  headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, fieldName );
  headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING,
      Boolean.TRUE );
  headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES,
      Boolean.TRUE );
  return headerElement;
}
 
Example 16
Source File: PieSparklineElementFactory.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates a new instance of the element. Override this method to return a concrete subclass of the element.
 *
 * @return the newly generated instance of the element.
 */
public Element createElement() {
  final Element element = new Element();
  applyElementName( element );
  applyStyle( element.getStyle() );

  element.setElementType( new PieSparklineType() );
  if ( getContent() != null ) {
    element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent() );
  }
  if ( getFieldname() != null ) {
    element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname() );
  }
  if ( getFormula() != null ) {
    final FormulaExpression formulaExpression = new FormulaExpression();
    formulaExpression.setFormula( getFormula() );
    element.setAttributeExpression( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression );
  }
  if ( startAngle != null ) {
    element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.START_ANGLE, startAngle );
  }
  if ( lowSlice != null ) {
    element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.LOW_SLICE, lowSlice );
  }
  if ( mediumSlice != null ) {
    element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE, mediumSlice );
  }
  if ( highSlice != null ) {
    element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.HIGH_SLICE, highSlice );
  }
  if ( counterClockwise != null ) {
    element.setAttribute( SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE,
        counterClockwise );
  }

  return element;
}
 
Example 17
Source File: Prd3319IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testLoadSaveFromDisk() throws Exception {
  final ResourceKey key = createImageKey();

  final Element element = new Element();
  element.setElementType( new ContentType() );
  element.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, key );
  // .. save it.
  final MasterReport report = new MasterReport();
  report.getReportHeader().addElement( element );

  saveReport( report, new File( "bin/test-tmp/prd-3319-load-save-disk-1.prpt" ) );

  // load it to establish the context in all resource-keys ..
  final ResourceManager mgr = new ResourceManager();
  mgr.registerDefaults();
  final Resource resource =
      mgr.createDirectly( new File( "bin/test-tmp/prd-3319-load-save-disk-1.prpt" ), MasterReport.class );

  // save it once, that changes the bundle ...
  final MasterReport report2 = (MasterReport) resource.getResource();
  saveReport( report2, new File( "bin/test-tmp/prd-3319-load-save-disk-2.prpt" ) );
  // save it twice, that triggers the crash...
  saveReport( report2, new File( "bin/test-tmp/prd-3319-load-save-disk-2.prpt" ) );

  final ProcessingContext processingContext = new DefaultProcessingContext();
  final DebugExpressionRuntime runtime = new DebugExpressionRuntime( new DefaultTableModel(), 0, processingContext );

  final Element reportElement = report2.getReportHeader().getElement( 0 );
  Object attribute = reportElement.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE );

  assertTrue( attribute instanceof ResourceKey );
  ResourceKey atKey = (ResourceKey) attribute;
  assertEquals( "http://127.0.0.1:65535/image.jpg", atKey.getIdentifierAsString() );
}
 
Example 18
Source File: Prd3688IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Element createDataItem( final String text ) {
  final Element label = new Element();
  label.setElementType( LabelType.INSTANCE );
  label.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text );
  label.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 100f );
  label.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 200f );
  return label;
}
 
Example 19
Source File: Prd3514IT.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void testWeirdTocLayoutComplex() throws ReportProcessingException, ContentProcessingException {

    if ( !DebugReportRunner.isSafeToTestComplexText() ) {
      return;
    }

    Element textField = new Element();
    textField.setName( "textField" );
    textField.getStyle().setStyleProperty( TextStyleKeys.FONT, "Arial" );
    textField.getStyle().setStyleProperty( TextStyleKeys.FONTSIZE, 14 );
    textField.getStyle().setStyleProperty( TextStyleKeys.TEXT_WRAP, TextWrap.NONE );
    textField.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 97f );
    textField.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 20f );
    textField.getStyle().setStyleProperty( ElementStyleKeys.POS_X, 0f );
    textField.getStyle().setStyleProperty( ElementStyleKeys.POS_Y, 0f );
    textField.setElementType( LabelType.INSTANCE );
    textField.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "Classic Cars" );

    Element dotField = new Element();
    dotField.setName( "dotField" );
    dotField.getStyle().setStyleProperty( TextStyleKeys.FONT, "Arial" );
    dotField.getStyle().setStyleProperty( TextStyleKeys.FONTSIZE, 14 );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.ALIGNMENT, ElementAlignment.RIGHT );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.VALIGNMENT, ElementAlignment.TOP );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.POS_X, 97f );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.POS_Y, 0f );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 628.463f );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 20f );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.WIDTH, 100f );
    dotField.getStyle().setStyleProperty( ElementStyleKeys.MAX_WIDTH, 100f );
    dotField.setElementType( LabelType.INSTANCE );
    dotField
        .setAttribute(
            AttributeNames.Core.NAMESPACE,
            AttributeNames.Core.VALUE,
            " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
                + " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
                + ". . . . . . . . . . . . . . . . . ." );

    Band band = new Band();
    band.setName( "outer-box" );
    band.setLayout( "inline" );
    band.getStyle().setStyleProperty( ElementStyleKeys.BOX_SIZING, BoxSizing.CONTENT_BOX );
    band.getStyle().setStyleProperty( ElementStyleKeys.OVERFLOW_X, false );
    band.getStyle().setStyleProperty( ElementStyleKeys.OVERFLOW_Y, false );
    band.getStyle().setStyleProperty( TextStyleKeys.LINEHEIGHT, 1f );
    band.getStyle().setStyleProperty( TextStyleKeys.WHITE_SPACE_COLLAPSE, WhitespaceCollapse.PRESERVE_BREAKS );
    band.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, 708f );
    band.getStyle().setStyleProperty( ElementStyleKeys.MIN_HEIGHT, 12f );
    band.getStyle().setStyleProperty( ElementStyleKeys.MAX_HEIGHT, 20f );
    band.addElement( textField );
    band.addElement( dotField );

    final MasterReport report = new MasterReport();
    report.getReportHeader().addElement( band );
    report.setCompatibilityLevel( null );
    report.getReportConfiguration()
        .setConfigProperty( ClassicEngineCoreModule.COMPLEX_TEXT_CONFIG_OVERRIDE_KEY, "true" );
    report.getStyle().setStyleProperty( TextStyleKeys.WORDBREAK, true );

    LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand( report, report.getReportHeader(), false, false );
    // ModelPrinter.INSTANCE.print(logicalPageBox);

    RenderBox outerBox = (RenderBox) MatchFactory.findElementByName( logicalPageBox, "outer-box" );
    assertNotNull( outerBox );

    assertEquals( 0, outerBox.getY() );

    // box only contains one line, and min-size is set to 8, max size = 20, so the line-height of 14.024 is used.
    assertTrue( outerBox.getHeight() >= StrictGeomUtility.toInternalValue( 16 ) );
    assertSame( outerBox.getFirstChild(), outerBox.getLastChild() );
    // no valid test.
    // assertEquals(outerBox.getHeight(), outerBox.getFirstChild().getHeight());
  }
 
Example 20
Source File: WizardProcessor.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected void configureRelationalGroupHeader( final RelationalGroup group,
                                               final GroupDefinition groupDefinition,
                                               final int index ) {
  final RootBandDefinition headerDefinition = groupDefinition.getHeader();
  if ( headerDefinition.isVisible() ) {
    final GroupHeader header = group.getHeader();
    final Boolean repeat = headerDefinition.getRepeat();
    if ( repeat != null ) {
      header.setRepeat( repeat.booleanValue() );
    }

    final Band content = AutoGeneratorUtility.findGeneratedContent( header );
    if ( content == null ) {
      return;
    }

    final Element headerLabelElement = new Element();
    headerLabelElement.setElementType( new LabelType() );
    if ( groupDefinition.getDisplayName() != null ) {
      headerLabelElement.setAttribute
        ( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, groupDefinition.getDisplayName() );
    } else {
      headerLabelElement.setAttribute
        ( AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, groupDefinition.getField() );
      headerLabelElement.setAttribute
        ( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, groupDefinition.getField() );
      headerLabelElement.setAttribute( AttributeNames.Wizard.NAMESPACE,
        AttributeNames.Wizard.ALLOW_METADATA_ATTRIBUTES, Boolean.TRUE );
    }

    final Element headerValueElement =
      AutoGeneratorUtility
        .generateDetailsElement( groupDefinition.getField(), computeElementType( groupDefinition ) );
    headerValueElement.setAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE, "-" );

    final Band headerElement = new Band();
    headerElement.getStyle().setStyleProperty( BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_INLINE );
    headerElement.getStyle().setStyleProperty( ElementStyleKeys.MIN_WIDTH, new Float( -100 ) );
    headerElement.getStyle().setStyleProperty( ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE );
    headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE,
      AttributeNames.Wizard.ALLOW_METADATA_STYLING, Boolean.TRUE );
    headerElement.setAttribute
      ( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, groupDefinition.getField() );
    headerElement.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.CACHED_WIZARD_FORMAT_DATA,
      headerDefinition );
    headerElement.addElement( headerLabelElement );
    headerElement.addElement( headerValueElement );
    content.clear();
    content.addElement( headerElement );
  }
}