Mike
Mike

Reputation: 217

CUBA : edit action does not open expected screen

I have:
- a Person browser screen which is the standard one
- a Person editor frame
- a Person editor screen which simply includes the Person editor frame

For some reason, when I open the editor from the browser, I'm facing a screen that is not the one I expect, and I did not design. The said screen seems to have been automatically generated on the fly.

The frame design (mapped to person-edit-frame.xml) :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
    caption="msg://editCaption"
    class="com.busy.busyapp.gui.person.PersonEditFrame"
    messagesPack="com.busy.busyapp.gui.person">
<dsContext>
    <datasource id="personDs"
                class="com.busy.busyapp.entity.Person"
                view="person-view">
        <collectionDatasource id="phoneLinesDs"
                              property="phoneLines"/>
    </datasource>
</dsContext>
<layout expand="rootBox"
        spacing="true">
    <scrollBox id="rootBox"
               spacing="true">
        <vbox id="details"
              spacing="true">
            <fieldGroup id="typeFieldGroup"
                        datasource="personDs">
                <column width="250px">
                    <field id="type"
                           custom="true"/>
                </column>
            </fieldGroup>
            <fieldGroup id="titleFieldGroup"
                        datasource="personDs">
                <column width="250px">
                    <field id="title"
                           custom="true"/>
                </column>
            </fieldGroup>
            <fieldGroup id="positionFieldGroup"
                        datasource="personDs">
                <column width="250px">
                    <field id="position"
                           custom="true"/>
                </column>
            </fieldGroup>
            <fieldGroup id="nameFieldGroup"
                        datasource="personDs">
                <column width="250px">
                    <field id="name"/>
                </column>
                <column width="250px">
                    <field id="firstName"/>
                </column>
            </fieldGroup>
        </vbox>
        <groupBox id="phoneLinesBox"
                  caption="msg://com.busy.busyapp.entity/Person.phoneLines">
            <table id="phoneLinesTable"
                   height="200px"
                   width="100%">
                <actions>
                    <action id="add"
                            openType="DIALOG"/>
                    <action id="remove"/>
                </actions>
                <columns>
                    <column id="label"/>
                    <column id="number"/>
                </columns>
                <rows datasource="phoneLinesDs"/>
                <buttonsPanel>
                    <button action="phoneLinesTable.add"
                            icon="font-icon:PLUS"/>
                    <button action="phoneLinesTable.remove"
                            icon="font-icon:MINUS"/>
                </buttonsPanel>
            </table>
        </groupBox>
    </scrollBox>
    <frame id="windowActions"
           screen="extendedEditWindowActions"/>
</layout>

The screen embedding the frame (mapped to person-edit.xml) :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
    caption="msg://editCaption"
    class="com.busy.busyapp.gui.person.PersonEdit"
    datasource="personDs"
    messagesPack="com.busy.busyapp.gui.person">
<dsContext>
    <datasource id="personDs"
                class="com.busy.busyapp.entity.Person"
                view="person-view">
        <collectionDatasource id="phoneLinesDs"
                              property="phoneLines"/>
    </datasource>
</dsContext>
<layout spacing="true">
    <label id="toto"
           datasource="personDs"
           property="id"/>
    <frame screen="busyapp$Person.edit.frame"/>
    <scrollBox height="100px"
               spacing="true"/>
    <frame id="windowActions"
           screen="extendedEditWindowActions"/>
</layout>

The screen I get :

screen 2

Edit : screens.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<screen-config xmlns="http://schemas.haulmont.com/cuba/screens.xsd">
<screen id="busyapp$Customer.browse"
        template="com/busy/busyapp/gui/customer/customer-browse.xml"/>
<screen id="busyapp$Customer.edit"
        template="com/busy/busyapp/gui/customer/customer-edit.xml"/>
<screen id="busyapp$ImpBusyArticles.browse"
        template="com/busy/busyapp/gui/impbusyarticles/impbusyarticles-browse.xml"/>
<screen id="busyapp$ImpBusyArticles.edit"
        template="com/busy/busyapp/gui/impbusyarticles/impbusyarticles-edit.xml"/>
<screen id="busyapp$Product.browse"
        template="com/busy/busyapp/gui/product/product-browse.xml"/>
<screen id="busyapp$Product.edit"
        template="com/busy/busyapp/gui/product/product-edit.xml"/>
<screen id="busyapp$ProductFamily.browse"
        template="com/busy/busyapp/gui/productfamily/product-family-browse.xml"/>
<screen id="busyapp$ProductFamily.edit"
        template="com/busy/busyapp/gui/productfamily/product-family-edit.xml"/>
<screen id="busyapp$Provider.browse"
        template="com/busy/busyapp/gui/provider/provider-browse.xml"/>
<screen id="busyapp$Provider.edit"
        template="com/busy/busyapp/gui/provider/provider-edit.xml"/>
<screen id="busyapp$Stock.browse"
        template="com/busy/busyapp/gui/stock/stock-browse.xml"/>
<screen id="busyapp$Stock.edit"
        template="com/busy/busyapp/gui/stock/stock-edit.xml"/>
<screen id="busyapp$VatRate.browse"
        template="com/busy/busyapp/gui/vatrate/vat-rate-browse.xml"/>
<screen id="busyapp$VatRate.edit"
        template="com/busy/busyapp/gui/vatrate/vat-rate-edit.xml"/>
<screen id="busyapp$SalePrice.browse"
        template="com/busy/busyapp/gui/saleprice/sale-price-browse.xml"/>
<screen id="busyapp$SalePrice.edit"
        template="com/busy/busyapp/gui/saleprice/sale-price-edit.xml"/>
<screen id="busyapp$SupplyPrice.browse"
        template="com/busy/busyapp/gui/supplyprice/supply-price-browse.xml"/>
<screen id="busyapp$SupplyPrice.edit"
        template="com/busy/busyapp/gui/supplyprice/supply-price-edit.xml"/>
<screen id="busyapp$Person.browse"
        template="com/busy/busyapp/gui/person/person-browse.xml"/>
<screen id="busyapp$Person.edit"
        template="com/busy/busyapp/gui/person/person-edit.xml"/>
<screen id="busyapp$Order.browse"
        template="com/busy/busyapp/gui/order/order-browse.xml"/>
<screen id="busyapp$Order.edit"
        template="com/busy/busyapp/gui/order/order-edit.xml"/>
<screen id="busyapp$Invoice.browse"
        template="com/busy/busyapp/gui/invoice/invoice-browse.xml"/>
<screen id="busyapp$Invoice.edit"
        template="com/busy/busyapp/gui/invoice/invoice-edit.xml"/>
<screen id="busyapp$Person.edit.frame"
        template="com/busy/busyapp/gui/person/person-edit-frame.xml"/>

Upvotes: 1

Views: 1088

Answers (1)

knstvk
knstvk

Reputation: 637

The standard actions use the following convention when selecting screens to open:

  • {entity_name}.edit for opening an editor screen
  • {entity_name}.lookup and {entity_name}.browse for opening a lookup screen

In your case, the browser by default opens the yournamespace$Person.edit screen. You can specify a screen to open for any action using the setWindowId() method.

Take a look at your screens.xml file to find out what screens are registered with what identifiers. The same information is available in the list of screens in Studio.

Upvotes: 0

Related Questions