3.5.4.5. MessageDialogFacet

MessageDialogFacet is a facet that provides an ability to pre-configure a message dialog. Declarative definition of the message dialog replaces existing Dialogs.createMessageDialog() method. MessageDialogFacet is defined in the facets element of the screen XML descriptor.

Component’s XML-name: messageDialog.

Usage example:

<facets>
    <messageDialog id="messageDialog"
                   caption="msg://msgDialogFacet"
                   message="msg://msgDialogDemo"
                   modal="true"
                   closeOnClickOutside="true"/>
</facets>

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

@Inject
protected MessageDialogFacet messageDialog;

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

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

<actions>
    <action id="dialogAction"/>
</actions>
<facets>
    <messageDialog id="messageDialog"
                   caption="msg://msgDialogFacet"
                   message="msg://msgDialogDemo"
                   onAction="dialogAction"/>
</facets>