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

      protected Metadata metadata
    • jsonAllRecordsExporter

      protected JsonAllRecordsExporter jsonAllRecordsExporter
    • gsonConfigurer

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

  • 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
    • createJsonObjectFromEntity

      protected com.google.gson.JsonObject createJsonObjectFromEntity(com.vaadin.flow.component.grid.Grid<Object> dataGrid, Object entity)
    • 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