public class ExportAction extends ListAction implements org.springframework.context.ApplicationContextAware
tableExporter
is required for this action
Should be defined for a list component (Table
, DataGrid
, etc.) in a screen XML descriptor.
BaseAction.EnabledRule
Action.ActionPerformedEvent, Action.AdjustWhenScreenReadOnly, Action.ExecutableAction, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.MainTabSheetAction, Action.ScreenOpeningAction, Action.SecuredAction, Action.Status
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
protected Downloader |
downloader |
static java.lang.String |
ID |
protected io.jmix.core.Messages |
messages |
protected TableExporter |
tableExporter |
target
caption, description, enabled, eventHub, icon, id, owners, primary, shortcut, visible
PROP_CAPTION, PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT, PROP_VISIBLE
Constructor and Description |
---|
ExportAction() |
ExportAction(java.lang.String id) |
ExportAction(java.lang.String id,
java.lang.String shortcut) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerform(Component component)
Invoked by owning component to execute the action.
|
void |
addColumnValueProvider(java.lang.String columnId,
java.util.function.Function<TableExporter.ColumnValueContext,java.lang.Object> columnValueProvider)
Adds a function to get value from the column.
|
protected void |
doExport(ExportMode exportMode) |
protected void |
execute() |
java.util.function.Function<TableExporter.ColumnValueContext,java.lang.Object> |
getColumnValueProvider(java.lang.String columnId) |
protected java.lang.String |
getMessage(java.lang.String id) |
protected boolean |
needExportAll() |
void |
removeColumnValueProvider(java.lang.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(java.lang.Class<T> exporterClass)
Autowire table exporter instance by exporter class
|
getTarget, setTarget, withCaption, withDescription, withHandler, withIcon, withPrimary, withShortcut
addActionPerformedListener, addEnabledRule, isApplicable, isEnabledByRule, isEnabledByUiPermissions, isPermitted, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternal
addOwner, addPropertyChangeListener, firePropertyChange, getCaption, getDescription, getEventHub, getIcon, getId, getOwner, getOwners, getShortcutCombination, hasSubscriptions, isEnabled, isPrimary, isVisible, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setPrimary, setShortcut, setShortcutCombination
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addOwner, addPropertyChangeListener, getCaption, getDescription, getIcon, getId, getOwner, getOwners, getShortcutCombination, isEnabled, isVisible, refreshState, removeOwner, removePropertyChangeListener, setCaption, setDescription, setEnabled, setIcon, setShortcut, setShortcutCombination, setVisible
public static final java.lang.String ID
protected org.springframework.context.ApplicationContext applicationContext
@Autowired protected io.jmix.core.Messages messages
@Autowired protected Downloader downloader
protected TableExporter tableExporter
public ExportAction(java.lang.String id)
public ExportAction()
public ExportAction(java.lang.String id, @Nullable java.lang.String shortcut)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
public void setTableExporter(TableExporter tableExporter)
public <T> T withExporter(java.lang.Class<T> exporterClass)
public void addColumnValueProvider(java.lang.String columnId, java.util.function.Function<TableExporter.ColumnValueContext,java.lang.Object> columnValueProvider)
columnId
- column idcolumnValueProvider
- column value provider functionpublic void removeColumnValueProvider(java.lang.String columnId)
columnId
- column id@Nullable public java.util.function.Function<TableExporter.ColumnValueContext,java.lang.Object> getColumnValueProvider(java.lang.String columnId)
columnId
- column idpublic void actionPerform(Component component)
Action
actionPerform
in interface Action
actionPerform
in class BaseAction
component
- invoking componentprotected void execute()
protected void doExport(ExportMode exportMode)
protected java.lang.String getMessage(java.lang.String id)
protected boolean needExportAll()