Examples of Band


Examples of org.pentaho.reporting.engine.classic.core.Band

    b.toString();
  }

  public void testAddElement()
  {
    final Band b = new Band();
    assertTrue(b.getElementCount() == 0);
    b.addElement(0, new Element());
    assertTrue(b.getElementCount() == 1);
    b.addElement(new Element());
    assertTrue(b.getElementCount() == 2);
    b.addElement(0, new Element());
    assertTrue(b.getElementCount() == 3);
    b.addElement(2, new Element());
    assertTrue(b.getElementCount() == 4);
    try
    {
      b.addElement(5, new Element());
      fail();
    }
    catch (IllegalArgumentException iob)
    {
      // expected, ignored
    }
    try
    {
      b.addElement(null);
      fail();
    }
    catch (NullPointerException npe)
    {
      // expected, ignored
    }
    try
    {
      b.addElement(b);
      fail();
    }
    catch (IllegalArgumentException ia)
    {
      // expected, ignored
    }

    try
    {
      final Band b1 = new Band();
      final Band b2 = new Band();
      final Band b3 = new Band();
      b1.addElement(b2);
      b2.addElement(b3);
      b3.addElement(b1);
      fail();
    }
    catch (IllegalArgumentException ia)
    {
      // expected, ignored
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

  }

  public void testSerialize() throws Exception
  {
    final Band e = new Band();
    final ByteArrayOutputStream bo = new ByteArrayOutputStream();
    final ObjectOutputStream out = new ObjectOutputStream(bo);
    out.writeObject(e);

    final ObjectInputStream oin = new ObjectInputStream(new ByteArrayInputStream(bo.toByteArray()));
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

  }


  public static Band findGeneratedContent(final Band band)
  {
    final Band generatedContentInternal = findGeneratedContentInternal(band);
    if (generatedContentInternal != null)
    {
      generatedContentInternal.clear();
      return generatedContentInternal;
    }

    if (band.getElementCount() == 0)
    {
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

    for (int i = 0; i < elements.length; i++)
    {
      final Element element = elements[i];
      if (element instanceof Band)
      {
        final Band retval = findGeneratedContentInternal((Band) element);
        if (retval != null)
        {
          return retval;
        }
      }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

    super(s);
  }

  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"));
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

    configureFunctions();
  }

  private void configureRecordGroup()
  {
    final Band b = new Band();
    b.setName("lunch");
    b.getStyle().setStyleProperty(TextStyleKeys.BOLD, Boolean.TRUE);
    b.getStyle().setStyleProperty(TextStyleKeys.FONT, "SansSerif");
    b.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, new Integer(12));

    LabelElementFactory labelFactory = new LabelElementFactory();
    labelFactory.setAbsolutePosition(new Point2D.Float(0, 0));
    labelFactory.setMinimumSize(new FloatDimension(200, 15));
    labelFactory.setText("Preferred Lunch Meals");
    b.addElement(labelFactory.createElement());

    labelFactory = new LabelElementFactory();
    labelFactory.setAbsolutePosition(new Point2D.Float(200, 0));
    labelFactory.setMinimumSize(new FloatDimension(-100, 15));
    labelFactory.setText("Rating");
    b.addElement(labelFactory.createElement());

    b.addElement(HorizontalLineElementFactory.createHorizontalLine
        (15, null, new BasicStroke(1)));

    final Group group = report.getGroupByName("record-group");
    group.getHeader().addElement(b);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

    group.getHeader().addElement(b);
  }

  private void configureItemBand()
  {
    final Band b = new Band();
    b.setName("lunch");
    b.getStyle().setStyleProperty(TextStyleKeys.BOLD, Boolean.FALSE);
    b.getStyle().setStyleProperty(TextStyleKeys.FONT, "SansSerif");
    b.getStyle().setStyleProperty(TextStyleKeys.FONTSIZE, new Integer(10));

    TextFieldElementFactory textFieldFactory = new TextFieldElementFactory();
    textFieldFactory.setFieldname("lunch.Meal");
    textFieldFactory.setAbsolutePosition(new Point2D.Float(0, 0));
    textFieldFactory.setMinimumSize(new FloatDimension(200, 12));
    b.addElement(textFieldFactory.createElement());

    textFieldFactory = new TextFieldElementFactory();
    textFieldFactory.setFieldname("lunch.Rating");
    textFieldFactory.setAbsolutePosition(new Point2D.Float(200, 0));
    textFieldFactory.setMinimumSize(new FloatDimension(-100, 12));
    textFieldFactory.setDynamicHeight(Boolean.TRUE);
    b.addElement(textFieldFactory.createElement());

    report.getItemBand().addElement(b);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

  protected void generate(final AbstractReportDefinition definition,
                          final DefaultFlowController flowController)
      throws ReportProcessingException
  {
    final Band details = AutoGeneratorUtility.findGeneratedContent(definition.getItemBand());
    final Band header = AutoGeneratorUtility.findGeneratedContent(definition.getDetailsHeader());
    final Band footer = AutoGeneratorUtility.findGeneratedContent(definition.getDetailsFooter());

    final ProcessingContext reportContext = flowController.getReportContext();
    final DefaultDataAttributeContext dac = new DefaultDataAttributeContext
        (reportContext.getOutputProcessorMetaData(), reportContext.getResourceBundleFactory().getLocale());

    final DataRow dataRow = flowController.getMasterRow().getGlobalView();
    final DataSchema dataSchema = flowController.getMasterRow().getDataSchema();

    // final Locale locale = reportContext.getResourceBundleFactory().getLocale();
    final AutoGeneratorFieldDescription[] fieldDescriptions = computeFields(dataRow, dataSchema, dac);

    if (fieldDescriptions == null || fieldDescriptions.length == 0)
    {
      // there are no fields, so what's the point of continuing ..
      return;
    }

    if (details != null)
    {
      details.clear();
      details.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "row");
    }
    if (header != null)
    {
      header.clear();
      header.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "row");
    }
    if (footer != null)
    {
      footer.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "row");
      footer.clear();
    }

    final float[] widths = computeFieldWidths(fieldDescriptions, definition.getPageDefinition().getWidth());
    for (int i = 0; i < fieldDescriptions.length; i++)
    {
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

    if (repeat != null)
    {
      footer.setRepeat(repeat.booleanValue());
    }

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

    final Class aggFunctionClass = groupDefinition.getAggregationFunction();
    final Element footerValueElement = AutoGeneratorUtility.generateFooterElement
        (aggFunctionClass, computeElementType(groupDefinition),
            groupDefinition.getGroupName(), groupDefinition.getField());

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

    final Band footerElement = new Band();
    footerElement.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "inline");
    footerElement.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(-100));
    footerElement.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
    footerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ALLOW_METADATA_STYLING,
        Boolean.TRUE);
    footerElement.setAttribute
        (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, groupDefinition.getField());
    footerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFormatData", footerDefinition);
    footerElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFieldData", groupDefinition);
    footerElement.addElement(footerLabelElement);
    footerElement.addElement(footerValueElement);

    content.clear();
    content.addElement(footerElement);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.Band

    if (repeat != null)
    {
      footer.setRepeat(repeat.booleanValue());
    }

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

    final Class aggFunctionClass = groupDefinition.getAggregationFunction();
    final Element footerValueElement = AutoGeneratorUtility.generateFooterElement
        (aggFunctionClass, computeElementType(groupDefinition),
            groupDefinition.getGroupName(), groupDefinition.getField());
    footerValueElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFormatData", footer);
    footerValueElement.setAttribute(AttributeNames.Wizard.NAMESPACE, "CachedWizardFieldData", groupDefinition);

    content.clear();
    content.addElement(footerValueElement);

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.