RadioBox First Steps #15
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements
Description of the Change
I Added the Annotation @Radiobox which have 2 parameters ::
-First :: As all existing annotations the 'title'
-Second :: the titleMap which is a class that should extends 'TitleMapsAdapter' and overrides the method 'getPossibleValues()' in which the user will decide what possible values can he return in a HashMap<String ,Object>.
This Map will be used by the 'RadioBoxGenerator' to add an ArrayNode named 'titleMap' to our field Form Definition ObjectNode. ['titleMap' defines the names and values of our RadioBoxes in the resulted Form].
Alternate Designs
---note :: This mechanism could be reused in the ComboBox.
The choice of making the HashMap supports Object types, brings more flexibility to the Adapter and leaving the choice to the user deciding the Type to put in the Radio's value.
---note :: This idea comes to me after noticing that the method 'ObjectNode.put()' can support many types as values.
Why Should This Be In Core?
This is an elementary functionality.
Benefits
The major benefit is the growing number of the supported layouts.
Possible Drawbacks
'TitleMapsAdapter' may cause some problems.
Applicable Issues
can't find yet