Examples of Band


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

    {
      return;
    }

    final Watermark watermark = definition.getWatermark();
    final Band content = AutoGeneratorUtility.findGeneratedContent(watermark);
    if (content == null)
    {
      // there is already some content, and we are not allowed to override it.
      return;
    }

    content.clear();

    final Element watermarkImage = new Element();
    watermarkImage.setElementType(new ContentType());
    watermarkImage.setAttribute
        (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, watermarkDefinition.getSource());
    final ElementStyleSheet watermarkStyle = watermarkImage.getStyle();
    watermarkStyle.setStyleProperty(ElementStyleKeys.POS_X, convertLength(watermarkDefinition.getX()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.POS_Y, convertLength(watermarkDefinition.getY()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.MIN_WIDTH, convertLength(watermarkDefinition.getWidth()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.MIN_HEIGHT, convertLength(watermarkDefinition.getHeight()));
    watermarkStyle.setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, watermarkDefinition.getKeepAspectRatio());
    watermarkStyle.setStyleProperty(ElementStyleKeys.SCALE, watermarkDefinition.getScale());

    content.addElement(watermarkImage);
  }
View Full Code Here

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

    return report;
  }

  private void setupPageFooter(final MasterReport report)
  {
    final Band pageFooter = report.getPageFooter();
    pageFooter.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(65));

    // add a horizontal line to set off the page footer
    pageFooter.addElement(HorizontalLineElementFactory.createHorizontalLine(0, Color.BLACK, null));

    final PageOfPagesFunction pageNofM = new PageOfPagesFunction();
    pageNofM.setName("PAGE_N_OF_M");
    pageNofM.setFormat("Page {0} of {1}");
    report.addExpression(pageNofM);

    final TextFieldElementFactory tff = new TextFieldElementFactory();
    tff.setName("PageIndicator");
    tff.setAbsolutePosition(new Point2D.Double(X4 + C4_WIDTH - 60.0, 50.0));
    tff.setMinimumSize(new FloatDimension(60.0f, 15.0f));
    tff.setFontName("Serif");
    tff.setItalic(Boolean.TRUE);
    tff.setFontSize(new Integer(8));
    tff.setHorizontalAlignment(ElementAlignment.RIGHT);
    tff.setFieldname("PAGE_N_OF_M");
    pageFooter.addElement(tff.createElement());

    final LabelElementFactory labelFactory = new LabelElementFactory();
    labelFactory.setText("Copyright \u00A9 2004 Object Refinery Limited. All Rights Reserved.");
    labelFactory.setFontName("Serif");
    labelFactory.setItalic(Boolean.TRUE);
    labelFactory.setFontSize(new Integer(8));
    labelFactory.setAbsolutePosition(new Point2D.Double(X1, 50.0));
    labelFactory.setMinimumSize(new FloatDimension(444.0f, 15.0f));
    labelFactory.setHorizontalAlignment(ElementAlignment.LEFT);
    pageFooter.addElement(labelFactory.createElement());
  }
View Full Code Here

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

    pageFooter.addElement(labelFactory.createElement());
  }

  private void setupItemBand(final MasterReport report)
  {
    final Band band = report.getItemBand();
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(20));

    final ItemCountFunction icf = new ItemCountFunction();
    icf.setName("ITEM_COUNT");

    report.addExpression(icf);

    final TextFieldElementFactory factory2 = new TextFieldElementFactory();
    factory2.setFontName("Serif");
    factory2.setFontSize(new Integer(11));
    factory2.setBold(Boolean.FALSE);

    final NumberFieldElementFactory nf = new NumberFieldElementFactory();
    nf.setName("ItemNumberTextField");
    nf.setAbsolutePosition(new Point2D.Double(X1, 7.0));
    nf.setMinimumSize(new FloatDimension(25.0f, 16.0f));
    nf.setVerticalAlignment(ElementAlignment.TOP);
    nf.setFieldname("ITEM_COUNT");
    nf.setFormatString("#0'.'");
    band.addElement(nf.createElement());

    factory2.setName("ItemField");
    factory2.setAbsolutePosition(new Point2D.Double(X1 + 25.0, 7.0));
    factory2.setMinimumSize(new FloatDimension(C1_WIDTH - 25.0f, 16.0f));
    factory2.setDynamicHeight(Boolean.TRUE);
    factory2.setTrimTextContent(Boolean.TRUE);
    factory2.setFieldname("Item");
    band.addElement(factory2.createElement());

    final SurveyScaleExpression iaf1 = new SurveyScaleExpression(1, 5);
    iaf1.setName("Survey Response");
    iaf1.setField(0, "Your Response");
    iaf1.setField(1, "Average Response");

    report.addExpression(iaf1);

    final ContentFieldElementFactory f = new ContentFieldElementFactory();
    f.setFieldname("Survey Response");
    f.setMinimumSize(new FloatDimension(C2_WIDTH, 15.0f));
    f.setAbsolutePosition(new Point2D.Double(X2, 6.0));
    band.addElement(f.createElement());

    final NumberFieldElementFactory nfef = new NumberFieldElementFactory();
    nfef.setFontName("Serif");
    nfef.setFontSize(new Integer(11));
    nfef.setName("F1");
    nfef.setAbsolutePosition(new Point2D.Double(X3, 7.0));
    nfef.setMinimumSize(new FloatDimension(C3_WIDTH, 16.0f));
    nfef.setFieldname("Your Response");
    nfef.setFormatString("0.00");
    nfef.setHorizontalAlignment(ElementAlignment.CENTER);
    band.addElement(nfef.createElement());

    nfef.setName("F2");
    nfef.setAbsolutePosition(new Point2D.Double(X4, 7.0));
    nfef.setFieldname("Average Response");
    band.addElement(nfef.createElement());
  }
