Code Monkey home page Code Monkey logo

gridexporteraddon's People

Contributors

brunoagretti avatar dominik42 avatar flang avatar flowingcodeci avatar javier-godoy avatar koendecock avatar mlopezfc avatar ngonzalezpazfc avatar paodb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gridexporteraddon's Issues

export to PDF it fails when you are using vaadin 24.0.5

Using the gridExporter (https://vaadin.com/directory/component/grid-exporter-add-on ) in V24 , when you try to export a PDF you get the following error:

Exception in thread "Thread-21" java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
at com.flowingcode.vaadin.addons.gridexporter.PdfInputStreamFactory$1.run(PdfInputStreamFactory.java:64)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.ValidationEventHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 2 more

Exception "Cannot join cells that are not adjacent" when navigating around

I have an application with several views, all of them containing a Grid. Navigating between the views gives the following exception when I navigate to a certain grid for the second time.

java.lang.IllegalArgumentException: Cannot join cells that are not adjacent
	at com.vaadin.flow.component.grid.AbstractRow.lambda$join$6(AbstractRow.java:276) ~[vaadin-grid-flow-23.1.3.jar:na]
	at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104) ~[na:na]
	at java.base/java.util.stream.IntPipeline$Head.forEach(IntPipeline.java:617) ~[na:na]
	at com.vaadin.flow.component.grid.AbstractRow.join(AbstractRow.java:274) ~[vaadin-grid-flow-23.1.3.jar:na]
	at com.vaadin.flow.component.grid.FooterRow.join(FooterRow.java:76) ~[vaadin-grid-flow-23.1.3.jar:na]
	at com.vaadin.flow.component.grid.FooterRow.join(FooterRow.java:30) ~[vaadin-grid-flow-23.1.3.jar:na]
	at com.vaadin.flow.component.grid.AbstractRow.join(AbstractRow.java:201) ~[vaadin-grid-flow-23.1.3.jar:na]
	at com.vaadin.flow.component.grid.FooterRow.join(FooterRow.java:30) ~[vaadin-grid-flow-23.1.3.jar:na]
	at com.flowingcode.vaadin.addons.gridhelpers.FooterToolbarGridHelper.setFooterToolbar(FooterToolbarGridHelper.java:24) ~[grid-helpers-0.2.0.jar:0.2.0]
	at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.addToolbarFooter(GridHelper.java:295) ~[grid-helpers-0.2.0.jar:0.2.0]
	at com.flowingcode.vaadin.addons.gridexporter.GridExporter.lambda$createFor$afa35fd0$1(GridExporter.java:102) ~[grid-exporter-addon-1.0.1.jar:1.0.1]

Combine GridExporter and GridHelper toolbar components in one toolbar

I would like to propose an enhancement.

It would be nice to have the export buttons combined with components in the toolbar generated by GridHelper.addToolbarFooter(). At the moment it is one or the other.
I think that would be easy if a third createFor static method on GridExporter is added that takes the Component provided to addToolbarFooter as an input, and adds the Anchors on that i.s.o the HorizontalLayout used now. After the createFor I can add the input Component (now with the export anchors) in the footer by calling GridHelper.addToolbarFooter() in my code.

Thanks in advance.

Component column headers are not exported

As explained in https://stackoverflow.com/a/74380144/1297272, component headers are exported as empty strings (because GridHelpers only retrieves string headers)

Grid<String> grid = new Grid<>();
Column<String> col1 = grid.addColumn(x -> x).setHeader("Has text header");
Column<String> col2 = grid.addColumn(x -> x).setHeader(new Span("Text header"));
System.out.println(GridHelper.getHeader(grid, col1));
System.out.println(GridHelper.getHeader(grid, col2)); //prints an empty string

Implement a feature that allows setting custom headers/footers for GridExport.

Also, consider defaulting component headers to column.getHeaderComponent().getElement().getTextRecursively() if Vaadin version is 23.2+ (for now, use reflection since 23.1 has to be supported)

Compilation error / Vaadin 24.0.0.beta1

