|
21 | 21 |
|
22 | 22 | import com.flowingcode.vaadin.addons.demo.DemoSource;
|
23 | 23 | import com.flowingcode.vaadin.addons.demo.SourceCodeViewer;
|
| 24 | +import com.flowingcode.vaadin.addons.gridhelpers.GridHelper; |
| 25 | +import com.flowingcode.vaadin.addons.gridhelpers.HeightMode; |
24 | 26 | import com.github.javafaker.Faker;
|
25 | 27 | import com.vaadin.flow.component.Html;
|
26 | 28 | import com.vaadin.flow.component.grid.Grid;
|
|
38 | 40 | import org.apache.poi.EncryptedDocumentException;
|
39 | 41 |
|
40 | 42 | @DemoSource
|
41 |
| -@DemoSource("/src/test/java/com/flowingcode/vaadin/addons/gridexporter/VaadinServiceInitListenerImpl.java") |
| 43 | +@DemoSource(clazz = VaadinServiceInitListenerImpl.class) |
42 | 44 | @PageTitle("Big Dataset")
|
43 | 45 | @Route(value = "gridexporter/bigdataset", layout = GridExporterDemoView.class)
|
44 | 46 | @SuppressWarnings("serial")
|
@@ -80,29 +82,38 @@ public GridExporterBigDatasetDemo() throws EncryptedDocumentException, IOExcepti
|
80 | 82 | exporter.setFileName(
|
81 | 83 | "GridExport" + new SimpleDateFormat("yyyyddMM").format(Calendar.getInstance().getTime()));
|
82 | 84 |
|
83 |
| - // begin-block concurrent |
| 85 | + // show-source add(grid); |
| 86 | + |
84 | 87 | // #if vaadin eq 0
|
85 |
| - Html concurrent = new Html( |
| 88 | + GridHelper.setHeightByRows(grid, 6); |
| 89 | + GridHelper.setHeightMode(grid, HeightMode.ROW); |
| 90 | + Html block1 = new Html( |
86 | 91 | """
|
87 | 92 | <div>
|
88 | 93 | This configuration prepares the exporter for the BigDataset demo, enabling it to manage resource-intensive
|
89 | 94 | document generation tasks effectively. In this setup, an upper limit of 10 is established for the cost of
|
90 | 95 | concurrent downloads, and the big dataset exporter is configured with a cost of 9, while other exporters
|
91 | 96 | handling smaller datasets retain the default cost of 1. This customization allows a combination of one large
|
92 | 97 | dataset download alongside one small dataset download, or up to 10 concurrent downloads of smaller datasets
|
93 |
| - when no big dataset is being exported.<p> |
94 |
| -
|
| 98 | + when no big dataset is being exported. |
| 99 | + </div>"""); |
| 100 | + Html block2 = new Html( |
| 101 | + """ |
| 102 | + <div> |
95 | 103 | Additionally, <code>setConcurrentDownloadTimeout</code> enforces a timeout for acquiring the necessary permits
|
96 | 104 | during a download operation. If the permits are not obtained within the specified timeframe, the download
|
97 | 105 | request will be aborted and the <code>DownloadTimeoutEvent</code> listener will execute, preventing prolonged
|
98 | 106 | waiting periods, especially during peak system loads.
|
99 | 107 | </div>""");
|
100 |
| - add(concurrent); |
| 108 | + |
| 109 | + add(block1, grid, block2); |
| 110 | + SourceCodeViewer.highlightOnHover(block1, "concurrent"); |
| 111 | + SourceCodeViewer.highlightOnHover(block2, |
| 112 | + "VaadinServiceInitListenerImpl.java#setConcurrentDownloadTimeout"); |
101 | 113 | // #endif
|
102 |
| - SourceCodeViewer.highlightOnHover(concurrent, "concurrent"); |
| 114 | + // begin-block concurrent |
103 | 115 | exporter.setConcurrentDownloadCost(9);
|
104 | 116 | // end-block
|
105 | 117 |
|
106 |
| - add(grid); |
107 | 118 | }
|
108 | 119 | }
|
0 commit comments