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
Modifier 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
-
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.AfterCloseEvent
listener to the screen.withAfterShowListener
(Consumer<AfterScreenShowEvent<S>> listener) AddsScreen.AfterShowEvent
listener to the screen.withContainer
(CollectionContainer<E> container) SetsCollectionContainer
and 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) SetsOpenMode
for the lookup screen and returns the builder for chaining.withOptions
(ScreenOptions options) SetsScreenOptions
for 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:LookupBuilder
SetsOpenMode
for the lookup screen and returns the builder for chaining.For example:
builder.withOpenMode(OpenMode.DIALOG).build();
- Overrides:
withOpenMode
in classLookupBuilder<E>
-
withOptions
Description copied from class:LookupBuilder
SetsScreenOptions
for the lookup screen and returns the builder for chaining.- Overrides:
withOptions
in classLookupBuilder<E>
-
withSelectValidator
public LookupClassBuilder<E,S> withSelectValidator(Predicate<LookupScreen.ValidationContext<E>> selectValidator) Description copied from class:LookupBuilder
Sets selection validator for the lookup screen and returns the builder for chaining.- Overrides:
withSelectValidator
in classLookupBuilder<E>
-
withSelectHandler
Description copied from class:LookupBuilder
Sets selection handler for the lookup screen and returns the builder for chaining.- Overrides:
withSelectHandler
in classLookupBuilder<E>
-
withField
Description copied from class:LookupBuilder
Sets 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:
withField
in classLookupBuilder<E>
-
withValuesField
Description copied from class:LookupBuilder
Sets 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:
withValuesField
in classLookupBuilder<E>
- Type Parameters:
T
- type of field- Parameters:
field
- field to set- Returns:
- the builder for chaining
-
withScreenId
Description copied from class:LookupBuilder
Sets screen id and returns the builder for chaining.- Overrides:
withScreenId
in classLookupBuilder<E>
- Parameters:
screenId
- identifier of the lookup screen as specified in theUiController
annotation orscreens.xml
.
-
withListComponent
Description copied from class:LookupBuilder
Sets list component and returns the builder for chaining.The component is used to get the
container
if it is not set explicitly byLookupBuilder.withContainer(CollectionContainer)
method. Usually, the list component is aTable
orDataGrid
displaying the list of entities.- Overrides:
withListComponent
in classLookupBuilder<E>
-
withContainer
Description copied from class:LookupBuilder
SetsCollectionContainer
and 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:
withContainer
in classLookupBuilder<E>
-
withAfterShowListener
AddsScreen.AfterShowEvent
listener to the screen.- Parameters:
listener
- listener
-
withAfterCloseListener
AddsScreen.AfterCloseEvent
listener to the screen.- Parameters:
listener
- listener
-
withTransformation
public LookupClassBuilder<E,S> withTransformation(Function<Collection<E>, Collection<E>> transformation) Description copied from class:LookupBuilder
Sets code to transform entities after selection and returns the builder for chaining.
Applied only if either field or container or listComponent is assigned.- Overrides:
withTransformation
in 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:LookupBuilder
Builds the lookup screen. Screen should be shown usingScreen.show()
.- Overrides:
build
in classLookupBuilder<E>
-
show
Description copied from class:LookupBuilder
Builds and shows the lookup screen.- Overrides:
show
in classLookupBuilder<E>
-