Search in sources :

Example 6 with WindowConfig

use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.

the class WebFrame method openEditor.

@Override
public Window.Editor openEditor(String windowAlias, Entity item, WindowManager.OpenType openType, Map<String, Object> params) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
    WebWindowManager wm = App.getInstance().getWindowManager();
    return wm.openEditor(windowInfo, item, openType, params);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 7 with WindowConfig

use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.

the class WebFrame method openEditor.

@Override
public Window.Editor openEditor(String windowAlias, Entity item, WindowManager.OpenType openType, Datasource parentDs) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
    WebWindowManager wm = App.getInstance().getWindowManager();
    return wm.openEditor(windowInfo, item, openType, parentDs);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 8 with WindowConfig

use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.

the class WebFrame method openLookup.

@Override
public Window.Lookup openLookup(String windowAlias, Window.Lookup.Handler handler, WindowManager.OpenType openType, Map<String, Object> params) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
    WebWindowManager wm = App.getInstance().getWindowManager();
    return wm.openLookup(windowInfo, handler, openType, params);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 9 with WindowConfig

use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.

the class WebFrame method openEditor.

@Override
public Window.Editor openEditor(String windowAlias, Entity item, WindowManager.OpenType openType) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
    WebWindowManager wm = App.getInstance().getWindowManager();
    return wm.openEditor(windowInfo, item, openType);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 10 with WindowConfig

use of com.haulmont.cuba.gui.config.WindowConfig in project cuba by cuba-platform.

the class UiPermissionsFrame method init.

@Override
public void init(Map<String, Object> params) {
    super.init(params);
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    Collection<WindowInfo> windows = sortWindowInfos(windowConfig.getWindows());
    Map<String, Object> screens = new LinkedHashMap<>();
    for (WindowInfo windowInfo : windows) {
        String id = windowInfo.getId();
        String menuId = "menu-config." + id;
        String localeMsg = messages.getMessage(AppConfig.getMessagesPack(), menuId);
        String title = menuId.equals(localeMsg) ? id : localeMsg + " (" + id + ")";
        screens.put(title, id);
    }
    screenFilter.setOptionsMap(screens);
    companion.initPermissionsColoredColumns(uiPermissionsTable);
    uiPermissionTargetsDs.addItemChangeListener(e -> {
        if (!selectedComponentPanel.isVisible() && (e.getItem() != null)) {
            selectedComponentPanel.setVisible(true);
        }
        if (selectedComponentPanel.isVisible() && (e.getItem() == null)) {
            selectedComponentPanel.setVisible(false);
        }
        updateCheckBoxes(e.getItem());
    });
    uiPermissionTargetsDs.addItemPropertyChangeListener(e -> {
        if ("permissionVariant".equals(e.getProperty())) {
            updateCheckBoxes(uiPermissionsTable.getSingleSelected());
        }
    });
    attachCheckBoxListener(readOnlyCheckBox, UiPermissionVariant.READ_ONLY);
    attachCheckBoxListener(hideCheckBox, UiPermissionVariant.HIDE);
    attachCheckBoxListener(showCheckBox, UiPermissionVariant.SHOW);
    uiPermissionTargetsDs.setPermissionDs(uiPermissionsDs);
    uiPermissionsDs.refresh();
    uiPermissionTargetsDs.refresh();
    boolean isCreatePermitted = security.isEntityOpPermitted(Permission.class, EntityOp.CREATE);
    boolean isDeletePermitted = security.isEntityOpPermitted(Permission.class, EntityOp.DELETE);
    boolean isRoleEditPermitted = security.isEntityOpPermitted(metadata.getClass(Role.class), EntityOp.UPDATE);
    final boolean hasPermissionsToModifyPermission = isCreatePermitted && isDeletePermitted && isRoleEditPermitted;
    RemoveAction removeAction = new RemoveAction(uiPermissionsTable, false);
    removeAction.setAfterRemoveHandler(removedItems -> {
        if (!removedItems.isEmpty()) {
            UiPermissionTarget removedPermission = (UiPermissionTarget) removedItems.iterator().next();
            markItemPermission(UiPermissionVariant.NOTSET, removedPermission);
        }
    });
    removeAction.setEnabled(hasPermissionsToModifyPermission);
    removeAction.setIcon(null);
    removeAction.setCaption(getMessage("actions.RemoveSelected"));
    removePermissionBtn.setAction(removeAction);
    uiPermissionsTable.addAction(removeAction);
    editPane.setEnabled(security.isEntityOpPermitted(Role.class, EntityOp.UPDATE));
    applyPermissions(hasPermissionsToModifyPermission);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) Role(com.haulmont.cuba.security.entity.Role) RemoveAction(com.haulmont.cuba.gui.components.actions.RemoveAction) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo) UiPermissionTarget(com.haulmont.cuba.gui.app.security.entity.UiPermissionTarget)

Aggregations

WindowConfig (com.haulmont.cuba.gui.config.WindowConfig)27 WindowInfo (com.haulmont.cuba.gui.config.WindowInfo)20 WebWindowManager (com.haulmont.cuba.web.WebWindowManager)15 MetaClass (com.haulmont.chile.core.model.MetaClass)3 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)3 WindowManager (com.haulmont.cuba.gui.WindowManager)2 Window (com.haulmont.cuba.gui.components.Window)2 Element (org.dom4j.Element)2 ErrorInfo (org.jdesktop.swingx.error.ErrorInfo)2 ParamsMap (com.haulmont.bali.util.ParamsMap)1 AbstractSearchFolder (com.haulmont.cuba.core.entity.AbstractSearchFolder)1 Entity (com.haulmont.cuba.core.entity.Entity)1 SoftDelete (com.haulmont.cuba.core.entity.SoftDelete)1 Messages (com.haulmont.cuba.core.global.Messages)1 UiPermissionTarget (com.haulmont.cuba.gui.app.security.entity.UiPermissionTarget)1 Component (com.haulmont.cuba.gui.components.Component)1 Filter (com.haulmont.cuba.gui.components.Filter)1 ListComponent (com.haulmont.cuba.gui.components.ListComponent)1 RemoveAction (com.haulmont.cuba.gui.components.actions.RemoveAction)1 DataSupplier (com.haulmont.cuba.gui.data.DataSupplier)1