2.5.2.1. Browser Layout

Find the ebook-browse.xml screen on the Screens section of the navigation panel and open it for editing. Choose the XML tab and completely replace its contents with the following code:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<    window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        caption="msg://browseCaption"
        class="com.sample.library.gui.ebook.EBookBrowse"
        lookupComponent="eBookTable"
        messagesPack="com.sample.library.gui.ebook">
    <dsContext>
        <collectionDatasource id="eBookDs"
                              class="com.sample.library.entity.EBook"
                              view="eBook.browse">
            <query>
                <![CDATA[select e from library$EBook e order by e.createTs]]>
            </query>
        </collectionDatasource>
    </dsContext>
    <layout expand="eBookTable"
            spacing="true">
        <filter id="filter"
                datasource="eBookDs">
            <properties include=".*"/>
        </filter>
        <table id="eBookTable"
               height="100%"
               width="100%">
            <rows datasource="eBookDs"/>
            <columns>
                <column id="publication"/>
                <column id="description"/>
                <column id="locState"/>
            </columns>
            <rowsCount/>
            <actions>
                <action id="remove"/>
            </actions>
            <buttonsPanel id="buttonsPanel"
                          alwaysVisible="true">
                <button id="createBtn"
                        action="eBookTable.create"/>
                <button id="editBtn"
                        action="eBookTable.edit"/>
                <button id="removeBtn"
                        action="eBookTable.remove"/>
            </buttonsPanel>
        </table>
    </layout>
</window>

The code contains the following differences from the standard browser screen:

  • description and locState have been added to the columns list of the eBookTable. These attributes provide the description of the card and the localized name of the current state.

  • create and edit have been removed from the list of declaratively created actions in the eBookTable table. The corresponding buttons in the buttonsPanel have been kept because we will programmatically create these actions in the controller code.

Return to the Layout tab. The layout of the screen will be as follows: