Package io.jmix.ui.action.entitypicker
Class EntityOpenAction<E>
java.lang.Object
io.jmix.ui.action.AbstractAction
io.jmix.ui.action.BaseAction
io.jmix.ui.action.entitypicker.EntityOpenAction<E>
- All Implemented Interfaces:
Action,Action.ExecutableAction,Action.HasPrimaryState,Action.ScreenOpeningAction,Action.SecuredAction,EntityPicker.EntityPickerAction,ValuePicker.ValuePickerAction,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
EntityOpenCompositionAction
@StudioAction(target="io.jmix.ui.component.EntityPicker",
description="Opens an entity using the entity edit screen")
@ActionType("entity_open")
public class EntityOpenAction<E>
extends BaseAction
implements EntityPicker.EntityPickerAction, Action.ScreenOpeningAction, org.springframework.beans.factory.InitializingBean, Action.ExecutableAction
Standard entity picker action for opening an entity instance in its editor screen.
Should be defined for EntityPicker or its subclass in a screen XML descriptor.
The action instance can be parameterized using the nested properties XML element or programmatically in the
screen controller.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.action.BaseAction
BaseAction.EnabledRuleNested classes/interfaces inherited from interface io.jmix.ui.action.Action
Action.ActionPerformedEvent, Action.AdjustWhenScreenReadOnly, Action.ExecutableAction, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.MainTabSheetAction, Action.ScreenOpeningAction, Action.SecuredAction, Action.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UiComponentPropertiesprotected booleanprotected EntityPickerprotected Iconsstatic final Stringprotected Messagesprotected MetadataToolsprotected ScreenBuildersprotected ActionScreenInitializerFields inherited from class io.jmix.ui.action.AbstractAction
caption, description, enabled, eventHub, icon, id, owners, primary, shortcut, visibleFields inherited from interface io.jmix.ui.action.Action
PROP_CAPTION, PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT, PROP_VISIBLEFields inherited from interface io.jmix.ui.component.ValuePicker.ValuePickerAction
PROP_EDITABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerform(Component component) Invoked by owning component to execute the action.voidprotected booleanvoideditableChanged(boolean editable) Called byValuePickerto inform about its editable state.voidexecute()Executes the action.Returns the editor screen open mode if it was set bysetOpenMode(OpenMode)or in the screen XML, otherwise returns null.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.booleanvoidsetAfterCloseHandler(Consumer<Screen.AfterCloseEvent> 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.protected voidsetEditable(boolean editable) voidsetEntityPicker(EntityPicker entityPicker) protected voidprotected voidsetMessages(Messages messages) voidsetOpenMode(OpenMode openMode) Sets the editor screen open mode.voidsetScreenBuilders(ScreenBuilders screenBuilders) voidsetScreenClass(Class<? extends Screen> screenClass) Sets the editor screen id.voidsetScreenConfigurer(Consumer<Screen> screenConfigurer) Sets the editor screen configurer.voidsetScreenId(String screenId) Sets the editor screen id.voidsetScreenOptionsSupplier(Supplier<ScreenOptions> screenOptionsSupplier) Sets the editor screen options supplier.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.protected voidsetUiComponentProperties(UiComponentProperties componentProperties) Methods inherited from class io.jmix.ui.action.BaseAction
addActionPerformedListener, addEnabledRule, isApplicable, isEnabledByRule, isEnabledByUiPermissions, isPermitted, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternal, withCaption, withDescription, withHandler, withIcon, withPrimary, withShortcutMethods inherited from class io.jmix.ui.action.AbstractAction
addOwner, addPropertyChangeListener, firePropertyChange, getCaption, getDescription, getEventHub, getIcon, getId, getOwner, getOwners, getShortcutCombination, hasSubscriptions, isEnabled, isPrimary, isVisible, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setPrimary, setShortcut, setShortcutCombinationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.ui.action.Action
addOwner, addPropertyChangeListener, getCaption, getDescription, getIcon, getId, getOwner, getOwners, getShortcutCombination, isEnabled, isVisible, refreshState, removeOwner, removePropertyChangeListener, setCaption, setDescription, setEnabled, setIcon, setShortcut, setShortcutCombination, setVisibleMethods inherited from interface io.jmix.ui.component.EntityPicker.EntityPickerAction
setPicker
-
Field Details
-
ID
- See Also:
-
entityPicker
-
icons
-
messages
-
componentProperties
-
screenBuilders
-
metadataTools
-
editable
protected boolean editable -
screenInitializer
-
-
Constructor Details
-
EntityOpenAction
public EntityOpenAction() -
EntityOpenAction
-
-
Method Details
-
getOpenMode
Returns the editor screen open mode if it was set bysetOpenMode(OpenMode)or in the screen XML, otherwise returns null.- Specified by:
getOpenModein interfaceAction.ScreenOpeningAction
-
setOpenMode
Sets the editor screen open mode.- Specified by:
setOpenModein interfaceAction.ScreenOpeningAction- 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 interfaceAction.ScreenOpeningAction
-
setScreenId
Sets the editor screen id.- Specified by:
setScreenIdin interfaceAction.ScreenOpeningAction- 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 interfaceAction.ScreenOpeningAction
-
setScreenClass
Sets the editor screen id.- Specified by:
setScreenClassin interfaceAction.ScreenOpeningAction- Parameters:
screenClass- the screen class to set
-
setScreenOptionsSupplier
Sets the editor screen options supplier. The supplier providesScreenOptionsto the opened screen.The preferred way to set the supplier is using a controller method annotated with
Install, e.g.:@Install(to = "petField.open", subject = "screenOptionsSupplier") protected ScreenOptions petFieldOpenScreenOptionsSupplier() { return new MapScreenOptions(ParamsMap.of("someParameter", 10)); }- Specified by:
setScreenOptionsSupplierin interfaceAction.ScreenOpeningAction
-
setScreenConfigurer
Sets the editor screen configurer. Use the configurer if you need to provide parameters to the opened screen through setters.The preferred way to set the configurer is using a controller method annotated with
Install, e.g.:@Install(to = "petField.open", subject = "screenConfigurer") protected void petFieldOpenScreenConfigurer(Screen editorScreen) { ((PetEdit) editorScreen).setSomeParameter(someValue); }- Specified by:
setScreenConfigurerin interfaceAction.ScreenOpeningAction
-
setAfterCloseHandler
Sets the handler to be invoked when the editor screen closes.The preferred way to set the handler is using a controller method annotated with
Install, e.g.:@Install(to = "petField.open", subject = "afterCloseHandler") protected void petFieldOpenAfterCloseHandler(AfterCloseEvent event) { CloseAction closeAction = event.getCloseAction(); System.out.println("Closed with " + closeAction); }- Specified by:
setAfterCloseHandlerin interfaceAction.ScreenOpeningAction
-
setAfterCommitHandler
Sets the handler to be invoked when the editor screen commits the entity.The preferred way to set the handler is using a controller method annotated with
Install, e.g.:@Install(to = "petField.open", subject = "afterCommitHandler") protected void petFieldOpenAfterCommitHandler(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.The preferred way to set the function is using a controller method annotated with
Install, e.g.:@Install(to = "petField.open", subject = "transformation") protected Pet petFieldOpenTransformation(Pet entity) { return doTransform(entity); } -
setUiComponentProperties
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
setEntityPicker
- Specified by:
setEntityPickerin interfaceEntityPicker.EntityPickerAction
-
editableChanged
public void editableChanged(boolean editable) Description copied from interface:ValuePicker.ValuePickerActionCalled byValuePickerto inform about its editable state.- Specified by:
editableChangedin interfaceValuePicker.ValuePickerAction- Parameters:
editable- aValuePickereditable state
-
isEditable
public boolean isEditable()- Specified by:
isEditablein interfaceValuePicker.ValuePickerAction- Returns:
- whether this action is editable
-
setEditable
protected void setEditable(boolean editable) -
setIcons
-
setMessages
-
setScreenBuilders
-
actionPerform
Description copied from interface:ActionInvoked by owning component to execute the action.- Specified by:
actionPerformin interfaceAction- Overrides:
actionPerformin classBaseAction- Parameters:
component- invoking component
-
execute
public void execute()Executes the action.- Specified by:
executein interfaceAction.ExecutableAction
-
checkFieldValue
protected boolean checkFieldValue()
-