Data Components

Data components are non-visual elements of screens that provide loading of data, binding it to data-aware visual components and saving changed data back to the data store. There are the following categories of data components:

  • Containers provide the thin layer between entities and data-aware visual components. Different types of containers hold either single instances or collections of entities.

  • Loaders load data to containers.

  • DataContext tracks changes in entities and saves changed instances upon request.

Usually, data components are defined in the screen XML descriptor in the <data> element:

<data readOnly="true">
    <collection id="departmentsDc"
        <fetchPlan extends="_base">
            <property name="employees" fetchPlan="_base"/>
        <loader id="departmentsDl">
                <![CDATA[select e from uiex1_Department e]]>
                        <c:where> like :name</c:where>

        <collection id="employeesDc" property="employees"/>

Data components can be injected into the controller in the same way as visual components:

private CollectionLoader<Department> departmentsDl;

private String departmentName;

public void onBeforeShow(BeforeShowEvent event) {
    departmentsDl.setParameter("name", departmentName);

Data components of a particular screen are registered in the ScreenData object which is associated with the screen controller and available through its getScreenData() method. This object is useful when you need to load all data for the screen, for example:

public void onAfterShow(AfterShowEvent event) {
Use DataLoadCoordinator facet for declarative linking of data loaders to data containers, visual components and screen events. In case you need to set some loading parameters, you can use programmatic loading as described in the section below.