use of com.haulmont.cuba.gui.screen.MapScreenOptions in project cuba by cuba-platform.
the class DynamicAttributesGuiTools method initPickerField.
protected void initPickerField(LookupAction<?> lookupAction, @Nullable String screen, MetaClass metaClass, Class javaClass) {
if (StringUtils.isNotBlank(screen)) {
lookupAction.setScreenId(screen);
} else {
screen = windowConfig.getBrowseScreenId(metaClass);
Map<String, String> screensMap = screensHelper.getAvailableBrowserScreens(javaClass);
if (windowConfig.findWindowInfo(screen) != null && screensMap.containsValue(screen)) {
lookupAction.setScreenId(screen);
lookupAction.setOpenMode(OpenMode.THIS_TAB);
} else {
lookupAction.setScreenId(CommonLookupController.SCREEN_ID);
lookupAction.setScreenOptionsSupplier(() -> new MapScreenOptions(ParamsMap.of(CommonLookupController.CLASS_PARAMETER, metaClass)));
lookupAction.setOpenMode(OpenMode.DIALOG);
}
}
}
use of com.haulmont.cuba.gui.screen.MapScreenOptions in project cuba by cuba-platform.
the class ScreenNavigationHandler method createEditor.
protected Screen createEditor(WindowInfo windowInfo, String screenRoute, NavigationState requestedState, AppUI ui) {
Map<String, Object> options = createEditorScreenOptions(windowInfo, requestedState, ui);
if (MapUtils.isEmpty(options)) {
log.info("Unable to load entity for editor: '{}'. " + "Subscribe for 'UrlParamsChangedEvent' to obtain its serialized id", windowInfo.getId());
}
Screen editor;
OpenMode openMode = getScreenOpenMode(requestedState.getNestedRoute(), screenRoute, ui);
if (isLegacyScreen(windowInfo.getControllerClass())) {
editor = ui.getScreens().create(windowInfo.getId(), openMode, new MapScreenOptions(options));
} else {
editor = ui.getScreens().create(windowInfo.getId(), openMode);
}
if (MapUtils.isNotEmpty(options)) {
Entity entity = (Entity) options.get(WindowParams.ITEM.name());
// noinspection unchecked
((EditorScreen<Entity>) editor).setEntityToEdit(entity);
}
return editor;
}
use of com.haulmont.cuba.gui.screen.MapScreenOptions in project cuba by cuba-platform.
the class RootNavigationHandler method handle404.
protected void handle404(String route, AppUI ui) {
RootWindow topWindow = ui.getTopLevelWindow();
Screen rootScreen = topWindow != null ? topWindow.getFrameOwner() : null;
if (rootScreen instanceof Window.HasWorkArea) {
MapScreenOptions options = new MapScreenOptions(ParamsMap.of("requestedRoute", route));
ui.getScreens().create(NotFoundScreen.class, OpenMode.NEW_TAB, options).show();
} else {
ui.getNotifications().create(Notifications.NotificationType.TRAY).withCaption(messages.formatMainMessage("navigation.screenNotFound", route)).show();
}
}
use of com.haulmont.cuba.gui.screen.MapScreenOptions in project cuba by cuba-platform.
the class AddToSetAction method actionPerform.
@Override
public void actionPerform(Component component) {
MetaClass entityMetaClass;
if (target.getItems() instanceof EntityDataUnit) {
entityMetaClass = ((EntityDataUnit) target.getItems()).getEntityMetaClass();
} else {
throw new UnsupportedOperationException("Unsupported data unit " + target.getItems());
}
String query;
if (filter.getDatasource() != null) {
query = filter.getDatasource().getQuery();
} else {
query = filter.getDataLoader().getQuery();
}
String[] strings = ValuePathHelper.parse(ComponentsHelper.getFilterComponentPath(filter));
String componentId = ValuePathHelper.pathSuffix(strings);
Set ownerSelection = target.getSelected();
Map<String, Object> params = new HashMap<>();
params.put("entityType", entityMetaClass.getName());
params.put("items", ownerSelection);
params.put("componentPath", ComponentsHelper.getFilterComponentPath(filter));
params.put("componentId", componentId);
params.put("foldersPane", filterHelper.getFoldersPane());
params.put("entityClass", entityMetaClass.getJavaClass().getName());
params.put("query", query);
Screens screens = ComponentsHelper.getScreenContext(filter).getScreens();
screens.create("saveSetInFolder", OpenMode.DIALOG, new MapScreenOptions(params)).show();
}
use of com.haulmont.cuba.gui.screen.MapScreenOptions in project cuba by cuba-platform.
the class DataGridEditorComponentGenerationStrategy method setupPickerFieldActions.
protected void setupPickerFieldActions(PickerField<?> pickerField) {
Map<String, Object> lookupScreenParams = ParamsMap.of("dataGridEditor", true);
PickerField.LookupAction legacyLookupAction = (PickerField.LookupAction) pickerField.getAction(PickerField.LookupAction.NAME);
if (legacyLookupAction != null) {
// Opening lookup screen in another mode will close editor
legacyLookupAction.setLookupScreenOpenType(WindowManager.OpenType.DIALOG);
// In case of adding special logic for lookup screen opened from DataGrid editor
legacyLookupAction.setLookupScreenParams(lookupScreenParams);
}
LookupAction<?> lookupAction = (LookupAction<?>) pickerField.getAction(LookupAction.ID);
if (lookupAction != null) {
// Opening lookup screen in another mode will close editor
lookupAction.setOpenMode(OpenMode.DIALOG);
// In case of adding special logic for lookup screen opened from DataGrid editor
lookupAction.setScreenOptionsSupplier(() -> new MapScreenOptions(lookupScreenParams));
}
}
Aggregations