Class DetailWindowBuilder<E,V extends View<?>>
- Type Parameters:
V
- a view type which is opened in a dialog window
- All Implemented Interfaces:
DialogWindowBuilder<V>
- Direct Known Subclasses:
DetailWindowClassBuilder
DialogWindow
.-
Field Summary
Modifier and TypeFieldDescriptionprotected Boolean
protected CollectionContainer<E>
protected E
protected com.vaadin.flow.component.HasValue<?,
E> protected ListDataComponent<E>
protected DetailViewMode
protected E
protected DataContext
Fields inherited from class io.jmix.flowui.view.builder.AbstractWindowBuilder
afterCloseListener, afterOpenListener, handler, origin, viewId
-
Constructor Summary
ModifierConstructorDescriptionprotected
DetailWindowBuilder
(DetailWindowBuilder<E, V> builder) DetailWindowBuilder
(View<?> origin, Class<E> entityClass, Function<? extends DetailWindowBuilder<E, V>, DialogWindow<V>> handler) -
Method Summary
Modifier and TypeMethodDescriptioneditEntity
(E entity) SetsDetailViewMode
toEDIT
and the builder for chaining.getField()
getMode()
SetsDetailViewMode
toCREATE
and the builder for chaining.SetsDetailViewMode
toCREATE
and the builder for chaining.withAddFirst
(Boolean addFirst) Defines whether a new item will be added to the beginning or to the end of collection.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 update after the detail view is saved.Sets the field in which the framework sets the saved entity after successful detail view saving.withInitializer
(Consumer<E> initializer) Sets callback to initialize a new entity instance.withListDataComponent
(ListDataComponent<E> listDataComponent) Sets list data component that is used to get thecontainer
if it is not set explicitly bywithContainer(CollectionContainer)
method.withParentDataContext
(DataContext parentDataContext) Sets parentDataContext
for the detail view.withTransformation
(Function<E, E> transformation) Sets code to transform the edited entity after detail view saved.<T extends View<?> & DetailView<E>>
DetailWindowClassBuilder<E,T> withViewClass
(Class<T> viewClass) Sets opened view class.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, getViewId, open
-
Field Details
-
entityClass
-
newEntity
-
editedEntity
-
initializer
-
transformation
-
container
-
parentDataContext
-
listDataComponent
-
field
-
addFirst
-
mode
-
-
Constructor Details
-
DetailWindowBuilder
-
DetailWindowBuilder
public DetailWindowBuilder(View<?> origin, Class<E> entityClass, Function<? extends DetailWindowBuilder<E, V>, DialogWindow<V>> handler)
-
-
Method Details
-
newEntity
SetsDetailViewMode
toCREATE
and the builder for chaining.A new entity instance will be created automatically. It can be initialized by code passed to the
withInitializer(Consumer)
method.- Returns:
- this instance for chaining
-
newEntity
SetsDetailViewMode
toCREATE
and the builder for chaining.The new entity instance is accepted as the parameter. It can be initialized by code passed to the
withInitializer(Consumer)
method.- Parameters:
entity
- new entity instance to be passed to the detail view- Returns:
- this instance for chaining
-
editEntity
SetsDetailViewMode
toEDIT
and the builder for chaining.- Parameters:
entity
- entity instance to be passed to the detail view- Returns:
- this instance for chaining
-
withViewClass
public <T extends View<?> & DetailView<E>> DetailWindowClassBuilder<E,T> withViewClass(Class<T> viewClass) Sets opened view class.- Type Parameters:
T
- view type- Parameters:
viewClass
- opened view class- Returns:
DetailWindowClassBuilder
instance for chaining
-
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
-
withInitializer
Sets callback to initialize a new entity instance.The initializer is invoked only when
DetailViewMode
isCREATE
, i.e. whennewEntity()
ornewEntity(Object)
methods are invoked on the builder.- Parameters:
initializer
- callback to initialize a new entity instance.- Returns:
- this instance for chaining
-
withTransformation
Sets code to transform the edited entity after detail view saved.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 update after the detail view is saved.If the container is
Nested
, the framework automatically initializes the reference to the parent entity and sets up data contexts for editing compositions.- Parameters:
container
- the container to update after the detail view is saved.- Returns:
- this instance for chaining
-
withParentDataContext
Sets parentDataContext
for the detail view.The view will save data to the parent context instead of directly to
DataManager
.- Parameters:
parentDataContext
- parent data context to set- Returns:
- this instance for chaining
-
withListDataComponent
public DetailWindowBuilder<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
Sets the field in which the framework sets the saved entity after successful detail view saving.- Parameters:
field
- the field to set- Returns:
- this instance for chaining
-
withAddFirst
Defines whether a new item will be added to the beginning or to the end of collection. Affects only standalone containers, for nested containers new items are always added to the end.- Parameters:
addFirst
- whether a new item will be added to the beginning of collection- Returns:
- this instance for chaining
-
withAfterOpenListener
public DetailWindowBuilder<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 DetailWindowBuilder<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
-
getEntityClass
- Returns:
- entity class
-
getNewEntity
- Returns:
- new entity set by
newEntity(Object)
.
-
getEditedEntity
- Returns:
- entity set by
editEntity(Object)
.
-
getInitializer
- Returns:
- initializer set by
withInitializer(Consumer)
.
-
getTransformation
- Returns:
- transformation set by
withTransformation(Function)
.
-
getContainer
- Returns:
- container set by
withContainer(CollectionContainer)
.
-
getParentDataContext
- Returns:
- parent data context set by
withParentDataContext(DataContext)
.
-
getListDataComponent
- Returns:
- list data component set by
withListDataComponent(ListDataComponent)
.
-
getField
- Returns:
- field set by
withField(HasValue)
.
-
getAddFirst
- Returns:
- whether a new item will be added to the beginning of collection
-
getMode
- Returns:
- builder mode derived from previous calls to
newEntity()
oreditEntity(Object)
-