Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361332

Summary: The default value is set differently in EDT & RBD for the DojoComboBox
Product: z_Archived Reporter: fahua jin <jinfahua>
Component: EDTAssignee: Justin Spadea <jspadea>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: hjiyong, jspadea, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
The sample EGL file. none

Description fahua jin CLA 2011-10-19 01:55:48 EDT
Build Identifier: 0.7.0.v201110180903

Open the attached H2.egl in EDT & RBD, you'll find the different setting of default value for the DojoCombobox. 

In the EDT, the default value is the 5; While in the RBD, the default value is empty.

Reproducible: Always
Comment 1 fahua jin CLA 2011-10-19 02:02:22 EDT
Created attachment 205472 [details]
The sample EGL file.
Comment 2 Huang Ji Yong CLA 2011-10-19 02:35:52 EDT
I think this defect is the same as bug 361333.
This defect just set model value to empty value, while 361333 set model value to a value 10. In both case, the model value does not publish to the view widget.
Comment 3 Huang Ji Yong CLA 2011-10-20 01:50:10 EDT
This is also resolved after resolution of bug 361333.
The default value is 0 in EDT which is different then RBD. This is caused by design change.
Comment 4 Brian Svihovec CLA 2011-10-20 09:25:10 EDT
Ji Yong, can you provide more information on the Design Change you mentioned in comment 3?
Comment 5 Huang Ji Yong CLA 2011-10-21 04:27:47 EDT
(In reply to comment #4)
> Ji Yong, can you provide more information on the Design Change you mentioned in
> comment 3?

The default int value is 0 in EDT while it is "" in RBD. I regard this as design change because EDT way makes more sense.
Comment 6 Huang Ji Yong CLA 2011-10-21 04:28:50 EDT
(In reply to comment #4)
> Ji Yong, can you provide more information on the Design Change you mentioned in
> comment 3?
Consider define a int variable.

i int;
function start()
    syslib.writeStdout(i);
end

The default int value is 0 in EDT while it is "" in RBD. I regard this as design change because EDT way makes more sense.
Comment 7 fahua jin CLA 2011-10-21 04:33:49 EDT
(In reply to comment #6)
> (In reply to comment #4)
> > Ji Yong, can you provide more information on the Design Change you mentioned in
> > comment 3?
> Consider define a int variable.
> 
> i int;
> function start()
>     syslib.writeStdout(i);
> end
> 
> The default int value is 0 in EDT while it is "" in RBD. I regard this as
> design change because EDT way makes more sense.

One similar issue was reported by me several days ago, where I can get the documentation for the design changes?
Comment 8 Brian Svihovec CLA 2011-10-21 10:43:22 EDT
Ji Yong,

We ran your test case (comment 6) in RBD 8012, and we see the value printed as '0' for Java, JS, and Debug.  Can you try this again and see what you get?  

I talked with Paul Harmon and Matt Heitz, and the default value of an integer in RBD is 0.  Before we ran the test, we believed that the 'asString' function in RBD might be invalid, and 0 was being converted to "" incorrectly, but this does not seem to be the case.

In general, I believe the behavior in EDT is correct, where 0 is being assigned to 'value' in the DojoComboBox instead of "".  When I was discussing this with Paul, he pointed out that a value of 0 shouldn't be selecting the first value in the Combo Box, since EGL is a '1' based language.  Can you review the Dojo widgets and look for other places where things are 0 based instead of 1 based?  I would recommend listing all of the widgets here before we make any changes.
Comment 9 Huang Ji Yong CLA 2011-10-24 05:42:53 EDT
Brian,
I was wrong in comment 6. The default value for int type in RBD and EDT is the same "0".
When use in MVC of RBD, in controller.egl line 78 (publish function),
s String = format(retrieveModelHelper)
will convert 0 to "".

In this testcase in EDT, the internalFormatters are not set for the int field, so it is not formatted to ""; I reopen this defect because the numericFormatter should be assign to the int field by default.

Another issue also exists in RBD is that, the 0 will be formatted to "", do you think this is a defect?

PS. "0" is available for DojoComboBox value, because it is a value, not an index. It is different with RUI Combo.
Comment 10 Justin Spadea CLA 2011-10-25 16:58:13 EDT
*** Bug 360921 has been marked as a duplicate of this bug. ***
Comment 11 Justin Spadea CLA 2011-10-25 17:00:52 EDT
I have a fix and it will be released once M3 is declared. The behavior that numeric zero values get formatted to blank strings in MVC is intentional, and it goes way back to the way that web transactions and JSF applications in RBD run their formatting (probably TUI as well). If you want the formatting to display a zero as "0" then use the following property:

myfield int{ZeroFormat = yes};
Comment 12 Justin Spadea CLA 2011-10-26 15:15:35 EDT
Fixed MVCTemplate.java and InternalNumericFormatter.egl
Comment 13 fahua jin CLA 2011-10-31 02:58:56 EDT
Verified in 0.7.0.v201110272101