MessageDialogFacet

MessageDialogFacet is a facet that allows you to pre-configure a message dialog. Declarative definition of the message dialog replaces existing Dialogs.createMessageDialog() method.

Component’s XML-name: messageDialog.

Attributes

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

You can bind MessageDialogFacet to action or button. In those cases, the dialog will appear when action is fires or button clicks. To aware MessageDialogFacet with action or button, use the following attributes:

  • onAction

<window xmlns="http://jmix.io/schema/ui/window"
        caption="msg://messageDialogFacetScreen.caption">
    <actions>
        <action id="messageDialogAction"
                caption="Show MessageDialog"/>
    </actions>
    <facets>
        <messageDialog id="messageDialog"
                       caption="Message Dialog"
                       message="Message"
                       modal="true"
                       closeOnClickOutside="true"
                       onAction="messageDialogAction"/>
    </facets>
    <layout>
    </layout>
</window>
  • onButton

<window xmlns="http://jmix.io/schema/ui/window"
        caption="msg://messageDialogFacetScreen.caption">
    <facets>
        <messageDialog id="messageDialogFacet"
                       caption="Message Dialog"
                       message="Message"
                       onButton="messageDialogBtn"
                       windowMode="MAXIMIZED"/>
    </facets>
    <layout>
        <button id="messageDialogBtn"
                caption="Show MessageDialog"/>
    </layout>
</window>

You can also make dialog configured with MessageDialogFacet to appear using the show() method:

@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 Component Inspector panel of the Studio’s Screen Designer.