use of io.jmix.reports.entity.wizard.ReportData in project jmix by jmix-framework.
the class ReportWizardCreator method buildReport.
@Nullable
public Report buildReport(boolean temporary) {
ReportData reportData = reportDataDc.getItem();
// be sure that reportData.name and reportData.outputFileFormat is not null before generation of template
try {
byte[] templateByteArray = reportWizard.generateTemplate(reportData, reportData.getTemplateFileType());
reportData.setTemplateContent(templateByteArray);
} catch (TemplateGenerationException e) {
notifications.create(Notifications.NotificationType.WARNING).withCaption(messages.getMessage("templateGenerationException")).show();
return null;
}
MetaClass entityMetaClass = metadata.getClass(reportData.getEntityName());
String storeName = entityMetaClass.getStore().getName();
if (!Stores.isMain(storeName)) {
reportData.setDataStore(storeName);
}
Report report = reportWizard.toReport(reportData, temporary);
reportData.setGeneratedReport(report);
return report;
}
use of io.jmix.reports.entity.wizard.ReportData in project jmix by jmix-framework.
the class DetailsStepFragment method clearQuery.
protected void clearQuery() {
ReportData reportData = reportDataDc.getItem();
reportData.setQuery(null);
reportData.setQueryParameters(null);
}
use of io.jmix.reports.entity.wizard.ReportData in project jmix by jmix-framework.
the class SaveStepFragment method onDownloadTemplateFileClick.
@Subscribe("downloadTemplateFile")
public void onDownloadTemplateFileClick(Button.ClickEvent event) {
ReportData reportData = reportDataDc.getItem();
try {
TemplateFileType templateFileType = reportData.getTemplateFileType();
byte[] newTemplate = reportWizardService.generateTemplate(reportData, templateFileType);
downloader.download(new ByteArrayDataProvider(newTemplate, uiProperties.getSaveExportedByteArrayDataThresholdBytes(), coreProperties.getTempDir()), downloadTemplateFile.getCaption(), DownloadFormat.getByExtension(templateFileType.toString().toLowerCase()));
} catch (TemplateGenerationException e) {
notifications.create(Notifications.NotificationType.WARNING).withCaption(messages.getMessage(getClass(), "templateGenerationException")).show();
}
}
use of io.jmix.reports.entity.wizard.ReportData in project jmix by jmix-framework.
the class SaveStepFragment method beforeShow.
@Override
public void beforeShow() {
if (StringUtils.isEmpty(outputFileName.getValue())) {
ReportData reportData = reportDataDc.getItem();
outputFileName.setValue(generateOutputFileName(reportData.getTemplateFileType().toString().toLowerCase()));
}
initChartPreview();
}
use of io.jmix.reports.entity.wizard.ReportData in project jmix by jmix-framework.
the class DetailsStepFragment method onEntityValueChange.
@Subscribe("entityField")
public void onEntityValueChange(HasValue.ValueChangeEvent<MetaClass> event) {
ReportData reportData = reportDataDc.getItem();
updateReportEntity(event.getPrevValue(), event.getValue(), reportData);
}
Aggregations