rdicroce / jsfexporter

Lapis JSF Exporter
19 stars 17 forks source link

Add support for composite components #20

Open rootkit007 opened 11 years ago

rootkit007 commented 11 years ago

Currently these show up as javax.faces.component.UINamingContainer in exported file. Would also appreciate any pointers on how to implement this on my own

rdicroce commented 11 years ago

You would need to add an IValueFormatter implementation for UINamingContainer. Probably all it needs to do is call ExportUtil.transformComponentsToString(), passing its children as the components to transform.

rootkit007 commented 11 years ago

Any reason why we cant just change it in implementation of DefaultFormatter?

rdicroce commented 11 years ago

The idea is to have a separate IValueFormatter implementation for each component type that needs to be formatted. DefaultFormatter is a last-ditch formatter for when no other formatters match the component.

rootkit007 commented 11 years ago

Understandable. However to me it seems ExportUtils.transformComponentsToString() will do a better last-ditch effort than just .toString()?

rdicroce commented 11 years ago

Not necessarily. The component may not have any children, or it may have children that don't render anything the user can see and which shouldn't be formatted (e.g. p:ajax).

rootkit007 commented 11 years ago

I ran into a problem with my composite component, so far no clue. See http://stackoverflow.com/questions/16443446/convert-jsf-composite-component-to-text

rdicroce commented 11 years ago

I'm not sure what's wrong. I would have to experiment with this myself. Unfortunately, I don't have the time right now.