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

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


    return table;
  }

  public static Band createCell(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);
    return tableCell;
  }
View Full Code Here


    return new EditGroupsUndoEntry(entries, changedEntries);
  }

  protected UndoEntry moveVisualElement(final AbstractReportDefinition report, final Element element)
  {
    final Band reportElement = element.getParent();
    if (reportElement != null == false)
    {
      return null;
    }

    if (element instanceof SubReport && reportElement instanceof AbstractRootLevelBand)
    {
      final AbstractRootLevelBand re = (AbstractRootLevelBand) reportElement;
      final int count = re.getSubReportCount() - 1;
      for (int i = 0; i < count; i++)
      {
        final SubReport sr = re.getSubReport(i);
        if (sr == element)
        {
          re.removeSubreport(sr);
          re.addSubReport(i + 1, sr);

          return new CompoundUndoEntry
              (new BandedSubreportEditUndoEntry(re.getObjectID(), i, sr, null),
                  new BandedSubreportEditUndoEntry(re.getObjectID(), i - 1, null, sr));
        }
      }
    }

    final int count = reportElement.getElementCount() - 1;
    for (int i = 0; i < count; i++)
    {
      final Element visualReportElement = reportElement.getElement(i);
      if (element == visualReportElement)
      {
        reportElement.removeElement(visualReportElement);
        reportElement.addElement(i + 1, visualReportElement);

        return new CompoundUndoEntry
            (new ElementEditUndoEntry(reportElement.getObjectID(), i, visualReportElement, null),
                new ElementEditUndoEntry(reportElement.getObjectID(), i + 1, null, visualReportElement));
      }
    }
    return null;
  }
View Full Code Here

  protected Element createElement(final ElementMetaData elementMetaData,
                                  final String fieldName,
                                  final ReportDocumentContext context) throws InstantiationException
  {
    final ElementType type = elementMetaData.create();
    final Element visualElement = new Band();
    type.configureDesignTimeDefaults(visualElement, Locale.getDefault());

    final ElementStyleSheet styleSheet = visualElement.getStyle();
    styleSheet.setStyleProperty(ElementStyleKeys.MIN_WIDTH, DEFAULT_WIDTH);
    styleSheet.setStyleProperty(ElementStyleKeys.MIN_HEIGHT, DEFAULT_HEIGHT);
    return visualElement;
  }
View Full Code Here

    return new EditGroupsUndoEntry(entries, changedEntries);
  }

  protected UndoEntry moveVisualElement(final AbstractReportDefinition report, final Element element)
  {
    final Band reportElement = element.getParent();
    if (reportElement == null)
    {
      return null;
    }

    if (element instanceof SubReport && reportElement instanceof AbstractRootLevelBand)
    {
      final AbstractRootLevelBand re = (AbstractRootLevelBand) reportElement;
      final int count = re.getSubReportCount() - 1;
      for (int i = 0; i < count; i++)
      {
        final SubReport sr = re.getSubReport(i);
        if (sr == element)
        {
          re.removeSubreport(sr);
          re.addSubReport(sr);

          return new CompoundUndoEntry
              (new BandedSubreportEditUndoEntry(re.getObjectID(), i, sr, null),
                  new BandedSubreportEditUndoEntry(re.getObjectID(), re.getElementCount() - 1, null, sr));
        }
      }
    }

    final int count = reportElement.getElementCount() - 1;
    for (int i = 0; i < count; i++)
    {
      final Element visualReportElement = reportElement.getElement(i);
      if (element == visualReportElement)
      {
        reportElement.removeElement(visualReportElement);
        reportElement.addElement(visualReportElement);

        return new CompoundUndoEntry
            (new ElementEditUndoEntry(reportElement.getObjectID(), i, visualReportElement, null),
                new ElementEditUndoEntry(reportElement.getObjectID(), reportElement.getElementCount() - 1, null, visualReportElement));
      }
    }
    return null;
  }
View Full Code Here

    this.newElement = newElement;
  }

  public void undo(final ReportDocumentContext renderContext)
  {
    final Band elementById = (Band)
        ModelUtility.findElementById(renderContext.getReportDefinition(), target);
    if (newElement != null)
    {
      elementById.removeElement(newElement);
    }
    if (oldElement != null)
    {
      elementById.addElement(position, oldElement);
    }
  }
