Class MultiValueSelectAction<E>

All Implemented Interfaces:
ExecutableAction, SecuredAction, TargetAction<PickerComponent<Collection<E>>>, ViewOpeningAction, Action, HasShortcutCombination, org.springframework.beans.factory.InitializingBean

@ActionType("multi_value_select") public class MultiValueSelectAction<E> extends PickerAction<MultiValueSelectAction<E>,PickerComponent<Collection<E>>,Collection<E>> implements org.springframework.beans.factory.InitializingBean, ViewOpeningAction
Standard multi value select action for selection the field value.

Should be defined for JmixMultiValuePicker or its subclass

  • Field Details

  • Constructor Details

    • MultiValueSelectAction

      public MultiValueSelectAction()
    • MultiValueSelectAction

      public MultiValueSelectAction(String id)
  • Method Details

    • initAction

      protected void initAction()
      Overrides:
      initAction in class PickerAction<MultiValueSelectAction<E>,PickerComponent<Collection<E>>,Collection<E>>
    • setUiComponentProperties

      @Autowired protected void setUiComponentProperties(UiComponentProperties uiComponentProperties)
    • setMessages

      @Autowired protected void setMessages(Messages messages)
    • setDialogWindows

      @Autowired public void setDialogWindows(DialogWindows dialogWindows)
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • isReadOnly

      public boolean isReadOnly()
      Determines whether the current state of MultiValueSelectView.MultiValueSelectContext passed to the view opened by this action is read-only.
      Returns:
      true if the action is in a read-only state, false otherwise
    • setReadOnly

      protected void setReadOnly(boolean readOnly)
      Sets the read-only state of MultiValueSelectView.MultiValueSelectContext passed to the view opened by this action.
      Parameters:
      readOnly - a boolean value indicating the desired read-only state.
    • getOpenMode

      @Nullable public OpenMode getOpenMode()
      Description copied from interface: ViewOpeningAction
      Returns the view open mode if it was set by ViewOpeningAction.setOpenMode(OpenMode) or in the view XML, otherwise returns null.
      Specified by:
      getOpenMode in interface ViewOpeningAction
    • setOpenMode

      public void setOpenMode(@Nullable OpenMode openMode)
      Description copied from interface: ViewOpeningAction
      Sets the view open mode.
      Specified by:
      setOpenMode in interface ViewOpeningAction
      Parameters:
      openMode - the open mode to set
    • getViewId

      public String getViewId()
      Returns the identifier of the view to be opened. If the view identifier is not explicitly set via the view initializer, a default identifier is returned.
      Specified by:
      getViewId in interface ViewOpeningAction
      Returns:
      the view identifier, or a default identifier if no specific identifier is set.
    • setViewId

      public void setViewId(@Nullable String viewId)
      Sets the identifier for the view to be opened.
      Specified by:
      setViewId in interface ViewOpeningAction
      Parameters:
      viewId - the unique identifier of the view
    • getViewClass

      @Nullable public Class<? extends View> getViewClass()
      Returns the class of the view to be opened.
      Specified by:
      getViewClass in interface ViewOpeningAction
      Returns:
      the class of the view if defined, or null if no class is set.
    • setViewClass

      public void setViewClass(@Nullable Class<? extends View> viewClass)
      Sets the class of the view to be opened by this action.
      Specified by:
      setViewClass in interface ViewOpeningAction
      Parameters:
      viewClass - the class of the view to be opened; can be null if no specific class is set
    • getRouteParametersProvider

      @Nullable public ViewOpeningAction.RouteParametersProvider getRouteParametersProvider()
      Specified by:
      getRouteParametersProvider in interface ViewOpeningAction
      Returns:
      route parameters or null if not set
    • setRouteParametersProvider

      public void setRouteParametersProvider(@Nullable ViewOpeningAction.RouteParametersProvider provider)
      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 interface ViewOpeningAction
      Parameters:
      provider - route parameters provider to set
      See Also:
      • Route
    • getQueryParametersProvider

      @Nullable public ViewOpeningAction.QueryParametersProvider getQueryParametersProvider()
      Specified by:
      getQueryParametersProvider in interface ViewOpeningAction
      Returns:
      query parameters provider or null if not set
    • setQueryParametersProvider

      public void setQueryParametersProvider(@Nullable ViewOpeningAction.QueryParametersProvider provider)
      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 interface ViewOpeningAction
      Parameters:
      provider - 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 interface ViewOpeningAction
      Type Parameters:
      V - view type
      Parameters:
      afterCloseHandler - handler to set
    • getAfterCloseHandler

      public <V extends View<?>> Consumer<DialogWindow.AfterCloseEvent<V>> getAfterCloseHandler()
      Specified by:
      getAfterCloseHandler in interface ViewOpeningAction
    • setViewConfigurer

      public <V extends View<?>> void setViewConfigurer(@Nullable Consumer<V> viewConfigurer)
      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 interface ViewOpeningAction
    • getViewConfigurer

      public <V extends View<?>> Consumer<V> getViewConfigurer()
      Specified by:
      getViewConfigurer in interface ViewOpeningAction
    • getLookupViewId

      @Nullable public String getLookupViewId()
      Returns the identifier for the lookup view. This identifier is obtained from the MultiValueSelectView.MultiValueSelectContext associated with this action. May return null if no lookup view identifier is set.
      Returns:
      the lookup view identifier, or null if not set
    • setLookupViewId

      public void setLookupViewId(@Nullable String lookupViewId)
      Sets the identifier for the lookup view to be opened. The identifier is passed to the MultiValueSelectView.MultiValueSelectContext associated with this action.
      Parameters:
      lookupViewId - the unique identifier of the lookup view; can be null if no specific lookup view is set
    • getEntityName

      @Nullable public String getEntityName()
      Returns the name of the entity associated with this action.
      Returns:
      the entity name as a String, or null if no entity name is set.
    • setEntityName

      public void setEntityName(@Nullable String entityName)
      Sets the name of the entity associated with the MultiValueSelectView.MultiValueSelectContext. This name is used to identify and configure the entity for the current action.
      Parameters:
      entityName - the name of the entity as a String; may be null if no specific entity is being set
    • getJavaClass

      @Nullable public Class<?> getJavaClass()
      Returns the Java class associated with the current instance of MultiValueSelectView.MultiValueSelectContext. This is used for defining the type of data handled by the component.
      Returns:
      the Java class if it is defined, or null if no class is set
    • setJavaClass

      public void setJavaClass(@Nullable Class<?> javaClass)
      Sets the Java class associated with the current instance of MultiValueSelectView.MultiValueSelectContext. This is used for defining the type of data handled by the component.
      Parameters:
      javaClass - the Java class to be associated with the current context; may be null if no specific class is set
    • getEnumClass

      @Nullable public Class<? extends Enum<?>> getEnumClass()
      Returns the enumeration class associated with the current MultiValueSelectView.MultiValueSelectContext. This class defines the type of enums that can be selected or processed by the component.
      Returns:
      the class of the enumeration if defined, or null if no enumeration class is set
    • setEnumClass

      public void setEnumClass(@Nullable Class<? extends Enum<?>> enumClass)
      Sets the enumeration class associated with the current MultiValueSelectView.MultiValueSelectContext. This class specifies the type of enumeration usable within the multi-value select action.
      Parameters:
      enumClass - the class of the enumeration to be set; it may be null if no specific enumeration class is desired
    • isUseComboBox

      public boolean isUseComboBox()
      Determines whether the MultiValueSelectView.MultiValueSelectContext is configured to use a ComboBox as its primary selection component.
      Returns:
      true if a ComboBox is used for selection, false otherwise
    • setUseComboBox

      public void setUseComboBox(boolean useComboBox)
      Configures whether to use a ComboBox as the selection component in the associated MultiValueSelectView.MultiValueSelectContext.
      Parameters:
      useComboBox - a boolean indicating whether a ComboBox should be used for selection (true) or another component (false)
    • getItems

      @Nullable public com.vaadin.flow.data.provider.DataProvider<?,?> getItems()
      Returns the data provider associated with the MultiValueSelectView.MultiValueSelectContext.
      Returns:
      the data provider instance if available; otherwise, null
    • setItems

      public void setItems(com.vaadin.flow.data.provider.DataProvider<?,?> items)
      Sets the items to be used by the MultiValueSelectView.MultiValueSelectContext.
      Parameters:
      items - the data provider supplying the items to be set
    • getTimeZone

      @Nullable public TimeZone getTimeZone()
      Returns the current time zone associated with MultiValueSelectView.MultiValueSelectContext.
      Returns:
      the TimeZone object if defined, or null if no time zone is set
    • setTimeZone

      public void setTimeZone(@Nullable TimeZone timeZone)
      Sets the time zone to be associated with the current MultiValueSelectView.MultiValueSelectContext.
      Parameters:
      timeZone - the TimeZone object to be set; may be null if no specific time zone is to be associated
    • getItemLabelGenerator

      @Nullable public com.vaadin.flow.component.ItemLabelGenerator<E> getItemLabelGenerator()
      Returns the current ItemLabelGenerator associated with the multi-value select context. The ItemLabelGenerator is used to generate display labels for items in the component.
      Returns:
      the ItemLabelGenerator instance if set, or null if no generator is defined
    • setItemLabelGenerator

      public void setItemLabelGenerator(@Nullable com.vaadin.flow.component.ItemLabelGenerator<E> itemLabelGenerator)
      Sets the item label generator for the component. The item label generator is used to define how the items are represented as strings in the user interface.
      Parameters:
      itemLabelGenerator - the item label generator to set, or null to unset and use the default item label generator
    • getValidators

      public List<Validator<E>> getValidators()
      Returns the list of validators associated with the MultiValueSelectView.MultiValueSelectContext.
      Returns:
      a list of Validator objects used for validation
    • setValidators

      public void setValidators(@Nullable List<Validator<E>> validators)
      Sets the list of validators for MultiValueSelectView.MultiValueSelectContext.
      Parameters:
      validators - the list of validators to be set. Can be null to indicate no validators.
    • addValidator

      public void addValidator(Validator<E> validator)
      Adds a validator to @link MultiValueSelectContext}.
      Parameters:
      validator - the validator to be added for validating the values
    • execute

      public void execute()
      Description copied from interface: ExecutableAction
      Executes the Action
      Specified by:
      execute in interface ExecutableAction
    • withViewId

      public MultiValueSelectAction<E> withViewId(@Nullable String viewId)
    • withViewClass

      public MultiValueSelectAction<E> withViewClass(@Nullable Class<? extends View> viewClass)
    • withAfterCloseHandler

      public <V extends View<?>> MultiValueSelectAction<E> withAfterCloseHandler(@Nullable Consumer<DialogWindow.AfterCloseEvent<V>> afterCloseHandler)
    • withViewConfigurer

      public <V extends View<?>> MultiValueSelectAction<E> withViewConfigurer(@Nullable Consumer<V> viewConfigurer)
      See Also:
    • withValidators

      public MultiValueSelectAction<E> withValidators(@Nullable List<Validator<E>> validators)
    • withEntityName

      public MultiValueSelectAction<E> withEntityName(@Nullable String entityName)
    • withEnumClass

      public MultiValueSelectAction<E> withEnumClass(@Nullable Class<? extends Enum<?>> enumClass)
    • withJavaClass

      public MultiValueSelectAction<E> withJavaClass(@Nullable Class<?> javaClass)
    • withReadOnly

      public MultiValueSelectAction<E> withReadOnly(boolean readOnly)
    • withLookupViewId

      public MultiValueSelectAction<E> withLookupViewId(@Nullable String lookupViewId)
    • withUseComboBox

      public MultiValueSelectAction<E> withUseComboBox(boolean useComboBox)
    • withItems

      public MultiValueSelectAction<E> withItems(com.vaadin.flow.data.provider.DataProvider<?,?> items)
    • withItemLabelGenerator

      public MultiValueSelectAction<E> withItemLabelGenerator(@Nullable com.vaadin.flow.component.ItemLabelGenerator<E> itemLabelGenerator)
    • withTimeZone

      public MultiValueSelectAction<E> withTimeZone(@Nullable TimeZone timeZone)
    • initMultiValuePickerComponentValueType

      protected void initMultiValuePickerComponentValueType(EntityValueSource<?,?> valueSource)