I am designing a custom input form that will be data-driven and will display things like input fields, input text components, custom inputs that I create, etc. The elements on the form will be largely data-driven so I could create it with dynamic vf binding like so:
<apex:repeat... var="inputobj">
<apex:outputpanel rendered="{!inputobj.type == 'standardinputfield'}"
<apex:inputField required="{!inputobj.isRequired}" value="{!inputobj.data[f.apiName]}"
</apex:outputpanel}"
<apex:outputpanel rendered="{!inputobj.type == 'something'}"
...
</apex:outputpanel}"
<apex:outputpanel rendered="{!inputobj.type == 'something else'}"
...
</apex:outputpanel}"
...
</apex:repeat>
I've used this pattern in the past and it works reasonably well but the vf becomes quite unwieldy as you create more types (both from a development and performance perspective) and you can't really reuse and extend the vf like you can with abstract and virtual classes.
My idea is that the inputobjects will have a method which generates a dynamic vf component for itself and then just repeat over those components. Has anyone built something similar or run into any issues with this?
My main concern is ending up with an unholy mess of UI mixed in with business logic or running into performance issues with dynamic vf components.