Class EditorClassBuilder<E,S extends Screen & EditorScreen<E>>
build() method returns that class.-
Field Summary
FieldsModifier 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the editor screen.editEntity(E entity) SetsEditModetoEDITand returns the builder for chaining.Returns editor screen class.SetsEditModetoCREATEand returns the builder for chaining.SetsEditModetoCREATEand 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.AfterCloseEventlistener to the screen.withAfterShowListener(Consumer<AfterScreenShowEvent<S>> listener) AddsScreen.AfterShowEventlistener to the screen.withContainer(CollectionContainer<E> container) SetsCollectionContainerand 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) SetsOpenModefor the editor screen and returns the builder for chaining.withOptions(ScreenOptions options) SetsScreenOptionsfor the editor screen and returns the builder for chaining.withParentDataContext(DataContext parentDataContext) Sets parentDataContextfor 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:EditorBuilderSetsEditModetoCREATEand 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:
newEntityin classEditorBuilder<E>- See Also:
-
editEntity
Description copied from class:EditorBuilderSetsEditModetoEDITand returns the builder for chaining.- Overrides:
editEntityin classEditorBuilder<E>- Parameters:
entity- entity instance to be passed to the editor screen- See Also:
-
newEntity
Description copied from class:EditorBuilderSetsEditModetoCREATEand 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:
newEntityin classEditorBuilder<E>- Parameters:
entity- new entity instance to be passed to the editor screen- See Also:
-
withContainer
Description copied from class:EditorBuilderSetsCollectionContainerand 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:
withContainerin classEditorBuilder<E>
-
withInitializer
Description copied from class:EditorBuilderSets code to initialize a new entity instance and returns the builder for chaining.The initializer is invoked only when
EditModeisCREATE, i.e. whenEditorBuilder.newEntity()orEditorBuilder.newEntity(Object)methods are invoked on the builder.- Overrides:
withInitializerin classEditorBuilder<E>
-
withAddFirst
Description copied from class:EditorBuilderDefines 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:
withAddFirstin classEditorBuilder<E>
-
withOpenMode
Description copied from class:EditorBuilderSetsOpenModefor the editor screen and returns the builder for chaining.For example:
builder.withOpenMode(OpenMode.DIALOG).build();- Overrides:
withOpenModein classEditorBuilder<E>
-
withParentDataContext
Description copied from class:EditorBuilderSets parentDataContextfor the editor screen and returns the builder for chaining.The screen will commit data to the parent context instead of directly to
DataManager.- Overrides:
withParentDataContextin classEditorBuilder<E>
-
withOptions
Description copied from class:EditorBuilderSetsScreenOptionsfor the editor screen and returns the builder for chaining.- Overrides:
withOptionsin classEditorBuilder<E>
-
withListComponent
Description copied from class:EditorBuilderSets list component and returns the builder for chaining.The component is used to get the
containerif it is not set explicitly byEditorBuilder.withContainer(CollectionContainer)method. Usually, the list component is aTableorDataGriddisplaying the list of entities.- Overrides:
withListComponentin classEditorBuilder<E>
-
withScreenId
Description copied from class:EditorBuilderSets screen id and returns the builder for chaining.- Overrides:
withScreenIdin classEditorBuilder<E>- Parameters:
screenId- identifier of the editor screen as specified in theUiControllerannotation orscreens.xml.
-
withAfterShowListener
AddsScreen.AfterShowEventlistener to the screen.- Parameters:
listener- listener
-
withAfterCloseListener
AddsScreen.AfterCloseEventlistener to the screen.- Parameters:
listener- listener
-
withTransformation
Description copied from class:EditorBuilderSets 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:
withTransformationin classEditorBuilder<E>- Parameters:
transformation- edited entity transformation- See Also:
-
withField
Description copied from class:EditorBuilderSets 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:
withFieldin classEditorBuilder<E>
-
getScreenClass
Returns editor screen class. -
getAfterShowListener
- Returns:
- after show screen listener
-
getAfterCloseListener
- Returns:
- after close screen listener
-
build
Description copied from class:EditorBuilderBuilds the editor screen. Screen should be shown usingScreen.show().- Overrides:
buildin classEditorBuilder<E>
-
show
Description copied from class:EditorBuilderBuilds and shows the editor screen.- Overrides:
showin classEditorBuilder<E>
-