E
- type of entity@StudioAction(category="Picker Actions", description="Sets an entity to the picker field using the entity lookup screen") @ActionType(value="picker_lookup") public class LookupAction<E extends Entity> extends BaseAction implements PickerField.PickerFieldAction, org.springframework.beans.factory.InitializingBean, Action.ExecutableAction
Should be defined for PickerField
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.
BaseAction.EnabledRule
Action.ActionPerformedEvent, Action.AdjustWhenScreenReadOnly, Action.BeforeActionPerformedHandler, Action.DisabledWhenScreenReadOnly, Action.ExecutableAction, Action.HasBeforeActionPerformedHandler, Action.HasOpenType, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.SecuredAction, Action.Status
Modifier and Type | Field and Description |
---|---|
protected Configuration |
configuration |
protected boolean |
editable |
protected Icons |
icons |
static java.lang.String |
ID |
protected Messages |
messages |
protected PickerField |
pickerField |
protected ScreenBuilders |
screenBuilders |
protected ActionScreenInitializer |
screenInitializer |
protected java.util.function.Predicate<LookupScreen.ValidationContext<E>> |
selectValidator |
protected java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> |
transformation |
caption, description, enabled, eventHub, icon, id, owners, primary, shortcut, visible
PROP_EDITABLE
PROP_CAPTION, PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT, PROP_VISIBLE
Constructor and Description |
---|
LookupAction() |
LookupAction(java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerform(Component component)
Invoked by owning component to execute the action.
|
void |
afterPropertiesSet() |
void |
editableChanged(PickerField pickerField,
boolean editable) |
void |
execute()
Executes the action.
|
OpenMode |
getOpenMode()
Returns the lookup screen open mode if it was set by
setOpenMode(OpenMode) or in the screen XML. |
java.lang.Class |
getScreenClass()
Returns the lookup screen class if it was set by
setScreenClass(Class) or in the screen XML. |
java.lang.String |
getScreenId()
Returns the lookup screen id if it was set by
setScreenId(String) or in the screen XML. |
boolean |
isEditable() |
void |
setAfterCloseHandler(java.util.function.Consumer<Screen.AfterCloseEvent> afterCloseHandler)
Sets the handler to be invoked when the lookup screen closes.
|
protected void |
setConfiguration(Configuration configuration) |
protected void |
setEditable(boolean editable) |
protected void |
setIcons(Icons icons) |
protected void |
setMessages(Messages messages) |
void |
setOpenMode(OpenMode openMode)
Sets the lookup screen open mode.
|
void |
setPickerField(PickerField pickerField) |
void |
setScreenClass(java.lang.Class screenClass)
Sets the lookup screen id.
|
void |
setScreenConfigurer(java.util.function.Consumer<Screen> screenConfigurer)
Sets the lookup screen configurer.
|
void |
setScreenId(java.lang.String screenId)
Sets the lookup screen id.
|
void |
setScreenOptionsSupplier(java.util.function.Supplier<ScreenOptions> screenOptionsSupplier)
Sets the lookup screen options supplier.
|
void |
setSelectValidator(java.util.function.Predicate<LookupScreen.ValidationContext<E>> selectValidator)
Sets the validator to be invoked when the user selects entities in the lookup screen.
|
void |
setTransformation(java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> transformation)
Sets the function to transform selected in the lookup screen entities.
|
addActionPerformedListener, addEnabledRule, isApplicable, isEnabledByRule, isEnabledByUiPermissions, isPermitted, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternal, withCaption, withDescription, withHandler, withIcon, withPrimary, withShortcut
addOwner, addPropertyChangeListener, firePropertyChange, getCaption, getDefaultCaption, getDescription, getEventHub, getIcon, getId, getOwner, getOwners, getShortcutCombination, hasSubscriptions, isEnabled, isPrimary, isVisible, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setIconFromSet, setPrimary, setShortcut, setShortcutCombination
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addOwner, addPropertyChangeListener, getCaption, getDescription, getIcon, getId, getOwner, getOwners, getShortcutCombination, isEnabled, isVisible, refreshState, removeOwner, removePropertyChangeListener, setCaption, setDescription, setEnabled, setIcon, setIconFromSet, setShortcut, setShortcutCombination, setVisible
public static final java.lang.String ID
protected PickerField pickerField
@Inject protected ScreenBuilders screenBuilders
protected Icons icons
protected Messages messages
protected Configuration configuration
protected boolean editable
protected ActionScreenInitializer screenInitializer
protected java.util.function.Predicate<LookupScreen.ValidationContext<E extends Entity>> selectValidator
public LookupAction()
public LookupAction(java.lang.String id)
@Nullable public OpenMode getOpenMode()
setOpenMode(OpenMode)
or in the screen XML.
Otherwise returns null.@StudioPropertiesItem public void setOpenMode(OpenMode openMode)
@Nullable public java.lang.String getScreenId()
setScreenId(String)
or in the screen XML.
Otherwise returns null.@StudioPropertiesItem public void setScreenId(java.lang.String screenId)
@Nullable public java.lang.Class getScreenClass()
setScreenClass(Class)
or in the screen XML.
Otherwise returns null.@StudioPropertiesItem public void setScreenClass(java.lang.Class screenClass)
public void setScreenOptionsSupplier(java.util.function.Supplier<ScreenOptions> screenOptionsSupplier)
ScreenOptions
to 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)); }
public void setScreenConfigurer(java.util.function.Consumer<Screen> screenConfigurer)
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); }
public void setAfterCloseHandler(java.util.function.Consumer<Screen.AfterCloseEvent> afterCloseHandler)
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); }
public void setSelectValidator(java.util.function.Predicate<LookupScreen.ValidationContext<E>> selectValidator)
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()); }
public void setTransformation(java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> transformation)
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); }
public void setPickerField(PickerField pickerField)
setPickerField
in interface PickerField.PickerFieldAction
public void editableChanged(PickerField pickerField, boolean editable)
editableChanged
in interface PickerField.PickerFieldAction
public boolean isEditable()
isEditable
in interface PickerField.PickerFieldAction
protected void setEditable(boolean editable)
@Inject protected void setIcons(Icons icons)
@Inject protected void setMessages(Messages messages)
@Inject protected void setConfiguration(Configuration configuration)
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void actionPerform(Component component)
Action
actionPerform
in interface Action
actionPerform
in class BaseAction
component
- invoking componentpublic void execute()
execute
in interface Action.ExecutableAction