2012/7/22 Vincent Massol <[email protected]>: > Hi devs, > > I've been thinking about Displayer architecture today and here are my > thoughts on how I see them implemented (without entering low-level details): > > Basics > ====== > > * Everything in XWiki should be a Component and should be able to be > implemented in Java and optionally extended in wiki pages (wiki components > notion) > * Have a Displayer component Role (ie a java interface for displayers) > * Have default implementations in the display module for all basic types we > want to support (textareas, date, string, number, etc). Basically this means > rewriting the current displayers as components. > * Allow to register Displayers defined in wiki pages by using wiki components > (same mechanism as wiki macros). > * Since a lot of Displayers are better written in wiki pages (javascript, > css), create a UI submodule of the current display module which contains > displayers we want bundled by default in XE (for ex for Dates and > Users/Groups) > * Extend the current {{display}} macro to support displaying Objects and > Object Properties (it already supports passing an EntityType parameter but > it's not used ATM). > * The {{display}} macro will use the CM to get an instance of a displayer for > the Object property type. It'll do by finding the XClass and getting the type > from the XClass and then do a getInstance > * Add an optional parameter to the {{display}} macro to support passing a > displayer hint (by default it would use the "default" displayer for the > property type). This will allow some pages to decide which displayer to use > to render their content without being forced to use the default displayer. > > Advanced > ========= > > In order to make it easy for a given class or a given object to decide how to > display itself we could also define some special DisplayerBinding XObjects > (one per property type). It could work like this: > > * If the {{display}} macro has the displayer hint specified as parameter then > use it > * If the {{display}} macro doesn't have the displayer hint specified then > check if the xclass document has a DisplayerBinding XObject defined and if so > use the displayer pointed to by the binding > * If the {{display}} macro doesn't have the displayer hint specified and the > xclass document doesn't have a DisplayerBinding XObject defined then check if > the object to display have such an XObject and if so use it
Currently custom displayers are activate on a per property basis, not by field type, so the binding should be per property. Knowing this it's a bit bizarre to have that binding not being a field of the property of the XClass. It should generally complicated to use bindings instead of just setting a field. There is another need (which I'm working on in the hackathon) to have default custom displayers for ALL property of a specific type for ALL classes. So if we go the component way we should make sure this is also possible. This means a binding at the wiki or multi wiki level for instance. Finally it's also important to have the same displayer system to be supported by calls to $doc.display(). Not everything can be done through macros, so we also need the API to support the same system of displayers In general it's a progress to be able to register new displayers like that as components, but it's important to make it simple to configure. If there are too many indirections it might be hard to actually understand where the configuration actually is. Ludovic > * Deprecate the notion of "custom displayer" that we have in our XClass since > it wouldn't be needed anymore > > WDYT? > > I know we're not there yet but it would be cool to make progress on the > direction we'd like to take. > > Thanks > -Vincent > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs -- Ludovic Dubost Founder and CEO Blog: http://blog.ludovic.org/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

