Package io.jmix.ui.action
Class AbstractLookupAction<E>
java.lang.Object
io.jmix.ui.action.AbstractAction
io.jmix.ui.action.BaseAction
io.jmix.ui.action.AbstractLookupAction<E>
- Type Parameters:
E- type of entity
- All Implemented Interfaces:
Action,Action.HasPrimaryState,Action.ScreenOpeningAction,Action.SecuredAction
- Direct Known Subclasses:
EntityLookupAction,TagLookupAction
public abstract class AbstractLookupAction<E>
extends BaseAction
implements Action.ScreenOpeningAction
Base class for actions that should open a screen.
-
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 Iconsprotected Messagesprotected ScreenBuildersprotected ActionScreenInitializerprotected Predicate<LookupScreen.ValidationContext<E>>protected Function<Collection<E>,Collection<E>> Fields 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_VISIBLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the lookup screen open mode if it was set bysetOpenMode(OpenMode)or in the screen XML.Returns the lookup screen class if it was set bysetScreenClass(Class)or in the screen XML.Returns the lookup screen id if it was set bysetScreenId(String)or in the screen XML.voidsetAfterCloseHandler(Consumer<Screen.AfterCloseEvent> afterCloseHandler) Sets the handler to be invoked when the lookup screen closes.protected voidprotected voidsetMessages(Messages messages) voidsetOpenMode(OpenMode openMode) Sets the lookup screen open mode.voidsetScreenBuilders(ScreenBuilders screenBuilders) voidsetScreenClass(Class<? extends Screen> screenClass) Sets the lookup screen id.voidsetScreenConfigurer(Consumer<Screen> screenConfigurer) Sets the lookup screen configurer.voidsetScreenId(String screenId) Sets the lookup screen id.voidsetScreenOptionsSupplier(Supplier<ScreenOptions> screenOptionsSupplier) Sets the lookup screen options supplier.voidsetSelectValidator(Predicate<LookupScreen.ValidationContext<E>> selectValidator) Sets the validator to be invoked when the user selects entities in the lookup screen.voidsetTransformation(Function<Collection<E>, Collection<E>> transformation) Sets the function to transform selected in the lookup screen entities.Methods inherited from class io.jmix.ui.action.BaseAction
actionPerform, 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, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setShortcut, setShortcutCombination
-
Field Details
-
screenBuilders
-
icons
-
messages
-
screenInitializer
-
selectValidator
-
transformation
-
-
Constructor Details
-
AbstractLookupAction
-
-
Method Details
-
setScreenBuilders
-
setIcons
-
setMessages
-
getOpenMode
Returns the lookup 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 lookup screen open mode.- Specified by:
setOpenModein interfaceAction.ScreenOpeningAction- Parameters:
openMode- the open mode to set
-
getScreenId
Returns the lookup screen id if it was set bysetScreenId(String)or in the screen XML. Otherwise returns null.- Specified by:
getScreenIdin interfaceAction.ScreenOpeningAction
-
setScreenId
Sets the lookup screen id.- Specified by:
setScreenIdin interfaceAction.ScreenOpeningAction- Parameters:
screenId- the screen id to set
-
getScreenClass
Returns the lookup screen class if it was set bysetScreenClass(Class)or in the screen XML. Otherwise returns null.- Specified by:
getScreenClassin interfaceAction.ScreenOpeningAction
-
setScreenClass
Sets the lookup screen id.- Specified by:
setScreenClassin interfaceAction.ScreenOpeningAction- Parameters:
screenClass- the screen class to set
-
setScreenOptionsSupplier
Sets the lookup 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.lookup", subject = "screenOptionsSupplier") protected ScreenOptions petFieldLookupScreenOptionsSupplier() { return new MapScreenOptions(ParamsMap.of("someParameter", 10)); }- Specified by:
setScreenOptionsSupplierin interfaceAction.ScreenOpeningAction
-
setScreenConfigurer
Sets the lookup 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.lookup", subject = "screenConfigurer") protected void petFieldLookupScreenConfigurer(Screen lookupScreen) { ((PetBrowse) lookupScreen).setSomeParameter(someValue); }- Specified by:
setScreenConfigurerin interfaceAction.ScreenOpeningAction
-
setAfterCloseHandler
Sets the handler to be invoked when the lookup screen closes.The preferred way to set the handler is using a controller method annotated with
Install, e.g.:@Install(to = "petField.lookup", subject = "afterCloseHandler") protected void petFieldLookupAfterCloseHandler(AfterCloseEvent event) { CloseAction closeAction = event.getCloseAction(); System.out.println("Closed with " + closeAction); }- Specified by:
setAfterCloseHandlerin interfaceAction.ScreenOpeningAction
-
setSelectValidator
Sets the validator to be invoked when the user selects entities in the lookup screen.The preferred way to set the validator is using a controller method annotated with
Install, e.g.:@Install(to = "petField.lookup", subject = "selectValidator") protected void petFieldLookupSelectValidator(LookupScreen.ValidationContext<Pet> context) { return checkSelected(context.getSelectedItems()); } -
setTransformation
Sets the function to transform selected in the lookup screen entities.The preferred way to set the function is using a controller method annotated with
Install, e.g.:@Install(to = "petField.lookup", subject = "transformation") protected Collection<Pet> petFieldLookupTransformation(Collection<Pet> entities) { return doTransform(entities); }
-