LookupScreenFacet

LookupScreenFacet is essentially a ScreenFacet with an extended set of options for opening the lookup screen.

Component’s XML-name: lookupScreen.

Attributes

In addition to all the attributes that ScreenFacet has, LookupScreenFacet has the following attributes from 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

Programmatic registration of the event handler: use the addAfterCloseEventListener() component method.

AfterShowEvent

Programmatic registration of the event handler: use the addAfterShowEventListener() component method.

OptionsProvider

Programmatic usage: call the setOptionsProvider() component method.

Transformation

Programmatic usage: call the setTransformation() component method.

SelectValidator

Programmatic usage: call the setSelectValidator() component method.

SelectHandler

To get collection of selected entities' from lookup screen, LookupScreenFacet has SelectHandler. 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.iterator().hasNext()){
        userField.setValue(collection.iterator().next().getEmail());
    }
}

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