Package org.eclipse.birt.report.model.api

Examples of org.eclipse.birt.report.model.api.CellHandle


      RowHandle row = (RowHandle) grid.getRows().get(0);

      // Create a label and add it to the first cell.
      LabelHandle label = efactory.newLabel("Hello, world!");
      label.setText("Hello, World!");
      CellHandle cell = (CellHandle) row.getCells().get(0);
      cell.getContent().add(label);

      // save the report design
      design.saveAs("c:/TEMP/sample.rptdesign");
      design.close();
      System.out.println("Finished");
View Full Code Here


      throws SemanticException {
    TableHandle table = reportDesignHandle.getElementFactory().newTableItem(name, columnNum, headerRow, detailRow, footerRow);

    RowHandle myHeader = (RowHandle) table.getHeader().get(0);
    for (int i = 0; i < myHeader.getCells().getCount(); i++) {
      CellHandle cell = (CellHandle) myHeader.getCells().get(i);
      LabelHandle label = createLabel("Column " + i);
      cell.getContent().add(label);
      if (border) {
        setBorders(cell);
      }
    }

    for (int i = 0; i < table.getDetail().getCount(); i++) {
      RowHandle myDetail = (RowHandle) table.getDetail().get(i);
      for (int j = 0; j < myDetail.getCells().getCount(); j++) {
        CellHandle cell = (CellHandle) myDetail.getCells().get(j);
        LabelHandle label = createLabel("Cell " + i + ":" + j);
        cell.getContent().add(label);
        if (border) {
          setBorders(cell);
        }
      }
    }
View Full Code Here

    GridHandle grid = createGrid(name, columnNum, rowNum);

    RowHandle headerRow = (RowHandle) grid.getRows().get(0);

    for (int i = 0; i < headerRow.getCells().getCount(); i++) {
      CellHandle cell = (CellHandle) headerRow.getCells().get(i);
      if (border) {
        setBorders(cell);
      }
      LabelHandle label = createLabel("Column " + i);
      cell.getContent().add(label);
    }

    RowHandle detailRow = null;
    for (int i = 0; i < rowNum; i++) {
      detailRow = createRow(columnNum);
      for (int j = 0; j < grid.getColumnCount(); j++) {
        CellHandle cell = (CellHandle) detailRow.getCells().get(j);
        if (border) {
          setBorders(cell);
        }
        LabelHandle label = createLabel("Cell " + i + ":" + j);
        cell.getContent().add(label);
      }
      grid.getElement().add(detailRow.getElement(), GridItem.ROW_SLOT);
    }

    return grid;
View Full Code Here

    int columnNum = grid.getColumnCount();
    RowHandle row = reportDesignHandle.getElementFactory().newTableRow(columnNum);

    if (border) {
      for (int i = 0; i < columnNum; i++) {
        CellHandle cell = (CellHandle) row.getCells().get(i);
        setBorders(cell);
      }
    }

    DesignElement deRow = row.getElement();
View Full Code Here

    computedSet.addItem(cs3);

    // Header
    RowHandle myheader = (RowHandle) mytable.getHeader().get(0);

    CellHandle tcell = (CellHandle) myheader.getCells().get(0);
    setBorders(tcell);
    LabelHandle mylabel = elementFactory.newLabel(null);
    mylabel.setText("Col1");
    tcell.getContent().add(mylabel);

    tcell = (CellHandle) myheader.getCells().get(1);
    setBorders(tcell);
    // tcell.setProperty(propName, value);
    mylabel = elementFactory.newLabel(null);
    mylabel.setText("Col2");
    tcell.getContent().add(mylabel);

    tcell = (CellHandle) myheader.getCells().get(2);
    setBorders(tcell);
    mylabel = elementFactory.newLabel(null);
    mylabel.setText("Col3");
    tcell.getContent().add(mylabel);

    RowHandle mydetail = (RowHandle) mytable.getDetail().get(0);
    tcell = (CellHandle) mydetail.getCells().get(0);
    setBorders(tcell);
    DataItemHandle mydata = elementFactory.newDataItem(null);
    mydata.setResultSetColumn("Month");
    tcell.getContent().add(mydata);

    tcell = (CellHandle) mydetail.getCells().get(1);
    mydata = elementFactory.newDataItem(null);
    mydata.setResultSetColumn("Product");
    tcell.getContent().add(mydata);

    CellHandle lastCell = (CellHandle) mydetail.getCells().get(2);
    lastCell.drop();
    tcell.setColumnSpan(2);
    setBorders(tcell);

    mytable.getColumns().get(0).setProperty("width", "45%");
    mytable.getColumns().get(1).setProperty("width", "45%");
View Full Code Here

    // System.out.println("colCount2 = " + colCount2);

    // create label for cell in row 1 / column 0
    LabelHandle lblHandle = elementFactory.newLabel(null);
    lblHandle.setText("Cell x:x");
    CellHandle cell = gridHandle.getCell(1, 0);
    cell.getContent().add(lblHandle);

    // ############# create column
    ColumnHandle column = reportDesignHandle.getElementFactory().newTableColumn();
    DesignElement deColumn = column.getElement();
    gridHandle.getElement().add(deColumn, GridItem.COLUMN_SLOT);

    int rowCount3 = gridHandle.getRows().getCount(); // = 2
    int colCount3 = gridHandle.getColumns().getCount(); // = 2

    // create label for cell in row 0 / column 1
    LabelHandle lblHandle2 = elementFactory.newLabel(null);
    lblHandle.setText("Cell y:y");
    // this.setStyle(lblHandle2, "borderSolidThin");
    CellHandle cell2 = gridHandle.getCell(0, 1);
    cell2.getContent().add(lblHandle2);
    System.out.println("Finished");
  }