Error:  Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project grid-exporter-addon: Compilation failure: 
Error:  /src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java:[196,12] cannot find symbol
Error:    symbol:   method getValueProviders()
Error:    location: variable r of type com.vaadin.flow.data.renderer.Renderer<T>

if (r.getValueProviders().size()>0) {
value = r.getValueProviders().values().iterator().next().apply(item);
} else if (r instanceof BasicRenderer) {

ClassNotFoundException: org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream

I've just upgraded the demos to 24.2.0.alpha2 and export fails with

(excel)

java.lang.ClassNotFoundException: org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[na:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[na:na]
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) ~[app.jar:1.0.0-SNAPSHOT]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
        at org.apache.poi.poifs.filesystem.FileMagic.valueOf(FileMagic.java:209) ~[poi-5.2.3.jar!/:5.2.3]
        at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:222) ~[poi-5.2.3.jar!/:5.2.3]
        at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:185) ~[poi-5.2.3.jar!/:5.2.3]
        at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.getBaseTemplateWorkbook(ExcelInputStreamFactory.java:289) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
        at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:79) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
        at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.StreamResource$Pipe.accept(StreamResource.java:83) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.communication.StreamResourceHandler.handleRequest(StreamResourceHandler.java:86) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.communication.StreamRequestHandler.handleRequest(StreamRequestHandler.java:110) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1529) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) ~[vaadin-spring-24.2.0.alpha2.jar!/:na]

PDF

java.lang.ClassNotFoundException: org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[na:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[na:na]
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) ~[app.jar:1.0.0-SNAPSHOT]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]
        at com.flowingcode.vaadin.addons.gridexporter.DocxInputStreamFactory.getBaseTemplateDoc(DocxInputStreamFactory.java:383) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
        at com.flowingcode.vaadin.addons.gridexporter.DocxInputStreamFactory.createDoc(DocxInputStreamFactory.java:106) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
        at com.flowingcode.vaadin.addons.gridexporter.PdfInputStreamFactory.createInputStream(PdfInputStreamFactory.java:53) ~[grid-exporter-addon-2.0.0-SNAPSHOT.jar!/:2.0.0-SNAPSHOT]
        at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.StreamResource$Pipe.accept(StreamResource.java:83) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.communication.StreamResourceHandler.handleRequest(StreamResourceHandler.java:86) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.communication.StreamRequestHandler.handleRequest(StreamRequestHandler.java:110) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1529) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:398) ~[flow-server-24.2.0.alpha2.jar!/:24.2.0.alpha2]
        at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) ~[vaadin-spring-24.2.0.alpha2.jar!/:na]

SAX Feature Unsupported

Exporting to EXCEL produces the following error:

java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalStylesheet at org.docx4j.org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571) ~[xalan-interpretive-8.0.0.jar:na] at org.apache.poi.util.XMLHelper.trySet(XMLHelper.java:283) ~[poi-5.2.2.jar:5.2.2] at org.apache.poi.util.XMLHelper.getTransformerFactory(XMLHelper.java:224) ~[poi-5.2.2.jar:5.2.2] at org.apache.poi.util.XMLHelper.newTransformer(XMLHelper.java:230) ~[poi-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.StreamHelper.saveXmlInStream(StreamHelper.java:56) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.saveImpl(ZipContentTypeManager.java:68) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.save(ContentTypeManager.java:450) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:563) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1490) ~[poi-ooxml-5.2.2.jar:5.2.2] at org.apache.poi.ooxml.POIXMLDocument.write(POIXMLDocument.java:227) ~[poi-ooxml-5.2.2.jar:5.2.2] at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory$1.run(ExcelInputStreamFactory.java:103) ~[grid-exporter-addon-1.2.1.jar:1.2.1] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

Exporting LocalDateRenderer cells does not work

LocalDateRenderer does not extend LitRenderer.
The start of the stacktrace:

