use of io.jmix.reports.entity.ReportTemplate in project jmix by jmix-framework.
the class TemplateEditor method onBeforeShow.
@Subscribe
protected void onBeforeShow(BeforeShowEvent event) {
initUploadField();
ReportTemplate reportTemplate = getEditedEntity();
initTemplateEditor(reportTemplate);
getDescriptionEditFragments().forEach(controller -> controller.setItem(reportTemplate));
setupVisibility(reportTemplate.getCustom(), reportTemplate.getReportOutputType());
}
use of io.jmix.reports.entity.ReportTemplate 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.reports.entity.ReportTemplate in project jmix by jmix-framework.
the class ReportEditTemplatesFragment method templatesTableRemoveAfterActionPerformedHandler.
@Install(to = "templatesTable.remove", subject = "afterActionPerformedHandler")
protected void templatesTableRemoveAfterActionPerformedHandler(RemoveOperation.AfterActionPerformedEvent<ReportTemplate> event) {
List<ReportTemplate> selected = event.getItems();
Report report = reportDc.getItem();
ReportTemplate defaultTemplate = report.getDefaultTemplate();
if (defaultTemplate != null && selected.contains(defaultTemplate)) {
ReportTemplate newDefaultTemplate = null;
if (templatesDc.getItems().size() == 1) {
newDefaultTemplate = templatesDc.getItems().iterator().next();
}
report.setDefaultTemplate(newDefaultTemplate);
}
}
use of io.jmix.reports.entity.ReportTemplate in project jmix by jmix-framework.
the class ReportEditTemplatesFragment method templatesTableCreateAfterCommitHandler.
@Install(to = "templatesTable.create", subject = "afterCommitHandler")
protected void templatesTableCreateAfterCommitHandler(ReportTemplate reportTemplate) {
Report report = reportDc.getItem();
ReportTemplate defaultTemplate = reportDc.getItem().getDefaultTemplate();
if (defaultTemplate == null) {
report.setDefaultTemplate(reportTemplate);
}
}
use of io.jmix.reports.entity.ReportTemplate in project jmix by jmix-framework.
the class ChartWidgetEdit method onInit.
@Subscribe
public void onInit(InitEvent initEvent) {
if (reportId != null) {
Report report = dataManager.load(Report.class).id(reportId).fetchPlan("report.edit").optional().orElse(null);
if (report != null) {
List<ReportTemplate> chartTemplates = getChartsTemplates(report);
ReportTemplate reportTemplate = null;
if (templateId != null) {
reportTemplate = chartTemplates.stream().filter(t -> templateId.equals(t.getId())).findFirst().orElse(ReportOutputType.CHART == report.getDefaultTemplate().getReportOutputType() ? report.getDefaultTemplate() : null);
}
reportComboBox.setValue(report);
templateComboBox.setOptionsList(chartTemplates);
templateComboBox.setValue(reportTemplate);
}
}
refreshAutomaticallyCheckbox.setValue(refreshAutomatically);
}
Aggregations