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
FieldsModifier and TypeFieldDescriptionprotected DialogWindowBuildersstatic final Stringprotected Messagesprotected OpenModeprotected ActionScreenInitializerprotected ScreenNavigatorsprotected booleanFields inherited from class io.jmix.flowui.action.list.SecuredListDataComponentAction
accessManager, applicationContext, constraintEntityOp, metadataFields inherited from class io.jmix.flowui.action.list.ListDataComponentAction
selectionListenerRegistration, targetFields inherited from class io.jmix.flowui.action.SecuredBaseAction
enabledByUiPermissions, visibleByUiPermissionsFields inherited from class io.jmix.flowui.kit.action.BaseAction
enabledExplicitly, visibleExplicitlyFields inherited from class io.jmix.flowui.kit.action.AbstractAction
description, enabled, eventBus, icon, id, shortcutCombination, text, variant, visibleFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()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.QueryParameterscom.vaadin.flow.router.RouteParametersReturns 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 voidbooleanprotected booleanprotected voidnavigateToScreen(E editedEntity) protected voidopenDialog(E editedEntity) void<S extends Screen<?>>
voidsetAfterCloseHandler(Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) Sets the handler to be invoked when the editor screen closes.voidsetAfterCommitHandler(Consumer<E> afterCommitHandler) Sets the handler to be invoked when the editor screen commits the entity.voidsetDialogWindowBuilders(DialogWindowBuilders dialogWindowBuilders) protected voidsetFlowUiComponentProperties(FlowUiComponentProperties flowUiComponentProperties) protected voidsetMessages(Messages messages) voidsetOpenMode(OpenMode openMode) Sets the screen open mode.voidsetQueryParameters(com.vaadin.flow.router.QueryParameters queryParameters) Sets query parameters that should be used in the URL.voidsetRouteParameters(com.vaadin.flow.router.RouteParameters routeParameters) Sets route parameters that should be used in the route template.voidsetScreenClass(Class<? extends Screen> screenClass) Sets the editor screen id.voidsetScreenId(String screenId) Sets the editor screen id.voidsetScreenNavigators(ScreenNavigators screenNavigators) voidvoidsetTransformation(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, withConstraintEntityOpMethods 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, withVisibleByUiPermissionsMethods inherited from class io.jmix.flowui.action.SecuredBaseAction
isEnabledByUiPermissions, isVisibleByUiPermissions, setEnabledByUiPermissions, setVisibleByUiPermissionsMethods inherited from class io.jmix.flowui.kit.action.BaseAction
addActionPerformedListener, setEnabled, setEnabledInternal, setVisible, setVisibleInternalMethods inherited from class io.jmix.flowui.kit.action.AbstractAction
addPropertyChangeListener, firePropertyChange, getDescription, getEventBus, getIcon, getId, getShortcutCombination, getText, getVariant, hasListener, isEnabled, isVisible, setDescription, setIcon, setShortcutCombination, setVariantMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
initActionin classListDataComponentAction<EditAction<E>,E>
-
getOpenMode
Description copied from interface:ScreenOpeningActionReturns the screen open mode if it was set byScreenOpeningAction.setOpenMode(OpenMode)or in the screen XML, otherwise returnsnull.- Specified by:
getOpenModein interfaceScreenOpeningAction
-
setOpenMode
Description copied from interface:ScreenOpeningActionSets the screen open mode.- Specified by:
setOpenModein 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:
getScreenIdin interfaceScreenOpeningAction
-
setScreenId
Sets the editor screen id.- Specified by:
setScreenIdin 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:
getScreenClassin interfaceScreenOpeningAction
-
setScreenClass
Sets the editor screen id.- Specified by:
setScreenClassin interfaceScreenOpeningAction- Parameters:
screenClass- the screen class to set
-
getRouteParameters
@Nullable public com.vaadin.flow.router.RouteParameters getRouteParameters()- Specified by:
getRouteParametersin interfaceScreenOpeningAction- Returns:
- route parameters or
nullif not set
-
setRouteParameters
public void setRouteParameters(@Nullable com.vaadin.flow.router.RouteParameters routeParameters) Description copied from interface:ScreenOpeningActionSets 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:
setRouteParametersin interfaceScreenOpeningAction- Parameters:
routeParameters- route parameters to set- See Also:
-
Route
-
getQueryParameters
@Nullable public com.vaadin.flow.router.QueryParameters getQueryParameters()- Specified by:
getQueryParametersin interfaceScreenOpeningAction- Returns:
- query parameters or
nullif not set
-
setQueryParameters
public void setQueryParameters(@Nullable com.vaadin.flow.router.QueryParameters queryParameters) Description copied from interface:ScreenOpeningActionSets 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:
setQueryParametersin interfaceScreenOpeningAction- Parameters:
queryParameters- query parameters to set
-
setAfterCloseHandler
public <S extends Screen<?>> void setAfterCloseHandler(@Nullable Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) Description copied from interface:ScreenOpeningActionSets the handler to be invoked when the editor screen closes.Note that handler is invoked if the editor is opened in
OpenMode.DIALOGmode.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:
setAfterCloseHandlerin 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.DIALOGmode.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.DIALOGmode.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:
setTextin interfaceAction- Overrides:
setTextin classAbstractAction
-
isPermitted
protected boolean isPermitted()- Overrides:
isPermittedin classSecuredListDataComponentAction<EditAction<E>,E>
-
refreshState
public void refreshState()- Specified by:
refreshStatein interfaceAction- Overrides:
refreshStatein classSecuredBaseAction
-
isDisabledWhenScreenReadOnly
public boolean isDisabledWhenScreenReadOnly()- Specified by:
isDisabledWhenScreenReadOnlyin 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:
executein 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:
-