3.5.4.9. EditorScreenFacet

EditorScreenFacet is a facet that provides an ability to pre-configure an editor screen. Declarative definition of the editor screen replaces existing ScreenBuilders.editor() method. EditorScreenFacet is defined in the facets element of the screen XML descriptor.

Component’s XML-name: editorScreen.

Usage example:

<facets>
    <editorScreen id="userEditor"
                  openMode="DIALOG"
                  editMode="CREATE"
                  entityClass="com.haulmont.cuba.security.entity.User"
                  onAction="action"/>
</facets>

The screen configured with EditorScreenFacet can be shown explicitly using the show() method:

@Inject
protected EditorScreenFacet userEditor;

@Subscribe("showDialog")
public void onShowDialogClick(Button.ClickEvent event) {
    userEditor.show();
}

Alternatively, the facet can be subscribed to any action (see onAction attribute) or button (see onButton attribute) by id.

EditorScreenFacet has the following attributes:

  • addFirst – defines whether a new item will be added to the beginning or to the end of the collection. 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 the EditMode enum: CREATE (to create a new entity instance), or EDIT (to edit an existing one).

  • entityClass – the full qualified name of an entity class.

  • field – sets the PickerField component id. If the field is set, the framework sets the committed entity to the field after a successful editor commit.

  • listComponent – sets the list component id. The component is used to get the container if it is not set. Usually, the list component is a Table or DataGrid displaying the list of entities.


Attributes of editorScreen

addFirst - container - editMode - entityClass - field - id - listComponent onAction - onButton - openMode - screenClass - screenId

Element of editorScreen

properties