EditorScreenFacet
EditorScreenFacet
is essentially a ScreenFacet with an extended set of options for opening entity edit screens.
Component’s XML-name: editorScreen
.
Attributes
In addition to the attributes of ScreenFacet
, EditorScreenFacet
has the following own attributes:
-
addFirst
- defines whether a new item will be added to the beginning or the end of the collection. It affects only standalone containers; for nested containers, new items are always added to the end.
-
container
- sets a CollectionContainer. The container is updated after the screen is committed. If the container is nested, the framework automatically initializes the reference to the parent entity and sets up data context for editing compositions.
-
editMode
- sets the screen edit mode, corresponds to theEditMode
enum:-
CREATE
- to create a new entity instance. -
EDIT
- to edit an existing one.
-
-
entityClass
- the full name of an entity class.
-
field
- sets the EntityPicker component id. The framework sets the committed entity to the field after a successful editor commit if the field is set.
Usage example:
<window xmlns="http://jmix.io/schema/ui/window"
caption="msg://editorScreenFacetScreen.caption">
<data readOnly="true">
<collection id="departmentsDc"
class="ui.ex1.entity.Department">
<fetchPlan extends="_base">
<property name="employee" fetchPlan="_base"/>
</fetchPlan>
<loader id="departmentsDl">
<query>
<![CDATA[select e from uiex1_Department e]]>
</query>
</loader>
</collection>
</data>
<facets>
<editorScreen id="editorScreen"
editMode="CREATE"
entityClass="ui.ex1.entity.Customer"
onButton="openEditBtn"
addFirst="true">
</editorScreen>
<dataLoadCoordinator auto="true"/>
<screenSettings id="settingsFacet" auto="true"/>
</facets>
<layout>
<button id="openEditBtn"
caption="Open an editor screen"
width="100%"/>
</layout>
</window>
Events and Handlers
To generate a handler stub in Jmix Studio, select the facet in the screen descriptor XML or in the Component Hierarchy panel and use the Handlers tab of the Component Inspector panel. Alternatively, you can use the Generate Handler button in the top panel of the screen controller. |
AfterCloseEvent
AfterCloseEvent
is sent after the screen configured by the facet is closed. See AfterCloseEvent for details.
Programmatic registration of the event handler: use the addAfterCloseEventListener()
method.
AfterShowEvent
AfterShowEvent
is sent after the screen configured by the facet is shown. See AfterShowEvent for details.
Programmatic registration of the event handler: use the addAfterShowEventListener()
method.
OptionsProvider
See OptionsProvider.
Programmatic usage: call the setOptionsProvider()
component method.
Initializer
It is a handler that accepts the new entity instance and can initialize it before show in the editor screen. See Initializer for details.
Programmatic usage: call the setInitializer()
component method.
Transformation
It is a handler that is invoked after the entity is selected and validated in the editor screen. See Transformation for details.
Programmatic usage: call the setTransformation()
method.
EntityProvider
The EntityProvider
delegate method allows you to pass an entity instance to the opening screen:
@Autowired
private DataManager dataManager;
@Install(to = "editorScreen", subject = "entityProvider")
private User editorScreenEntityProvider() {
User user = dataManager.create(User.class);
user.setFirstName("John");
user.setLastName("Doe");
return user;
}
Programmatic usage: call the setEntityProvider()
method.
ParentDataContextProvider
The ParentDataContextProvider
delegate method allows you to pass parent DataContext to the opening screen:
@Autowired
private DataContext dataContext;
@Install(to = "editorScreen", subject = "parentDataContextProvider")
private DataContext editorScreenParentDataContextProvider() {
return dataContext;
}
Programmatic usage: call the setParentDataContextProvider()
method.
All XML Attributes
You can view and edit attributes applicable to the facet using the Component Inspector panel of the Studio’s Screen Designer. |
addFirst - container - entityClass - entityMode - field - id - listComponent - onAction - onButton - openMode - screenClass - screenId