Package io.jmix.gridexportui.action
Class ExportAction
java.lang.Object
io.jmix.ui.action.AbstractAction
io.jmix.ui.action.BaseAction
io.jmix.ui.action.ListAction
io.jmix.gridexportui.action.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.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.action.BaseAction
BaseAction.EnabledRule
Nested classes/interfaces inherited from interface io.jmix.ui.action.Action
Action.ActionPerformedEvent, Action.AdjustWhenScreenReadOnly, Action.ExecutableAction, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.MainTabSheetAction, Action.OperationResultAction, Action.ScreenAction<S extends Screen>, Action.ScreenOpeningAction, Action.SecuredAction, Action.Status
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected Downloader
static final String
protected Messages
protected TableExporter
Fields inherited from class io.jmix.ui.action.ListAction
target
Fields inherited from class io.jmix.ui.action.AbstractAction
caption, description, enabled, eventHub, icon, id, owners, primary, shortcut, visible
Fields inherited from interface io.jmix.ui.action.Action
PROP_CAPTION, PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT, PROP_VISIBLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
actionPerform
(Component component) Invoked by owning component to execute the action.void
addColumnValueProvider
(String columnId, Function<TableExporter.ColumnValueContext, Object> columnValueProvider) Adds a function to get value from the column.protected void
doExport
(ExportMode exportMode) protected void
execute()
getColumnValueProvider
(String columnId) protected String
getMessage
(String id) protected boolean
isDataLoaderExist
(ListComponent<?> target) void
removeColumnValueProvider
(String columnId) Removes an column value provider function by column id.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setTableExporter
(TableExporter tableExporter) Sets the table exporter instance<T> T
withExporter
(Class<T> exporterClass) Autowire table exporter instance by exporter classMethods inherited from class io.jmix.ui.action.ListAction
getTarget, setTarget, withCaption, withDescription, withHandler, withIcon, withPrimary, withShortcut
Methods inherited from class io.jmix.ui.action.BaseAction
addActionPerformedListener, addEnabledRule, isApplicable, isEnabledByRule, isEnabledByUiPermissions, isPermitted, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternal
Methods inherited from class io.jmix.ui.action.AbstractAction
addOwner, addPropertyChangeListener, firePropertyChange, getCaption, getDescription, getEventHub, getIcon, getId, getOwner, getOwners, getShortcutCombination, hasSubscriptions, isEnabled, isPrimary, isVisible, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setPrimary, setShortcut, setShortcutCombination
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.action.Action
addOwner, addPropertyChangeListener, getCaption, getDescription, getIcon, getId, getOwner, getOwners, getShortcutCombination, isEnabled, isVisible, refreshState, removeOwner, removePropertyChangeListener, setCaption, setDescription, setEnabled, setIcon, setShortcut, setShortcutCombination, setVisible
-
Field Details
-
ID
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
messages
-
downloader
-
tableExporter
-
-
Constructor Details
-
ExportAction
-
ExportAction
public ExportAction() -
ExportAction
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
setTableExporter
Sets the table exporter instance -
withExporter
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 idcolumnValueProvider
- column value provider function
-
removeColumnValueProvider
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
Description copied from interface:Action
Invoked by owning component to execute the action.- Specified by:
actionPerform
in interfaceAction
- Overrides:
actionPerform
in classBaseAction
- Parameters:
component
- invoking component
-
execute
protected void execute() -
doExport
-
getMessage
-
isDataLoaderExist
-