[MGNLUI-234] Add support for saving both as String and Boolean in CheckboxField Created: 27/Nov/12 Updated: 09/Dec/13 Resolved: 09/Dec/13 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | forms |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Tobias Mattsson | Assignee: | Mikaël Geljić |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | checkbox, form | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
In info.magnolia.ui.model.field.definition.FieldDefinition we have a property 'type' that is the type the property should have in the JCR. The CheckboxField should respect this property and support saving as both String and Boolean. When saved as a string it should save the strings 'true' and 'false'. Accepted values should also include for instance 'True' and 'TRUE' as implemented in Boolean.parseBoolean(). When implemented this should replace EnabledField in Security app. |
| Comments |
| Comment by Mikaël Geljić [ 09/Dec/13 ] |
|
Tentatively closing as incomplete: Setting field type as String or Boolean will properly result in reading/saving properties in JCR with the correct type. However, the uppercase variants for String type are not supported. Concretely we just build a TransformedProperty typed with String, that we pass to the Vaadin CheckBox as property datasource. While this works perfectly for the lowercase variants, it just doesn't with uppercase, and should IMO be fixed on this Vaadin side, unless absolutely required. In the latter case, a workaround currently is to use a custom property transformer, although we could/should expose the initProperty method of the AbstractFieldFactory so that CheckboxFieldFactory can act on it. |