Search in sources :

Example 6 with WorksheetContent

use of org.isisaddons.module.excel.dom.WorksheetContent in project estatio by estatio.

the class IncomingInvoiceDownloadManager method downloadToExcel.

@Action(semantics = SemanticsOf.SAFE)
public Blob downloadToExcel(final String fileName) {
    final List<IncomingInvoiceExport> exports = getInvoiceItems().stream().map(item -> new IncomingInvoiceExport(item, documentNumberFor(item), codaElementFor(item), commentsFor(item))).sorted(// guard only for (demo)fixtures because in production a document can be expected
    Comparator.comparing(x -> x.getDocumentNumber() != null ? x.getDocumentNumber() : "_No_Document")).collect(Collectors.toList());
    WorksheetSpec spec = new WorksheetSpec(IncomingInvoiceDownloadManager.exportClass, "invoiceExport");
    WorksheetContent worksheetContent = new WorksheetContent(exports, spec);
    return excelService.toExcel(worksheetContent, fileName);
}
Also used : WorksheetSpec(org.isisaddons.module.excel.dom.WorksheetSpec) WorksheetContent(org.isisaddons.module.excel.dom.WorksheetContent) Action(org.apache.isis.applib.annotation.Action)

Example 7 with WorksheetContent

use of org.isisaddons.module.excel.dom.WorksheetContent in project estatio by estatio.

the class KeyItemImportExportManager method export.

// region > export (action)
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-download")
@MemberOrder(name = "keyItems", sequence = "1")
public Blob export() {
    final String fileName = withExtension(getFileName(), ".xlsx");
    WorksheetSpec spec = new WorksheetSpec(KeyItemImportExportLineItem.class, "keyItems");
    WorksheetContent worksheetContent = new WorksheetContent(getKeyItems(), spec);
    return excelService.toExcel(worksheetContent, fileName);
}
Also used : WorksheetSpec(org.isisaddons.module.excel.dom.WorksheetSpec) WorksheetContent(org.isisaddons.module.excel.dom.WorksheetContent) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 8 with WorksheetContent

use of org.isisaddons.module.excel.dom.WorksheetContent in project estatio by estatio.

the class InvoiceImportManager method downloadTemplate.

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-download")
public Blob downloadTemplate() {
    final String fileName = "template.xlsx";
    WorksheetSpec spec = new WorksheetSpec(InvoiceImportLine.class, "invoiceImportLine");
    WorksheetContent worksheetContent = new WorksheetContent(getLines(), spec);
    return excelService.toExcel(worksheetContent, fileName);
}
Also used : WorksheetSpec(org.isisaddons.module.excel.dom.WorksheetSpec) WorksheetContent(org.isisaddons.module.excel.dom.WorksheetContent) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Aggregations

Action (org.apache.isis.applib.annotation.Action)8 WorksheetContent (org.isisaddons.module.excel.dom.WorksheetContent)8 WorksheetSpec (org.isisaddons.module.excel.dom.WorksheetSpec)8 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)7 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)4 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 CollectionLayout (org.apache.isis.applib.annotation.CollectionLayout)2 Contributed (org.apache.isis.applib.annotation.Contributed)2 DomainObject (org.apache.isis.applib.annotation.DomainObject)2 Nature (org.apache.isis.applib.annotation.Nature)2 SemanticsOf (org.apache.isis.applib.annotation.SemanticsOf)2 Blob (org.apache.isis.applib.value.Blob)2 ExcelService (org.isisaddons.module.excel.dom.ExcelService)2 Inject (javax.inject.Inject)1 Getter (lombok.Getter)1 NoArgsConstructor (lombok.NoArgsConstructor)1 Setter (lombok.Setter)1 Parameter (org.apache.isis.applib.annotation.Parameter)1 Programmatic (org.apache.isis.applib.annotation.Programmatic)1