Search in sources :

Example 1 with SwtTreeCol

use of org.pentaho.ui.xul.swt.tags.SwtTreeCol in project pentaho-kettle by pentaho.

the class XulPreviewRowsController method createPreviewRows.

private void createPreviewRows() {
    GetPreviewTableProgressDialog theProgressDialog = new GetPreviewTableProgressDialog(this.shell, this.databaseMeta, this.schema, this.table, this.limit);
    List<Object[]> thePreviewData = theProgressDialog.open();
    // Adds table rows.
    Object[] theObj = null;
    XulTreeRow theRow = null;
    Object theValue = null;
    SwtTreeCell theCell = null;
    int theRowCount = 0;
    XulTree thePreviewTable = (XulTree) super.document.getElementById("table_data");
    thePreviewTable.getRootChildren().removeAll();
    Iterator<Object[]> theItr = thePreviewData.iterator();
    while (theItr.hasNext()) {
        theObj = theItr.next();
        theRow = thePreviewTable.getRootChildren().addNewRow();
        theRowCount++;
        for (int i = 0; i < theObj.length; i++) {
            theValue = theObj[i];
            theCell = new SwtTreeCell(null);
            theCell.setLabel(theValue == null ? "" : theValue.toString());
            theRow.addCell(theCell);
        }
    }
    // Adds table columns.
    SwtTreeCol theColumn = null;
    String[] theFieldNames = theProgressDialog.getRowMeta().getFieldNames();
    SwtTreeCols theColumns = new SwtTreeCols(null, thePreviewTable, null, null);
    for (int i = 0; i < theFieldNames.length; i++) {
        theColumn = new SwtTreeCol(null, null, null, null);
        theColumn.setWidth(100);
        theColumn.setLabel(theFieldNames[i]);
        theColumns.addColumn(theColumn);
    }
    thePreviewTable.setColumns(theColumns);
    thePreviewTable.update();
    setRowCount("Rows of step: " + this.table + " (" + theRowCount + " rows)");
}
Also used : XulTree(org.pentaho.ui.xul.containers.XulTree) SwtTreeCol(org.pentaho.ui.xul.swt.tags.SwtTreeCol) SwtTreeCell(org.pentaho.ui.xul.swt.tags.SwtTreeCell) XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow) SwtTreeCols(org.pentaho.ui.xul.swt.tags.SwtTreeCols)

Aggregations

XulTree (org.pentaho.ui.xul.containers.XulTree)1 XulTreeRow (org.pentaho.ui.xul.containers.XulTreeRow)1 SwtTreeCell (org.pentaho.ui.xul.swt.tags.SwtTreeCell)1 SwtTreeCol (org.pentaho.ui.xul.swt.tags.SwtTreeCol)1 SwtTreeCols (org.pentaho.ui.xul.swt.tags.SwtTreeCols)1