Package io.jmix.ui.builder
Class LookupClassBuilder<E,S extends Screen & LookupScreen<E>>
java.lang.Object
io.jmix.ui.builder.LookupBuilder<E>
io.jmix.ui.builder.LookupClassBuilder<E,S>
Lookup screen builder that knows the concrete screen class. It's
build() method returns that class.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Consumer<AfterScreenCloseEvent<S>>protected Consumer<AfterScreenShowEvent<S>>Fields inherited from class io.jmix.ui.builder.LookupBuilder
container, entityClass, field, handler, isFieldCollectionValue, listComponent, openMode, options, origin, screenId, selectHandler, selectValidator, transformation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the lookup screen.Returns lookup screen class.show()Builds and shows the lookup screen.withAfterCloseListener(Consumer<AfterScreenCloseEvent<S>> listener) AddsScreen.AfterCloseEventlistener to the screen.withAfterShowListener(Consumer<AfterScreenShowEvent<S>> listener) AddsScreen.AfterShowEventlistener to the screen.withContainer(CollectionContainer<E> container) SetsCollectionContainerand returns the builder for chaining.<T extends HasValue<E>>
LookupClassBuilder<E,S> withField(T field) Sets the field component and returns the builder for chaining.withListComponent(ListComponent<E> target) Sets list component and returns the builder for chaining.withOpenMode(OpenMode openMode) SetsOpenModefor the lookup screen and returns the builder for chaining.withOptions(ScreenOptions options) SetsScreenOptionsfor the lookup screen and returns the builder for chaining.withScreenId(String screenId) Sets screen id and returns the builder for chaining.withSelectHandler(Consumer<Collection<E>> selectHandler) Sets selection handler for the lookup screen and returns the builder for chaining.withSelectValidator(Predicate<LookupScreen.ValidationContext<E>> selectValidator) Sets selection validator for the lookup screen and returns the builder for chaining.withTransformation(Function<Collection<E>, Collection<E>> transformation) Sets code to transform entities after selection and returns the builder for chaining.<T extends HasValue<Collection<E>>>
LookupClassBuilder<E,S> withValuesField(T field) Sets the field component with collection value type.Methods inherited from class io.jmix.ui.builder.LookupBuilder
getContainer, getEntityClass, getField, getListComponent, getOpenMode, getOptions, getOrigin, getScreenId, getSelectHandler, getSelectValidator, getTransformation, isFieldCollectionValue, withScreenClass
-
Field Details
-
screenClass
-
afterShowListener
-
afterCloseListener
-
-
Constructor Details
-
LookupClassBuilder
-
-
Method Details
-
withOpenMode
Description copied from class:LookupBuilderSetsOpenModefor the lookup screen and returns the builder for chaining.For example:
builder.withOpenMode(OpenMode.DIALOG).build();- Overrides:
withOpenModein classLookupBuilder<E>
-
withOptions
Description copied from class:LookupBuilderSetsScreenOptionsfor the lookup screen and returns the builder for chaining.- Overrides:
withOptionsin classLookupBuilder<E>
-
withSelectValidator
public LookupClassBuilder<E,S> withSelectValidator(Predicate<LookupScreen.ValidationContext<E>> selectValidator) Description copied from class:LookupBuilderSets selection validator for the lookup screen and returns the builder for chaining.- Overrides:
withSelectValidatorin classLookupBuilder<E>
-
withSelectHandler
Description copied from class:LookupBuilderSets selection handler for the lookup screen and returns the builder for chaining.- Overrides:
withSelectHandlerin classLookupBuilder<E>
-
withField
Description copied from class:LookupBuilderSets the field component and returns the builder for chaining.If the field is set, the framework sets the selected entity to the field after successful lookup.
- Overrides:
withFieldin classLookupBuilder<E>
-
withValuesField
Description copied from class:LookupBuilderSets the field component with collection value type.If the field is set, the framework sets the selected entity to the field after successful lookup.
- Overrides:
withValuesFieldin classLookupBuilder<E>- Type Parameters:
T- type of field- Parameters:
field- field to set- Returns:
- the builder for chaining
-
withScreenId
Description copied from class:LookupBuilderSets screen id and returns the builder for chaining.- Overrides:
withScreenIdin classLookupBuilder<E>- Parameters:
screenId- identifier of the lookup screen as specified in theUiControllerannotation orscreens.xml.
-
withListComponent
Description copied from class:LookupBuilderSets list component and returns the builder for chaining.The component is used to get the
containerif it is not set explicitly byLookupBuilder.withContainer(CollectionContainer)method. Usually, the list component is aTableorDataGriddisplaying the list of entities.- Overrides:
withListComponentin classLookupBuilder<E>
-
withContainer
Description copied from class:LookupBuilderSetsCollectionContainerand returns the builder for chaining.The container is updated after the lookup screen is closed. If the container is
Nested, the framework automatically initializes the reference to the parent entity and sets up data contexts for added One-To-Many and Many-To-Many relations.- Overrides:
withContainerin classLookupBuilder<E>
-
withAfterShowListener
AddsScreen.AfterShowEventlistener to the screen.- Parameters:
listener- listener
-
withAfterCloseListener
AddsScreen.AfterCloseEventlistener to the screen.- Parameters:
listener- listener
-
withTransformation
public LookupClassBuilder<E,S> withTransformation(Function<Collection<E>, Collection<E>> transformation) Description copied from class:LookupBuilderSets code to transform entities after selection and returns the builder for chaining.
Applied only if either field or container or listComponent is assigned.- Overrides:
withTransformationin classLookupBuilder<E>- Parameters:
transformation- edited entity transformation- See Also:
-
getScreenClass
Returns lookup screen class. -
getAfterShowListener
- Returns:
- after show screen listener
-
getAfterCloseListener
- Returns:
- after close screen listener
-
build
Description copied from class:LookupBuilderBuilds the lookup screen. Screen should be shown usingScreen.show().- Overrides:
buildin classLookupBuilder<E>
-
show
Description copied from class:LookupBuilderBuilds and shows the lookup screen.- Overrides:
showin classLookupBuilder<E>
-