LookupScreenFacet

LookupScreenFacet is essentially a ScreenFacet with an extended set of options for opening entity lookup screens.

Component’s XML-name: lookupScreen.

Attributes

In addition to the attributes of ScreenFacet, LookupScreenFacet has the following attributes of EditorScreenFacet:

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

Programmatic usage: call the setOptionsProvider() method.

Transformation

It is a handler that is invoked after entities are selected and validated in the lookup screen. See Transformation for details.

Programmatic usage: call the setTransformation() method.

SelectValidator

It is a handler that is invoked when the user clicks Select in the lookup screen. See SelectValidator for details.

Programmatic usage: call the setSelectValidator() method.

SelectHandler

The SelectHandler delegate method allows you to get the collection of selected entities from the lookup screen. In the example below, the lookup screen of the Customer entity is opened on button clicks, and the email of the selected customer is written to the textField:

<facets>
    <lookupScreen id="lookupScreen"
                  entityClass="ui.ex1.entity.Customer"
                  openMode="DIALOG"
                  screenClass="ui.ex1.screen.entity.customer.CustomerBrowse"
                  onButton="btn">
    </lookupScreen>
</facets>
<layout>
    <textField id="userField"/>
    <button caption="Button"
            id="btn"/>
</layout>
@Autowired
private TextField<String> userField;

@Install(to = "lookupScreen", subject = "selectHandler")
private void lookupScreenSelectHandler(Collection<Customer> collection) {
    if (!collection.isEmpty()) {
        userField.setValue(collection.iterator().next().getEmail());
    }
}

Programmatic usage: call the setSelectHandler() 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.