Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342119 - INumericTextRidget does not write the proper decimal number to the control when using TypedBean
Summary: INumericTextRidget does not write the proper decimal number to the control wh...
Status: RESOLVED FIXED
Alias: None
Product: Riena
Classification: RT
Component: ridget (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 289653 294527
Blocks:
  Show dependency tree
 
Reported: 2011-04-07 05:00 EDT by Sabine Achilles CLA
Modified: 2011-09-19 08:52 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sabine Achilles CLA 2011-04-07 05:00:12 EDT
Using a TypedBean<Float> for example with a value of 12.0f results in 120,00 in the widget (->german locale).
If I write my own bean that returns a float value, everything works fine. But with a Float as an Object you get the strange behavior above.

This can be seen in the Example Client in the TextNumericSubModuleController. The Float-Ridget is bound to new TypedBean<Float>(Float.valueOf("1234")), but the UI shows 12340,00.
Comment 1 Stefan Liebig CLA 2011-09-19 08:52:48 EDT
The root cause of this problem is that the generic type gets lost (type erasure).
The bindToModel() method in DecimalTextRidget uses a data binding API (PojoObservables/BeansObservables) that is not capable of passing in the type of the value.
However, the BeanProperties and PojoProperties do allow this (recommended see comment #6 in bug#335792 ).
Using this API and retrieving the type of the value by an extension in TypedBean returning the actual type of the value (convention) and if this is not available by inspecting the actual value's type the bindToModel() can be rewritten so that the generic TypedBean can be used.

The above mentioned convention for retrieving the values type is:
- look for a property: valueProperty + "Type", e.g. property: "value" -> "valueType"
- and if this property's return type is Class
- use it as the value's type