Search in sources :

Example 6 with ReportOutputType

use of io.jmix.reports.entity.ReportOutputType in project jmix by jmix-framework.

the class TemplateEditor method updateOutputType.

protected void updateOutputType() {
    if (outputTypeField.getValue() == null) {
        String extension = FilenameUtils.getExtension(templateUploadField.getFileName()).toUpperCase();
        ReportOutputType reportOutputType = ReportOutputType.getTypeFromExtension(extension);
        if (reportOutputType != null) {
            outputTypeField.setValue(reportOutputType);
        }
    }
}
Also used : ReportOutputType(io.jmix.reports.entity.ReportOutputType)

Example 7 with ReportOutputType

use of io.jmix.reports.entity.ReportOutputType in project jmix by jmix-framework.

the class InputParametersFragment method updateOutputTypes.

protected void updateOutputTypes() {
    if (!containsAlterableTemplate(report)) {
        setOutputTypeVisible(false);
        return;
    }
    ReportTemplate template;
    if (report.getTemplates() != null && report.getTemplates().size() > 1) {
        template = templateComboBox.getValue();
    } else {
        template = report.getDefaultTemplate();
    }
    if (template != null && supportAlterableForTemplate(template)) {
        List<ReportOutputType> outputTypes = ReportPrintHelper.getInputOutputTypesMapping().get(template.getExt());
        if (outputTypes != null && !outputTypes.isEmpty()) {
            outputTypeComboBox.setOptionsList(outputTypes);
            if (outputTypeComboBox.getValue() == null) {
                outputTypeComboBox.setValue(template.getReportOutputType());
            }
            setOutputTypeVisible(true);
        } else {
            outputTypeComboBox.setValue(null);
            setOutputTypeVisible(false);
        }
    } else {
        outputTypeComboBox.setValue(null);
        setOutputTypeVisible(false);
    }
}
Also used : ReportTemplate(io.jmix.reports.entity.ReportTemplate) ReportOutputType(io.jmix.reports.entity.ReportOutputType)

Example 8 with ReportOutputType

use of io.jmix.reports.entity.ReportOutputType in project jmix by jmix-framework.

the class TemplateEditor method validateInputOutputFormats.

protected boolean validateInputOutputFormats() {
    ReportTemplate reportTemplate = getEditedEntity();
    String name = reportTemplate.getName();
    if (!Boolean.TRUE.equals(reportTemplate.getCustom()) && hasTemplateOutput(reportTemplate.getReportOutputType()) && name != null) {
        String inputType = name.contains(".") ? name.substring(name.lastIndexOf(".") + 1) : "";
        ReportOutputType outputTypeValue = outputTypeField.getValue();
        if (!ReportPrintHelper.getInputOutputTypesMapping().containsKey(inputType) || !ReportPrintHelper.getInputOutputTypesMapping().get(inputType).contains(outputTypeValue)) {
            notifications.create(Notifications.NotificationType.TRAY).withCaption(messages.getMessage(getClass(), "inputOutputTypesError")).show();
            return false;
        }
    }
    return true;
}
Also used : ReportTemplate(io.jmix.reports.entity.ReportTemplate) ReportOutputType(io.jmix.reports.entity.ReportOutputType)

Aggregations

ReportOutputType (io.jmix.reports.entity.ReportOutputType)8 ReportTemplate (io.jmix.reports.entity.ReportTemplate)5 OpenOfficeException (com.haulmont.yarg.exception.OpenOfficeException)1 ReportingInterruptedException (com.haulmont.yarg.exception.ReportingInterruptedException)1 NoFreePortsException (com.haulmont.yarg.formatters.impl.doc.connector.NoFreePortsException)1 ReportOutputDocument (com.haulmont.yarg.reporting.ReportOutputDocument)1 ReportingAPI (com.haulmont.yarg.reporting.ReportingAPI)1 RunParams (com.haulmont.yarg.reporting.RunParams)1 DataManager (io.jmix.core.DataManager)1 EntityStates (io.jmix.core.EntityStates)1 Id (io.jmix.core.Id)1 PrototypesLoader (io.jmix.reports.PrototypesLoader)1 ReportExecutionHistoryRecorder (io.jmix.reports.ReportExecutionHistoryRecorder)1 ReportsProperties (io.jmix.reports.ReportsProperties)1 ParameterPrototype (io.jmix.reports.app.ParameterPrototype)1 Report (io.jmix.reports.entity.Report)1 ReportExecution (io.jmix.reports.entity.ReportExecution)1 io.jmix.reports.exception (io.jmix.reports.exception)1 CustomFormatter (io.jmix.reports.libintegration.CustomFormatter)1 FluentReportRunner (io.jmix.reports.runner.FluentReportRunner)1