3.5.4.8. ScreenFacet
ScreenFacet is a facet that provides an ability to pre-configure screen opening and passing properties. Declarative definition of the screen replaces existing ScreenBuilders.screen() method. ScreenFacet is defined in the facets element of the screen XML descriptor.
Component’s XML-name: screen.
Usage example:
<facets>
<screen id="testScreen"
screenId="sample_TestScreen"
onButton="openTestScreen">
<properties>
<property name="num" value="42"/>
</properties>
</screen>
</facets>
The screen configured with ScreenFacet can be shown explicitly using the show() method:
@Inject
protected ScreenFacet testScreen;
@Subscribe("showDialog")
public void onShowDialogClick(Button.ClickEvent event) {
testScreen.show();
}
Alternatively, the facet can be subscribed to any action (see onAction attribute) or button (see onButton attribute) by id.
ScreenFacet has the following attributes:
-
screenId– specifies the id of the screen to open.
-
screenClass– Java class of the screen controller to open.
-
openMode– screen open mode, corresponds to theOpenModeenum:NEW_TAB,DIALOG,NEW_WINDOW,ROOT,THIS_TAB. The default value isNEW_TAB.
ScreenFacet has the properties element, which represents a list of properties, that will be injected into the opened screen via public setters. See Passing parameters to screens.