View Full Code Here

    }
  }

  public void redo(final ReportDocumentContext renderContext)
  {
    final Band elementById = (Band)
        ModelUtility.findElementById(renderContext.getReportDefinition(), target);
    if (oldElement != null)
    {
      elementById.removeElement(oldElement);
    }
    if (newElement != null)
    {
      elementById.addElement(position, newElement);
    }
  }
View Full Code Here

    final int[][] layout = new int[][]{
        {200, 400},
        {400, 800}
    };

    final Band table = createTable(layout, 1);
    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(new MasterReport(), table);

    // TESTBUG: Test disabled for a few days, until we can deal with it properly
//    ModelPrinter.print(logicalPageBox);
//    assertWidth(layout, logicalPageBox);
View Full Code Here

    final int[][] layout = new int[][]{
        {300, 600},
        {200, 100}
    };

    final Band table = createTable(layout, 1);
    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(new MasterReport(), table);

    // TESTBUG: Test disabled for a few days, until we can deal with it properly
//    ModelPrinter.INSTANCE.print(logicalPageBox);
//    assertWidth(layout, logicalPageBox);
View Full Code Here

  }

  public void testFixedSizeTableCells() throws Exception
  {

    final Band tableCell1 = TableTestUtil.createCell(0, 0, 100, 20, TableTestUtil.createDataItem("Text", 100, 20));
    tableCell1.setAttribute(AttributeNames.Table.NAMESPACE, AttributeNames.Table.ROWSPAN, Integer.valueOf(2));
    final Band tableCell2 = TableTestUtil.createCell(0, 1, 100, 20, TableTestUtil.createDataItem("Text2", 100, 20));

    final Band tableRow = new Band();
    tableRow.setLayout(BandStyleKeys.LAYOUT_TABLE_ROW);
    tableRow.addElement(tableCell1);
    tableRow.addElement(tableCell2);

    final Band tableCell3 = TableTestUtil.createCell(1, 1, 100, 20, TableTestUtil.createDataItem("Text3", 100, 20));
    final Band tableRow2 = new Band();
    tableRow2.setLayout(BandStyleKeys.LAYOUT_TABLE_ROW);
    tableRow2.addElement(tableCell3);

    final Band tableSection = new Band();
    tableSection.setLayout(BandStyleKeys.LAYOUT_TABLE_BODY);
    tableSection.addElement(tableRow);
    tableSection.addElement(tableRow2);

    final MasterReport report = new MasterReport();
    report.getReportHeader().setLayout(BandStyleKeys.LAYOUT_TABLE);
    report.getReportHeader().addElement(tableSection);
View Full Code Here

  }

  public void testFixedSizeTableCellsRelativeSizeComplex() throws Exception
  {

    final Band tableCell1 = TableTestUtil.createCell(0, 0, 100, 10, TableTestUtil.createDataItem("Text", -100, -100));
    tableCell1.setAttribute(AttributeNames.Table.NAMESPACE, AttributeNames.Table.ROWSPAN, Integer.valueOf(2));
    final Band tableCell2 = TableTestUtil.createCell(0, 1, 100, 10, TableTestUtil.createDataItem("Text2", -100, -100));

    final Band tableRow = new Band();
    tableRow.setLayout(BandStyleKeys.LAYOUT_TABLE_ROW);
    tableRow.addElement(tableCell1);
    tableRow.addElement(tableCell2);

    final Band tableCell3 = TableTestUtil.createCell(1, 1, 100, 10, TableTestUtil.createDataItem("Text3", -100, -100));
    final Band tableRow2 = new Band();
    tableRow2.setLayout(BandStyleKeys.LAYOUT_TABLE_ROW);
    tableRow2.addElement(tableCell3);

    final Band tableSection = new Band();
    tableSection.setLayout(BandStyleKeys.LAYOUT_TABLE_BODY);
    tableSection.addElement(tableRow);
    tableSection.addElement(tableRow2);

    final MasterReport report = new MasterReport();
    report.getStyle().setStyleProperty(TextStyleKeys.WORDBREAK, true);
    report.getReportConfiguration().setConfigProperty(ClassicEngineCoreModule.COMPLEX_TEXT_CONFIG_OVERRIDE_KEY, "true");
    report.getReportHeader().setLayout(BandStyleKeys.LAYOUT_TABLE);
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.