Search in sources :

Example 31 with XulComponent

use of org.pentaho.ui.xul.XulComponent in project data-access by pentaho.

the class DatasourceAdminDialogController method getDatasourceTypes.

private void getDatasourceTypes() {
    List<String> datasourceTypes = manager.getTypes();
    // Clear out the current component list
    List<XulComponent> components = datasourceTypeMenuPopup.getChildNodes();
    // remove exist import and plugins
    for (int i = 0; i < components.size(); i++) {
        XulComponent component = components.get(i);
        if (component.getId() == null) {
            continue;
        }
        if (component.getId().startsWith("import") || component.getId().startsWith("plugin")) {
            // remove import and plugins items
            datasourceTypeMenuPopup.removeComponent(component);
        }
    }
    // find separator
    components = datasourceTypeMenuPopup.getChildNodes();
    int beforePlugins = 0;
    XulComponent beforePluginsMenuItem = null;
    for (int i = 0; i < components.size(); i++) {
        XulComponent component = components.get(i);
        if ("beforePlugins".equals(component.getId())) {
            beforePlugins = i;
            beforePluginsMenuItem = component;
        }
    }
    List<IDatasourceInfo> datasourceInfoList = datasourceAdminDialogModel.getDatasourcesList();
    // Add "Import..." items first
    for (String datasourceType : datasourceTypes) {
        IUIDatasourceAdminService datasourceAdminService = manager.getService(datasourceType);
        if (datasourceAdminService instanceof DSWUIDatasourceService) {
            // Data Source Wizard
            continue;
        }
        if (datasourceAdminService instanceof JdbcDatasourceService) {
            // JDBC
            continue;
        }
        if (// Analysis - import
        !(datasourceAdminService instanceof MondrianUIDatasourceService) && !(datasourceAdminService instanceof MetadataUIDatasourceService)) {
            // Metadata - import
            continue;
        }
        if (!datasourceAdminService.isCreatable()) {
            continue;
        }
        XulMenuitem menuItem;
        try {
            String displayName = DatasourceInfo.getDisplayType(datasourceType, messageBundle);
            String label = messageBundle.getString(IMPORT_MSG_ID, displayName);
            menuItem = (XulMenuitem) document.createElement("menuitem");
            menuItem.setLabel(label);
            menuItem.setCommand(getName() + ".launchNewUI(\"" + datasourceType + "\")");
            menuItem.setId("import" + datasourceType);
            datasourceTypeMenuPopup.addChildAt(menuItem, beforePlugins++);
        } catch (XulException e) {
            throw new RuntimeException(e);
        }
    }
    // Add plugin items
    boolean hasPlugins = false;
    beforePlugins++;
    for (String datasourceType : datasourceTypes) {
        IUIDatasourceAdminService datasourceAdminService = manager.getService(datasourceType);
        if (datasourceAdminService instanceof DSWUIDatasourceService) {
            // Data Source Wizard
            continue;
        }
        if (datasourceAdminService instanceof JdbcDatasourceService) {
            // JDBC
            continue;
        }
        if (datasourceAdminService instanceof MondrianUIDatasourceService) {
            // Analysis - import
            continue;
        } else if (datasourceAdminService instanceof MetadataUIDatasourceService) {
            // Metadata - import
            continue;
        }
        if (!datasourceAdminService.isCreatable()) {
            continue;
        }
        hasPlugins = true;
        XulMenuitem menuItem;
        try {
            String displayName = DatasourceInfo.getDisplayType(datasourceType, messageBundle);
            String label = messageBundle.getString(PLUGIN_MSG_ID, displayName);
            menuItem = (XulMenuitem) document.createElement("menuitem");
            menuItem.setLabel(label);
            menuItem.setCommand(getName() + ".launchNewUI(\"" + datasourceType + "\")");
            menuItem.setId("plugin" + datasourceType);
            datasourceTypeMenuPopup.addChildAt(menuItem, beforePlugins++);
        } catch (XulException e) {
            throw new RuntimeException(e);
        }
    }
    beforePluginsMenuItem.setVisible(hasPlugins);
    datasourceAdminDialogModel.setDatasourceTypeList(datasourceTypes);
}
Also used : JdbcDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.JdbcDatasourceService) GwtDatasourceEditorEntryPoint(org.pentaho.platform.dataaccess.datasource.wizard.GwtDatasourceEditorEntryPoint) IUIDatasourceAdminService(org.pentaho.platform.dataaccess.datasource.ui.service.IUIDatasourceAdminService) XulException(org.pentaho.ui.xul.XulException) MondrianUIDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.MondrianUIDatasourceService) XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) XulComponent(org.pentaho.ui.xul.XulComponent) DSWUIDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.DSWUIDatasourceService) IDatasourceInfo(org.pentaho.platform.dataaccess.datasource.IDatasourceInfo) MetadataUIDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.MetadataUIDatasourceService)

Example 32 with XulComponent

use of org.pentaho.ui.xul.XulComponent 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 33 with XulComponent

use of org.pentaho.ui.xul.XulComponent 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

XulComponent (org.pentaho.ui.xul.XulComponent)33 XulException (org.pentaho.ui.xul.XulException)13 KettleException (org.pentaho.di.core.exception.KettleException)8 XulConfirmBox (org.pentaho.ui.xul.components.XulConfirmBox)8 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)7 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)6 XulPromptBox (org.pentaho.ui.xul.components.XulPromptBox)6 XulMenuitem (org.pentaho.ui.xul.components.XulMenuitem)4 Document (org.pentaho.ui.xul.dom.Document)4 Test (org.junit.Test)3 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)3 UIRepositoryObject (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObject)3 Bindable (org.pentaho.ui.xul.stereotype.Bindable)3 Label (com.google.gwt.user.client.ui.Label)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 ArrayList (java.util.ArrayList)2 HttpStatus (org.apache.http.HttpStatus)2 IAclObject (org.pentaho.di.ui.repository.pur.repositoryexplorer.IAclObject)2 ILockObject (org.pentaho.di.ui.repository.pur.repositoryexplorer.ILockObject)2 UIObjectCreationException (org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException)2