View Full Code Here

  }

  public static void test06() throws Exception {
    GridHandle gridHandle = (GridHandle) reportDesignHandle.findElement("myGrid5");
    TableHandle table = createTable(30);
    CellHandle cell2 = gridHandle.getCell(0, 1);
    cell2.getContent().add(table);
    System.out.println("Finished");
  }
View Full Code Here

          // add new data item and cell
          DataItemHandle data = reportDesign.getElementFactory()
              .newDataItem(columnName);
          data.setResultSetColumn(columnName);
          CellHandle cell = (CellHandle) detailRow.getCells().get(x);
          cell.getContent().add(data);
          x++; // advance position
        }

        // add the table to my report
        reportDesign.getBody().add(reportTable);
View Full Code Here

      RowHandle tableheader = (RowHandle) table.getHeader().get(0);

      for( int i = 0 ; i < cols.size() ; i++ ) {
        LabelHandle label1 = designFactory.newLabel((String) cols.get(i));
        label1.setText((String) cols.get(i));
        CellHandle cell = (CellHandle) tableheader.getCells().get(i);
        cell.getContent().add(label1);
      }

      // table detail
      RowHandle tabledetail = (RowHandle) table.getDetail().get(0);

      for( int i = 0 ; i < cols.size() ; i++ ) {
        CellHandle cell = (CellHandle) tabledetail.getCells().get(i);
        DataItemHandle data = designFactory.newDataItem("data_" + (String) cols.get(i));
        data.setResultSetColumn((String) cols.get(i));
        cell.getContent().add(data);
      }

      designHandle.getBody().add(table);

      // Save the design and close it.
View Full Code Here

    computedSet.addItem(cs5);

    // Header
    RowHandle header = (RowHandle) table.getHeader().get(0);

    CellHandle tcell = (CellHandle) header.getCells().get(0);
    tcell.getWidth().setStringValue("3in");
    LabelHandle label = elementFactory.newLabel(null);
    label.setText("Order");//$NON-NLS-1$
    tcell.getContent().add(label);

    tcell = (CellHandle) header.getCells().get(1);
    label = elementFactory.newLabel(null);
    label.setText("Product");//$NON-NLS-1$
    tcell.getContent().add(label);

    tcell = (CellHandle) header.getCells().get(2);
    label = elementFactory.newLabel(null);
    label.setText("Amount");//$NON-NLS-1$
    tcell.getContent().add(label);

    // Table Group
    TableGroupHandle group = elementFactory.newTableGroup();
    group.setName("MyGroup");
    group.setKeyExpr("dataSetRow[\"ORDERNUMBER\"]");
    group.setInterval("none");
    group.setSortDirection("asc");

    table.getGroups().add(group);

    RowHandle groupHeader = elementFactory.newTableRow(3);
    tcell = (CellHandle) groupHeader.getCells().get(0);
    DataItemHandle data = elementFactory.newDataItem(null);

    data.setResultSetColumn(cs1.getName());
    tcell.getContent().add(data);
    group.getHeader().add(groupHeader);

    RowHandle groupFooter = elementFactory.newTableRow(3);
    tcell = (CellHandle) groupFooter.getCells().get(2);
    data = elementFactory.newDataItem(null);
    data.setResultSetColumn(cs5.getName());
    tcell.getContent().add(data);

    group.getFooter().add(groupFooter);
    RowHandle detail = (RowHandle) table.getDetail().get(0);
    data = elementFactory.newDataItem(null);

    tcell = (CellHandle) detail.getCells().get(1);
    data = elementFactory.newDataItem(null);
    data.setResultSetColumn(cs2.getName());
    tcell.getContent().add(data);

    tcell = (CellHandle) detail.getCells().get(2);
    data = elementFactory.newDataItem(null);
    data.setResultSetColumn(cs3.getName());
    tcell.getContent().add(data);

    RowHandle footer = (RowHandle) table.getFooter().get(0);
    tcell = (CellHandle) footer.getCells().get(2);
    data = elementFactory.newDataItem(null);
    data.setResultSetColumn(cs4.getName());
    tcell.getContent().add(data);

    reportDesignHandle.getBody().add(table);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.birt.report.model.api.CellHandle

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.