Class ExportAction

All Implemented Interfaces:
Action, Action.HasPrimaryState, Action.HasTarget, Action.SecuredAction, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
ExcelExportAction, JsonExportAction

public class ExportAction extends ListAction implements org.springframework.context.ApplicationContextAware
Base action for export table content with defined exporter. tableExporter is required for this action

Should be defined for a list component (Table, DataGrid, etc.) in a screen XML descriptor.

  • Field Details

    • ID

      public static final String ID
      See Also:
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • messages

      @Autowired protected Messages messages
    • downloader

      @Autowired protected Downloader downloader
    • tableExporter

      protected TableExporter tableExporter
  • Constructor Details

    • ExportAction

      public ExportAction(String id)
    • ExportAction

      public ExportAction()
    • ExportAction

      public ExportAction(String id, @Nullable String shortcut)
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
    • setTableExporter

      public void setTableExporter(TableExporter tableExporter)
      Sets the table exporter instance
    • withExporter

      public <T> T withExporter(Class<T> exporterClass)
      Autowire table exporter instance by exporter class
    • addColumnValueProvider

      public void addColumnValueProvider(String columnId, Function<TableExporter.ColumnValueContext,Object> columnValueProvider)
      Adds a function to get value from the column.
      Parameters:
      columnId - column id
      columnValueProvider - column value provider function
    • removeColumnValueProvider

      public void removeColumnValueProvider(String columnId)
      Removes an column value provider function by column id.
      Parameters:
      columnId - column id
    • getColumnValueProvider

      @Nullable public Function<TableExporter.ColumnValueContext,Object> getColumnValueProvider(String columnId)
      Parameters:
      columnId - column id
      Returns:
      column value provider function for the column id
    • actionPerform

      public void actionPerform(Component component)
      Description copied from interface: Action
      Invoked by owning component to execute the action.
      Specified by:
      actionPerform in interface Action
      Overrides:
      actionPerform in class BaseAction
      Parameters:
      component - invoking component
    • execute

      protected void execute()
    • doExport

      protected void doExport(ExportMode exportMode)
    • getMessage

      protected String getMessage(String id)
    • needExportAll

      protected boolean needExportAll()