Search in sources :

Example 1 with XulCheckbox

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

the class DataHandlerTest method testHandleUseSecurityCheckbox.

@Test
public void testHandleUseSecurityCheckbox() throws Exception {
    dataHandler.handleUseSecurityCheckbox();
    // Now add the widget
    XulCheckbox useIntegratedSecurityCheck = mock(XulCheckbox.class);
    when(useIntegratedSecurityCheck.isChecked()).thenReturn(false);
    when(document.getElementById("use-integrated-security-check")).thenReturn(useIntegratedSecurityCheck);
    dataHandler.getControls();
    dataHandler.handleUseSecurityCheckbox();
    when(useIntegratedSecurityCheck.isChecked()).thenReturn(true);
    dataHandler.handleUseSecurityCheckbox();
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) Test(org.junit.Test)

Example 2 with XulCheckbox

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

the class AbsController method setSelectedSystemRoleChanged.

/**
 * The method is called when a user select a role from the role list. This method reads the current selected role and
 * populates the Action Permission UI with the details
 */
public void setSelectedSystemRoleChanged(IUIRole role) throws Exception {
    IUIAbsRole absRole = null;
    uncheckAllSystemActionPermissions();
    if (role instanceof IUIAbsRole) {
        absRole = (IUIAbsRole) role;
        if (absRole != null && absRole.getLogicalRoles() != null) {
            for (String permission : absRole.getLogicalRoles()) {
                XulCheckbox permissionCheckbox = findSystemRoleCheckbox(permission);
                if (permissionCheckbox != null) {
                    permissionCheckbox.setChecked(true);
                }
            }
        }
    } else {
        throw new IllegalStateException();
    }
}
Also used : IUIAbsRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole) XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox)

Example 3 with XulCheckbox

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

the class AbsController method initializeLogicalSystemRolesUI.

/**
 * Initialized the ActionPermissions UI with all the possible values from LogicalSystemRoles enum
 */
private void initializeLogicalSystemRolesUI() {
    try {
        Map<String, String> logicalRoles = ((IAbsSecurityManager) service).getAllLogicalRoles(GlobalMessages.getLocale().getDisplayName());
        for (Entry<String, String> logicalRole : logicalRoles.entrySet()) {
            XulCheckbox logicalSystemRoleCheckbox;
            // $NON-NLS-1$
            logicalSystemRoleCheckbox = (XulCheckbox) document.createElement("checkbox");
            logicalSystemRoleCheckbox.setLabel(logicalRole.getValue());
            logicalSystemRoleCheckbox.setId(logicalRole.getValue());
            // $NON-NLS-1$
            logicalSystemRoleCheckbox.setCommand("iSecurityController.updateSystemRoleActionPermission()");
            logicalSystemRoleCheckbox.setFlex(1);
            logicalSystemRoleCheckbox.setDisabled(true);
            logicalSystemRolesBox.addChild(logicalSystemRoleCheckbox);
            logicalSystemRoleChecboxMap.put(logicalSystemRoleCheckbox, logicalRole.getKey());
            bf.setBindingType(Binding.Type.ONE_WAY);
            // $NON-NLS-1$ //$NON-NLS-2$
            bf.createBinding(systemRoleListBox, "selectedIndex", logicalSystemRoleCheckbox, "disabled", buttonConverter);
        }
    } catch (XulException xe) {
    } catch (KettleException xe) {
    }
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) KettleException(org.pentaho.di.core.exception.KettleException) IAbsSecurityManager(org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager) XulException(org.pentaho.ui.xul.XulException)

Example 4 with XulCheckbox

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

the class ServiceCacheController method initBindings.

public void initBindings(DataServiceModel model) {
    PushDownOptimizationMeta meta = locateServiceCacheMeta(model);
    ServiceCache serviceCache = (ServiceCache) meta.getType();
    BindingFactory bindingFactory = getBindingFactory();
    XulRadio normalModeRadio = getElementById("regular-type-radio");
    XulTab serviceCacheTab = getElementById("service-cache-tab");
    XulCheckbox serviceCacheCheckBox = getElementById("service-cache-checkbox");
    XulTextbox serviceCacheTextBox = getElementById("service-cache-ttl");
    bindingFactory.setBindingType(Binding.Type.ONE_WAY);
    serviceCacheCheckBox.setChecked(meta.isEnabled());
    serviceCacheTab.setVisible(!model.isStreaming());
    try {
        serviceCacheTextBox.setValue(serviceCache.getConfiguredTimeToLive());
    } catch (Exception e) {
        getLogChannel().logError("Unable to set default TTL", e);
    }
    bindingFactory.createBinding(serviceCacheTextBox, "value", serviceCache, "timeToLive");
    bindingFactory.createBinding(serviceCacheCheckBox, "checked", meta, "enabled");
    bindingFactory.createBinding(serviceCacheCheckBox, "checked", serviceCacheTextBox, "disabled", not());
    bindingFactory.createBinding(normalModeRadio, "selected", serviceCacheTab, "visible");
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) XulRadio(org.pentaho.ui.xul.components.XulRadio) ServiceCache(org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) XulTab(org.pentaho.ui.xul.components.XulTab) BindingFactory(org.pentaho.ui.xul.binding.BindingFactory)

Example 5 with XulCheckbox

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

the class AbsController method initializeLogicalRolesUI.

/**
 * Initialized the ActionPermissions UI with all the possible values from LogicalRoles enum
 */
private void initializeLogicalRolesUI() {
    try {
        Map<String, String> logicalRoles = ((IAbsSecurityManager) service).getAllLogicalRoles(GlobalMessages.getLocale().getDisplayName());
        for (Entry<String, String> logicalRole : logicalRoles.entrySet()) {
            XulCheckbox logicalRoleCheckbox;
            // $NON-NLS-1$
            logicalRoleCheckbox = (XulCheckbox) document.createElement("checkbox");
            logicalRoleCheckbox.setLabel(logicalRole.getValue());
            logicalRoleCheckbox.setId(logicalRole.getValue());
            // $NON-NLS-1$
            logicalRoleCheckbox.setCommand("iSecurityController.updateRoleActionPermission()");
            logicalRoleCheckbox.setFlex(1);
            logicalRoleCheckbox.setDisabled(true);
            logicalRolesBox.addChild(logicalRoleCheckbox);
            logicalRoleChecboxMap.put(logicalRoleCheckbox, logicalRole.getKey());
            bf.setBindingType(Binding.Type.ONE_WAY);
            // $NON-NLS-1$ //$NON-NLS-2$
            bf.createBinding(roleListBox, "selectedIndex", logicalRoleCheckbox, "disabled", buttonConverter);
        }
    } catch (XulException xe) {
    } catch (KettleException xe) {
    }
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) KettleException(org.pentaho.di.core.exception.KettleException) IAbsSecurityManager(org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager) XulException(org.pentaho.ui.xul.XulException)

Aggregations

XulCheckbox (org.pentaho.ui.xul.components.XulCheckbox)6 KettleException (org.pentaho.di.core.exception.KettleException)2 IUIAbsRole (org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole)2 IAbsSecurityManager (org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager)2 XulException (org.pentaho.ui.xul.XulException)2 Test (org.junit.Test)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 ServiceCache (org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache)1 BindingFactory (org.pentaho.ui.xul.binding.BindingFactory)1 XulRadio (org.pentaho.ui.xul.components.XulRadio)1 XulTab (org.pentaho.ui.xul.components.XulTab)1 XulTextbox (org.pentaho.ui.xul.components.XulTextbox)1