java.lang.IllegalStateException: It's not possible to obtain a value for column, please set a value provider by calling setExportValue()
	at com.flowingcode.vaadin.addons.gridexporter.GridExporter.extractValueFromColumn(GridExporter.java:143)
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.lambda$buildRow$2(ExcelInputStreamFactory.java:163)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.buildRow(ExcelInputStreamFactory.java:162)
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.lambda$fillData$1(ExcelInputStreamFactory.java:146)
	at java.base/java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:1002)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.fillData(ExcelInputStreamFactory.java:137)
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:71)

Doesn’t work fine with frozen columns

If you define a frozen column col.setFrozen(true) then the scroll lateral doesn’t work fine, see next videos:

in the first video “fase" is frozen and exporter is not activate , all the other columns are scroll, but not export function is show
frozen column 2

in the second video “fase" is frozen and exporter is activate, then none of the columns of the grid are scroll it
frozen column

In the third video any column is frozen and exporter is activate, then works fine the columns in the grid are scroll it but only with out frozen
frozen column 3

Exporter throw errors in browser using vaadin 24.1.0

When you are running in development mode each time you redraw a row that contains more than one grid child (separate in different tabs) it shows errors in console (see next videos and photos) If you disable the exporter then the errors disappear
change row generate errors

Captura de Pantalla 2023-06-20 a las 12 46 20 Captura de Pantalla 2023-06-19 a las 19 13 53

Upgrade grid-helpers to 1.1.0

Version 1.5.0 uses grid helpers 0.3.3 and is compatible with Vaadin 23.1+ (I guess that means 23.1-23.3, given the other errors related to Vaadin 24)

Since we will release a new major version (#58) for Vaadin 24, and Vaadin 23.2 has reached EOL, version 1.x should remain compatible with Vaadin 23.3. That means that we can upgrade to grid-helpers 1.1.0 (particularly, in order to bring FlowingCode/GridHelpers#76)

[labelling as a bug, since there are bugs related to using an outdated version of grid-helpers]

ClassCastException when exporting to Xls

After clicking the export to excel button, the following exception is thrown:

 com.vaadin.flow.server.ServiceException: java.lang.ClassCastException: class com.vaadin.flow.component.orderedlayout.VerticalLayout cannot be cast to class com.vaadin.flow.dom.Element (com.vaadin.flow.component.orderedlayout.VerticalLayout and com.vaadin.flow.dom.Element are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @26dcd8c0)
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:371) ~[flow-server-23.3.4.jar:23.3.4]
	at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:106) ~[vaadin-spring-23.3.4.jar:na]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[servlet-api.jar:na]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[catalina.jar:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.34]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:9.0.34]
	at vaadin.hibernate.CurrentServerContextFilter.doFilterInternal(CurrentServerContextFilter.java:115) ~[classes/:6.7.0-SNAPSHOT]
	... 80 common frames omitted
Caused by: com.vaadin.flow.server.ServiceException: java.lang.ClassCastException: class com.vaadin.flow.component.orderedlayout.VerticalLayout cannot be cast to class com.vaadin.flow.dom.Element (com.vaadin.flow.component.orderedlayout.VerticalLayout and com.vaadin.flow.dom.Element are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @26dcd8c0)
	at com.vaadin.flow.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1613) ~[flow-server-23.3.4.jar:23.3.4]
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1576) ~[flow-server-23.3.4.jar:23.3.4]
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:369) ~[flow-server-23.3.4.jar:23.3.4]
	... 88 common frames omitted
Caused by: java.lang.ClassCastException: class com.vaadin.flow.component.orderedlayout.VerticalLayout cannot be cast to class com.vaadin.flow.dom.Element (com.vaadin.flow.component.orderedlayout.VerticalLayout and com.vaadin.flow.dom.Element are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @26dcd8c0)
	at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.renderCellTextContent(BaseInputStreamFactory.java:112) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
	at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.lambda$getGridHeaders$0(BaseInputStreamFactory.java:89) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
	at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.getGridHeaders(BaseInputStreamFactory.java:90) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:89) ~[grid-exporter-addon-1.4.1.jar:1.4.1]
	at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-23.3.4.jar:23.3.4]
	at com.vaadin.flow.server.StreamResource$Pipe.accept(StreamResource.java:83) ~[flow-server-23.3.4.jar:23.3.4]
	at com.vaadin.flow.server.communication.StreamResourceHandler.handleRequest(StreamResourceHandler.java:91) ~[flow-server-23.3.4.jar:23.3.4]
	at com.vaadin.flow.server.communication.StreamRequestHandler.handleRequest(StreamRequestHandler.java:103) ~[flow-server-23.3.4.jar:23.3.4]
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1564) ~[flow-server-23.3.4.jar:23.3.4]
	... 89 common frames omitted

