Search in sources :

Example 6 with XulTree

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

Example 7 with XulTree

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);
}
Also used : UIRepositoryDirectory(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectory) Binding(org.pentaho.ui.xul.binding.Binding) XulTree(org.pentaho.ui.xul.containers.XulTree) Document(org.pentaho.ui.xul.dom.Document) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) Before(org.junit.Before)

Example 8 with XulTree

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");
}
Also used : XulDeck(org.pentaho.ui.xul.containers.XulDeck) XulTree(org.pentaho.ui.xul.containers.XulTree)

Example 9 with XulTree

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();
}
Also used : XulTreeItem(org.pentaho.ui.xul.containers.XulTreeItem) XulTreeCell(org.pentaho.ui.xul.components.XulTreeCell) XulTree(org.pentaho.ui.xul.containers.XulTree) XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow) XulComponent(org.pentaho.ui.xul.XulComponent) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Example 10 with XulTree

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();
}
Also used : XulTreeItem(org.pentaho.ui.xul.containers.XulTreeItem) XulTreeCell(org.pentaho.ui.xul.components.XulTreeCell) XulTree(org.pentaho.ui.xul.containers.XulTree) XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow) XulComponent(org.pentaho.ui.xul.XulComponent) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Aggregations

XulTree (org.pentaho.ui.xul.containers.XulTree)11 XulTreeRow (org.pentaho.ui.xul.containers.XulTreeRow)3 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)2 XulComponent (org.pentaho.ui.xul.XulComponent)2 XulTreeCell (org.pentaho.ui.xul.components.XulTreeCell)2 XulTreeItem (org.pentaho.ui.xul.containers.XulTreeItem)2 Bindable (org.pentaho.ui.xul.stereotype.Bindable)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 MissingResourceException (java.util.MissingResourceException)1 Vector (java.util.Vector)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Composite (org.eclipse.swt.widgets.Composite)1 Before (org.junit.Before)1 ExtTextbox (org.pentaho.di.ui.core.database.dialog.tags.ExtTextbox)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1 ComboVar (org.pentaho.di.ui.core.widget.ComboVar)1