Search in sources :

Example 6 with MapScreenOptions

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);
}
Also used : ScreenWrapper(com.haulmont.cuba.gui.screen.compatibility.ScreenWrapper) LookupScreen(io.jmix.ui.screen.LookupScreen) EditorScreen(io.jmix.ui.screen.EditorScreen) Screen(io.jmix.ui.screen.Screen) MapScreenOptions(io.jmix.ui.screen.MapScreenOptions)

Example 7 with MapScreenOptions

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();
                    }
                }
            }
        }
    }
}
Also used : RegionEditor(io.jmix.reportsui.screen.report.wizard.region.RegionEditor) MetaClass(io.jmix.core.metamodel.model.MetaClass) HashMap(java.util.HashMap) ReportData(io.jmix.reports.entity.wizard.ReportData) MapScreenOptions(io.jmix.ui.screen.MapScreenOptions) EntityTree(io.jmix.reports.app.EntityTree) ReportRegion(io.jmix.reports.entity.wizard.ReportRegion)

Example 8 with MapScreenOptions

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;
}
Also used : EditorScreen(io.jmix.ui.screen.EditorScreen) LookupScreen(io.jmix.ui.screen.LookupScreen) EditorScreen(io.jmix.ui.screen.EditorScreen) Screen(io.jmix.ui.screen.Screen) MapScreenOptions(io.jmix.ui.screen.MapScreenOptions)

Example 9 with MapScreenOptions

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);
}
Also used : EditorScreen(io.jmix.ui.screen.EditorScreen) LookupScreen(io.jmix.ui.screen.LookupScreen) EditorScreen(io.jmix.ui.screen.EditorScreen) Screen(io.jmix.ui.screen.Screen) MapScreenOptions(io.jmix.ui.screen.MapScreenOptions) AbstractEditor(com.haulmont.cuba.gui.components.AbstractEditor) ScreenEditorWrapper(com.haulmont.cuba.gui.screen.compatibility.ScreenEditorWrapper)

Example 10 with MapScreenOptions

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);
}
Also used : ScreenWrapper(com.haulmont.cuba.gui.screen.compatibility.ScreenWrapper) LookupScreen(io.jmix.ui.screen.LookupScreen) EditorScreen(io.jmix.ui.screen.EditorScreen) Screen(io.jmix.ui.screen.Screen) MapScreenOptions(io.jmix.ui.screen.MapScreenOptions)

Aggregations

MapScreenOptions (io.jmix.ui.screen.MapScreenOptions)20 Screen (io.jmix.ui.screen.Screen)11 EditorScreen (io.jmix.ui.screen.EditorScreen)9 LookupScreen (io.jmix.ui.screen.LookupScreen)8 MetaClass (io.jmix.core.metamodel.model.MetaClass)4 HashMap (java.util.HashMap)4 LegacyFrame (com.haulmont.cuba.gui.screen.compatibility.LegacyFrame)3 ScreenEditorWrapper (com.haulmont.cuba.gui.screen.compatibility.ScreenEditorWrapper)3 AbstractEditor (com.haulmont.cuba.gui.components.AbstractEditor)2 SelectHandlerAdapter (com.haulmont.cuba.gui.components.compatibility.SelectHandlerAdapter)2 ScreenLookupWrapper (com.haulmont.cuba.gui.screen.compatibility.ScreenLookupWrapper)2 ScreenWrapper (com.haulmont.cuba.gui.screen.compatibility.ScreenWrapper)2 Screens (io.jmix.ui.Screens)2 ScreenFragment (io.jmix.ui.screen.ScreenFragment)2 EntityLoadInfo (com.haulmont.cuba.core.global.EntityLoadInfo)1 WindowManager (com.haulmont.cuba.gui.WindowManager)1 OpenType (com.haulmont.cuba.gui.WindowManager.OpenType)1 Filter (com.haulmont.cuba.gui.components.Filter)1 LegacyFragmentAdapter (com.haulmont.cuba.gui.components.compatibility.LegacyFragmentAdapter)1 DsContextImplementation (com.haulmont.cuba.gui.data.impl.DsContextImplementation)1