Class JsonExporter

All Implemented Interfaces:
DataGridExporter

@Component("grdexp_JsonExporter") @Scope("prototype") public class JsonExporter extends AbstractDataGridExporter<JsonExporter>
Use this class to export DataGrid into JSON format.
Just create an instance of ExportAction with withExporter method.
  • Field Details

    • metadata

      @Autowired protected Metadata metadata
    • gsonConfigurer

      protected Function<com.google.gson.GsonBuilder,com.google.gson.GsonBuilder> gsonConfigurer
  • Constructor Details

    • JsonExporter

      public JsonExporter()
  • Method Details

    • withGsonConfigurator

      protected JsonExporter withGsonConfigurator(Function<com.google.gson.GsonBuilder,com.google.gson.GsonBuilder> gsonConfigurer)
      Configure Gson builder for export
      Parameters:
      gsonConfigurer - Gson configurator function
      Returns:
      exporter instance
    • exportDataGrid

      public void exportDataGrid(Downloader downloader, com.vaadin.flow.component.grid.Grid<Object> dataGrid, ExportMode exportMode)
      Description copied from interface: DataGridExporter
      download dataGrid content via downloader
    • createGsonForSerialization

      protected com.google.gson.Gson createGsonForSerialization()
    • getItems

      protected Collection<Object> getItems(com.vaadin.flow.component.grid.Grid<Object> dataGrid, ExportMode exportMode)
    • getDataGridItems

      protected Collection<Object> getDataGridItems(com.vaadin.flow.component.grid.Grid<Object> dataGrid)
    • getLabel

      public String getLabel()
      Returns:
      exporter label