Package io.jmix.flowui.view.builder
Class LookupWindowBuilder<E,V extends View<?>>
java.lang.Object
io.jmix.flowui.view.builder.AbstractWindowBuilder<V>
io.jmix.flowui.view.builder.LookupWindowBuilder<E,V>
- Type Parameters:
V
- a view type which is opened in a dialog window
- All Implemented Interfaces:
DialogWindowBuilder<V>
- Direct Known Subclasses:
LookupWindowClassBuilder
Provides a fluent interface to configure and open a lookup view
in a
DialogWindow
.-
Field Summary
Modifier and TypeFieldDescriptionprotected CollectionContainer<E>
protected com.vaadin.flow.component.HasValue
protected boolean
protected ListDataComponent<E>
protected boolean
protected Consumer<Collection<E>>
protected Predicate<LookupView.ValidationContext<E>>
protected Function<Collection<E>,
Collection<E>> Fields inherited from class io.jmix.flowui.view.builder.AbstractWindowBuilder
afterCloseListener, afterOpenListener, handler, origin, viewConfigurer, viewId
-
Constructor Summary
ModifierConstructorDescriptionprotected
LookupWindowBuilder
(LookupWindowBuilder<E, V> builder) LookupWindowBuilder
(View<?> origin, Class<E> entityClass, Function<? extends LookupWindowBuilder<E, V>, DialogWindow<V>> handler) -
Method Summary
Modifier and TypeMethodDescriptionOptional<com.vaadin.flow.component.HasValue>
getField()
boolean
boolean
withAfterCloseListener
(Consumer<DialogWindow.AfterCloseEvent<V>> listener) AddsDialogWindow.AfterCloseEvent
listener to the dialog window.withAfterOpenListener
(Consumer<DialogWindow.AfterOpenEvent<V>> listener) AddsDialogWindow.AfterOpenEvent
listener to the dialog window.withContainer
(CollectionContainer<E> container) SetsCollectionContainer
to updated after the lookup view is closed.<T extends com.vaadin.flow.component.HasValue<?,
E>>
LookupWindowBuilder<E,V> withField
(T field) Sets the field in which the framework sets the selected entity after successful lookup.withListDataComponent
(ListDataComponent<E> listDataComponent) Sets list data component that is used to get thecontainer
if it is not set explicitly bywithContainer(CollectionContainer)
method.withLookupComponentMultiSelect
(boolean lookupComponentMultiSelect) Sets multi selection mode for the lookup component in the lookup view.<T extends com.vaadin.flow.component.HasValue<?,
Collection<E>>>
LookupWindowBuilder<E,V> withMultiValueField
(T field) Sets the field in which the framework sets the selected entities after successful lookup.withSelectHandler
(Consumer<Collection<E>> selectHandler) Sets selection handler for the lookup view.withSelectValidator
(Predicate<LookupView.ValidationContext<E>> selectValidator) Sets selection validator for the lookup view.withTransformation
(Function<Collection<E>, Collection<E>> transformation) Sets code to transform the entities after selection.<T extends View<?> & LookupView<E>>
LookupWindowClassBuilder<E,T> withViewClass
(Class<T> viewClass) Sets opened view class.withViewConfigurer
(Consumer<V> configurer) Adds configurer to the dialog window.withViewId
(String viewId) Sets identifier of the opened view as specified in theViewController
annotation.Methods inherited from class io.jmix.flowui.view.builder.AbstractWindowBuilder
build, getAfterCloseListener, getAfterOpenListener, getOrigin, getViewConfigurer, getViewId, open
-
Field Details
-
entityClass
-
selectHandler
-
selectValidator
-
transformation
-
container
-
listDataComponent
-
field
protected com.vaadin.flow.component.HasValue field -
lookupComponentMultiSelect
protected boolean lookupComponentMultiSelect -
fieldCollectionValue
protected boolean fieldCollectionValue
-
-
Constructor Details
-
LookupWindowBuilder
-
LookupWindowBuilder
public LookupWindowBuilder(View<?> origin, Class<E> entityClass, Function<? extends LookupWindowBuilder<E, V>, DialogWindow<V>> handler)
-
-
Method Details
-
withViewId
Sets identifier of the opened view as specified in theViewController
annotation.- Parameters:
viewId
- identifier of the opened view as specified in theViewController
annotation- Returns:
- this instance for chaining
-
withViewClass
public <T extends View<?> & LookupView<E>> LookupWindowClassBuilder<E,T> withViewClass(Class<T> viewClass) Sets opened view class.- Type Parameters:
T
- view type- Parameters:
viewClass
- opened view class- Returns:
LookupWindowClassBuilder
instance for chaining
-
withSelectHandler
Sets selection handler for the lookup view.- Parameters:
selectHandler
- handler to set- Returns:
- this instance for chaining
-
withSelectValidator
public LookupWindowBuilder<E,V> withSelectValidator(Predicate<LookupView.ValidationContext<E>> selectValidator) Sets selection validator for the lookup view.- Parameters:
selectValidator
- validator to set- Returns:
- this instance for chaining
-
withTransformation
public LookupWindowBuilder<E,V> withTransformation(@Nullable Function<Collection<E>, Collection<E>> transformation) Sets code to transform the entities after selection.Applied only if either field or container or listDataComponent is assigned.
- Parameters:
transformation
- edited entity transformation object- Returns:
- this instance for chaining
- See Also:
-
withContainer
SetsCollectionContainer
to updated after the lookup view 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.- Parameters:
container
- the container to update after the lookup view is closed- Returns:
- this instance for chaining
-
withListDataComponent
public LookupWindowBuilder<E,V> withListDataComponent(@Nullable ListDataComponent<E> listDataComponent) Sets list data component that is used to get thecontainer
if it is not set explicitly bywithContainer(CollectionContainer)
method.Usually, the list component is a
DataGrid
displaying the list of entities.- Parameters:
listDataComponent
- the component to set- Returns:
- this instance for chaining
-
withField
public <T extends com.vaadin.flow.component.HasValue<?,E>> LookupWindowBuilder<E,V> withField(@Nullable T field) Sets the field in which the framework sets the selected entity after successful lookup.- Parameters:
field
- the field to set- Returns:
- this instance for chaining
-
withLookupComponentMultiSelect
Sets multi selection mode for the lookup component in the lookup view.- Parameters:
lookupComponentMultiSelect
- whether to use multi selection for the lookup component- Returns:
- this instance for chaining
-
withMultiValueField
public <T extends com.vaadin.flow.component.HasValue<?,Collection<E>>> LookupWindowBuilder<E,V> withMultiValueField(@Nullable T field) Sets the field in which the framework sets the selected entities after successful lookup.- Parameters:
field
- the field to set- Returns:
- this instance for chaining
-
withAfterOpenListener
public LookupWindowBuilder<E,V> withAfterOpenListener(@Nullable Consumer<DialogWindow.AfterOpenEvent<V>> listener) Description copied from class:AbstractWindowBuilder
AddsDialogWindow.AfterOpenEvent
listener to the dialog window.- Overrides:
withAfterOpenListener
in classAbstractWindowBuilder<V extends View<?>>
- Parameters:
listener
- the listener to add- Returns:
- this instance for chaining
-
withAfterCloseListener
public LookupWindowBuilder<E,V> withAfterCloseListener(@Nullable Consumer<DialogWindow.AfterCloseEvent<V>> listener) Description copied from class:AbstractWindowBuilder
AddsDialogWindow.AfterCloseEvent
listener to the dialog window.- Overrides:
withAfterCloseListener
in classAbstractWindowBuilder<V extends View<?>>
- Parameters:
listener
- the listener to add- Returns:
- this instance for chaining
-
withViewConfigurer
Description copied from class:AbstractWindowBuilder
Adds configurer to the dialog window.- Overrides:
withViewConfigurer
in classAbstractWindowBuilder<V extends View<?>>
- Parameters:
configurer
- the configurer to add- Returns:
- the instance for chaining
-
getEntityClass
- Returns:
- entity class
-
getSelectHandler
- Returns:
- select handler set by
withSelectHandler(Consumer)
.
-
getSelectValidator
- Returns:
- select validator set by
withSelectValidator(Predicate)
.
-
getTransformation
- Returns:
- transformation set by
withTransformation(Function)
.
-
getContainer
- Returns:
- container set by
withContainer(CollectionContainer)
.
-
getListDataComponent
- Returns:
- list data component set by
withListDataComponent(ListDataComponent)
.
-
getField
- Returns:
- field set by either
withField(HasValue)
orwithMultiValueField(HasValue)
.
-
isLookupComponentMultiSelect
public boolean isLookupComponentMultiSelect()- Returns:
- whether to use multi selection for the lookup component
-
isFieldCollectionValue
public boolean isFieldCollectionValue()- Returns:
- whether a field stores multiple values
-