protected boolean validateInputOutputFormats() { ReportTemplate reportTemplate = getItem(); 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 = outputType.getValue(); if (!ReportPrintHelper.getInputOutputTypesMapping().containsKey(inputType) || !ReportPrintHelper.getInputOutputTypesMapping().get(inputType).contains(outputTypeValue)) { showNotification(getMessage("inputOutputTypesError"), NotificationType.TRAY); return false; } } return true; }
protected boolean validateTemplateFile() { ReportTemplate template = getItem(); if (!Boolean.TRUE.equals(template.getCustom()) && hasTemplateOutput(template.getReportOutputType()) && template.getContent() == null) { StringBuilder notification = new StringBuilder(getMessage("template.uploadTemplate")); if (StringUtils.isEmpty(template.getCode())) { notification.append("\n").append(getMessage("template.codeMsg")); } if (template.getOutputType() == null) { notification.append("\n").append(getMessage("template.outputTypeMsg")); } showNotification(getMessage("validationFail.caption"), notification.toString(), NotificationType.TRAY); return false; } return true; } }
@Override public void ready() { super.ready(); ReportTemplate reportTemplate = getItem(); initTemplateEditor(reportTemplate); getDescriptionEditFrames().forEach(controller -> controller.setItem(reportTemplate)); setupVisibility(reportTemplate.getCustom(), reportTemplate.getReportOutputType()); }
public boolean supportAlterableForTemplate(ReportTemplate template) { if (BooleanUtils.isTrue(template.getCustom())) { return false; } if (template.getReportOutputType() == ReportOutputType.CHART || template.getReportOutputType() == ReportOutputType.TABLE) { return false; } return BooleanUtils.isTrue(template.getAlterable()); } }
@Override protected void postInit() { super.postInit(); initUploadField(); templateDs.addItemPropertyChangeListener(e -> { ReportTemplate reportTemplate = getItem(); if ("reportOutputType".equals(e.getProperty())) { ReportOutputType prevOutputType = (ReportOutputType) e.getPrevValue(); ReportOutputType newOutputType = (ReportOutputType) e.getValue(); setupVisibility(reportTemplate.getCustom(), newOutputType); if (hasHtmlCsvTemplateOutput(prevOutputType) && !hasTemplateOutput(newOutputType)) { showMessageDialog(getMessage("templateEditor.warning"), getMessage("templateEditor.clearTemplateMessage"), MessageType.CONFIRMATION); } } else if ("custom".equals(e.getProperty())) { setupVisibility(Boolean.TRUE.equals(e.getValue()), reportTemplate.getReportOutputType()); } }); initOutputTypeList(); }
if (!Boolean.TRUE.equals(reportTemplate.getCustom())) { reportTemplate.setCustomDefinition("");