View Full Code Here

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

  }

  private void setupPageHeader(final MasterReport report)
  {
    // define the page header...
    final Band pageHeader = report.getPageHeader();
    pageHeader.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(20));

    // the main heading is just a fixed label centered on the page...
    final LabelElementFactory labelFactory = new LabelElementFactory();
    labelFactory.setText("Free / Open Source Software Survey");
    labelFactory.setFontName("SansSerif");
    labelFactory.setFontSize(new Integer(18));
    labelFactory.setBold(Boolean.TRUE);
    labelFactory.setAbsolutePosition(new Point2D.Double(X1, 10.0));
    labelFactory.setMinimumSize(new FloatDimension(C1_WIDTH + C2_WIDTH + C3_WIDTH + C4_WIDTH, 28.0f));
    labelFactory.setHorizontalAlignment(ElementAlignment.CENTER);
    pageHeader.addElement(labelFactory.createElement());

    // the following expression is used to format the manager name into a message string
    // that says 'Respondent:  <name>'.  The whole string can be centered on the page that way.
    // This expression expects to find a marked report property called 'MANAGER_NAME', look
    // in the attemptPreview() method to see how this is set up.

    // here is the element that displays the string calculated in the expression above.
    final MessageFieldElementFactory tfef = new MessageFieldElementFactory();
    tfef.setFormatString("Respondent: $(RESPONDENT_NAME)");
    tfef.setFontName("SansSerif");
    tfef.setFontSize(new Integer(12));
    tfef.setBold(Boolean.TRUE);
    tfef.setAbsolutePosition(new Point2D.Double(0.0, 38.0));
    tfef.setMinimumSize(new FloatDimension(PRINT_WIDTH, 14.0f));
    tfef.setHorizontalAlignment(ElementAlignment.CENTER);
    pageHeader.addElement(tfef.createElement());

    labelFactory.setAbsolutePosition(new Point2D.Double(X1, 58.0));
    labelFactory.setText(
        "Please note that the questions AND responses presented below were INVENTED for the the purpose of this demo report.  They are NOT real.");
    labelFactory.setFontName("Serif");
    labelFactory.setFontSize(new Integer(11));
    labelFactory.setBold(Boolean.FALSE);
    labelFactory.setItalic(Boolean.TRUE);
    pageHeader.addElement(labelFactory.createElement());

    // labels
    labelFactory.setFontName("SansSerif");
    labelFactory.setFontSize(new Integer(7));
    labelFactory.setItalic(Boolean.FALSE);
    labelFactory.setBold(Boolean.FALSE);
    labelFactory.setVerticalAlignment(ElementAlignment.BOTTOM);

    final float delta = C2_WIDTH / 5.0f;
    labelFactory.setText("Not Important");
    labelFactory.setAbsolutePosition(new Point2D.Double(X2, 70.0));
    labelFactory.setMinimumSize(new FloatDimension(delta, 30.0f));
    pageHeader.addElement(labelFactory.createElement());

    labelFactory.setText("Very Important");
    labelFactory.setAbsolutePosition(new Point2D.Double(X2 + 4 * delta, 70.0));
    labelFactory.setMinimumSize(new FloatDimension(delta, 30.0f));
    pageHeader.addElement(labelFactory.createElement());

    addBoxedLabelToBand(pageHeader, null, X1, BOX_TOP, C1_WIDTH, COLUMN_HEADER_BOX_HEIGHT,
        "SansSerif", 10, true, Color.black, new Color(220, 255, 220));
    addBoxedLabelToBand(pageHeader, null, X2, BOX_TOP, C2_WIDTH, COLUMN_HEADER_BOX_HEIGHT,
        "SansSerif", 10, true, Color.black, new Color(220, 255, 220));

    final SurveyScale scaleHeader = new SurveyScale(1, 5, null);
    scaleHeader.setDrawScaleValues(true);
    scaleHeader.setDrawTickMarks(false);
    scaleHeader.setScaleValueFont(new Font("SansSerif", Font.PLAIN, 9));
    report.getParameterValues().put("SCALE_HEADER", scaleHeader);

    final ContentFieldElementFactory dfef = new ContentFieldElementFactory();
    dfef.setName("ScaleHeaderElement");
    dfef.setAbsolutePosition(new Point2D.Double(X2, BOX_TOP));
    dfef.setFieldname("SCALE_HEADER");
    dfef.setMinimumSize(new FloatDimension(C2_WIDTH, COLUMN_HEADER_BOX_HEIGHT));
    pageHeader.addElement(dfef.createElement());

    addBoxedLabelToBand(pageHeader, "Your Response", X3, BOX_TOP, C3_WIDTH, COLUMN_HEADER_BOX_HEIGHT,
        "SansSerif", 8, false, Color.black, new Color(220, 255, 220));

    addBoxedLabelToBand(pageHeader, "Average Response", X3 + C3_WIDTH, BOX_TOP, C3_WIDTH, COLUMN_HEADER_BOX_HEIGHT,
View Full Code Here

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

  }

  private void setupWatermark(final MasterReport report)
  {
    // use a watermark to draw a frame around the page...
    final Band watermarkBand = report.getWatermark();
    final RectangleElementFactory sef = new RectangleElementFactory();
    sef.setMinimumSize(new FloatDimension(-100.0f, -100));
    sef.setColor(Color.black);
    sef.setStroke(new BasicStroke(1.0f));
    sef.setShouldDraw(Boolean.TRUE);
    sef.setScale(Boolean.TRUE);
    sef.setKeepAspectRatio(Boolean.FALSE);
    watermarkBand.addElement(sef.createElement());
  }
