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
FieldsModifier and TypeFieldDescriptionprotected Booleanprotected CollectionContainer<E>protected Eprotected com.vaadin.flow.component.HasValue<?,E> protected ListDataComponent<E>protected DetailViewModeprotected Eprotected DataContextFields inherited from class io.jmix.flowui.view.builder.AbstractWindowBuilder
afterCloseListener, afterOpenListener, handler, origin, viewId -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDetailWindowBuilder(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) SetsDetailViewModetoEDITand the builder for chaining.getField()getMode()SetsDetailViewModetoCREATEand the builder for chaining.SetsDetailViewModetoCREATEand 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.AfterCloseEventlistener to the dialog window.withAfterOpenListener(Consumer<DialogWindow.AfterOpenEvent<V>> listener) AddsDialogWindow.AfterOpenEventlistener to the dialog window.withContainer(CollectionContainer<E> container) SetsCollectionContainerto 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 thecontainerif it is not set explicitly bywithContainer(CollectionContainer)method.withParentDataContext(DataContext parentDataContext) Sets parentDataContextfor 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 theViewControllerannotation.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
SetsDetailViewModetoCREATEand 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
SetsDetailViewModetoCREATEand 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
SetsDetailViewModetoEDITand 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:
DetailWindowClassBuilderinstance for chaining
-
withViewId
Sets identifier of the opened view as specified in theViewControllerannotation.- Parameters:
viewId- identifier of the opened view as specified in theViewControllerannotation- Returns:
- this instance for chaining
-
withInitializer
Sets callback to initialize a new entity instance.The initializer is invoked only when
DetailViewModeisCREATE, 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
SetsCollectionContainerto 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 parentDataContextfor 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 thecontainerif it is not set explicitly bywithContainer(CollectionContainer)method.Usually, the list component is a
DataGriddisplaying 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:AbstractWindowBuilderAddsDialogWindow.AfterOpenEventlistener to the dialog window.- Overrides:
withAfterOpenListenerin 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:AbstractWindowBuilderAddsDialogWindow.AfterCloseEventlistener to the dialog window.- Overrides:
withAfterCloseListenerin 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)
-