Package io.jmix.gridexportflowui.action
Class ExportAction
java.lang.Object
io.jmix.flowui.kit.action.AbstractAction
io.jmix.flowui.kit.action.BaseAction
io.jmix.flowui.action.SecuredBaseAction
io.jmix.flowui.action.list.ListDataComponentAction<ExportAction,Object>
io.jmix.gridexportflowui.action.ExportAction
- All Implemented Interfaces:
ExecutableAction
,SecuredAction
,TargetAction<ListDataComponent<Object>>
,Action
,HasShortcutCombination
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
ExcelExportAction
,JsonExportAction
@ActionType("grdexp_export")
public class ExportAction
extends ListDataComponentAction<ExportAction,Object>
implements org.springframework.context.ApplicationContextAware
Base action for export table content with defined exporter.
dataGridExporter
is required for this action
Should be defined for a list component (Table
, DataGrid
, etc.).
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.action.SecuredBaseAction
SecuredBaseAction.EnabledRule
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected List<ExportMode>
protected ColumnsToExport
protected DataGridExporter
protected Dialogs
protected Downloader
static final String
protected Messages
Fields inherited from class io.jmix.flowui.action.list.ListDataComponentAction
selectionListenerRegistration, target
Fields inherited from class io.jmix.flowui.action.SecuredBaseAction
enabledByUiPermissions, enabledRules, visibleByUiPermissions
Fields inherited from class io.jmix.flowui.kit.action.BaseAction
enabledExplicitly, visibleExplicitly
Fields inherited from class io.jmix.flowui.kit.action.AbstractAction
description, enabled, eventBus, icon, id, shortcutCombination, text, variant, visible
Fields inherited from interface io.jmix.flowui.kit.action.Action
PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT_COMBINATION, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumnValueProvider
(String columnId, Function<DataGridExporter.ColumnValueContext, Object> columnValueProvider) Adds a function to get value from the column.protected Action
createCurrentPageAction
(Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> primaryFilterPredicate) protected Action
createExportAllAction
(Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> primaryFilterPredicate) protected Action
createExportSelectedAction
(Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> primaryFilterPredicate) protected void
doExport
(ExportMode exportMode, Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> primaryFilterPredicate) void
execute()
Executes theAction
getColumnValueProvider
(String columnId) protected String
getMessage
(String id) protected boolean
isDataLoaderExist
(ListDataComponent<?> target) void
removeColumnValueProvider
(String columnId) Removes an column value provider function by column id.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setAvailableExportModes
(List<ExportMode> availableExportModes) Sets the export modes that will be available in the export option dialog.void
setColumnKeysToExport
(List<String> columnKeysToExport) Sets a list of column keys to use for export.void
setColumnsExportFilter
(Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> columnsExportFilter) Sets thePredicate
that is used to filter columns to export.void
setColumnsToExport
(ColumnsToExport columnsToExport) Sets theColumnsToExport
that is used to filter columns to export.void
setDataGridExporter
(DataGridExporter dataGridExporter) Sets the dataGrid exporter instancevoid
setDialogs
(Dialogs dialogs) void
setDownloader
(Downloader downloader) void
setFileName
(String fileName) Sets a file name.void
setGridExportProperties
(GridExportProperties gridExportProperties) void
setMessages
(Messages messages) withAvailableExportModes
(List<ExportMode> availableExportModes) withColumnKeysToExport
(List<String> columnKeysToExport) withColumnsExportFilter
(Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> columnsExportFilter) withColumnsToExport
(ColumnsToExport columnsToExport) <T> T
withExporter
(Class<T> exporterClass) <T> T
withFileName
(String fileName) Sets a file name.Methods inherited from class io.jmix.flowui.action.list.ListDataComponentAction
actionPerform, attachSelectionListener, checkTarget, checkTargetItems, getTarget, initAction, onSelectionChange, setTarget, withEnabled, withEnabledByUiPermissions, withHandler, withIcon, withIcon, withShortcutCombination, withTarget, withText, withTitle, withVariant, withVisible, withVisibleByUiPermissions
Methods inherited from class io.jmix.flowui.action.SecuredBaseAction
addEnabledRule, isEnabledByRule, isEnabledByUiPermissions, isPermitted, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabledByUiPermissions, setVisibleByUiPermissions
Methods inherited from class io.jmix.flowui.kit.action.BaseAction
addActionPerformedListener, isApplicable, setEnabled, setEnabledInternal, setVisible, setVisibleInternal
Methods inherited from class io.jmix.flowui.kit.action.AbstractAction
addPropertyChangeListener, firePropertyChange, getDescription, getEventBus, getIcon, getId, getShortcutCombination, getText, getVariant, hasListener, isEnabled, isVisible, setDescription, setIcon, setShortcutCombination, setText, setVariant
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.flowui.kit.action.Action
addPropertyChangeListener, getDescription, getIcon, getId, getText, getVariant, isEnabled, isVisible, refreshState, setDescription, setEnabled, setIcon, setText, setVariant, setVisible
Methods inherited from interface io.jmix.flowui.kit.component.HasShortcutCombination
getShortcutCombination, setShortcutCombination
-
Field Details
-
ID
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
messages
-
downloader
-
dialogs
-
dataGridExporter
-
availableExportModes
-
columnsToExport
-
columnsExportFilter
-
columnKeysToExport
-
-
Constructor Details
-
ExportAction
public ExportAction() -
ExportAction
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
setMessages
-
setDownloader
-
setDialogs
-
setGridExportProperties
-
setColumnsToExport
Sets theColumnsToExport
that is used to filter columns to export. This is a simple, predefined alternative tosetColumnsExportFilter(Predicate)
. Has the lowest filtering priority.The default value depends on
GridExportProperties.getDefaultColumnsToExport()
.- Parameters:
columnsToExport
-ColumnsToExport
that is used to filter columns to export
-
withColumnsToExport
- Returns:
- this
- See Also:
-
setColumnsExportFilter
public void setColumnsExportFilter(Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> columnsExportFilter) Sets thePredicate
that is used to filter columns to export. This is a flexible alternative tosetColumnsToExport(ColumnsToExport)
. Has secondary filtering priority.- Parameters:
columnsExportFilter
- column export predicate to set
-
withColumnsExportFilter
public ExportAction withColumnsExportFilter(Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> columnsExportFilter) - Returns:
- this
- See Also:
-
setColumnKeysToExport
Sets a list of column keys to use for export. Has primary filtering priority.- Parameters:
columnKeysToExport
- list of column keys
-
withColumnKeysToExport
- Returns:
- this
- See Also:
-
setAvailableExportModes
Sets the export modes that will be available in the export option dialog.- Parameters:
availableExportModes
- export modes to set
-
withAvailableExportModes
- Returns:
- this
- See Also:
-
setDataGridExporter
Sets the dataGrid exporter instance -
withExporter
-
setFileName
Sets a file name.- Parameters:
fileName
- a file name
-
withFileName
Sets a file name.- Parameters:
fileName
- a file name- Returns:
- builder
-
addColumnValueProvider
public void addColumnValueProvider(String columnId, Function<DataGridExporter.ColumnValueContext, Object> columnValueProvider) Adds a function to get value from the column.- Parameters:
columnId
- column idcolumnValueProvider
- column value provider function
-
removeColumnValueProvider
Removes an column value provider function by column id.- Parameters:
columnId
- column id
-
getColumnValueProvider
@Nullable public Function<DataGridExporter.ColumnValueContext,Object> getColumnValueProvider(String columnId) - Parameters:
columnId
- column id- Returns:
- column value provider function for the column id
-
execute
public void execute()Description copied from interface:ExecutableAction
Executes theAction
- Specified by:
execute
in interfaceExecutableAction
-
definePrimaryFilterPredicate
-
doExport
protected void doExport(ExportMode exportMode, Predicate<com.vaadin.flow.component.grid.Grid.Column<Object>> primaryFilterPredicate) -
getMessage
-
createExportSelectedAction
-
createExportAllAction
-
createCurrentPageAction
-
isDataLoaderExist
-