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.EnabledRuleNested 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.ScreenOpeningAction, Action.SecuredAction, Action.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected Downloaderstatic final Stringprotected Messagesprotected TableExporterFields inherited from class io.jmix.ui.action.ListAction
targetFields inherited from class io.jmix.ui.action.AbstractAction
caption, description, enabled, eventHub, icon, id, owners, primary, shortcut, visibleFields inherited from interface io.jmix.ui.action.Action
PROP_CAPTION, PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT, PROP_VISIBLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerform(Component component) Invoked by owning component to execute the action.voidaddColumnValueProvider(String columnId, Function<TableExporter.ColumnValueContext, Object> columnValueProvider) Adds a function to get value from the column.protected voiddoExport(ExportMode exportMode) protected voidexecute()getColumnValueProvider(String columnId) protected StringgetMessage(String id) protected booleanvoidremoveColumnValueProvider(String columnId) Removes an column value provider function by column id.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetTableExporter(TableExporter tableExporter) Sets the table exporter instance<T> TwithExporter(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, withShortcutMethods inherited from class io.jmix.ui.action.BaseAction
addActionPerformedListener, addEnabledRule, isApplicable, isEnabledByRule, isEnabledByUiPermissions, isPermitted, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternalMethods 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, setShortcutCombinationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
setApplicationContextin 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:ActionInvoked by owning component to execute the action.- Specified by:
actionPerformin interfaceAction- Overrides:
actionPerformin classBaseAction- Parameters:
component- invoking component
-
execute
protected void execute() -
doExport
-
getMessage
-
isExportAllEnabled
protected boolean isExportAllEnabled()
-