1
votes

I was wondering if there is a way to targets all possible additional attribute to a given component, something like a wildcard. In the following example, I would like to target all attribute to the component btn. Typically, I would like to target all the JavaScript attributes (onclick, onsubmit, etc.) and I don't want to copy the whole list of attributes. Is there a way to simplify that?

<composite:interface>
    <composite:attribute name="action" targets="btn" required="false" />
    <composite:attribute name="onkeydown" targets="btn" required="false" />
    <composite:attribute name="onkeyup" targets="btn" required="false" />
    <composite:attribute name="onclick" targets="btn" required="false" />
    <!-- Here other attributes with targets="btn" -->
</composite:interface>
<composite:implementation>
    <p:commandButton id="btn" />
    <!-- additional code (not relevant for the question) -->
</composite:implementation>
1

1 Answers

2
votes

Is there a way to simplify that?

No. Just bite the bullet and copypaste them all and live with verbosity of declarative nature of XML.

Note that with your proposed approach the Facelet file editors (e.g. Eclipse) won't be able to propose the right attributes on autocomplete of <your:composite> in template client. Also, Facelet tag library documentation generators like Vdldoc won't be able to list the right attribtues in the documentation.