MessageDialogFacet

MessageDialogFacet gives you an alternative way to configure and open a message dialog. Instead of using the Dialogs.createMessageDialog() method in the screen controller, you can configure MessageDialogFacet in the XML descriptor with the help of Studio visual designer.

Component’s XML-name: messageDialog.

Basics

In the example below, the message dialog will be opened when the user clicks messageDialogBtn button:

<facets>
    <messageDialog id="messageDialogFacet"
                   caption="Message Dialog"
                   message="Message"
                   onButton="messageDialogBtn"
                   windowMode="MAXIMIZED"/>
</facets>
<layout>
    <button id="messageDialogBtn"
            caption="Show MessageDialog"/>
</layout>

MessageDialogFacet is defined in the facets element of the screen XML descriptor and has the following attributes:

You can bind MessageDialogFacet to a button or an action to open the dialog on the button click or execution of the action.

  • onAction - defines id of an action which should trigger the dialog opening.

  • onButton - defines id of a button which should trigger the dialog opening.

Also, you can use the MessageDialogFacet.show() method to show the dialog:

@Autowired
private MessageDialogFacet msgDialog;

@Subscribe("messageDialogBtn")
public void onMessageDialogBtnClick(Button.ClickEvent event) {
    msgDialog.show();
}

All XML Attributes

You can view and edit attributes applicable to the facet using the Jmix UI inspector panel of the Studio’s Screen Designer.