A.9. screens.xml
Files of this type are used in the generic user interface of the Web Client and the Desktop Client for registration of screen XML-descriptors.
XML schema is available at http://schemas.haulmont.com/cuba/6.2/screens.xsd.
A set of screens.xml
files, including the ones defined in base projects, is declared in the cuba.windowConfig application property.
The file has the following structure:
screen-config
– the root element.
screen-config
elements:
-
screen
– screen descriptor.screen
attributes:-
id
– screen identifier used to reference this screen from the application code (e.g. in theFrame.openWindow()
and other methods) and in the menu.xml. -
template
– path to screen’s XML-descriptor. Resources interface rules apply to loading the descriptor. -
class
– if thetemplate
attribute is not set, this attribute should contain the name of the class implementing eitherCallable
orRunnable
.In case of
Callable
, thecall()
method should return an instance ofWindow
, which will be returned to the invoking code as the result of callingWindowManager.openWindow()
. The class may contain a constructor with string parameters, defined by the nestedparam
element (see below). -
multipleOpen
– optional attribute, allowing a screen to be opened multiple times. If set tofalse
or not defined and the screen with this identifier has already been opened in the main window, the system will show the existing screen instead of opening a new one. If set totrue
, any number of screen instances can be opened.screen
elements: -
param
– defines a screen parameter submitted as a map to the controller'sinit()
method. Parameters, passed to theopenWindow()
methods by the invoking code, override the matching parameters set inscreens.xml
.param
attributes:-
name
– parameter name. -
value
– parameter value. Stringstrue
andfalse
are converted into the correspondingBoolean
values.
-
-
-
include
– includes a different file, e.g.screens.xml
.include
attributes:-
file
– path to a file according to the rules of the Resources interface.
-
Example of a screens.xml
file:
<screen-config xmlns="http://schemas.haulmont.com/cuba/screens.xsd">
<screen id="sales$Customer.lookup" template="/com/sample/sales/gui/customer/customer-browse.xml"/>
<screen id="sales$Customer.edit" template="/com/sample/sales/gui/customer/customer-edit.xml"/>
<screen id="sales$Order.lookup" template="/com/sample/sales/gui/order/order-browse.xml"/>
<screen id="sales$Order.edit" template="/com/sample/sales/gui/order/order-edit.xml"/>
</screen-config>