I'm using this addon's version 1.4.1 and Vaadin 23.3.7

extractValueFromColumn throws Exception when no value can be obtained

Can you please just offer the possibility to return a null value in that case?
That would give the possibility to use your exporter for all grids without the risk that someone somewhere adds a non-exportable column and the user will get an exception.
You could probably add a "general null value handler" that generates the default-value for null-columns (if no custom column-value-provider-data is set).

if (value == null) {
      throw new IllegalStateException("It's not possible to obtain a value for column, please set a value provider by calling setExportValue()");
}

Cannot access state in VaadinSession or UI without locking the session.

Hi,

Thanks for this plugin, it's very useful.
I want to use it to export to CSV with a custom export button, which works... until I try to hide the buttons generated by the plugin, by setting exporter.setAutoAttachExportButtons(false).
If I do that, when I click my export button I get an empty file, and this exception in the application log:

Exception in thread "Thread-23" java.lang.IllegalStateException: Cannot access state in VaadinSession or UI without locking the session.
        at com.vaadin.flow.server.VaadinSession.checkHasLock(VaadinSession.java:576)
        at com.vaadin.flow.server.VaadinSession.checkHasLock(VaadinSession.java:590)
        at com.vaadin.flow.internal.StateTree.checkHasLock(StateTree.java:432)
        at com.vaadin.flow.internal.StateTree.beforeClientResponse(StateTree.java:362)
        at com.vaadin.flow.data.provider.DataCommunicator$FlushRequest.lambda$register$43f5e0c7$1(DataCommunicator.java:1515)
        at com.vaadin.flow.internal.StateNode.runWhenAttached(StateNode.java:895)
        at com.vaadin.flow.data.provider.DataCommunicator$FlushRequest.register(DataCommunicator.java:1511)
        at com.vaadin.flow.data.provider.DataCommunicator.requestFlush(DataCommunicator.java:1107)
        at com.vaadin.flow.data.provider.DataCommunicator.requestFlush(DataCommunicator.java:1093)
        at com.vaadin.flow.data.provider.DataCommunicator.reset(DataCommunicator.java:378)
        at com.vaadin.flow.component.grid.Grid.setClassNameGenerator(Grid.java:3933)
        at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.setClassNameGenerator(GridHelper.java:154)
        at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.<init>(GridHelper.java:77)
        at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.getHelper(GridHelper.java:91)
        at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.getHeader(GridHelper.java:327)
        at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.renderCellTextContent(BaseInputStreamFactory.java:84)
        at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.lambda$getGridHeaders$0(BaseInputStreamFactory.java:70)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.getGridHeaders(BaseInputStreamFactory.java:71)
        at com.flowingcode.vaadin.addons.gridexporter.CsvInputStreamFactory$1.run(CsvInputStreamFactory.java:46)
        at java.base/java.lang.Thread.run(Thread.java:829)

The only difference is the AutoAttachExportButtons setting. Do you have any idea what could be causing this?
I'm using Vaadin 23.3.0 and addon version 1.4.0.

Large data throws exception for excel export

When exporting data more than 64,000 records, the following error is thrown.

java.lang.IllegalStateException: The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook
	at org.apache.poi.xssf.model.StylesTable.createCellStyle(StylesTable.java:860) ~[poi-ooxml-5.2.3.jar:5.2.3]
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:788) ~[poi-ooxml-5.2.3.jar:5.2.3]
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:108) ~[poi-ooxml-5.2.3.jar:5.2.3]
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.lambda$buildRow$2(ExcelInputStreamFactory.java:277) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[na:na]
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[na:na]
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.buildRow(ExcelInputStreamFactory.java:270) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.fillData(ExcelInputStreamFactory.java:251) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
	at com.flowingcode.vaadin.addons.gridexporter.ExcelInputStreamFactory.createInputStream(ExcelInputStreamFactory.java:112) ~[grid-exporter-addon-2.2.0.jar:2.2.0]
	at com.vaadin.flow.server.StreamResource$Pipe.createInputStream(StreamResource.java:99) ~[flow-server-24.3.2.jar:24.3.2]

