use of io.jmix.reports.entity.PivotTableData in project jmix by jmix-framework.
the class ShowPivotTableScreen method onBeforeShow.
@Subscribe
protected void onBeforeShow(BeforeShowEvent event) {
if (report != null) {
reportSelectorBox.setVisible(false);
if (pivotTableData != null) {
PivotTableData result = (PivotTableData) serialization.deserialize(pivotTableData);
initFragments(result.getPivotTableJson(), result.getValues(), params);
}
} else {
showStubText();
}
reportEntityComboBox.addValueChangeListener(e -> {
report = e.getValue();
initFragments(null, null, null);
initReportTemplatesComboBox();
});
}
use of io.jmix.reports.entity.PivotTableData in project jmix by jmix-framework.
the class ShowPivotTableScreen method printReport.
@Subscribe("printReportBtn")
protected void printReport(Button.ClickEvent event) {
if (inputParametersFragment != null && inputParametersFragment.getReport() != null) {
ValidationErrors validationErrors = screenValidation.validateUiComponents(getWindow());
if (validationErrors.isEmpty()) {
Map<String, Object> parameters = inputParametersFragment.collectParameters();
Report report = inputParametersFragment.getReport();
String resultTemplateCode = templateCode;
if (templateCode == null) {
if (reportTemplateComboBox.getValue() != null) {
resultTemplateCode = reportTemplateComboBox.getValue().getCode();
} else {
resultTemplateCode = report.getTemplates().stream().filter(template -> template.getReportOutputType() == ReportOutputType.PIVOT_TABLE).findFirst().map(ReportTemplate::getCode).orElse(null);
}
}
ReportOutputDocument document = reportRunner.byReportEntity(report).withParams(parameters).withTemplateCode(resultTemplateCode).run();
PivotTableData result = (PivotTableData) serialization.deserialize(document.getContent());
openPivotTable(result.getPivotTableJson(), result.getValues());
} else {
screenValidation.showValidationErrors(this, validationErrors);
}
}
}
use of io.jmix.reports.entity.PivotTableData in project jmix by jmix-framework.
the class PivotTableFormatter method renderDocument.
@Override
public void renderDocument() {
PivotTableDescription pivotTableDescription = ((ReportTemplate) reportTemplate).getPivotTableDescription();
beanFactory.getBean(StandardSerialization.class).serialize(new PivotTableData(PivotTableDescription.toJsonString(pivotTableDescription), getEntries(pivotTableDescription)), outputStream);
}
Aggregations