5.5.1.2. XML-Descriptor
XML-descriptor is a file in XML format describing datasources and screen layout.
XML schema is available at http://schemas.haulmont.com/cuba/6.8/window.xsd.
Descriptor has the following structure:
window
− root element.
window
attributes:
-
class
− name of a controller class. -
messagesPack
− a default message pack for the screen. It is used to obtain localized messages in the controller usinggetMessage()
method and in the XML descriptor using message key without specifying the pack. -
caption
− window caption, can contain a link to a message from the above mentioned pack, for example,caption="msg://credits"
-
focusComponent
− identifier of a component which should get input focus when the screen is displayed. -
lookupComponent
– mandatory attribute for a lookup screen; defines the identifier of a visual component that the entity instance should be selected from. Supports the following types of components (and their subclasses):-
Table
-
Tree
-
LookupField
-
PickerField
-
OptionsGroup
-
-
datasource
– mandatory attribute for an edit screen which defines the identifier of the datasource containing the edited entity instance.
window
elements:
-
metadataContext
− the element initializing the views required for the screen. It is recommended to define all views in a single views.xml file, because all view descriptors are deployed into a common repository, so it is difficult to ensure unique names if the descriptors are scattered across multiple files. -
dsContext
− defines datasource for the screen. -
dialogMode
- defines the settings of geometry and behaviour of the screen when it is opened as a dialog.Attributes of
dialogMode
:-
closeable
- defines whether the dialog window has close button. Possible values:true
,false
. -
closeOnClickOutside
- defines if the dialog window should be closed by click on 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 regardless of whatWindowManager.OpenType
was selected in the calling code. Possible values:true
,false
. -
height
- sets the height of the dialog window. -
maximized
- if thetrue
value is set, the dialog window will be maximized across the screen. Possible values:true
,false
. -
modal
- specifies the modal mode for the dialog window. Possible values:true
,false
. -
positionX
- sets thex
position of the top-left corner of the dialog window. -
positionY
- sets they
position of the top-left corner of the dialog window. -
resizable
- defines whether the user can change the size of the dialog window. Possible values:true
,false
. -
width
- sets the width of the dialog window.
For example:
<dialogMode height="600" width="800" positionX="200" positionY="200" forceDialog="true" closeOnClickOutside="false" resizable="true"/>
-
-
actions
– defines the list of actions for the screen. -
timers
– defines the list of timers for the screen. -
companions
– defines the list of companion classes for the screen controller.Elements of
companions
:-
web
– defines a companion implemented in the web module. -
desktop
– defines a companion implemented in the desktop module.
Each of these elements contains
class
attribute defining the companion class. -
-
layout
− root element of the screen layout, a container with a vertical layout of components, similar to vbox.Attributes of
layout
: