myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aneesha Govil" <popcor...@gmail.com>
Subject Re: creating a dynamic code for a group of radio buttons
Date Thu, 16 Nov 2006 09:07:29 GMT
Hi Yaron,

Can you post the updated code? I think you had missed this step earlier -

> selectOneRadio.getChildren().add(radio);

Aneesha

On 11/15/06, Yaron Spektor <yaron.spektor@b6systems.com> wrote:
>
>  Thanks Aneesha,
>
> I did have the IDs unique. I also tried setting the valueBinding to an
> HtmlSelectOneRadio that I put on the bean (with getters and setters of
> course) nothing seemed to work.
>
> Just to make sure my question is clear I need to create a dynamic view
> similar to this:
>
> |*column1|column2**|column3|*
>
> *|radio1    |radio 2   |radio3    |*
>
> *|radio4    |radio5    |*              |
>
>
>
>
>
> The number of columns and number of rows is not fixed and all the radio
> buttons need to be in the same group.
>
>
>
> Any advice would be appreciated,
>
>
>  ------------------------------
>
> *From:* Aneesha Govil [mailto:popcorn09@gmail.com]
> *Sent:* Tuesday, November 14, 2006 4:58 AM
> *To:* MyFaces Discussion
> *Subject:* Re: creating a dynamic code for a group of radio buttons
>
>
>
> Hi,
>
> I haven't constructed radio buttons dynamically but in general, to do
> something like this..
> HtmlSelectOneRadio selectOneRadio = new HtmlSelectOneRadio();
> selectOneRadio.setId("choicesRadioButtons");//TODO: componentID
> selectOneRadio.setLayout("spread");
> selectOneRadio.setValue(displayValue);
>
> // If you are setting IDs for radio instances here, make sure each is
> unique
> HtmlRadio radio = new HtmlRadio();
> radio.setFor("choicesRadioButtons");
> radio.setIndex("0");
>
> selectOneRadio.getChildren ().add(radio);
>
> panelGroup.getChildren().add(selectOneRadio);
>
> Hope that helps!
>
> Aneesha
>
> On 11/14/06, *Yaron Spektor* <yaron.spektor@b6systems.com> wrote:
>
> Hi there,
>
> I would like to convert this code to dynamic components (I can not use
> tableData with newspaperColumn because I want multiple columns with the same
> button group and I need a header aligned with each such column). I would
> like to be able to set the  t:radio in a panelGrid with X number of
>  columns:
>
> <h:panelGroup>
>
>       <t:selectOneRadio id="buttons" layout="spread" forceId="true"
> forceIdIndex="false" value="hello">
>
>             <f:selectItems value="#{pc_Wizard.choicesDisplayValue}" />
>
>       </t:selectOneRadio>
>
>
>
>
>
>       <h:panelGrid columns="5" >
>
>
>
>         <t:radio for="buttons" index="0" />
>
>         <t:radio for="buttons" index="1" />
>
>         <t:radio for="buttons" index="2" />
>
>         <t:radio for="buttons" index="3" />
>
>         <t:radio for="buttons" index="4" />
>
>         <t:radio for="buttons" index="5" />
>
>         <t:radio for="buttons" index="6" />
>
>         <t:radio for="buttons" index="7" />
>
>         <t:radio for="buttons" index="8" />
>
>       </h:panelGrid>
>
>  </h:panelGroup>
>
>
>
> This is the code I started writing but I have a problem making it work
> especially setting the "for"
>
>   HtmlPanelGroup panelGroup= new HtmlPanelGroup();
>
>   HtmlPanelGrid htmlPanelGrid = new HtmlPanelGrid();
>
>   List panelGroupChildren = panelGroup.getChildren();
>
>   panelGroupChildren.clear();
>
>   HtmlRadio radio;
>
>
>
>   HtmlSelectOneRadio selectOneRadio = new HtmlSelectOneRadio();
>
>   selectOneRadio.setId("choicesRadioButtons");//TODO: componentID
>
>   selectOneRadio.setLayout("spread");
>
>   selectOneRadio.setValue(displayValue);
>
>
>
>   htmlPanelGrid.setColumns(5);
>
>   htmlPanelGrid.setColumnClasses(Constants.cColumnClasses+
> ","+Constants.cColumnClassesCurrency);
>
>   htmlPanelGrid.setRendered(true);
>
>
>
> for(int i=0;i<9;i++){
>
>   radio = new HtmlRadio();
>
>   radio.setId("selectOneRadio");
>
>   ValueBinding vb =app.createValueBinding("buttons");
>
>   radio.setValueBinding("for", vb);
>
>   radio.setIndex(i);
>
>   htmlPanelGrid.getChildren().add(radio);
>
> }
>
>
>
>
>
> panelGroupChildren.add(selectOneRadio);
>
> panelGroupChildren.add(htmlPanelGrid);
>
>
>
> return panelGroup;
>
>
>
> any ideas?
>
>
>
>
>
>
>
>
>

Mime
View raw message