use of io.jmix.reportsui.screen.report.wizard.region.RegionEditor in project jmix by jmix-framework.
the class RegionsStepFragment method showRegionEditor.
protected void showRegionEditor(ReportRegion item, Map<String, Object> editorParams) {
RegionEditor regionEditor = screenBuilders.editor(ReportRegion.class, getFragment().getFrameOwner()).withScreenClass(RegionEditor.class).editEntity(item).withOpenMode(OpenMode.DIALOG).withContainer(reportRegionsDc).withOptions(new MapScreenOptions(editorParams)).build();
regionEditor.show();
}
use of io.jmix.reportsui.screen.report.wizard.region.RegionEditor 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();
}
}
}
}
}
}
Aggregations