public class EditorClassBuilder<E,S extends Screen & EditorScreen<E>> extends EditorBuilder<E>
build() method returns that class.| Modifier and Type | Field and Description |
|---|---|
protected java.util.function.Consumer<AfterScreenCloseEvent<S>> |
afterCloseListener |
protected java.util.function.Consumer<AfterScreenShowEvent<S>> |
afterShowListener |
protected java.lang.Class<S> |
screenClass |
addFirst, container, editedEntity, entityClass, field, handler, initializer, listComponent, mode, newEntity, openMode, options, origin, parentDataContext, screenId, transformation| Constructor and Description |
|---|
EditorClassBuilder(EditorBuilder<E> builder,
java.lang.Class<S> screenClass) |
| Modifier and Type | Method and Description |
|---|---|
S |
build()
Builds the editor screen.
|
EditorClassBuilder<E,S> |
editEntity(E entity)
Sets
EditMode to EDIT and returns the builder for chaining. |
java.util.function.Consumer<AfterScreenCloseEvent<S>> |
getAfterCloseListener() |
java.util.function.Consumer<AfterScreenShowEvent<S>> |
getAfterShowListener() |
java.lang.Class<S> |
getScreenClass()
Returns editor screen class.
|
EditorClassBuilder<E,S> |
newEntity()
Sets
EditMode to CREATE and returns the builder for chaining. |
EditorClassBuilder<E,S> |
newEntity(E entity)
Sets
EditMode to CREATE and returns the builder for chaining. |
S |
show()
Builds and shows the editor screen.
|
EditorClassBuilder<E,S> |
withAddFirst(boolean addFirst)
Defines whether a new item will be added to the beginning or to the end of collection.
|
EditorClassBuilder<E,S> |
withAfterCloseListener(java.util.function.Consumer<AfterScreenCloseEvent<S>> listener)
Adds
Screen.AfterCloseEvent listener to the screen. |
EditorClassBuilder<E,S> |
withAfterShowListener(java.util.function.Consumer<AfterScreenShowEvent<S>> listener)
Adds
Screen.AfterShowEvent listener to the screen. |
EditorClassBuilder<E,S> |
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.
|
EditorClassBuilder<E,S> |
withInitializer(java.util.function.Consumer<E> initializer)
Sets code to initialize a new entity instance and returns the builder for chaining.
|
EditorClassBuilder<E,S> |
withListComponent(ListComponent<E> listComponent)
Sets list component and returns the builder for chaining.
|
EditorClassBuilder<E,S> |
withOpenMode(OpenMode openMode)
Sets
OpenMode for the editor screen and returns the builder for chaining. |
EditorClassBuilder<E,S> |
withOptions(ScreenOptions options)
Sets
ScreenOptions for the editor screen and returns the builder for chaining. |
EditorClassBuilder<E,S> |
withParentDataContext(DataContext parentDataContext)
Sets parent
DataContext for the editor screen and returns the builder for chaining. |
EditorBuilder<E> |
withScreenId(java.lang.String screenId)
Sets screen id and returns the builder for chaining.
|
EditorClassBuilder<E,S> |
withTransformation(java.util.function.Function<E,E> transformation)
Sets code to transform the edited entity after editor commit and returns the builder for chaining.
|
getAddFirst, getContainer, getEditedEntity, getEntityClass, getField, getInitializer, getListComponent, getMode, getNewEntity, getOpenMode, getOptions, getOrigin, getParentDataContext, getScreenId, getTransformation, withScreenClassprotected java.lang.Class<S extends Screen & EditorScreen<E>> screenClass
protected java.util.function.Consumer<AfterScreenCloseEvent<S extends Screen & EditorScreen<E>>> afterCloseListener
protected java.util.function.Consumer<AfterScreenShowEvent<S extends Screen & EditorScreen<E>>> afterShowListener
public EditorClassBuilder(EditorBuilder<E> builder, java.lang.Class<S> screenClass)
public EditorClassBuilder<E,S> newEntity()
EditorBuilderEditMode to CREATE 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.
newEntity in class EditorBuilder<E>EditorBuilder.newEntity(Object)public EditorClassBuilder<E,S> editEntity(E entity)
EditorBuilderEditMode to EDIT and returns the builder for chaining.editEntity in class EditorBuilder<E>entity - entity instance to be passed to the editor screenEditorBuilder.newEntity()public EditorClassBuilder<E,S> newEntity(E entity)
EditorBuilderEditMode to CREATE 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.
newEntity in class EditorBuilder<E>entity - new entity instance to be passed to the editor screenEditorBuilder.newEntity()public EditorClassBuilder<E,S> withContainer(CollectionContainer<E> container)
EditorBuilderCollectionContainer 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.
withContainer in class EditorBuilder<E>public EditorClassBuilder<E,S> withInitializer(java.util.function.Consumer<E> initializer)
EditorBuilderThe initializer is invoked only when EditMode is CREATE, i.e. when EditorBuilder.newEntity() or
EditorBuilder.newEntity(Object) methods are invoked on the builder.
withInitializer in class EditorBuilder<E>public EditorClassBuilder<E,S> withAddFirst(boolean addFirst)
EditorBuilderwithAddFirst in class EditorBuilder<E>public EditorClassBuilder<E,S> withOpenMode(OpenMode openMode)
EditorBuilderOpenMode for the editor screen and returns the builder for chaining.
For example: builder.withOpenMode(OpenMode.DIALOG).build();
withOpenMode in class EditorBuilder<E>public EditorClassBuilder<E,S> withParentDataContext(DataContext parentDataContext)
EditorBuilderDataContext for the editor screen and returns the builder for chaining.
The screen will commit data to the parent context instead of directly to DataManager.
withParentDataContext in class EditorBuilder<E>public EditorClassBuilder<E,S> withOptions(ScreenOptions options)
EditorBuilderScreenOptions for the editor screen and returns the builder for chaining.withOptions in class EditorBuilder<E>public EditorClassBuilder<E,S> withListComponent(ListComponent<E> listComponent)
EditorBuilderThe component is used to get the container if it is not set explicitly by
EditorBuilder.withContainer(CollectionContainer) method. Usually, the list component is a Table
or DataGrid displaying the list of entities.
withListComponent in class EditorBuilder<E>public EditorBuilder<E> withScreenId(java.lang.String screenId)
EditorBuilderwithScreenId in class EditorBuilder<E>screenId - identifier of the editor screen as specified in the UiController annotation
or screens.xml.public EditorClassBuilder<E,S> withAfterShowListener(java.util.function.Consumer<AfterScreenShowEvent<S>> listener)
Screen.AfterShowEvent listener to the screen.listener - listenerpublic EditorClassBuilder<E,S> withAfterCloseListener(java.util.function.Consumer<AfterScreenCloseEvent<S>> listener)
Screen.AfterCloseEvent listener to the screen.listener - listenerpublic EditorClassBuilder<E,S> withTransformation(@Nullable java.util.function.Function<E,E> transformation)
EditorBuilderwithTransformation in class EditorBuilder<E>transformation - edited entity transformationEditorBuilder.withContainer(CollectionContainer),
EditorBuilder.withField(HasValue),
EditorBuilder.withListComponent(ListComponent)public <T extends HasValue<E>> EditorClassBuilder<E,S> withField(T field)
EditorBuilderIf the field is set, the framework sets the committed entity to the field after successful editor commit.
withField in class EditorBuilder<E>@Nullable public java.lang.Class<S> getScreenClass()
public java.util.function.Consumer<AfterScreenShowEvent<S>> getAfterShowListener()
public java.util.function.Consumer<AfterScreenCloseEvent<S>> getAfterCloseListener()
public S build()
EditorBuilderScreen.show().build in class EditorBuilder<E>public S show()
EditorBuildershow in class EditorBuilder<E>