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);
}
}
}
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);
}
}
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;
}
Aggregations