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)");
}
Aggregations