Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic generation of Composite<> classes with @Wire for all screen components #55

Open
isunagatov opened this issue Feb 7, 2019 · 1 comment
Assignees
Labels
type: enhancement New feature or request

Comments

@isunagatov
Copy link

isunagatov commented Feb 7, 2019

In each project, there is an XML with the description of all controls with CubaId.

It is necessary to use it for automatic generation of classes describing screens with all controls. Getters with the appropriate type of control must be created in these classes.

Get'er to form the pattern ”get” + "Control Type" + Cuba-Id

web-screen.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<screen-config xmlns="http://schemas.haulmont.com/cuba/screens.xsd">
    <include file="com/haulmont/projectName/screens.xml"/>
    <screen id="projectName$Client.browse"
            template="com/haulmont/projectName/web/screens/client/client-browse.xml"/>
    <screen id="projectName$Client.edit"
            template="com/haulmont/projectName/web/screens/client/client-edit.xml"/>
    <screen id="projectName$ReferenceType.edit"
            template="/com/haulmont/projectName/web/screens/common/reference_type/reference-type-edit.xml"/>
    <screen id="projectName$ReferenceType.browse"
            template="/com/haulmont/projectName/web/screens/common/reference_type/reference-type-browse.xml"/>
    <screen id="html-page-editor"

File client-browse.xml

<buttonsPanel id="buttonsPanel"
                         alwaysVisible="true">
               <hbox margin="false,true,false,false"
                     spacing="true">
                   <button id="createBtn"
                           action="clientsTable.create"/>
                   <button id="editBtn"
                           action="clientsTable.edit"/>
                   <button id="removeBtn"
                           action="clientsTable.remove"/>
               </hbox>
               <button id="openChatBtn"
                       action="clientsTable.openChat"/>
               <popupButton id="paymentsPopupBtn"
                            caption="msg://paymentsCaption">
                   <actions>
                       <action id="startPaymentYearForSelected"
                               caption="msg://startPaymentYearForSelectedCaption"
                               invoke="startPaymentYearForSelected"/>
                       <action id="startPaymentYearForAll"
                               caption="msg://startPaymentYearForAllCaption"
                               invoke="startPaymentYearForAll"/>
                   </actions>
               </popupButton>
               <hbox margin="false,false,false,true"
                     spacing="true">
                   <button id="excelBtn"
                           action="clientsTable.excel"/>
                   <button id="importBtn"
                           caption="mainMsg://actions.Import"
                           icon="icons/excel.png"
                           invoke="importExcelFile"/>
                   <button id="importTransactionsBtn"
                           caption="msg://actions.ImportTransactions"
                           icon="icons/excel.png"
                           invoke="importTransactions"/>
               </hbox>
           </buttonsPanel>
@jreznot jreznot self-assigned this Feb 7, 2019
@jreznot jreznot added the type: enhancement New feature or request label Feb 7, 2019
@jreznot jreznot modified the milestone: 2.0 Feb 7, 2019
@jreznot jreznot changed the title Automatic generation of get requests for the described controls with CubaId Automatic generation of Composite<> classes with @Wire for all screen components Feb 7, 2019
@jreznot jreznot assigned natfirst and unassigned jreznot May 25, 2019
@jreznot
Copy link
Contributor

jreznot commented May 25, 2019

We could implement a script that will generate simple Composite classes with injected fields.

For instance, we pass the following XML file:

...
<filter id="filter"
                datasource="companiesDs">
            <properties include=".*"/>
        </filter>
        <table id="companiesTable"
               width="100%">
            <actions>
                <action id="create"/>
                <action id="edit"/>
                <action id="remove"/>
...

It should generate Java class:

public class CompanyBrowse extends Composite<CompanyBrowse> {
    @Wire
    public Table companiesTable;
    @Wire
    public Untyped filter;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants