Search in sources :

Example 6 with XulTextbox

use of org.pentaho.ui.xul.components.XulTextbox in project pentaho-kettle by pentaho.

the class FragmentHandler method refreshOptions.

/**
 * This method handles the resource-like loading of the XUL fragment definitions based on connection type and access
 * method. If there is a common definition, and no connection specific override definition, then the common definition
 * is used. Connection specific definition resources follow the naming pattern [connection type code]_[access
 * method].xul.
 */
public void refreshOptions() {
    connectionBox = (XulListbox) document.getElementById("connection-type-list");
    accessBox = (XulListbox) document.getElementById("access-type-list");
    Object connectionKey = DataHandler.connectionNametoID.get(connectionBox.getSelectedItem());
    String databaseName = null;
    try {
        databaseName = PluginRegistry.getInstance().getPlugin(DatabasePluginType.class, "" + connectionKey).getIds()[0];
    } catch (Exception e) {
        e.printStackTrace();
    }
    DatabaseInterface database = DataHandler.connectionMap.get(connectionBox.getSelectedItem());
    Object accessKey = accessBox.getSelectedItem();
    int access = DatabaseMeta.getAccessType((String) accessKey);
    String fragment = null;
    DataHandler dataHandler = null;
    try {
        dataHandler = (DataHandler) xulDomContainer.getEventHandler("dataHandler");
        dataHandler.pushCache();
    } catch (XulException e) {
    // TODO not a critical function, but should log a problem...
    }
    switch(access) {
        case DatabaseMeta.TYPE_ACCESS_JNDI:
            fragment = getFragment(database, databaseName, "_jndi.xul", "common_jndi.xul");
            break;
        case DatabaseMeta.TYPE_ACCESS_NATIVE:
            fragment = getFragment(database, databaseName, "_native.xul", "common_native.xul");
            break;
        case DatabaseMeta.TYPE_ACCESS_OCI:
            fragment = getFragment(database, databaseName, "_oci.xul", "common_native.xul");
            break;
        case DatabaseMeta.TYPE_ACCESS_ODBC:
            fragment = getFragment(database, databaseName, "_odbc.xul", "common_odbc.xul");
            break;
        case DatabaseMeta.TYPE_ACCESS_PLUGIN:
            fragment = getFragment(database, databaseName, "_plugin.xul", "common_native.xul");
            break;
        default:
            break;
    }
    try {
        loadDatabaseOptionsFragment(fragment.toLowerCase());
    } catch (XulException e) {
        // TODO should be reporting as an error dialog; need error dialog in XUL framework
        showMessage(Messages.getString("FragmentHandler.USER.CANT_LOAD_OPTIONS", databaseName));
    }
    XulTextbox portBox = (XulTextbox) document.getElementById("port-number-text");
    if (portBox != null) {
        int port = database.getDefaultDatabasePort();
        if (port > 0) {
            portBox.setValue(Integer.toString(port));
        }
    }
    if (dataHandler != null) {
        dataHandler.popCache();
    }
}
Also used : DatabaseInterface(org.pentaho.di.core.database.DatabaseInterface) XulException(org.pentaho.ui.xul.XulException) DatabasePluginType(org.pentaho.di.core.plugins.DatabasePluginType) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulException(org.pentaho.ui.xul.XulException)

Example 7 with XulTextbox

use of org.pentaho.ui.xul.components.XulTextbox in project pentaho-kettle by pentaho.

the class DataOverrideHandler method getControls.

