EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  Null Pointer Exception in RBD Tutorial

    Posted Wed April 13, 2016 04:37 AM

    Hello all,

    complete newbie to EGL here.

    I am going over the database tutorial included in the latest Rational Business Developer 9.5 release help guide and I keep getting a null pointer exception while

    adding elements to a Rich UI. Here is a link to the tutorial. I keep getting stuck in step 4 after adding the title pane and connecting an EGL record variable to it.

    Once this is done, the design and preview pages in the rich ui display a stack trace for the null pointer exception and I cannot continue with the tutorial.

    My database connection to the embedded derby db is working fine and I successfully create a sql record.

    I am including the source code for the Rich UI handler below.

    Any help is greately appreciated.

    package handlers;

    // RUI Handler

    import com.ibm.egl.rui.widgets.GridLayout;
    import records.paymentRec;
    import com.ibm.egl.rui.widgets.DataGrid;
    import com.ibm.egl.rui.widgets.GridLayoutData;
    import com.ibm.egl.rui.widgets.DataGridColumn;
    import com.ibm.egl.rui.widgets.DataGridLib;
    import com.ibm.egl.rui.widgets.GridLayoutLib;
    import dojo.widgets.DojoButton;
    import dojo.widgets.DojoTitlePane;
    import com.ibm.egl.rui.widgets.Div;
    import com.ibm.egl.rui.widgets.TextLabel;
    import dojo.widgets.DojoTextField;
    import com.ibm.egl.rui.mvc.Controller;
    import com.ibm.egl.rui.mvc.MVC;
    import com.ibm.egl.rui.mvc.FormField;
    import dojo.widgets.DojoComboBox;
    import dojo.widgets.DojoCurrencyTextBox;
    import dojo.widgets.DojoCheckBox;
    import dojo.widgets.DojoDateTextBox;
    import dojo.widgets.DojoLib;
    import com.ibm.egl.rui.mvc.FormManager;

    //
    //

    handler PaymentFileMaintenance type RUIhandler{initialUI =[ui
                ], onConstructionFunction = start, cssFile = "css/PaymentClient.css", title = "PaymentFileMaintenance"}

        ui GridLayout{columns = 2, rows = 2, cellPadding = 4, children =[editPane, buttonLayout, allPayments_ui
                ]};
        allPayments paymentRec[0];

        allPayments_ui DataGrid{layoutData = new GridLayoutData{row = 2, column = 1, verticalAlignment = GridLayoutLib.VALIGN_TOP}, columns =[
                        new DataGridColumn{name = "category", displayName = "Type", width = 90},
                        new DataGridColumn{name = "description", displayName = "Description", width = 120},
                        new DataGridColumn{name = "amount", displayName = "Amount Due", width = 90}
                ], data = allPayments as any[], selectionMode = DataGridLib.SINGLE_SELECTION};
        buttonLayout GridLayout{ layoutData = new GridLayoutData{ row = 1, column = 1 }, cellPadding = 4, rows = 1, columns = 3,
            children = [ sampleButton, deleteButton, addButton ] };
        addButton DojoButton{ layoutData = new GridLayoutData{ row = 1, column = 1 }, text = "Add", onClick ::= addRow };
        deleteButton DojoButton{ layoutData = new GridLayoutData{ row = 1, column = 2 }, text = "Delete", onClick ::= deleteRow };
        sampleButton DojoButton{ layoutData = new GridLayoutData{ row = 1, column = 3 }, text = "Sample", onClick ::= sampleData };
        selectedPayment paymentRec;
        editPane DojoTitlePane{ layoutData = new GridLayoutData{ row = 2, column = 2,
            verticalAlignment = GridLayoutLib.VALIGN_TOP }, title = "Payment record", isOpen=true, duration=1000, width = "350", children = [ new Div {
                children = [ selectedPayment_ui ]
            } ] };
        
        selectedPayment_ui GridLayout { rows = 9, columns = 2, cellPadding = 4, children = [ selectedPayment_paymentId_nameLabel,selectedPayment_paymentId_field,selectedPayment_category_nameLabel,selectedPayment_category_comboBox,selectedPayment_description_nameLabel,selectedPayment_description_field,selectedPayment_amount_nameLabel,selectedPayment_amount_textBox,selectedPayment_fixedPayment_nameLabel,selectedPayment_fixedPayment_checkBox,selectedPayment_dueDate_nameLabel,selectedPayment_dueDate_textBox,selectedPayment_payeeName_nameLabel,selectedPayment_payeeName_field,selectedPayment_payeeAddress1_nameLabel,selectedPayment_payeeAddress1_field,selectedPayment_payeeAddress2_nameLabel,selectedPayment_payeeAddress2_field ] };

        selectedPayment_paymentId_nameLabel TextLabel { text="paymentId" , layoutData = new GridLayoutData { row = 1, column = 1} };
        selectedPayment_paymentId_field DojoTextField {layoutData = new GridLayoutData { row = 1, column = 2} };
        selectedPayment_paymentId_controller Controller { @MVC {model = selectedPayment.paymentId, view = selectedPayment_paymentId_field as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_paymentId_formField FormField { controller = selectedPayment_paymentId_controller, nameLabel = selectedPayment_paymentId_nameLabel};

        selectedPayment_category_nameLabel TextLabel { text="category" , layoutData = new GridLayoutData { row = 2, column = 1} };
        selectedPayment_category_comboBox DojoComboBox { values = [] , layoutData = new GridLayoutData { row = 2, column = 2} };
        selectedPayment_category_controller Controller { @MVC {model = selectedPayment.category, view = selectedPayment_category_comboBox as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_category_formField FormField { controller = selectedPayment_category_controller, nameLabel = selectedPayment_category_nameLabel};

        selectedPayment_description_nameLabel TextLabel { text="description" , layoutData = new GridLayoutData { row = 3, column = 1} };
        selectedPayment_description_field DojoTextField {layoutData = new GridLayoutData { row = 3, column = 2} };
        selectedPayment_description_controller Controller { @MVC {model = selectedPayment.description, view = selectedPayment_description_field as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_description_formField FormField { controller = selectedPayment_description_controller, nameLabel = selectedPayment_description_nameLabel};

        selectedPayment_amount_nameLabel TextLabel { text="amount" , layoutData = new GridLayoutData { row = 4, column = 1} };
        selectedPayment_amount_textBox DojoCurrencyTextBox { currency = "USD", value = selectedPayment.amount, width ="100", errorMessage="Amount is not valid." , layoutData = new GridLayoutData { row = 4, column = 2} };
        selectedPayment_amount_controller Controller { @MVC {model = selectedPayment.amount, view = selectedPayment_amount_textBox as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_amount_formField FormField { controller = selectedPayment_amount_controller, nameLabel = selectedPayment_amount_nameLabel};

        selectedPayment_fixedPayment_nameLabel TextLabel { text="fixedPayment" , layoutData = new GridLayoutData { row = 5, column = 1} };
        selectedPayment_fixedPayment_checkBox DojoCheckBox { layoutData = new GridLayoutData { row = 5, column = 2} };
        selectedPayment_fixedPayment_controller Controller { @MVC {model = selectedPayment.fixedPayment, view = selectedPayment_fixedPayment_checkBox as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_fixedPayment_formField FormField { controller = selectedPayment_fixedPayment_controller, nameLabel = selectedPayment_fixedPayment_nameLabel};

        selectedPayment_dueDate_nameLabel TextLabel { text="dueDate" , layoutData = new GridLayoutData { row = 6, column = 1} };
        selectedPayment_dueDate_textBox DojoDateTextBox { formatLength = DojoLib.DATEBOX_FORMAT_LONG, value = selectedPayment.dueDate , layoutData = new GridLayoutData { row = 6, column = 2} };
        selectedPayment_dueDate_controller Controller { @MVC {model = selectedPayment.dueDate, view = selectedPayment_dueDate_textBox as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_dueDate_formField FormField { controller = selectedPayment_dueDate_controller, nameLabel = selectedPayment_dueDate_nameLabel};

        selectedPayment_payeeName_nameLabel TextLabel { text="payeeName" , layoutData = new GridLayoutData { row = 7, column = 1} };
        selectedPayment_payeeName_field DojoTextField {layoutData = new GridLayoutData { row = 7, column = 2} };
        selectedPayment_payeeName_controller Controller { @MVC {model = selectedPayment.payeeName, view = selectedPayment_payeeName_field as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_payeeName_formField FormField { controller = selectedPayment_payeeName_controller, nameLabel = selectedPayment_payeeName_nameLabel};

        selectedPayment_payeeAddress1_nameLabel TextLabel { text="payeeAddress1" , layoutData = new GridLayoutData { row = 8, column = 1} };
        selectedPayment_payeeAddress1_field DojoTextField {layoutData = new GridLayoutData { row = 8, column = 2} };
        selectedPayment_payeeAddress1_controller Controller { @MVC {model = selectedPayment.payeeAddress1, view = selectedPayment_payeeAddress1_field as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_payeeAddress1_formField FormField { controller = selectedPayment_payeeAddress1_controller, nameLabel = selectedPayment_payeeAddress1_nameLabel};

        selectedPayment_payeeAddress2_nameLabel TextLabel { text="payeeAddress2" , layoutData = new GridLayoutData { row = 9, column = 1} };
        selectedPayment_payeeAddress2_field DojoTextField {layoutData = new GridLayoutData { row = 9, column = 2} };
        selectedPayment_payeeAddress2_controller Controller { @MVC {model = selectedPayment.payeeAddress2, view = selectedPayment_payeeAddress2_field as Widget}, validStateSetter = handleValidStateChange_selectedPayment1};
        selectedPayment_payeeAddress2_formField FormField { controller = selectedPayment_payeeAddress2_controller, nameLabel = selectedPayment_payeeAddress2_nameLabel};    

        selectedPayment_form FormManager {entries = [ selectedPayment_paymentId_formField,selectedPayment_category_formField,selectedPayment_description_formField,selectedPayment_amount_formField,selectedPayment_fixedPayment_formField,selectedPayment_dueDate_formField,selectedPayment_payeeName_formField,selectedPayment_payeeAddress1_formField,selectedPayment_payeeAddress2_formField ] };

        function start()
            allPayments_ui.data =[
                    new paymentRec{category = 1, description = "test01", amount = 100.00},
                    new paymentRec{category = 2, description = "test02", amount = 200.00},
                    new paymentRec{category = 3, description = "test03", amount = 300.00}
            ];
        end
        
        function addRow(event Event in)
            
        end
        
        function deleteRow(event Event in)
            
        end
        
        function sampleData(event Event in)
            
        end
        
        function selectedPayment_form_Submit(event Event in)
            if(selectedPayment_form.isValid())
                selectedPayment_form.commit();
            end
        end
        
        function selectedPayment_form_Publish(event Event in)
            selectedPayment_form.publish();
            selectedPayment_form_Validate();
        end
        
        function selectedPayment_form_Validate()
            selectedPayment_form.isValid();
        end
        
        function handleValidStateChange_selectedPayment1(view Widget in, valid boolean in)
            for (n int from selectedPayment_form.entries.getSize() to 1 decrement by 1)
                entry FormField = selectedPayment_form.entries[n];
                if(entry.controller.view == view)
                    if(valid)
                        // TODO: handle valid value
                    else
                        msg String? = entry.controller.getErrorMessage();
                        // TODO: handle invalid value
                    end
                end
            end
        end
    end

    isaric


  • 2.  Re: Null Pointer Exception in RBD Tutorial

    Posted Wed April 13, 2016 12:55 PM

    Hi...welcome to EGL!!

     

    Will take a look, but what embedded browser are you using to render pages in the editor as sometimes that will make a difference.  

     

    You can find this in the "Window->Preferences->EGL->Rich UI->Appearance page.

     

    Thanks.

    markevans


  • 3.  Re: Null Pointer Exception in RBD Tutorial

    Posted Wed April 13, 2016 05:51 PM

    I tried this and assuming I see the same exception, , this was a problem we resolved in RBD 9.5.0.1. 

    You can use the IBM Installation Manager to do an "update" and you should be able to install the fixes.

    Give this a try.

     

    Mark

    markevans


  • 4.  Re: Null Pointer Exception in RBD Tutorial

    Posted Thu April 14, 2016 03:58 AM

    The exception disappears after updating RBD. Thank you for your help!

    isaric