| Summary: | INumericTextRidget does not write the proper decimal number to the control when using TypedBean | ||
|---|---|---|---|
| Product: | [RT] Riena | Reporter: | Sabine Achilles <achilles.sabine> |
| Component: | ridget | Assignee: | Project Inbox <riena.core-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Stefan.Liebig |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
| Bug Depends on: | 289653, 294527 | ||
| Bug Blocks: | |||
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 |
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.