@Override
protected void getControls() {
    super.getControls();
    XulTextbox[] boxes = new XulTextbox[] { hostNameBox, databaseNameBox, portNumberBox, userNameBox, passwordBox, customDriverClassBox, customUrlBox, dataTablespaceBox, indexTablespaceBox, poolSizeBox, maxPoolSizeBox, languageBox, systemNumberBox, clientBox, serverInstanceBox, warehouseBox };
    for (int i = 0; i < boxes.length; i++) {
        XulTextbox xulTextbox = boxes[i];
        if ((xulTextbox != null) && (xulTextbox instanceof ExtTextbox)) {
            ExtTextbox ext = (ExtTextbox) xulTextbox;
            ext.setVariableSpace(databaseMeta);
        }
    }
    XulTree[] trees = new XulTree[] { poolParameterTree, clusterParameterTree, optionsParameterTree };
    for (int i = 0; i < trees.length; i++) {
        XulTree xulTree = trees[i];
        if (xulTree != null) {
            xulTree.setData(databaseMeta);
        }
    }
    XulMenuList[] menus = new XulMenuList[] { namedClusterList };
    for (int i = 0; i < menus.length; i++) {
        XulMenuList xulMenu = menus[i];
        if (xulMenu != null && xulMenu instanceof ExtMenuList) {
            ExtMenuList ext = (ExtMenuList) xulMenu;
            ext.setVariableSpace(databaseMeta);
        }
    }
}
Also used : ExtTextbox(org.pentaho.di.ui.core.database.dialog.tags.ExtTextbox) ExtMenuList(org.pentaho.di.ui.core.database.dialog.tags.ExtMenuList) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulTree(org.pentaho.ui.xul.containers.XulTree) XulMenuList(org.pentaho.ui.xul.components.XulMenuList)

Example 8 with XulTextbox

use of org.pentaho.ui.xul.components.XulTextbox in project pentaho-kettle by pentaho.

the class AuthProviderController method browse.

public void browse() {
    try {
        XulTextbox filename = (XulTextbox) document.getElementById("keytab");
        XulFileDialog dialog = (XulFileDialog) document.createElement("filedialog");
        XulFileDialog.RETURN_CODE retval = dialog.showOpenDialog();
        if (retval == XulFileDialog.RETURN_CODE.OK) {
            File file = (File) dialog.getFile();
            filename.setValue(file.getAbsolutePath());
        }
    } catch (XulException e) {
        log.logError(resourceBundle.getString("error.file_browse"), e);
    }
}
Also used : XulException(org.pentaho.ui.xul.XulException) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulFileDialog(org.pentaho.ui.xul.components.XulFileDialog) File(java.io.File)

Example 9 with XulTextbox

use of org.pentaho.ui.xul.components.XulTextbox in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceTestController method bindOptImpactInfo.

private void bindOptImpactInfo(BindingFactory bindingFactory) {
    XulTextbox maxRows = (XulTextbox) document.getElementById("optimization-impact-info");
    bindingFactory.setBindingType(Binding.Type.ONE_WAY);
    Binding binding = bindingFactory.createBinding(model, "optimizationImpactDescription", maxRows, "value");
    binding.initialize();
}
Also used : Binding(org.pentaho.ui.xul.binding.Binding) XulTextbox(org.pentaho.ui.xul.components.XulTextbox)

Example 10 with XulTextbox

use of org.pentaho.ui.xul.components.XulTextbox in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceTestController method bindStreamingWindowParameters.

