Class CreateAction<E>
- All Implemented Interfaces:
AdjustWhenScreenReadOnly,ExecutableAction,ScreenOpeningAction,SecuredAction,TargetAction<ListDataComponent<E>>,Action
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AccessManagerprotected DialogWindowBuildersstatic final Stringprotected OpenModeprotected ActionScreenInitializerprotected ScreenNavigatorsFields 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, otherwise returns null.protected voidprotected booleanprotected voidprotected voidvoidsetAccessManager(AccessManager accessManager) <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 new entity.voidsetDialogWindowBuilders(DialogWindowBuilders dialogWindowBuilders) protected voidsetFlowUiComponentProperties(FlowUiComponentProperties flowUiComponentProperties) voidsetInitializer(Consumer<E> initializer) Sets the new entity initializer.protected voidsetMessages(Messages messages) voidsetNewEntitySupplier(Supplier<E> newEntitySupplier) Sets the new entity supplier.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 class.voidsetScreenId(String screenId) Sets the editor screen id.voidsetScreenNavigators(ScreenNavigators screenNavigators) voidsetTransformation(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<?>>
CreateAction<E>withAfterCloseHandler(Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) withAfterCommitHandler(Consumer<E> afterCommitHandler) withInitializer(Consumer<E> initializer) withNewEntitySupplier(Supplier<E> newEntitySupplier) 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.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, refreshState, setEnabledByUiPermissions, setVisibleByUiPermissionsMethods inherited from class io.jmix.flowui.kit.action.BaseAction
addActionPerformedListener, isApplicable, 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, setText, 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, refreshState, setDescription, setEnabled, setIcon, setShortcutCombination, setText, setVariant, setVisibleMethods inherited from interface io.jmix.flowui.action.AdjustWhenScreenReadOnly
isDisabledWhenScreenReadOnly
-
Field Details
-
ID
- See Also:
-
dialogWindowBuilders
-
accessManager
-
screenInitializer
-
newEntitySupplier
-
initializer
-
afterCommitHandler
-
transformation
-
openMode
-
-
Constructor Details
-
CreateAction
public CreateAction() -
CreateAction
-
-
Method Details
-
initAction
protected void initAction()- Overrides:
initActionin classListDataComponentAction<CreateAction<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 class.- 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
-
setInitializer
Sets the new entity initializer. The initializer accepts the new entity instance and can perform its initialization.Note that initializer is invoked if the editor is opened in
OpenMode.DIALOGmode.The preferred way to set the initializer is using a controller method annotated with
Install, e.g.:@Install(to = "petsTable.create", subject = "initializer") protected void petsTableCreateInitializer(Pet entity) { entity.setName("a cat"); } -
setAfterCommitHandler
Sets the handler to be invoked when the editor screen commits the new 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.create", subject = "afterCommitHandler") protected void petsTableCreateAfterCommitHandler(Pet entity) { System.out.println("Created " + 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.create", subject = "transformation") protected Pet petsTableCreateTransformation(Pet entity) { return doTransform(entity); } -
setNewEntitySupplier
Sets the new entity supplier. The supplier should return a new entity instance.Note that supplier is invoked if the editor is opened in
OpenMode.DIALOGmode.The preferred way to set the supplier is using a controller method annotated with
Install, e.g.:@Install(to = "petsTable.create", subject = "newEntitySupplier") protected Pet petsTableCreateNewEntitySupplier() { Pet pet = metadata.create(Pet.class); pet.setName("a cat"); return pet; } -
setMessages
-
setFlowUiComponentProperties
@Autowired protected void setFlowUiComponentProperties(FlowUiComponentProperties flowUiComponentProperties) -
setAccessManager
-
setDialogWindowBuilders
-
isPermitted
protected boolean isPermitted()- Overrides:
isPermittedin classSecuredBaseAction
-
execute
public void execute()Executes the action.- Specified by:
executein interfaceExecutableAction
-
openDialog
protected void openDialog() -
withScreenId
- See Also:
-
withScreenClass
- See Also:
-
withRouteParameters
public CreateAction<E> withRouteParameters(@Nullable com.vaadin.flow.router.RouteParameters routeParameters) - See Also:
-
withQueryParameters
public CreateAction<E> withQueryParameters(@Nullable com.vaadin.flow.router.QueryParameters queryParameters) - See Also:
-
withOpenMode
- See Also:
-
withAfterCloseHandler
public <S extends Screen<?>> CreateAction<E> withAfterCloseHandler(@Nullable Consumer<DialogWindow.AfterCloseEvent<S>> afterCloseHandler) - See Also:
-
withAfterCommitHandler
- See Also:
-
withTransformation
- See Also:
-
withInitializer
- See Also:
-
withNewEntitySupplier
- See Also:
-