public class LookupBuilder<E extends Entity>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected CollectionContainer<E> |
container |
protected java.lang.Class<E> |
entityClass |
protected HasValue<E> |
field |
protected java.util.function.Function<LookupBuilder<E>,Screen> |
handler |
protected Screens.LaunchMode |
launchMode |
protected ListComponent<E> |
listComponent |
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<E> |
getField()
Returns the field component set by
withField(HasValue) . |
Screens.LaunchMode |
getLaunchMode()
Returns launch mode set by
withLaunchMode(Screens.LaunchMode) . |
ListComponent<E> |
getListComponent()
Returns list component set by
withListComponent(ListComponent) . |
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() |
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> |
withLaunchMode(Screens.LaunchMode launchMode)
Sets
Screens.LaunchMode for the lookup screen 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 the edited entity after editor commit and returns the builder for chaining.
|
protected final FrameOwner origin
protected final java.util.function.Function<LookupBuilder<E extends Entity>,Screen> handler
protected java.util.function.Predicate<LookupScreen.ValidationContext<E extends Entity>> selectValidator
protected java.util.function.Function<java.util.Collection<E extends Entity>,java.util.Collection<E extends Entity>> transformation
protected java.util.function.Consumer<java.util.Collection<E extends Entity>> selectHandler
protected Screens.LaunchMode launchMode
protected ScreenOptions options
protected CollectionContainer<E extends Entity> container
protected java.lang.String screenId
protected ListComponent<E extends Entity> listComponent
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> withLaunchMode(Screens.LaunchMode launchMode)
Screens.LaunchMode
for the lookup screen and returns the builder for chaining.
For example: builder.withLaunchMode(OpenMode.DIALOG).build();
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(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 <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)
public java.lang.String getScreenId()
withScreenId(String)
.public Screens.LaunchMode getLaunchMode()
withLaunchMode(Screens.LaunchMode)
.public ScreenOptions getOptions()
withOptions(ScreenOptions)
.@Nonnull public FrameOwner getOrigin()
public java.lang.Class<E> getEntityClass()
public java.util.function.Consumer<java.util.Collection<E>> getSelectHandler()
withSelectHandler(Consumer)
.public java.util.function.Predicate<LookupScreen.ValidationContext<E>> getSelectValidator()
withSelectValidator(Predicate)
.public HasValue<E> getField()
withField(HasValue)
.public CollectionContainer<E> getContainer()
withContainer(CollectionContainer)
.public ListComponent<E> getListComponent()
withListComponent(ListComponent)
.public java.util.function.Function<java.util.Collection<E>,java.util.Collection<E>> getTransformation()
public Screen build()
Screen.show()
.public Screen show()