private void bindStreamingWindowParameters(BindingFactory bindingFactory) {
    XulGroupbox streamingGroupBox = (XulGroupbox) document.getElementById("streaming-groupbox");
    streamingGroupBox.setVisible(dataService.isStreaming());
    XulRadio timeBasedRadio = (XulRadio) document.getElementById("time-based-radio");
    XulRadio rowBasedRadio = (XulRadio) document.getElementById("row-based-radio");
    XulTextbox sizeTextBox = (XulTextbox) document.getElementById("window-size");
    XulTextbox everyTextBox = (XulTextbox) document.getElementById("window-every");
    XulTextbox limitTextBox = (XulTextbox) document.getElementById("window-limit");
    XulLabel sizeTimeUnitLabel = (XulLabel) document.getElementById("window-size-time-unit");
    XulLabel everyTimeUnitLabel = (XulLabel) document.getElementById("window-every-time-unit");
    XulLabel limitTimeUnitLabel = (XulLabel) document.getElementById("window-limit-time-unit");
    XulLabel sizeRowUnitLabel = (XulLabel) document.getElementById("window-size-row-unit");
    XulLabel everyRowUnitLabel = (XulLabel) document.getElementById("window-every-row-unit");
    XulLabel limitRowUnitLabel = (XulLabel) document.getElementById("window-limit-row-unit");
    model.setWindowMode(IDataServiceClientService.StreamingMode.TIME_BASED);
    timeBasedRadio.setSelected(true);
    rowBasedRadio.setSelected(false);
    sizeTimeUnitLabel.setVisible(true);
    everyTimeUnitLabel.setVisible(true);
    limitTimeUnitLabel.setVisible(false);
    sizeRowUnitLabel.setVisible(false);
    everyRowUnitLabel.setVisible(false);
    limitRowUnitLabel.setVisible(true);
    sizeTextBox.setValue("");
    everyTextBox.setValue("");
    limitTextBox.setValue("");
    bindingFactory.setBindingType(Binding.Type.BI_DIRECTIONAL);
    bindingFactory.createBinding(model, "windowSize", sizeTextBox, "value", BindingConverters.longToStringEmptyZero());
    bindingFactory.createBinding(model, "windowEvery", everyTextBox, "value", BindingConverters.longToStringEmptyZero());
    bindingFactory.createBinding(model, "windowLimit", limitTextBox, "value", BindingConverters.longToStringEmptyZero());
    bindingFactory.createBinding(timeBasedRadio, "selected", sizeTimeUnitLabel, "visible");
    bindingFactory.createBinding(timeBasedRadio, "selected", everyTimeUnitLabel, "visible");
    bindingFactory.createBinding(timeBasedRadio, "!selected", limitTimeUnitLabel, "visible");
    bindingFactory.createBinding(timeBasedRadio, "!selected", sizeRowUnitLabel, "visible");
    bindingFactory.createBinding(timeBasedRadio, "!selected", everyRowUnitLabel, "visible");
    bindingFactory.createBinding(timeBasedRadio, "selected", limitRowUnitLabel, "visible");
    bindingFactory.createBinding(rowBasedRadio, "!selected", sizeTimeUnitLabel, "visible");
    bindingFactory.createBinding(rowBasedRadio, "!selected", everyTimeUnitLabel, "visible");
    bindingFactory.createBinding(rowBasedRadio, "selected", limitTimeUnitLabel, "visible");
    bindingFactory.createBinding(rowBasedRadio, "selected", sizeRowUnitLabel, "visible");
    bindingFactory.createBinding(rowBasedRadio, "selected", everyRowUnitLabel, "visible");
    bindingFactory.createBinding(rowBasedRadio, "!selected", limitRowUnitLabel, "visible");
}
Also used : XulRadio(org.pentaho.ui.xul.components.XulRadio) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulLabel(org.pentaho.ui.xul.components.XulLabel) XulGroupbox(org.pentaho.ui.xul.containers.XulGroupbox)

Aggregations

XulTextbox (org.pentaho.ui.xul.components.XulTextbox)13 XulRadio (org.pentaho.ui.xul.components.XulRadio)5 BindingFactory (org.pentaho.ui.xul.binding.BindingFactory)4 DatabaseInterface (org.pentaho.di.core.database.DatabaseInterface)2 XulComponent (org.pentaho.ui.xul.XulComponent)2 XulException (org.pentaho.ui.xul.XulException)2 Binding (org.pentaho.ui.xul.binding.Binding)2 XulLabel (org.pentaho.ui.xul.components.XulLabel)2 XulTab (org.pentaho.ui.xul.components.XulTab)2 File (java.io.File)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 DatabasePluginType (org.pentaho.di.core.plugins.DatabasePluginType)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 BaseMessages.getString (org.pentaho.di.i18n.BaseMessages.getString)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 ServiceCache (org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache)1 ExtMenuList (org.pentaho.di.ui.core.database.dialog.tags.ExtMenuList)1 ExtTextbox (org.pentaho.di.ui.core.database.dialog.tags.ExtTextbox)1 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)1