use of io.jmix.reportsui.runner.FluentUiReportRunner in project jmix by jmix-framework.
the class QueryStepFragment method onRunBtnClick.
@Subscribe("runBtn")
public void onRunBtnClick(Button.ClickEvent event) {
ReportWizardCreator reportWizardCreator = (ReportWizardCreator) getFragment().getFrameOwner().getHostController();
lastGeneratedTmpReport = reportWizardCreator.buildReport(true);
if (lastGeneratedTmpReport != null) {
FluentUiReportRunner fluentRunner = uiReportRunner.byReportEntity(lastGeneratedTmpReport).withParametersDialogShowMode(ParametersDialogShowMode.IF_REQUIRED);
if (reportsClientProperties.getUseBackgroundReportProcessing()) {
fluentRunner.inBackground(getFragment().getFrameOwner());
}
fluentRunner.runAndShow();
}
}
use of io.jmix.reportsui.runner.FluentUiReportRunner in project jmix by jmix-framework.
the class InputParametersDialog method onPrintReportButtonClick.
@Subscribe("printReportButton")
public void onPrintReportButtonClick(Button.ClickEvent event) {
if (inputParametersFragment.getReport() != null) {
ValidationErrors validationErrors = screenValidation.validateUiComponents(getWindow());
crossValidateParameters(validationErrors);
if (validationErrors.isEmpty()) {
ReportTemplate template = inputParametersFragment.getReportTemplate();
if (template != null) {
templateCode = template.getCode();
}
Report report = inputParametersFragment.getReport();
Map<String, Object> parameters = inputParametersFragment.collectParameters();
FluentUiReportRunner fluentRunner = uiReportRunner.byReportEntity(report).withParams(parameters).withTemplateCode(templateCode).withOutputNamePattern(outputFileName).withOutputType(inputParametersFragment.getOutputType()).withParametersDialogShowMode(ParametersDialogShowMode.NO);
if (inBackground) {
fluentRunner.inBackground(this);
}
if (bulkPrint) {
fluentRunner.runMultipleReports(inputParameter.getAlias(), selectedEntities);
} else {
fluentRunner.runAndShow();
}
} else {
screenValidation.showValidationErrors(this, validationErrors);
}
}
}
use of io.jmix.reportsui.runner.FluentUiReportRunner 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.reportsui.runner.FluentUiReportRunner in project jmix by jmix-framework.
the class AbstractPrintFormAction method runAndShow.
public void runAndShow(Report report, FrameOwner screen, ReportInputParameter reportInputParameter, Object parameterValue, @Nullable String outputFileName) {
List<ReportInputParameter> params = report.getInputParameters();
boolean reportHasMoreThanOneParameter = params != null && params.size() > 1;
boolean inputParametersRequiredByTemplates = inputParametersRequiredByTemplates(report);
Object resultingParamValue = convertParameterIfNecessary(reportInputParameter, parameterValue, reportHasMoreThanOneParameter || inputParametersRequiredByTemplates);
boolean reportTypeIsSingleEntity = ParameterType.ENTITY == reportInputParameter.getType() && resultingParamValue instanceof Collection;
boolean moreThanOneEntitySelected = resultingParamValue instanceof Collection && ((Collection) resultingParamValue).size() > 1;
if (reportHasMoreThanOneParameter || inputParametersRequiredByTemplates) {
boolean bulkPrint = reportTypeIsSingleEntity && moreThanOneEntitySelected;
openReportParamsDialog(report, ParamsMap.of(reportInputParameter.getAlias(), resultingParamValue), outputFileName, reportInputParameter, bulkPrint);
} else {
FluentUiReportRunner fluentRunner = uiReportRunner.byReportEntity(report).withParametersDialogShowMode(ParametersDialogShowMode.NO).withOutputNamePattern(outputFileName);
if (reportsClientProperties.getUseBackgroundReportProcessing()) {
fluentRunner.inBackground(screen);
}
if (reportTypeIsSingleEntity) {
Collection selectedEntities = (Collection) resultingParamValue;
if (moreThanOneEntitySelected) {
fluentRunner.runMultipleReports(reportInputParameter.getAlias(), selectedEntities);
} else if (selectedEntities.size() == 1) {
fluentRunner.addParam(reportInputParameter.getAlias(), selectedEntities.iterator().next()).runAndShow();
}
} else {
fluentRunner.addParam(reportInputParameter.getAlias(), resultingParamValue).runAndShow();
}
}
}
use of io.jmix.reportsui.runner.FluentUiReportRunner in project jmix by jmix-framework.
the class ReportRun method onReportsTableRunReport.
@Subscribe("reportsTable.runReport")
protected void onReportsTableRunReport(Action.ActionPerformedEvent event) {
Report report = reportsTable.getSingleSelected();
if (report != null) {
report = dataManager.load(Id.of(report)).fetchPlan("report.edit").one();
FluentUiReportRunner fluentRunner = uiReportRunner.byReportEntity(report).withParametersDialogShowMode(ParametersDialogShowMode.IF_REQUIRED);
if (reportsClientProperties.getUseBackgroundReportProcessing()) {
fluentRunner.inBackground(ReportRun.this);
}
fluentRunner.runAndShow();
}
}
Aggregations