Search in sources :

Example 6 with UiPermissionValue

use of com.haulmont.cuba.gui.app.security.role.edit.UiPermissionValue in project cuba by cuba-platform.

the class DesktopTabSheet method applyPermission.

@Override
public void applyPermission(UiPermissionDescriptor permissionDescriptor) {
    Preconditions.checkNotNullArgument(permissionDescriptor);
    final String subComponentId = permissionDescriptor.getSubComponentId();
    final TabSheet.Tab tab = getTab(subComponentId);
    if (tab != null) {
        UiPermissionValue permissionValue = permissionDescriptor.getPermissionValue();
        if (permissionValue == UiPermissionValue.HIDE) {
            tab.setVisible(false);
        } else if (permissionValue == UiPermissionValue.READ_ONLY) {
            tab.setEnabled(false);
        }
    } else {
        LoggerFactory.getLogger(DesktopTabSheet.class).info(String.format("Couldn't find component %s in window %s", subComponentId, permissionDescriptor.getScreenId()));
    }
}
Also used : UiPermissionValue(com.haulmont.cuba.gui.app.security.role.edit.UiPermissionValue) TabSheet(com.haulmont.cuba.gui.components.TabSheet)

Aggregations

UiPermissionValue (com.haulmont.cuba.gui.app.security.role.edit.UiPermissionValue)6 Component (com.haulmont.cuba.gui.components.Component)2 UiPermissionDescriptor (com.haulmont.cuba.gui.app.security.role.edit.UiPermissionDescriptor)1 Accordion (com.haulmont.cuba.gui.components.Accordion)1 TabSheet (com.haulmont.cuba.gui.components.TabSheet)1 CubaAccordion (com.haulmont.cuba.web.toolkit.ui.CubaAccordion)1 CubaFieldGroup (com.haulmont.cuba.web.toolkit.ui.CubaFieldGroup)1 CubaTabSheet (com.haulmont.cuba.web.toolkit.ui.CubaTabSheet)1 Matcher (java.util.regex.Matcher)1 Logger (org.slf4j.Logger)1