use of io.jmix.ui.screen.MapScreenOptions in project jmix by jmix-framework.
the class CubaScreens method openWindow.
@Override
public com.haulmont.cuba.gui.components.Window openWindow(WindowInfo windowInfo, OpenType openType, Map<String, Object> params) {
params = createParametersMap(windowInfo, params);
MapScreenOptions options = new MapScreenOptions(params);
Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
applyOpenTypeParameters(screen.getWindow(), openType);
show(screen);
return screen instanceof com.haulmont.cuba.gui.components.Window ? (com.haulmont.cuba.gui.components.Window) screen : new ScreenWrapper(screen);
}
use of io.jmix.ui.screen.MapScreenOptions in project jmix by jmix-framework.
the class EditFetchPlanAction method actionPerform.
@Override
public void actionPerform(Component component) {
if (dataSetsTable.getSingleSelected() != null) {
final DataSet dataSet = dataSetsTable.getSingleSelected();
if (DataSetType.SINGLE == dataSet.getType() || DataSetType.MULTI == dataSet.getType()) {
MetaClass forEntityTreeModelMetaClass = findMetaClassByAlias(dataSet);
if (forEntityTreeModelMetaClass != null) {
final EntityTree entityTree = reportsWizard.buildEntityTree(forEntityTreeModelMetaClass);
ReportRegion reportRegion = dataSetToReportRegion(dataSet, entityTree);
if (reportRegion != null) {
if (reportRegion.getRegionPropertiesRootNode() == null) {
notifications.create(Notifications.NotificationType.TRAY).withCaption(messages.getMessage(getClass(), "dataSet.entityAliasInvalid")).withDescription(getNameForEntityParameter(dataSet)).show();
// without that root node region editor form will not initialized correctly and became empty. just return
} else {
// Open editor and convert saved in editor ReportRegion item to Fetch plan
reportRegion.setReportData(dataManager.create(ReportData.class));
reportRegion.setBandNameFromReport(dataSet.getName());
Map<String, Object> editorParams = new HashMap<>();
editorParams.put("rootEntity", reportRegion.getRegionPropertiesRootNode());
editorParams.put("scalarOnly", Boolean.TRUE);
RegionEditor screen = screenBuilders.editor(ReportRegion.class, dataSetsTable.getFrame().getFrameOwner()).editEntity(reportRegion).withScreenClass(RegionEditor.class).withOpenMode(OpenMode.DIALOG).withOptions(new MapScreenOptions(editorParams)).build();
screen.setAsFetchPlanEditor(true);
screen.setUpdatePermission(secureOperations.isEntityUpdatePermitted(metadata.getClass(Report.class), policyStore));
screen.addAfterCloseListener(afterCloseEvent -> {
if (afterCloseEvent.closedWith(StandardOutcome.COMMIT)) {
RegionEditor editor = (RegionEditor) afterCloseEvent.getSource();
reportRegion.setRegionProperties(editor.getEditedEntity().getRegionProperties());
dataSet.setFetchPlan(reportRegionToFetchPlan(entityTree, reportRegion));
}
});
screen.show();
}
}
}
}
}
}
use of io.jmix.ui.screen.MapScreenOptions in project jmix by jmix-framework.
the class CubaScreens method createEditor.
@Override
public Screen createEditor(WindowInfo windowInfo, Entity item, OpenType openType, @Nullable Map<String, Object> params) {
params = createParametersMap(windowInfo, params);
params.put(WindowParams.ITEM.name(), item);
MapScreenOptions options = new MapScreenOptions(params);
Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
applyOpenTypeParameters(screen.getWindow(), openType);
EditorScreen editorScreen = (EditorScreen) screen;
// noinspection unchecked
editorScreen.setEntityToEdit(item);
return screen;
}
use of io.jmix.ui.screen.MapScreenOptions in project jmix by jmix-framework.
the class CubaScreens method openEditor.
@Override
public com.haulmont.cuba.gui.components.Window.Editor openEditor(WindowInfo windowInfo, Entity item, OpenType openType, Datasource parentDs) {
Map<String, Object> params = createParametersMap(windowInfo, Collections.singletonMap(WindowParams.ITEM.name(), item));
MapScreenOptions options = new MapScreenOptions(params);
Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
applyOpenTypeParameters(screen.getWindow(), openType);
EditorScreen editorScreen = (EditorScreen) screen;
if (editorScreen instanceof AbstractEditor) {
((AbstractEditor) editorScreen).setParentDs(parentDs);
}
editorScreen.setEntityToEdit(item);
show(screen);
return screen instanceof com.haulmont.cuba.gui.components.Window.Editor ? (com.haulmont.cuba.gui.components.Window.Editor) screen : new ScreenEditorWrapper(screen);
}
use of io.jmix.ui.screen.MapScreenOptions in project jmix by jmix-framework.
the class CubaScreens method openWindow.
@Override
public com.haulmont.cuba.gui.components.Window openWindow(WindowInfo windowInfo, OpenType openType) {
Map<String, Object> params = createParametersMap(windowInfo, Collections.emptyMap());
MapScreenOptions options = new MapScreenOptions(params);
Screen screen = createScreen(windowInfo, openType.getOpenMode(), options);
applyOpenTypeParameters(screen.getWindow(), openType);
show(screen);
return screen instanceof com.haulmont.cuba.gui.components.Window ? (com.haulmont.cuba.gui.components.Window) screen : new ScreenWrapper(screen);
}
Aggregations