public class LookupBuilder<E>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected CollectionContainer<E> |
container |
protected java.lang.Class<E> |
entityClass |
protected HasValue |
field |
protected java.util.function.Function<LookupBuilder<E>,Screen> |
handler |
protected boolean |
isFieldCollectionValue |
protected ListComponent<E> |
listComponent |
protected OpenMode |
openMode |
protected ScreenOptions |
options |
protected FrameOwner |
origin |
protected java.lang.String |
screenId |
protected java.util.function.Consumer<java.util.Collection<E>> |
selectHandler |
protected java.util.function.Predicate<LookupScreen.ValidationContext<E>> |
selectValidator |
protected java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> |
transformation |
Constructor and Description |
---|
LookupBuilder(FrameOwner origin,
java.lang.Class<E> entityClass,
java.util.function.Function<LookupBuilder<E>,Screen> handler) |
LookupBuilder(LookupBuilder<E> builder) |
Modifier and Type | Method and Description |
---|---|
Screen |
build()
Builds the lookup screen.
|
CollectionContainer<E> |
getContainer()
Returns container set by
withContainer(CollectionContainer) . |
java.lang.Class<E> |
getEntityClass()
Returns class of the entity to lookup.
|
HasValue |
getField()
Returns the field component set by
withField(HasValue) . |
ListComponent<E> |
getListComponent()
Returns list component set by
withListComponent(ListComponent) . |
OpenMode |
getOpenMode()
Returns launch mode set by
withOpenMode(OpenMode) . |
ScreenOptions |
getOptions()
Returns screen options set by
withOptions(ScreenOptions) . |
FrameOwner |
getOrigin()
Returns invoking screen.
|
java.lang.String |
getScreenId()
Returns screen id set by
withScreenId(String) . |
java.util.function.Consumer<java.util.Collection<E>> |
getSelectHandler()
Returns selection handler set by
withSelectHandler(Consumer) . |
java.util.function.Predicate<LookupScreen.ValidationContext<E>> |
getSelectValidator()
Returns selection validator set by
withSelectValidator(Predicate) . |
java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> |
getTransformation() |
protected boolean |
isFieldCollectionValue() |
Screen |
show()
Builds and shows the lookup screen.
|
LookupBuilder<E> |
withContainer(CollectionContainer<E> container)
Sets
CollectionContainer and returns the builder for chaining. |
<T extends HasValue<E>> |
withField(T field)
Sets the field component and returns the builder for chaining.
|
LookupBuilder<E> |
withListComponent(ListComponent<E> target)
Sets list component and returns the builder for chaining.
|
LookupBuilder<E> |
withOpenMode(OpenMode openMode)
Sets
OpenMode for the lookup screen and returns the builder for chaining. |
LookupBuilder<E> |
withOptions(ScreenOptions options)
Sets
ScreenOptions for the lookup screen and returns the builder for chaining. |
<S extends Screen & LookupScreen<E>> |
withScreenClass(java.lang.Class<S> screenClass)
Sets screen class and returns the
LookupClassBuilder for chaining. |
LookupBuilder<E> |
withScreenId(java.lang.String screenId)
Sets screen id and returns the builder for chaining.
|
LookupBuilder<E> |
withSelectHandler(java.util.function.Consumer<java.util.Collection<E>> selectHandler)
Sets selection handler for the lookup screen and returns the builder for chaining.
|
LookupBuilder<E> |
withSelectValidator(java.util.function.Predicate<LookupScreen.ValidationContext<E>> selectValidator)
Sets selection validator for the lookup screen and returns the builder for chaining.
|
LookupBuilder<E> |
withTransformation(java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> transformation)
Sets code to transform entities after selection and returns the builder for chaining.
|
<T extends HasValue<java.util.Collection<E>>> |
withValuesField(T field)
Sets the field component with collection value type.
|
protected final FrameOwner origin
protected final java.lang.Class<E> entityClass
protected final java.util.function.Function<LookupBuilder<E>,Screen> handler
protected java.util.function.Predicate<LookupScreen.ValidationContext<E>> selectValidator
protected java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> transformation
protected java.util.function.Consumer<java.util.Collection<E>> selectHandler
protected OpenMode openMode
protected ScreenOptions options
protected CollectionContainer<E> container
protected java.lang.String screenId
protected ListComponent<E> listComponent
protected HasValue field
protected boolean isFieldCollectionValue
public LookupBuilder(LookupBuilder<E> builder)
public LookupBuilder(FrameOwner origin, java.lang.Class<E> entityClass, java.util.function.Function<LookupBuilder<E>,Screen> handler)
public LookupBuilder<E> withOpenMode(OpenMode openMode)
OpenMode
for the lookup screen and returns the builder for chaining.
For example: builder.withOpenMode(OpenMode.DIALOG).build();
public LookupBuilder<E> withOptions(ScreenOptions options)
ScreenOptions
for the lookup screen and returns the builder for chaining.public LookupBuilder<E> withSelectValidator(java.util.function.Predicate<LookupScreen.ValidationContext<E>> selectValidator)
public LookupBuilder<E> withSelectHandler(@Nullable java.util.function.Consumer<java.util.Collection<E>> selectHandler)
public <T extends HasValue<E>> LookupBuilder<E> withField(T field)
If the field is set, the framework sets the selected entity to the field after successful lookup.
public <T extends HasValue<java.util.Collection<E>>> LookupBuilder<E> withValuesField(T field)
If the field is set, the framework sets the selected entity to the field after successful lookup.
T
- type of fieldfield
- field to setpublic <S extends Screen & LookupScreen<E>> LookupClassBuilder<E,S> withScreenClass(java.lang.Class<S> screenClass)
LookupClassBuilder
for chaining.screenClass
- class of the screen controllerpublic LookupBuilder<E> withScreenId(java.lang.String screenId)
screenId
- identifier of the lookup screen as specified in the UiController
annotation
or screens.xml
.public LookupBuilder<E> withListComponent(ListComponent<E> target)
The component is used to get the container
if it is not set explicitly by
withContainer(CollectionContainer)
method. Usually, the list component is a Table
or DataGrid
displaying the list of entities.
public LookupBuilder<E> withContainer(CollectionContainer<E> container)
CollectionContainer
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.
public LookupBuilder<E> withTransformation(java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> transformation)
transformation
- edited entity transformationwithContainer(CollectionContainer)
,
withField(HasValue)
,
withListComponent(ListComponent)
@Nullable public java.lang.String getScreenId()
withScreenId(String)
.public OpenMode getOpenMode()
withOpenMode(OpenMode)
.public ScreenOptions getOptions()
withOptions(ScreenOptions)
.public FrameOwner getOrigin()
public java.lang.Class<E> getEntityClass()
@Nullable public java.util.function.Consumer<java.util.Collection<E>> getSelectHandler()
withSelectHandler(Consumer)
.@Nullable public java.util.function.Predicate<LookupScreen.ValidationContext<E>> getSelectValidator()
withSelectValidator(Predicate)
.@Nullable public HasValue getField()
withField(HasValue)
.@Nullable public CollectionContainer<E> getContainer()
withContainer(CollectionContainer)
.@Nullable public ListComponent<E> getListComponent()
withListComponent(ListComponent)
.@Nullable public java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> getTransformation()
public Screen build()
Screen.show()
.public Screen show()
protected boolean isFieldCollectionValue()