Hello guys, me and Jirka are working on Page Fragments refactoring. We have started with Accordion and Autocomplete page fragments. We would like to know your opinions on some things, to be sure that we can continue in the similar way with other fragments.
Lets start with RichFacesAutocomplete page fragment.
The refactoring is made in this commit
Basically what we are trying to achieve with all page fragments:
- create high level API, which contains only important methods which all users will need. e.g.: Autocomplete
- its implementation which will hide other not so important methods (usually used for framework testing), so the API stays simple and clean
- (1) we are achieving this by declaring such methods in AdvancedInteractions
- Sample of usage of the new Autocomplete ca be found here.
Second refactored page fragment is RichFacesAccordion.
The refactoring is made in this commit.
- (2) We would like to use interfaces SwitchableComponent and ComponentsContainer as a base for common functionality for: r:tabPanel, r:accordion, r:collapsiblePanel, r:togglePanel
- currently it is implemented just for r:accordion, but we believe that it will work for the other as well
- Sample usage of such accordion.
(3) Third question: Some page fragments are able to retrieve their settings from the <script> element of the corresponding element. E.g. Autocomplete can retrieve whether it is Ajax or client based, or tokens used for separating the values. An user of such page fragment would not have to call .setMode() or setTokens(String tokens). There are other examples for other page fragments. The concern here is that such Page Fragments will be behaving in a little bit in magic way. On the other hand it can save some of the settings which user needs to do. What is your opinion on this ? IMHO we can setup the page fragment automatically from script, but still we should provide setters for these features, hidden in the AdvancedInteractions.
Do you have some ideas on this guys ? What can be done better or so ?