-
1. Re: The easiest way to add an attribute to a component
aparij Oct 24, 2008 2:20 PM (in response to aparij)The only help source I could find was
in the CDK Developer guide in section
4.4.1. Templating. But it is about creating a completely new component... -
2. Re: The easiest way to add an attribute to a component
nbelaevski Oct 24, 2008 6:28 PM (in response to aparij)If you need to read this attribute by another component or from Java code you can use <f:attribute> tag/javax.faces.component.UIComponent#getAttributes() method.
To extend the component you have to:
1. Extend Html* component class - add getter/setter for your property together with overriding saveState/restoreState
2. Write your own renderer (or use ours if you find the way to extend it)
3. Create *.tld/faces-config.xml/*.taglib.xml files for your component
4. Extend JSP tag handler class
5. Extend or create Facelet handler class (that's necessary in rare cases like adding method attributes)
That's all and I hope that I didn't forget anything :).
In fact it would be much easier to modify CDK files for component (SVN_ROOT/ui/component/src/main/config and SVN_ROOT/ui/component/src/main/templates) and rebuild it than creating/extending all the stuff mentioned above.