You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Don Tam <dt...@consumercontact.com> on 2005/11/07 21:03:56 UTC

dynamic number of panelTabs in panelTabbedPane

Hi,

Could anyone tell me how I could generate a tab for each item in a list?

Thanks,

-- 
Don Tam
Manager, Software Development
(416)493-6111x143
dtam@consumercontact.com


Re: dynamic number of panelTabs in panelTabbedPane

Posted by Enrique Medina <e....@gmail.com>.
Well, I have used the approach of creating the components in the setter of
the property. This approach has the advantage that the component you are
binding to is created by JSF and then passed as a parameter to your setter,
so you can use that reference to create all the hierarchy of components.

2005/11/7, Don Tam <dt...@consumercontact.com>:
>
> Hi,
>
> Thanks. I'm quite new to faces and i've never used the component
> bindings before, actually. What is the best practice for organizing this?
>
> Should I have something like this in faces-config.xml:
>
> <managed-bean>
> <managed-bean-name>Bean</managed-bean-name>
> <managed-bean-class>com.web.Bean</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> <managed-property>
> <property-name>tabs</property-name>
>
> <property-class>org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane
> </property-class>
> <value>#{Bean.initTabs}</value>
> </managed-property>
> </managed-bean>
>
> and then have
>
> public HtmlPanelTabbedPane initTabs();
> public HtmlPanelTabbedPane getTabs();
> public void setTabs(HtmlPanelTabbedPane hptp);
>
> ?
>
> Thanks,
>
> Enrique Medina wrote:
>
> > Yes, thats the idea! And always add childs using getChildren() instead
> > of setParent() ;-)
> >
> > 2005/11/7, Don Tam <dtam@consumercontact.com
> > <ma...@consumercontact.com>>:
> >
> > Hi Enrique,
> >
> > Thank you for your response. Does this mean I would have to generate
> > whatever is in the tabs through code as well? So basically my jsp
> > would
> > just look like:
> >
> > <panelTabbedPane binding="#{Bean.stuff}">
> > </panelTabbedPane>
> >
> > Thanks,
> >
> > Enrique Medina wrote:
> >
> > > Just bind your panelTabbedPane to a property in your backing
> > bean, and
> > > create the tabs dynamically from code, adding them to your property
> > > using getChildren().
> > >
> > > 2005/11/7, Don Tam < dtam@consumercontact.com
> > <ma...@consumercontact.com>
> > > <mailto:dtam@consumercontact.com
> > <ma...@consumercontact.com>>>:
> > >
> > > Hi,
> > >
> > > Could anyone tell me how I could generate a tab for each
> > item in a
> > > list?
> > >
> > > Thanks,
> > >
> > > --
> > > Don Tam
> > > Manager, Software Development
> > > (416)493-6111x143
> > > dtam@consumercontact.com <ma...@consumercontact.com>
> > <mailto:dtam@consumercontact.com <ma...@consumercontact.com>>
> > >
> > >
> >
> > --
> > Don Tam
> > Manager, Software Development
> > (416)493-6111x143
> > dtam@consumercontact.com <ma...@consumercontact.com>
> >
> >
>
> --
> Don Tam
> Manager, Software Development
> (416)493-6111x143
> dtam@consumercontact.com
>
>

Re: dynamic number of panelTabs in panelTabbedPane

Posted by Don Tam <dt...@consumercontact.com>.
Hi,

Thanks.  I'm quite new to faces and i've never used the component 
bindings before, actually.  What is the best practice for organizing this?

Should I have something like this in faces-config.xml:

    <managed-bean>
        <managed-bean-name>Bean</managed-bean-name>
        <managed-bean-class>com.web.Bean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
            <property-name>tabs</property-name>
            
<property-class>org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane</property-class>
            <value>#{Bean.initTabs}</value>
        </managed-property>
    </managed-bean>

and then have

public HtmlPanelTabbedPane initTabs();
public HtmlPanelTabbedPane getTabs();
public void setTabs(HtmlPanelTabbedPane hptp);

?

Thanks,

Enrique Medina wrote:

