Class TagField.NewTagProvider<V>

java.lang.Object
io.jmix.ui.component.TagField.NewTagProvider<V>
Type Parameters:
V - type of item
All Implemented Interfaces:
Consumer<HasEnterPressHandler.EnterPressEvent>
Enclosing interface:
TagField<V>

public abstract static class TagField.NewTagProvider<V> extends Object implements Consumer<HasEnterPressHandler.EnterPressEvent>
Enables to handle a user's entered text and add it to a TagField value.

For instance:

 tagField.setEnterActionHandler(new TagField.NewTagProvider<ServiceType>() {
     @Nullable
     @Override
     public ServiceType create(String text) {
         ServiceType serviceType = dataManager.create(ServiceType.class);
         serviceType.setName(text);
         return serviceType;
     }
 });
 
  • Constructor Details

    • NewTagProvider

      public NewTagProvider()
  • Method Details

    • accept

      public void accept(HasEnterPressHandler.EnterPressEvent event)
      Specified by:
      accept in interface Consumer<V>
    • create

      @Nullable public abstract V create(String text)
      Provides ability to create new item from entered text. Method is invoked when user press ENTER key.
      Parameters:
      text - user's entered text
      Returns:
      new item