Package org.pentaho.reporting.engine.classic.core

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


   * @return the created band
   */
  private Band createBand(final String name, final Color color,
                          final int x, final int y, final int width, final int height)
  {
    final Band band = new Band();
    band.setName("Band-" + name);
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(width));
    band.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(height));
    band.getStyle().setStyleProperty(ElementStyleKeys.MAX_WIDTH, new Float(width));
    band.getStyle().setStyleProperty(ElementStyleKeys.MAX_HEIGHT, new Float(height));

    band.getStyle().setStyleProperty(ElementStyleKeys.POS_X, new Float(x));
    band.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, new Float(y));

    // create the marker shape, the shape fills the generated band and paints the colored background
    // all coordinates or dimensions are within the band, and not affected by the bands placement in
    // the outer report bands
    band.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, color);
    return band;
  }
View Full Code Here


   *
   * @return the created report.
   */
  public MasterReport createReport()
  {
    final Band levelA1 = createBand("A1", Color.magenta, 0, 0, 100, 100);
    levelA1.addElement(createBand("A1-B1", Color.blue, 0, 50, 50, 50));
    levelA1.addElement(createBand("A1-B2", Color.yellow, 50, 0, 150, 50));
    // x=55%, y=5%, width=40%, height=100%
    final Band levelA2 = createBand("A2", Color.green, -50, 0, -50, -100);
    // x=5%, y=55%, width=40%, height=40%
    levelA2.addElement(createBand("A2-B1", Color.red, 0, -50, -50, -50));
    // x=55%, y=5%, width=40%, height=40%
    levelA2.addElement(createBand("A2-B2", Color.darkGray, -55, -5, -40, -40));

    final ReportHeader header = new ReportHeader();
    header.setName("Report-Header");
    header.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, new Float(-100));
    header.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, new Float(100));
View Full Code Here

    super(s);
  }

  public void testBandCreate()
  {
    final Band b = new Band();
    assertNotNull(b.getDataSource());
    assertNotNull(b.getStyle());
    assertNotNull(b.getName());
    assertTrue(b.isVisible());
    assertNull(b.getParent());
    assertNotNull(b.getElementArray());
    assertTrue(b.getElementCount() == 0);
//    assertNotNull(b.getElements());
  }
View Full Code Here

//    assertNotNull(b.getElements());
  }

  public void testBandMethods()
  {
    final Band b = new Band();
    assertTrue(b.isVisible());
    b.setVisible(false);
    assertTrue(b.isVisible() == false);
    b.setVisible(true);
    assertTrue(b.isVisible());

    try
    {
      b.setDataSource(null);
      fail();
    }
    catch (NullPointerException npe)
    {
      // expected, ignored
    }

    b.toString();
  }
View Full Code Here

    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

  }

  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

  }


  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

    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

    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

    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

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.Band

Copyright © 2018 www.massapicom. 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.