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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations