use of org.pentaho.ui.xul.containers.XulTree 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)");
}
use of org.pentaho.ui.xul.containers.XulTree in project pentaho-kettle by pentaho.
the class BrowseControllerTest method setUp.
@Before
public void setUp() throws Exception {
DocumentFactory.registerElementClass(ElementDom4J.class);
controller = new BrowseController();
controller.setRepositoryDirectory(mock(UIRepositoryDirectory.class));
directoryMap = new HashMap<>(8);
controller.setDirMap(directoryMap);
document = mock(Document.class);
XulDomContainer xulDomContainer = mock(XulDomContainer.class);
when(xulDomContainer.getDocumentRoot()).thenReturn(document);
controller.setXulDomContainer(xulDomContainer);
UIRepositoryDirectory someDirectory = mock(UIRepositoryDirectory.class);
selectedFolder = mock(UIRepositoryDirectory.class);
when(selectedFolder.createFolder(FOLDER_NAME)).thenReturn(someDirectory);
XulTree folderTree = mock(XulTree.class);
when(folderTree.getSelectedItems()).thenReturn(Collections.<Object>singleton(selectedFolder));
controller.setFolderTree(folderTree);
directoryBinding = mock(Binding.class);
controller.setDirectoryBinding(directoryBinding);
selectedItemsBinding = mock(Binding.class);
controller.setSelectedItemsBinding(selectedItemsBinding);
}
use of org.pentaho.ui.xul.containers.XulTree in project pentaho-kettle by pentaho.
the class TrashBrowseController method selectDeletedFileTable.
private XulTree selectDeletedFileTable(boolean isAdmin) {
XulDeck treeDeck = (XulDeck) document.getElementById("tree-deck");
treeDeck.setSelectedIndex(isAdmin ? 1 : 0);
return (XulTree) document.getElementById(isAdmin ? "deleted-file-table-admin" : "deleted-file-table");
}
use of org.pentaho.ui.xul.containers.XulTree in project data-access by pentaho.
the class StageDataStep method deselectAll.
@Bindable
public void deselectAll() {
// $NON-NLS-1$
XulTree tree = (XulTree) document.getElementById("csvModelDataTable");
for (XulComponent component : tree.getRootChildren().getChildNodes()) {
XulTreeItem item = (XulTreeItem) component;
for (XulComponent childComp : item.getChildNodes()) {
XulTreeRow row = (XulTreeRow) childComp;
XulTreeCell cell = row.getCell(0);
cell.setValue(false);
}
}
datasourceModel.getModelInfo().validate();
}
use of org.pentaho.ui.xul.containers.XulTree in project data-access by pentaho.
the class StageDataStep method selectAll.
@Bindable
public void selectAll() {
// $NON-NLS-1$
XulTree tree = (XulTree) document.getElementById("csvModelDataTable");
for (XulComponent component : tree.getRootChildren().getChildNodes()) {
XulTreeItem item = (XulTreeItem) component;
for (XulComponent childComp : item.getChildNodes()) {
XulTreeRow row = (XulTreeRow) childComp;
XulTreeCell cell = row.getCell(0);
cell.setValue(true);
}
}
datasourceModel.getModelInfo().validate();
}
Aggregations