> Yes, thats the idea! And always add childs using getChildren() instead 
> of setParent() ;-)
>
> 2005/11/7, Don Tam <dtam@consumercontact.com 
> <ma...@consumercontact.com>>:
>
>     Hi Enrique,
>
>     Thank you for your response.  Does this mean I would have to generate
>     whatever is in the tabs through code as well? So basically my jsp
>     would
>     just look like:
>
>     <panelTabbedPane binding="#{Bean.stuff}">
>     </panelTabbedPane>
>
>     Thanks,
>
>     Enrique Medina wrote:
>
>     > Just bind your panelTabbedPane to a property in your backing
>     bean, and
>     > create the tabs dynamically from code, adding them to your property
>     > using getChildren().
>     >
>     > 2005/11/7, Don Tam < dtam@consumercontact.com
>     <ma...@consumercontact.com>
>     > <mailto:dtam@consumercontact.com
>     <ma...@consumercontact.com>>>:
>     >
>     >     Hi,
>     >
>     >     Could anyone tell me how I could generate a tab for each
>     item in a
>     >     list?
>     >
>     >     Thanks,
>     >
>     >     --
>     >     Don Tam
>     >     Manager, Software Development
>     >     (416)493-6111x143
>     >     dtam@consumercontact.com <ma...@consumercontact.com>
>     <mailto:dtam@consumercontact.com <ma...@consumercontact.com>>
>     >
>     >
>
>     --
>     Don Tam
>     Manager, Software Development
>     (416)493-6111x143
>     dtam@consumercontact.com <ma...@consumercontact.com>
>
>

-- 
Don Tam
Manager, Software Development
(416)493-6111x143
dtam@consumercontact.com


Re: dynamic number of panelTabs in panelTabbedPane

Posted by Enrique Medina <e....@gmail.com>.
Yes, thats the idea! And always add childs using getChildren() instead of
setParent() ;-)

2005/11/7, Don Tam <dt...@consumercontact.com>:
>
> Hi Enrique,
>
> Thank you for your response. Does this mean I would have to generate
> whatever is in the tabs through code as well? So basically my jsp would
> just look like:
>
> <panelTabbedPane binding="#{Bean.stuff}">
> </panelTabbedPane>
>
> Thanks,
>
> Enrique Medina wrote:
>
> > Just bind your panelTabbedPane to a property in your backing bean, and
> > create the tabs dynamically from code, adding them to your property
> > using getChildren().
> >
> > 2005/11/7, Don Tam <dtam@consumercontact.com
> > <ma...@consumercontact.com>>:
> >
> > Hi,
> >
> > Could anyone tell me how I could generate a tab for each item in a
> > list?
> >
> > Thanks,
> >
> > --
> > Don Tam
> > Manager, Software Development
> > (416)493-6111x143
> > dtam@consumercontact.com <ma...@consumercontact.com>
> >
> >
>
> --
> Don Tam
> Manager, Software Development
> (416)493-6111x143
> dtam@consumercontact.com
>
>

Re: dynamic number of panelTabs in panelTabbedPane

Posted by Don Tam <dt...@consumercontact.com>.
Hi Enrique,

Thank you for your response.  Does this mean I would have to generate 
whatever is in the tabs through code as well? So basically my jsp would 
just look like:

<panelTabbedPane binding="#{Bean.stuff}">
</panelTabbedPane>

Thanks,

Enrique Medina wrote:

> Just bind your panelTabbedPane to a property in your backing bean, and 
> create the tabs dynamically from code, adding them to your property 
> using getChildren().
>
> 2005/11/7, Don Tam <dtam@consumercontact.com 
> <ma...@consumercontact.com>>:
>
>     Hi,
>
>     Could anyone tell me how I could generate a tab for each item in a
>     list?
>
>     Thanks,
>
>     --
>     Don Tam
>     Manager, Software Development
>     (416)493-6111x143
>     dtam@consumercontact.com <ma...@consumercontact.com>
>
>

-- 
Don Tam
Manager, Software Development
(416)493-6111x143
dtam@consumercontact.com


Re: dynamic number of panelTabs in panelTabbedPane

Posted by Enrique Medina <e....@gmail.com>.
Just bind your panelTabbedPane to a property in your backing bean, and
create the tabs dynamically from code, adding them to your property using
getChildren().

2005/11/7, Don Tam <dt...@consumercontact.com>:
>
> Hi,
>
> Could anyone tell me how I could generate a tab for each item in a list?
>
> Thanks,
>
> --
> Don Tam
> Manager, Software Development
> (416)493-6111x143
> dtam@consumercontact.com
>
>