Cannot load from short array because "sun.awt.FontConfiguration.head" is null

I'm facing this problem when deploying a demo application using the addon using docker:

Caused by: java.lang.NullPointerException: Cannot load from short array because "sun.awt.FontConfiguration.head" is null
        at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
        at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224)
        at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106)
        at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706)
        at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358)
        at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:315)
        at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
        at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
        ... 61 more

I suspect that it is related to a missing font in the OS

Exporting columns that are defined by ComponentRenderer

I have several grid columns that have custom renderers
Column myColumn = this.addColumn(new ComponentRenderer<>(this::createUserNumber))

These columns do not get included in the export. Is there a way to configure the exporter to include these values as part of the export?

Add column reordering

It would be very useful to have a method that allows to reorder the columns order before they are exported.

PDF/Docx Export with wrong sorting

When you export to PDF or Docx, the first row is exported correctly, but from the second onwards all rows are sorted in descending order. This can be seen in the online demo as well.

Exception in docx-Export

Exporting a grid to docx without template:

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "o" is null
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:57) ~[na:na]
	at java.base/jdk.internal.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36) ~[na:na]
	at java.base/java.lang.reflect.Field.get(Field.java:425) ~[na:na]
	at com.flowingcode.vaadin.addons.gridhelpers.HeaderFooterGridHelper.getTemplate(HeaderFooterGridHelper.java:22) ~[grid-helpers-0.2.0.jar:0.2.0]
	at com.flowingcode.vaadin.addons.gridhelpers.HeaderFooterGridHelper.getFooter(HeaderFooterGridHelper.java:64) ~[grid-helpers-0.2.0.jar:0.2.0]
	at com.flowingcode.vaadin.addons.gridhelpers.GridHelper.getFooter(GridHelper.java:308) ~[grid-helpers-0.2.0.jar:0.2.0]
	at com.flowingcode.vaadin.addons.gridexporter.BaseInputStreamFactory.lambda$getGridFooters$1(BaseInputStreamFactory.java:61) ~[grid-exporter-addon-1.0.1.jar:1.0.1]
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]

PDF/Doc Export

For PDF and Doc export, is it possible to change the page orientation from LETTER to LANDSCAPE?

Thank you

Bad Performance on huge grids

I use the grid exporter for my Vaadin 24 apps and it's really working well for nearly all use cases, except one grid with large data sets (3000 rows). Exporting this grid is unusable due to the bad performance (> 60s).
I profiled the execution with VisualVM and its turned out, that

ExcelInputStreamFactory.fillData

and there the call for

sheet.shiftRows

is responsible for the huge time needed.
Why is such a call neded and is there something I can fasten in order to make it work as for small data sets ?

kind regrads
Dominik

P.S.: as workaround, please provide a hook/callback/listener for a FINISHED event of generating the stream resource so one can show a progressBar or something in the meantime.

Exporter works unproperly with grids filtered by ListDataView

If a grid is filtered using grid.getListDataView().addFilter(...), the exported grid will show the correct ammount of items, but will not show the filtered items (the items that passed the filter), rather it will show the first n items (even if they don't match the filter) of the grid.

Example having the following rows:
row A
row B
row C
Applying a filter criteria that leaves out row B:
row A
row C
What ends up being exported (which is wrong) is:
row A
row B

To further show the behaviour of this issue, I attached a sample project in which I attempt something as shown above.
grid-exporter-test.zip
To test it, please:

  1. Import the project as a Maven project
  2. Run mvn install
  3. Run Application class
  4. Navigate to "/test".
  5. Add any filter, then export as xls or pdf.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.