myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yaron Spektor" <yaron.spek...@b6systems.com>
Subject creating a dynamic code for a group of radio buttons
Date Tue, 14 Nov 2006 05:35:46 GMT
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.cC
olumnClassesCurrency);

  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