Class EditorClassBuilder<E,S extends Screen & EditorScreen<E>>
build()
method returns that class.-
Field Summary
Modifier and TypeFieldDescriptionprotected Consumer<AfterScreenCloseEvent<S>>
protected Consumer<AfterScreenShowEvent<S>>
Fields inherited from class io.jmix.ui.builder.EditorBuilder
addFirst, container, editedEntity, entityClass, field, handler, initializer, listComponent, mode, newEntity, openMode, options, origin, parentDataContext, screenId, transformation
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the editor screen.editEntity
(E entity) SetsEditMode
toEDIT
and returns the builder for chaining.Returns editor screen class.SetsEditMode
toCREATE
and returns the builder for chaining.SetsEditMode
toCREATE
and returns the builder for chaining.show()
Builds and shows the editor screen.withAddFirst
(boolean addFirst) Defines whether a new item will be added to the beginning or to the end of collection.withAfterCloseListener
(Consumer<AfterScreenCloseEvent<S>> listener) AddsScreen.AfterCloseEvent
listener to the screen.withAfterShowListener
(Consumer<AfterScreenShowEvent<S>> listener) AddsScreen.AfterShowEvent
listener to the screen.withContainer
(CollectionContainer<E> container) SetsCollectionContainer
and returns the builder for chaining.<T extends HasValue<E>>
EditorClassBuilder<E,S> withField
(T field) Sets the field component and returns the builder for chaining.withInitializer
(Consumer<E> initializer) Sets code to initialize a new entity instance and returns the builder for chaining.withListComponent
(ListComponent<E> listComponent) Sets list component and returns the builder for chaining.withOpenMode
(OpenMode openMode) SetsOpenMode
for the editor screen and returns the builder for chaining.withOptions
(ScreenOptions options) SetsScreenOptions
for the editor screen and returns the builder for chaining.withParentDataContext
(DataContext parentDataContext) Sets parentDataContext
for the editor screen and returns the builder for chaining.withScreenId
(String screenId) Sets screen id and returns the builder for chaining.withTransformation
(Function<E, E> transformation) Sets code to transform the edited entity after editor commit and returns the builder for chaining.Methods inherited from class io.jmix.ui.builder.EditorBuilder
getAddFirst, getContainer, getEditedEntity, getEntityClass, getField, getInitializer, getListComponent, getMode, getNewEntity, getOpenMode, getOptions, getOrigin, getParentDataContext, getScreenId, getTransformation, withScreenClass
-
Field Details
-
screenClass
-
afterCloseListener
-
afterShowListener
-
-
Constructor Details
-
EditorClassBuilder
-
-
Method Details
-
newEntity
Description copied from class:EditorBuilder
SetsEditMode
toCREATE
and returns the builder for chaining.A new entity instance will be created automatically. It can be initialized by code passed to the
EditorBuilder.withInitializer(Consumer)
method.- Overrides:
newEntity
in classEditorBuilder<E>
- See Also:
-
editEntity
Description copied from class:EditorBuilder
SetsEditMode
toEDIT
and returns the builder for chaining.- Overrides:
editEntity
in classEditorBuilder<E>
- Parameters:
entity
- entity instance to be passed to the editor screen- See Also:
-
newEntity
Description copied from class:EditorBuilder
SetsEditMode
toCREATE
and returns the builder for chaining.The new entity instance is accepted as the parameter. It can be initialized by code passed to the
EditorBuilder.withInitializer(Consumer)
method.- Overrides:
newEntity
in classEditorBuilder<E>
- Parameters:
entity
- new entity instance to be passed to the editor screen- See Also:
-
withContainer
Description copied from class:EditorBuilder
SetsCollectionContainer
and returns the builder for chaining.The container is updated after the editor screen is committed. If the container is
Nested
, the framework automatically initializes the reference to the parent entity and sets up data contexts for editing compositions.- Overrides:
withContainer
in classEditorBuilder<E>
-
withInitializer
Description copied from class:EditorBuilder
Sets code to initialize a new entity instance and returns the builder for chaining.The initializer is invoked only when
EditMode
isCREATE
, i.e. whenEditorBuilder.newEntity()
orEditorBuilder.newEntity(Object)
methods are invoked on the builder.- Overrides:
withInitializer
in classEditorBuilder<E>
-
withAddFirst
Description copied from class:EditorBuilder
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.- Overrides:
withAddFirst
in classEditorBuilder<E>
-
withOpenMode
Description copied from class:EditorBuilder
SetsOpenMode
for the editor screen and returns the builder for chaining.For example:
builder.withOpenMode(OpenMode.DIALOG).build();
- Overrides:
withOpenMode
in classEditorBuilder<E>
-
withParentDataContext
Description copied from class:EditorBuilder
Sets parentDataContext
for the editor screen and returns the builder for chaining.The screen will commit data to the parent context instead of directly to
DataManager
.- Overrides:
withParentDataContext
in classEditorBuilder<E>
-
withOptions
Description copied from class:EditorBuilder
SetsScreenOptions
for the editor screen and returns the builder for chaining.- Overrides:
withOptions
in classEditorBuilder<E>
-
withListComponent
Description copied from class:EditorBuilder
Sets list component and returns the builder for chaining.The component is used to get the
container
if it is not set explicitly byEditorBuilder.withContainer(CollectionContainer)
method. Usually, the list component is aTable
orDataGrid
displaying the list of entities.- Overrides:
withListComponent
in classEditorBuilder<E>
-
withScreenId
Description copied from class:EditorBuilder
Sets screen id and returns the builder for chaining.- Overrides:
withScreenId
in classEditorBuilder<E>
- Parameters:
screenId
- identifier of the editor screen as specified in theUiController
annotation orscreens.xml
.
-
withAfterShowListener
AddsScreen.AfterShowEvent
listener to the screen.- Parameters:
listener
- listener
-
withAfterCloseListener
AddsScreen.AfterCloseEvent
listener to the screen.- Parameters:
listener
- listener
-
withTransformation
Description copied from class:EditorBuilder
Sets code to transform the edited entity after editor commit and returns the builder for chaining.
Applied only if either field or container or listComponent is assigned.- Overrides:
withTransformation
in classEditorBuilder<E>
- Parameters:
transformation
- edited entity transformation- See Also:
-
withField
Description copied from class:EditorBuilder
Sets the field component and returns the builder for chaining.If the field is set, the framework sets the committed entity to the field after successful editor commit.
- Overrides:
withField
in classEditorBuilder<E>
-
getScreenClass
Returns editor screen class. -
getAfterShowListener
- Returns:
- after show screen listener
-
getAfterCloseListener
- Returns:
- after close screen listener
-
build
Description copied from class:EditorBuilder
Builds the editor screen. Screen should be shown usingScreen.show()
.- Overrides:
build
in classEditorBuilder<E>
-
show
Description copied from class:EditorBuilder
Builds and shows the editor screen.- Overrides:
show
in classEditorBuilder<E>
-