use of io.jmix.reports.entity.Report in project jmix by jmix-framework.
the class ReportBrowser method reloadReport.
private Report reloadReport(Report report, FetchPlan fetchPlan) {
MetaClass metaClass = metadata.getClass(Report.class);
LoadContext<Report> lc = new LoadContext<>(metaClass);
lc.setId(report.getId());
lc.setFetchPlan(fetchPlan);
report = dataManager.load(lc);
return report;
}
use of io.jmix.reports.entity.Report in project jmix by jmix-framework.
the class ReportBrowser method onTableRunReport.
@Subscribe("reportsTable.runReport")
protected void onTableRunReport(Action.ActionPerformedEvent event) {
Report report = reportsTable.getSingleSelected();
report = reloadReport(report, fetchPlanRepository.findFetchPlan(metadata.getClass(Report.class), "report.edit"));
if (CollectionUtils.isNotEmpty(report.getInputParameters()) || inputParametersRequiredByTemplates(report)) {
InputParametersDialog inputParametersDialog = screens.create(InputParametersDialog.class, OpenMode.DIALOG, new MapScreenOptions(ParamsMap.of("report", report)));
inputParametersDialog.setInBackground(reportsClientProperties.getUseBackgroundReportProcessing());
inputParametersDialog.show().addAfterCloseListener(e -> {
reportsTable.focus();
});
} else {
FluentUiReportRunner fluentRunner = uiReportRunner.byReportEntity(report).withParams(Collections.emptyMap());
if (reportsClientProperties.getUseBackgroundReportProcessing()) {
fluentRunner.inBackground(ReportBrowser.this);
}
fluentRunner.runAndShow();
}
}
use of io.jmix.reports.entity.Report in project jmix by jmix-framework.
the class ReportBrowser method onTableCopy.
@Subscribe("reportsTable.copy")
protected void onTableCopy(Action.ActionPerformedEvent event) {
Report report = reportsTable.getSingleSelected();
if (report != null) {
copyReport(report);
reportDl.load();
} else {
notifications.create(Notifications.NotificationType.HUMANIZED).withCaption(messages.getMessage(getClass(), "notification.selectReport")).show();
}
}
use of io.jmix.reports.entity.Report in project jmix by jmix-framework.
the class ReportBrowser method onPopupCreateBtnWizard.
@Subscribe("popupCreateBtn.wizard")
protected void onPopupCreateBtnWizard(Action.ActionPerformedEvent event) {
ReportWizardCreator wizard = screens.create(ReportWizardCreator.class, OpenMode.DIALOG);
wizard.addAfterCloseListener(e -> {
if (e.closedWith(StandardOutcome.COMMIT)) {
Report item = wizard.getItem().getGeneratedReport();
reportDc.getMutableItems().add(item);
reportsTable.setSelected(item);
ReportEditor reportEditor = (ReportEditor) screenBuilders.editor(reportsTable).withOpenMode(OpenMode.THIS_TAB).build();
reportEditor.show().addAfterCloseListener(closeEvent -> {
if (closeEvent.closedWith(StandardOutcome.COMMIT)) {
reportDc.replaceItem(reportEditor.getEditedEntity());
}
reportsTable.expandPath(reportDc.getItem(reportEditor.getEditedEntity()));
});
}
});
wizard.show();
}
use of io.jmix.reports.entity.Report in project jmix by jmix-framework.
the class ShowReportTableScreen method printReport.
@Subscribe("printReportBtn")
protected void printReport(Button.ClickEvent button) {
if (inputParametersFrame != null && inputParametersFrame.getReport() != null) {
ValidationErrors validationErrors = screenValidation.validateUiComponents(getWindow());
if (validationErrors.isEmpty()) {
Map<String, Object> parameters = inputParametersFrame.collectParameters();
Report report = inputParametersFrame.getReport();
if (templateCode == null || templateCode.isEmpty())
templateCode = findTableCode(report);
ReportOutputDocument reportResult = reportRunner.byReportEntity(report).withParams(parameters).withTemplateCode(templateCode).run();
JmixTableData dto = (JmixTableData) serialization.deserialize(reportResult.getContent());
drawTables(dto);
} else {
screenValidation.showValidationErrors(this, validationErrors);
}
}
}
Aggregations