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: [email protected]
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.COM
PONENT_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.

Reply via email to