XML Descriptors

Screen descriptor is an XML file containing declarative definition of visual components, data components and some screen parameters. For example, look at the XML descriptor of the edit screen:

<window xmlns="http://jmix.io/schema/ui/window"
        focusComponent="demoForm"
        caption="msg://window.caption">
    <data>
        <instance id="orderDc"
                  class="ui.ex1.entity.Order">
            <fetchPlan extends="_base"/>
            <loader/>
        </instance>
    </data>
    <facets>
        <dataLoadCoordinator auto="true"/>
        <screenSettings id="settingsFacet" auto="true"/>
    </facets>
    <actions>
        <action id="windowCommitAndClose" caption="msg:///actions.Ok"
                icon="EDITOR_OK"
                primary="true"
                shortcut="${COMMIT_SHORTCUT}"/>
        <action id="windowClose"
                caption="msg:///actions.Close"
                icon="EDITOR_CANCEL"/>
    </actions>
    <dialogMode height="600"
                width="800"/>
    <layout spacing="true" expand="editActions">
        <form id="demoForm" dataContainer="orderDc">
            <column width="350px">
                <timeField id="deliveryTimeField" property="deliveryTime"/>
                <textField id="ratingField" property="rating"/>
                <dateField id="dateField" property="date"/>
                <textField id="amountField" property="amount"/>
            </column>
        </form>
        <hbox id="editActions" spacing="true">
            <button id="commitAndCloseBtn" action="windowCommitAndClose"/>
            <button id="closeBtn" action="windowClose"/>
        </hbox>
    </layout>
</window>

The window element is a root element that has the following attributes:

  • class − a name of the controller.

  • caption − a window caption that can contain a link to a message from the pack mentioned above.

  • focusComponent − an identifier of a component that should get input focus when the screen is displayed.

Elements of the descriptor:

  • data − defines data components of the screen.

  • dialogMode - defines settings of geometry and behavior of the screen when it is opened as a dialog.

    Attributes of the dialogMode element:

    • closeable - defines whether the dialog window has a close button. Possible values: true, false.

    • closeOnClickOutside - defines if the dialog window should be closed by click outside the window area when the window has a modal mode. Possible values: true, false.

    • forceDialog - specifies that the screen should always be opened as a dialog. Possible values: true, false.

    • height - sets the height of the dialog window.

    • modal - specifies the modal mode for the dialog window. Possible values: true, false.

    • positionX - sets the x position of the top-left corner of the dialog window.

    • positionY - sets the y position of the top-left corner of the dialog window.

    • resizable - defines whether a user can change the size of the dialog window. Possible values: true, false.

    • width - sets the width of the dialog window.

      <dialogMode height="600"
                  width="800"
                  positionX="200"
                  positionY="200"
                  forceDialog="true"
                  resizable="true"/>
  • actions – defines the list of actions for the screen.

  • facets – defines the list of facets for the screen.

  • layout − root element of the screen layout.