View Full Code Here

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

  }

  public void testElementClone()
          throws CloneNotSupportedException
  {
    final Band band = new Band();
    final Element e = new Element();
    band.addElement(e);
    assertNotNull(e.getParent());
    assertNotNull(e.getDataSource());
    assertNotNull(e.getStyle());
    assertNotNull(e.getName());
    assertTrue(e.isVisible());

    final Element clone = (Element) e.clone();
    assertNull(clone.getParent());
    assertNotNull(clone.getDataSource());
    assertNotNull(clone.getStyle());
    assertNotNull(clone.getName());
    assertTrue(clone.isVisible());

    final Band clonedBand = (Band) band.clone();
    assertNull(clonedBand.getParent());
    assertNotNull(clonedBand.getDataSource());
    assertNotNull(clonedBand.getStyle());
    assertNotNull(clonedBand.getName());
    assertTrue(clonedBand.isVisible());

    final Element clientElement = (Element) clonedBand.getElement(0);
    assertNotNull(clientElement.getParent());
    assertNotNull(clientElement.getDataSource());
    assertNotNull(clientElement.getStyle());
    assertNotNull(clientElement.getName());
    assertTrue(clientElement.isVisible());
    assertEquals(clonedBand, clientElement.getParent());

    clonedBand.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
    assertTrue(clientElement.isDynamicContent());
    assertFalse(e.isDynamicContent());
  }
View Full Code Here

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

    configureFunctions();
  }

  private void configureRecordGroup()
  {
    final Band b = new Band();
    b.setName("office");
    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("People in the same office:");
    b.addElement(labelFactory.createElement());

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

    final Element line = HorizontalLineElementFactory.createHorizontalLine(15);
    line.getStyle().setStyleProperty(ElementStyleKeys.STROKE, new BasicStroke(1));
    b.addElement(line);

    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("office");
    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("office.Name");
    textFieldFactory.setAbsolutePosition(new Point2D.Float(0, 0));
    textFieldFactory.setMinimumSize(new FloatDimension(200, 12));
    b.addElement(textFieldFactory.createElement());

    textFieldFactory = new TextFieldElementFactory();
    textFieldFactory.setFieldname("office.Annotations");
    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

  /**
   * Default Constructor that constructs generic bands.
   */
  public BandElementFactory()
  {
    this(new Band());
  }
View Full Code Here

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

    ClassicEngineBoot.getInstance().start();
  }

  public void testStyleInheritance()
  {
    final Band band = new Band();
    band.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.YELLOW);

    final Element element = new Element();
    band.addElement(element);

    assertNull(element.getStyle().getStyleProperty(ElementStyleKeys.BACKGROUND_COLOR));
    band.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.GREEN);
    assertNull(element.getStyle().getStyleProperty(ElementStyleKeys.BACKGROUND_COLOR));
  }
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.