4.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.1/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. -
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
: