Search in sources :

Example 1 with XulTreeRow

use of org.pentaho.ui.xul.containers.XulTreeRow in project pentaho-kettle by pentaho.

the class DataHandler method setDefaultPoolParameters.

private void setDefaultPoolParameters() {
    if (poolParameterTree != null) {
        for (DatabaseConnectionPoolParameter parameter : BaseDatabaseMeta.poolingParameters) {
            XulTreeRow row = poolParameterTree.getRootChildren().addNewRow();
            row.addCellText(0, "false");
            row.addCellText(1, parameter.getParameter());
            row.addCellText(2, parameter.getDefaultValue());
        }
    }
}
Also used : DatabaseConnectionPoolParameter(org.pentaho.di.core.database.DatabaseConnectionPoolParameter) XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow)

Example 2 with XulTreeRow

use of org.pentaho.ui.xul.containers.XulTreeRow in project pentaho-kettle by pentaho.

the class DataHandler method editOptions.

public void editOptions(int index) {
    if (index + 1 == optionsParameterTree.getRows()) {
        // editing last row add a new one below
        Object[][] values = optionsParameterTree.getValues();
        Object[] row = values[values.length - 1];
        if (row != null && (!StringUtils.isEmpty((String) row[0]) || !StringUtils.isEmpty((String) row[1]))) {
            // acutally have something in current last row
            XulTreeRow newRow = optionsParameterTree.getRootChildren().addNewRow();
            newRow.addCellText(0, "");
            newRow.addCellText(1, "");
        }
    }
}
Also used : XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow)

Example 3 with XulTreeRow

use of org.pentaho.ui.xul.containers.XulTreeRow in project pentaho-kettle by pentaho.

the class DataHandler method setClusterData.

private void setClusterData(PartitionDatabaseMeta[] clusterInformation) {
    if (clusterParameterTree == null) {
        // there's nothing to do
        return;
    }
    clusterParameterTree.getRootChildren().removeAll();
    if ((clusterInformation != null) && (clusterParameterTree != null)) {
        for (int i = 0; i < clusterInformation.length; i++) {
            PartitionDatabaseMeta meta = clusterInformation[i];
            XulTreeRow row = clusterParameterTree.getRootChildren().addNewRow();
            row.addCellText(0, Const.NVL(meta.getPartitionId(), ""));
            row.addCellText(1, Const.NVL(meta.getHostname(), ""));
            row.addCellText(2, Const.NVL(meta.getPort(), ""));
            row.addCellText(3, Const.NVL(meta.getDatabaseName(), ""));
            row.addCellText(4, Const.NVL(meta.getUsername(), ""));
            row.addCellText(5, Const.NVL(meta.getPassword(), ""));
        }
    }
    // Add 5 blank rows if none are already there, otherwise, just add one.
    int numToAdd = 5;
    /*
     * if(clusterInformation != null && clusterInformation.length > 0){ numToAdd = 1; }
     */
    while (numToAdd-- > 0) {
        XulTreeRow row = clusterParameterTree.getRootChildren().addNewRow();
        // easy way of putting new cells in the row
        row.addCellText(0, "");
        row.addCellText(1, "");
        row.addCellText(2, "");
        row.addCellText(3, "");
        row.addCellText(4, "");
        row.addCellText(5, "");
    }
}
Also used : PartitionDatabaseMeta(org.pentaho.di.core.database.PartitionDatabaseMeta) XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow)

Example 4 with XulTreeRow

use of org.pentaho.ui.xul.containers.XulTreeRow in project pentaho-kettle by pentaho.

the class DataHandler method poolingRowChange.

public void poolingRowChange(int idx) {
    if (idx != -1) {
        if (idx >= BaseDatabaseMeta.poolingParameters.length) {
            idx = BaseDatabaseMeta.poolingParameters.length - 1;
        }
        if (idx < 0) {
            idx = 0;
        }
        poolingDescription.setValue(BaseDatabaseMeta.poolingParameters[idx].getDescription());
        XulTreeRow row = poolParameterTree.getRootChildren().getItem(idx).getRow();
        if (row.getSelectedColumnIndex() == 2) {
            row.addCellText(0, "true");
        }
    }
}
Also used : XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow)

Example 5 with XulTreeRow

use of org.pentaho.ui.xul.containers.XulTreeRow in project pentaho-kettle by pentaho.

the class DataHandler method setOptionsData.

private void setOptionsData(Map<String, String> extraOptions) {
    if (optionsParameterTree == null) {
        return;
    }
    if (extraOptions != null) {
        removeTypedOptions(extraOptions);
        Iterator<String> keys = extraOptions.keySet().iterator();
        Object connection = connectionBox.getSelectedItem();
        String currentType = null;
        if (connection != null) {
            currentType = connectionMap.get(connection.toString()).getPluginId();
        }
        while (keys.hasNext()) {
            String parameter = keys.next();
            String value = extraOptions.get(parameter);
            if ((value == null) || (value.trim().length() <= 0) || (value.equals(DatabaseMeta.EMPTY_OPTIONS_STRING))) {
                value = "";
            }
            // If the parameter starts with a database type code we show it in the options, otherwise we don't.
            // For example MySQL.defaultFetchSize
            // 
            int dotIndex = parameter.indexOf('.');
            if (dotIndex >= 0) {
                String parameterOption = parameter.substring(dotIndex + 1);
                String databaseTypeString = parameter.substring(0, dotIndex);
                String databaseType = databaseTypeString;
                if (currentType != null && currentType.equals(databaseType)) {
                    XulTreeRow row = optionsParameterTree.getRootChildren().addNewRow();
                    row.addCellText(0, parameterOption);
                    row.addCellText(1, value);
                }
            }
        }
    }
    // Have at least 5 option rows, with at least one blank
    int numToAdd = 15;
    int numSet = optionsParameterTree.getRootChildren().getItemCount();
    if (numSet < numToAdd) {
        numToAdd -= numSet;
    } else {
        numToAdd = 1;
    }
    while (numToAdd-- > 0) {
        XulTreeRow row = optionsParameterTree.getRootChildren().addNewRow();
        // easy way of putting new cells in the row
        row.addCellText(0, "");
        row.addCellText(1, "");
    }
}
Also used : XulTreeRow(org.pentaho.ui.xul.containers.XulTreeRow)

Aggregations

XulTreeRow (org.pentaho.ui.xul.containers.XulTreeRow)9 XulTree (org.pentaho.ui.xul.containers.XulTree)3 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 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 Shell (org.eclipse.swt.widgets.Shell)1 Table (org.eclipse.swt.widgets.Table)1 TableItem (org.eclipse.swt.widgets.TableItem)1 DatabaseConnectionPoolParameter (org.pentaho.di.core.database.DatabaseConnectionPoolParameter)1 PartitionDatabaseMeta (org.pentaho.di.core.database.PartitionDatabaseMeta)1 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)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