Class ReadAction<E>
- All Implemented Interfaces:
ExecutableAction
,SecuredAction
,SecurityConstraintAction
,TargetAction<ListDataComponent<E>>
,ViewOpeningAction
,Action
,HasShortcutCombination
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.action.SecuredBaseAction
SecuredBaseAction.EnabledRule
Nested classes/interfaces inherited from interface io.jmix.flowui.action.ViewOpeningAction
ViewOpeningAction.QueryParametersProvider, ViewOpeningAction.RouteParametersProvider
-
Field Summary
Modifier and TypeFieldDescriptionprotected DialogWindows
static final String
protected OpenMode
protected ReadOnlyViewsSupport
protected boolean
protected ActionViewInitializer
protected ViewNavigators
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, enabledRules, 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_COMBINATION, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Executes the action.<V extends View<?>>
Consumer<DialogWindow.AfterCloseEvent<V>>Returns the view open mode if it was set byViewOpeningAction.setOpenMode(OpenMode)
or in the view XML, otherwise returnsnull
.Returns the detail view class if it was set bysetViewClass(Class)
or in the view XML.Returns the detail view id if it was set bysetViewId(String)
or in the view XML.protected void
protected boolean
protected void
protected void
openDialog
(E editedEntity) <V extends View<?>>
voidsetAfterCloseHandler
(Consumer<DialogWindow.AfterCloseEvent<V>> afterCloseHandler) Sets the handler to be invoked when the detail view closes.void
setAfterSaveHandler
(Consumer<E> afterSaveHandler) Sets the handler to be invoked when the detail view saves the entity (if "enable editing" action was executed).void
setDialogWindowBuilders
(DialogWindows dialogWindows) protected void
setMessages
(Messages messages) void
setOpenMode
(OpenMode openMode) Sets the view open mode.void
setQueryParametersProvider
(ViewOpeningAction.QueryParametersProvider queryParameters) Sets query parameters provider that returns query parameters that should be used in the URL.void
setReadOnlyViewsSupport
(ReadOnlyViewsSupport readOnlyViewsSupport) void
setRouteParametersProvider
(ViewOpeningAction.RouteParametersProvider routeParameters) Sets route parameters provider that returns route parameters that should be used in the route template.void
void
setTransformation
(Function<E, E> transformation) Sets the function to transform the saved in the detail view entity (if "enable editing" action was executed) before setting it to the target data container.protected void
setUiComponentProperties
(UiComponentProperties uiComponentProperties) void
setViewClass
(Class<? extends View> viewClass) Sets the detail view id.<V extends View<?>>
voidsetViewConfigurer
(Consumer<V> viewConfigurer) Sets the view configurer.void
Sets the detail view id.void
setViewNavigators
(ViewNavigators viewNavigators) <V extends View<?>>
ReadAction<E>withAfterCloseHandler
(Consumer<DialogWindow.AfterCloseEvent<V>> afterCloseHandler) withAfterSavedHandler
(Consumer<E> afterSavedHandler) withOpenMode
(OpenMode openMode) withTransformation
(Function<E, E> transformation) withViewClass
(Class<? extends View> viewClass) <V extends View<?>>
ReadAction<E>withViewConfigurer
(Consumer<V> viewConfigurer) withViewId
(String viewId) 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, checkTargetItems, getTarget, onSelectionChange, setTarget, withEnabled, withEnabledByUiPermissions, withHandler, withIcon, withIcon, withShortcutCombination, withTarget, withText, withTitle, withVariant, withVisible, withVisibleByUiPermissions
Methods inherited from class io.jmix.flowui.action.SecuredBaseAction
addEnabledRule, isEnabledByRule, isEnabledByUiPermissions, isVisibleByUiPermissions, refreshState, removeEnabledRule, 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, getText, getVariant, isEnabled, isVisible, refreshState, setDescription, setEnabled, setIcon, setVariant, setVisible
Methods inherited from interface io.jmix.flowui.kit.component.HasShortcutCombination
getShortcutCombination, setShortcutCombination
-
Field Details
-
ID
- See Also:
-
dialogWindows
-
readOnlyViewsSupport
-
viewInitializer
-
afterSaveHandler
-
transformation
-
textInitialized
protected boolean textInitialized -
openMode
-
-
Constructor Details
-
ReadAction
public ReadAction() -
ReadAction
-
-
Method Details
-
initAction
protected void initAction()- Overrides:
initAction
in classListDataComponentAction<ReadAction<E>,
E>
-
getOpenMode
Description copied from interface:ViewOpeningAction
Returns the view open mode if it was set byViewOpeningAction.setOpenMode(OpenMode)
or in the view XML, otherwise returnsnull
.- Specified by:
getOpenMode
in interfaceViewOpeningAction
-
setOpenMode
Description copied from interface:ViewOpeningAction
Sets the view open mode.- Specified by:
setOpenMode
in interfaceViewOpeningAction
- Parameters:
openMode
- the open mode to set
-
getViewId
Returns the detail view id if it was set bysetViewId(String)
or in the view XML. Otherwise, returns null.- Specified by:
getViewId
in interfaceViewOpeningAction
-
setViewId
Sets the detail view id.- Specified by:
setViewId
in interfaceViewOpeningAction
- Parameters:
viewId
- the view id to set
-
getViewClass
Returns the detail view class if it was set bysetViewClass(Class)
or in the view XML. Otherwise returns null.- Specified by:
getViewClass
in interfaceViewOpeningAction
-
setViewClass
Sets the detail view id.- Specified by:
setViewClass
in interfaceViewOpeningAction
- Parameters:
viewClass
- the view class to set
-
getRouteParametersProvider
- Specified by:
getRouteParametersProvider
in interfaceViewOpeningAction
- Returns:
- route parameters or
null
if not set
-
setRouteParametersProvider
public void setRouteParametersProvider(@Nullable ViewOpeningAction.RouteParametersProvider routeParameters) Description copied from interface:ViewOpeningAction
Sets route parameters provider that returns route parameters that should be used in the route template.Note that route parameters provider is set if the detail is opened in
OpenMode.NAVIGATION
.- Specified by:
setRouteParametersProvider
in interfaceViewOpeningAction
- Parameters:
routeParameters
- route parameters provider to set- See Also:
-
Route
-
getQueryParametersProvider
- Specified by:
getQueryParametersProvider
in interfaceViewOpeningAction
- Returns:
- query parameters provider or
null
if not set
-
setQueryParametersProvider
public void setQueryParametersProvider(@Nullable ViewOpeningAction.QueryParametersProvider queryParameters) Description copied from interface:ViewOpeningAction
Sets query parameters provider that returns query parameters that should be used in the URL.Note that query parameters provider is set if the detail is opened in
OpenMode.NAVIGATION
.- Specified by:
setQueryParametersProvider
in interfaceViewOpeningAction
- Parameters:
queryParameters
- query parameters provider to set
-
setAfterCloseHandler
public <V extends View<?>> void setAfterCloseHandler(@Nullable Consumer<DialogWindow.AfterCloseEvent<V>> afterCloseHandler) Description copied from interface:ViewOpeningAction
Sets the handler to be invoked when the detail view closes.Note that handler is invoked if the detail 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.SAVE)) { System.out.println("Saved"); } }
- Specified by:
setAfterCloseHandler
in interfaceViewOpeningAction
- Type Parameters:
V
- view type- Parameters:
afterCloseHandler
- handler to set
-
getAfterCloseHandler
- Specified by:
getAfterCloseHandler
in interfaceViewOpeningAction
-
setViewConfigurer
Description copied from interface:ViewOpeningAction
Sets the view configurer. Use the configurer if you need to provide parameters to the opened view through setters.The preferred way to set the configurer is using a controller method annotated with
Install
, e.g.:@Install(to = "petsTable.view", subject = "viewConfigurer") protected void petsTableViewConfigurer(View<?> view) { view.setSomeParameter(someValue); }
- Specified by:
setViewConfigurer
in interfaceViewOpeningAction
-
getViewConfigurer
- Specified by:
getViewConfigurer
in interfaceViewOpeningAction
-
setAfterSaveHandler
Sets the handler to be invoked when the detail view saves the entity (if "enable editing" action was executed).Note that handler is invoked if the detail 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.read", subject = "afterSaveHandler") protected void petsTableReadAfterSaveHandler(Pet entity) { System.out.println("Saved " + entity); }
-
getAfterSaveHandler
-
setTransformation
Sets the function to transform the saved in the detail view entity (if "enable editing" action was executed) before setting it to the target data container.Note that transformation function is invoked if the detail 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.read", subject = "transformation") protected Pet petsTableReadTransformation(Pet entity) { return doTransform(entity); }
- Parameters:
transformation
- transformation function to set
-
getTransformation
-
setMessages
-
setUiComponentProperties
-
setDialogWindowBuilders
-
setReadOnlyViewsSupport
-
setText
- Specified by:
setText
in interfaceAction
- Overrides:
setText
in classAbstractAction
-
isPermitted
protected boolean isPermitted()- Overrides:
isPermitted
in classSecuredListDataComponentAction<ReadAction<E>,
E>
-
execute
public void execute()Executes the action.- Specified by:
execute
in interfaceExecutableAction
-
openDialog
-
withViewId
- See Also:
-
withViewClass
- See Also:
-
withRouteParametersProvider
public ReadAction<E> withRouteParametersProvider(@Nullable ViewOpeningAction.RouteParametersProvider provider) -
withQueryParametersProvider
public ReadAction<E> withQueryParametersProvider(@Nullable ViewOpeningAction.QueryParametersProvider provider) -
withOpenMode
- See Also:
-
withAfterCloseHandler
public <V extends View<?>> ReadAction<E> withAfterCloseHandler(Consumer<DialogWindow.AfterCloseEvent<V>> afterCloseHandler) - See Also:
-
withViewConfigurer
- See Also:
-
withAfterSavedHandler
- See Also:
-
withTransformation
- See Also:
-