Because there are a high number of developers and I want hide the way to set the value of this kind of checkbox (I use the custom component in table with a checkbox in each row for the multi selection).
Mario. ________________________________ From: Guy Bashan [mailto:[EMAIL PROTECTED] Sent: 15 luglio 2008 21.21 To: 'MyFaces Discussion' Subject: RE: Creating child automatically Hi, Why do you need a specific component for this task? Why not simply write the code as is? Guy. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2008 10:30 AM To: users@myfaces.apache.org Subject: Creating child automatically Hi, i need a custom column that render automatically a check box child. So, what I need is insert, automatically, in the table the tags: <t:column > <t:selectBooleanCheckbox value="#{xxx}"/> </t:column> inserting just the tag <xx:mycol>. To do that, I have developed a my custom tag and a my component. The component extends org.apache.myfaces.custom.column.HtmlSimpleColumn and override the encodeBegin in this way: public void encodeBegin(FacesContext context) throws IOException { super.encodeBegin(context); Application app = context.getApplication(); if (this.getChildren()== null || this.getChildren().size() == 0){ UIComponent parent = this.getParent(); if(parent instanceof HtmlDataTable){ HtmlSelectBooleanCheckbox select = (HtmlSelectBooleanCheckbox)app.createComponent(HtmlSelectBooleanCheckbox .COMPONENT_TYPE); select.setValueBinding("value",app.createValueBinding("myvalue")); this.getChildren().add(select); }else { log.warn("Parent component must be a data table of class "+HtmlDataTable.class); } } } What I do, I simply add a child with the HtmlSelectBooleanCheckbox just if I don't have any childs. Is this the correct way to that? This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.