Search in sources :

Example 11 with ReportTemplate

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());
}
Also used : ReportTemplate(io.jmix.reports.entity.ReportTemplate)

Example 12 with ReportTemplate

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);
        }
    }
}
Also used : FluentUiReportRunner(io.jmix.reportsui.runner.FluentUiReportRunner) ValidationErrors(io.jmix.ui.component.ValidationErrors) Report(io.jmix.reports.entity.Report) ReportTemplate(io.jmix.reports.entity.ReportTemplate)

Example 13 with ReportTemplate

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);
    }
}
Also used : Report(io.jmix.reports.entity.Report) ReportTemplate(io.jmix.reports.entity.ReportTemplate)

Example 14 with ReportTemplate

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);
    }
}
Also used : Report(io.jmix.reports.entity.Report) ReportTemplate(io.jmix.reports.entity.ReportTemplate)

Example 15 with 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);
}
Also used : ScreenFragment(io.jmix.ui.screen.ScreenFragment) DataManager(io.jmix.core.DataManager) ReportTemplate(io.jmix.reports.entity.ReportTemplate) Subscribe(io.jmix.ui.screen.Subscribe) CheckBox(io.jmix.ui.component.CheckBox) UiController(io.jmix.ui.screen.UiController) ReportOutputType(io.jmix.reports.entity.ReportOutputType) Autowired(org.springframework.beans.factory.annotation.Autowired) UUID(java.util.UUID) WidgetParam(io.jmix.dashboardsui.annotation.WidgetParam) Collectors(java.util.stream.Collectors) UiDescriptor(io.jmix.ui.screen.UiDescriptor) WindowParam(io.jmix.ui.WindowParam) HasValue(io.jmix.ui.component.HasValue) List(java.util.List) EntityComboBox(io.jmix.ui.component.EntityComboBox) Report(io.jmix.reports.entity.Report) Report(io.jmix.reports.entity.Report) ReportTemplate(io.jmix.reports.entity.ReportTemplate) Subscribe(io.jmix.ui.screen.Subscribe)

Aggregations

ReportTemplate (io.jmix.reports.entity.ReportTemplate)26 Report (io.jmix.reports.entity.Report)14 ReportOutputType (io.jmix.reports.entity.ReportOutputType)6 ReportOutputDocument (com.haulmont.yarg.reporting.ReportOutputDocument)4 Subscribe (io.jmix.ui.screen.Subscribe)3 List (java.util.List)3 DataManager (io.jmix.core.DataManager)2 PivotTableData (io.jmix.reports.entity.PivotTableData)2 ReportRunContext (io.jmix.reports.runner.ReportRunContext)2 HashMap (java.util.HashMap)2 Collectors (java.util.stream.Collectors)2 ZipArchiveEntry (org.apache.commons.compress.archivers.zip.ZipArchiveEntry)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 OpenOfficeException (com.haulmont.yarg.exception.OpenOfficeException)1 ReportingInterruptedException (com.haulmont.yarg.exception.ReportingInterruptedException)1 NoFreePortsException (com.haulmont.yarg.formatters.impl.doc.connector.NoFreePortsException)1 ReportingAPI (com.haulmont.yarg.reporting.ReportingAPI)1 RunParams (com.haulmont.yarg.reporting.RunParams)1 EntityStates (io.jmix.core.EntityStates)1 Id (io.jmix.core.Id)1