Package io.jmix.flowui.action.list
Class EditAction<E>
- All Implemented Interfaces:
AdjustWhenScreenReadOnly
,ExecutableAction
,ScreenOpeningAction
,SecuredAction
,SecurityConstraintAction
,TargetAction<ListDataComponent<E>>
,Action
@ActionType("edit")
public class EditAction<E>
extends SecuredListDataComponentAction<EditAction<E>,E>
implements AdjustWhenScreenReadOnly, ScreenOpeningAction, ExecutableAction
-
Field Summary
Modifier and TypeFieldDescriptionprotected DialogWindowBuilders
static final String
protected Messages
protected OpenMode
protected ActionScreenInitializer
protected ScreenNavigators
protected boolean
Fields inherited from class io.jmix.flowui.action.list.SecuredListDataComponentAction
accessManager, applicationContext, constraintEntityOp, metadata
Fields inherited from class io.jmix.flowui.action.list.ListDataComponentAction
selectionListenerRegistration, target
Fields inherited from class io.jmix.flowui.action.SecuredBaseAction
enabledByUiPermissions, 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, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Executes the action.Returns the screen open mode if it was set byScreenOpeningAction.setOpenMode(OpenMode)
or in the screen XML, otherwise returnsnull
.com.vaadin.flow.router.QueryParameters
com.vaadin.flow.router.RouteParameters
Returns the editor screen class if it was set bysetScreenClass(Class)
or in the screen XML.Returns the editor screen id if it was set bysetScreenId(String)
or in the screen XML.protected void
boolean
protected boolean
protected void
navigateToScreen
(E editedEntity) protected void
openDialog
(E editedEntity) void
<S extends Screen<?>>
voidsetAfterCloseHandler
(Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) Sets the handler to be invoked when the editor screen closes.void
setAfterCommitHandler
(Consumer<E> afterCommitHandler) Sets the handler to be invoked when the editor screen commits the entity.void
setDialogWindowBuilders
(DialogWindowBuilders dialogWindowBuilders) protected void
setFlowUiComponentProperties
(FlowUiComponentProperties flowUiComponentProperties) protected void
setMessages
(Messages messages) void
setOpenMode
(OpenMode openMode) Sets the screen open mode.void
setQueryParameters
(com.vaadin.flow.router.QueryParameters queryParameters) Sets query parameters that should be used in the URL.void
setRouteParameters
(com.vaadin.flow.router.RouteParameters routeParameters) Sets route parameters that should be used in the route template.void
setScreenClass
(Class<? extends Screen> screenClass) Sets the editor screen id.void
setScreenId
(String screenId) Sets the editor screen id.void
setScreenNavigators
(ScreenNavigators screenNavigators) void
void
setTransformation
(Function<E, E> transformation) Sets the function to transform the committed in the editor screen entity before setting it to the target data container.<S extends Screen<?>>
EditAction<E>withAfterCloseHandler
(Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) withAfterCommitHandler
(Consumer<E> afterCommitHandler) withOpenMode
(OpenMode openMode) withQueryParameters
(com.vaadin.flow.router.QueryParameters queryParameters) withRouteParameters
(com.vaadin.flow.router.RouteParameters routeParameters) withScreenClass
(Class<? extends Screen> screenClass) withScreenId
(String screenId) withTransformation
(Function<E, E> transformation) Methods inherited from class io.jmix.flowui.action.list.SecuredListDataComponentAction
getConstraintEntityOp, isApplicable, setAccessManager, setApplicationContext, setConstraintEntityOp, setMetadata, withConstraintEntityOp
Methods inherited from class io.jmix.flowui.action.list.ListDataComponentAction
actionPerform, attachSelectionListener, checkTarget, getTarget, onSelectionChange, setTarget, withEnabled, withEnabledByUiPermissions, withHandler, withIcon, withIcon, withShortcutCombination, withTarget, withText, withTitle, withVariant, withVisible, withVisibleByUiPermissions
Methods inherited from class io.jmix.flowui.action.SecuredBaseAction
isEnabledByUiPermissions, isVisibleByUiPermissions, setEnabledByUiPermissions, setVisibleByUiPermissions
Methods inherited from class io.jmix.flowui.kit.action.BaseAction
addActionPerformedListener, 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, 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
actionPerform, addPropertyChangeListener, getDescription, getIcon, getId, getShortcutCombination, getText, getVariant, isEnabled, isVisible, setDescription, setEnabled, setIcon, setShortcutCombination, setVariant, setVisible
-
Field Details
-
ID
- See Also:
-
dialogWindowBuilders
-
screenInitializer
-
afterCommitHandler
-
transformation
-
textInitialized
protected boolean textInitialized -
messages
-
openMode
-
-
Constructor Details
-
EditAction
public EditAction() -
EditAction
-
-
Method Details
-
initAction
protected void initAction()- Overrides:
initAction
in classListDataComponentAction<EditAction<E>,
E>
-
getOpenMode
Description copied from interface:ScreenOpeningAction
Returns the screen open mode if it was set byScreenOpeningAction.setOpenMode(OpenMode)
or in the screen XML, otherwise returnsnull
.- Specified by:
getOpenMode
in interfaceScreenOpeningAction
-
setOpenMode
Description copied from interface:ScreenOpeningAction
Sets the screen open mode.- Specified by:
setOpenMode
in interfaceScreenOpeningAction
- Parameters:
openMode
- the open mode to set
-
getScreenId
Returns the editor screen id if it was set bysetScreenId(String)
or in the screen XML. Otherwise, returns null.- Specified by:
getScreenId
in interfaceScreenOpeningAction
-
setScreenId
Sets the editor screen id.- Specified by:
setScreenId
in interfaceScreenOpeningAction
- Parameters:
screenId
- the screen id to set
-
getScreenClass
Returns the editor screen class if it was set bysetScreenClass(Class)
or in the screen XML. Otherwise returns null.- Specified by:
getScreenClass
in interfaceScreenOpeningAction
-
setScreenClass
Sets the editor screen id.- Specified by:
setScreenClass
in interfaceScreenOpeningAction
- Parameters:
screenClass
- the screen class to set
-
getRouteParameters
@Nullable public com.vaadin.flow.router.RouteParameters getRouteParameters()- Specified by:
getRouteParameters
in interfaceScreenOpeningAction
- Returns:
- route parameters or
null
if not set
-
setRouteParameters
public void setRouteParameters(@Nullable com.vaadin.flow.router.RouteParameters routeParameters) Description copied from interface:ScreenOpeningAction
Sets route parameters that should be used in the route template.Note that route parameters are set if the editor is opened in
OpenMode.NAVIGATION
.- Specified by:
setRouteParameters
in interfaceScreenOpeningAction
- Parameters:
routeParameters
- route parameters to set- See Also:
-
Route
-
getQueryParameters
@Nullable public com.vaadin.flow.router.QueryParameters getQueryParameters()- Specified by:
getQueryParameters
in interfaceScreenOpeningAction
- Returns:
- query parameters or
null
if not set
-
setQueryParameters
public void setQueryParameters(@Nullable com.vaadin.flow.router.QueryParameters queryParameters) Description copied from interface:ScreenOpeningAction
Sets query parameters that should be used in the URL.Note that query parameters are set if the editor is opened in
OpenMode.NAVIGATION
.- Specified by:
setQueryParameters
in interfaceScreenOpeningAction
- Parameters:
queryParameters
- query parameters to set
-
setAfterCloseHandler
public <S extends Screen<?>> void setAfterCloseHandler(@Nullable Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) Description copied from interface:ScreenOpeningAction
Sets the handler to be invoked when the editor screen closes.Note that handler is invoked if the editor is opened in
OpenMode.DIALOG
mode.The preferred way to set the handler is using a controller method annotated with
Install
, e.g.:@Install(to = "petsTable.view", subject = "afterCloseHandler") protected void petsTableViewAfterCloseHandler(AfterCloseEvent event) { if (event.closedWith(StandardOutcome.COMMIT)) { System.out.println("Committed"); } }
- Specified by:
setAfterCloseHandler
in interfaceScreenOpeningAction
- Type Parameters:
S
- screen type- Parameters:
afterCloseHandler
- handler to set
-
setAfterCommitHandler
Sets the handler to be invoked when the editor screen commits the entity.Note that handler is invoked if the editor is opened in
OpenMode.DIALOG
mode.The preferred way to set the handler is using a controller method annotated with
Install
, e.g.:@Install(to = "petsTable.edit", subject = "afterCommitHandler") protected void petsTableEditAfterCommitHandler(Pet entity) { System.out.println("Committed " + entity); }
-
setTransformation
Sets the function to transform the committed in the editor screen entity before setting it to the target data container.Note that transformation function is invoked if the editor is opened in
OpenMode.DIALOG
mode.The preferred way to set the function is using a controller method annotated with
Install
, e.g.:@Install(to = "petsTable.edit", subject = "transformation") protected Pet petsTableEditTransformation(Pet entity) { return doTransform(entity); }
- Parameters:
transformation
- transformation function to set
-
setMessages
-
setFlowUiComponentProperties
@Autowired protected void setFlowUiComponentProperties(FlowUiComponentProperties flowUiComponentProperties) -
setDialogWindowBuilders
-
setText
- Specified by:
setText
in interfaceAction
- Overrides:
setText
in classAbstractAction
-
isPermitted
protected boolean isPermitted()- Overrides:
isPermitted
in classSecuredListDataComponentAction<EditAction<E>,
E>
-
refreshState
public void refreshState()- Specified by:
refreshState
in interfaceAction
- Overrides:
refreshState
in classSecuredBaseAction
-
isDisabledWhenScreenReadOnly
public boolean isDisabledWhenScreenReadOnly()- Specified by:
isDisabledWhenScreenReadOnly
in interfaceAdjustWhenScreenReadOnly
- Returns:
- whether this action must be disabled when a screen in the read-only mode
-
execute
public void execute()Executes the action.- Specified by:
execute
in interfaceExecutableAction
-
openDialog
-
withScreenId
- See Also:
-
withScreenClass
- See Also:
-
withRouteParameters
public EditAction<E> withRouteParameters(@Nullable com.vaadin.flow.router.RouteParameters routeParameters) - See Also:
-
withQueryParameters
public EditAction<E> withQueryParameters(@Nullable com.vaadin.flow.router.QueryParameters queryParameters) - See Also:
-
withOpenMode
- See Also:
-
withAfterCloseHandler
public <S extends Screen<?>> EditAction<E> withAfterCloseHandler(Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) - See Also:
-
withAfterCommitHandler
- See Also:
-
withTransformation
- See Also:
-