Ok,

I do think I know now what your problem is:

the findComponent will deliver a component which is not properly
initialized (it will return the stamp, but not the actual initialized
component for this row...)

So what you're really looking for is the functionality I implemented a
few weeks ago for findComponent, to return a properly initialized
component for this row.

But: I can't help you out with fixing this in the radio-renderer right
now, sorry. And you're in stress, too, to get your thesis finished,
right? So I really don't know how to fix this. no clue.

Anyone else able to help?

regards,

Martin

On 2/8/06, Matthias Kahlau <[EMAIL PROTECTED]> wrote:
> Hi Martin!
>
> If you can't imagine the cause of the problem, maybe you can give me a hint
> to a workable solution using HtmlDataTable ...
>
>
> Regards,
>
> Matthias
>
> > -----Ursprüngliche Nachricht-----
> > Von: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Auftrag
> > von Matthias Kahlau
> > Gesendet: Mittwoch, 8. Februar 2006 20:45
> > An: MyFaces Discussion; [EMAIL PROTECTED]
> > Betreff: AW: Problem with evaluation of Tomahawk HtmlSelectOneRadio
> > components inside UIData (programmatically created UI)
> >
> >
> > I didn't use JSP, the UI is programmatically created.
> >
> > This is a part of the method which adds HtmlSelectOneRadio
> > components to the
> > HtmlDataTable:
> >
> > HtmlDataTable table = new HtmlDataTable();
> >     this.form.getChildren().add(table);
> >     table.setId(this.viewRoot.createUniqueId());
> >     table.setVar("row");
> >     table.setBorder(1);
> >     table.setCellspacing("0");
> >     table.setCellpadding("5");
> >
> >
> > // the snippet which creates the HtmlSimpleUIColumn components for the
> > table:
> >
> > for (int i = 0; i < columns; i++) {
> >       column[i] = new HtmlSimpleColumn();
> >       table.getChildren().add(column[i]);
> >
> >       if (i == 0) {
> >
> >         HtmlOutputText hot = new HtmlOutputText();
> >         hot.setId(this.viewRoot.createUniqueId());
> >         ValueBinding vb =
> > app.createValueBinding("#{row.matrixfragetext}");
> >         hot.setValueBinding("value", vb);
> >         hot.setEscape(false);
> >
> >         column[i].setWidth("150");
> >         column[i].getChildren().add(hot);
> >
> >       } else {
> >
> >         String text = ((Auswahlmoeglichkeit)sortedAm.get(i -
> > 1)).getText();
> >         HtmlOutputText header = this.createHtmlOutputText(text, null);
> >         column[i].setHeader(header);
> >
> >         HtmlRadio radio = new HtmlRadio();
> >         radio.setId(this.viewRoot.createUniqueId());
> >         ValueBinding vb =
> > app.createValueBinding("#{row.htmlSelectOneRadioId}");
> >         radio.setValueBinding("for", vb);
> >         radio.setIndex(i - 1);
> >         column[i].getChildren().add(radio);
> >       }
> >
> >     }
> >
> >
> > // the snippet which creates the HtmlSelectOneRadio components
> > for each row
> > of the table:
> > List rowData = new ArrayList();
> > for (int i = 0; i < matrixfragetexte.length; i++) {
> >       Matrixfragetext mft = (Matrixfragetext)matrixfragetexte[i];
> >
> >       HtmlSelectOneRadio radios = new HtmlSelectOneRadio(); // Tomahawk
> >
> >       table.getChildren().add(radios);
> >       radios.setId(id);
> >       radios.setLayout("spread");
> >       radios.setRendererType("org.apache.myfaces.Radio");
> >       radios.setConverter(new IntegerConverter());
> >
> >       List selectItems =
> >
> > SelectItemsCreator.createSelectItemsListByAuswMglWithoutLabel(sorted
> > Am);
> >       UISelectItems usi = new UISelectItems();
> >       usi.setValue(selectItems);
> >       radios.getChildren().add(usi);
> >
> >       radios.setValue(selected); // initially selected value
> >
> >       MatrixfrageRow row = new MatrixfrageRow();
> >       row.setMatrixfragetext(mft.getText());
> >       row.setHtmlSelectOneRadioId(radios.getId());
> >       rowData.add(row);
> > }
> >
> > table.setValue(model); // contains the rowData ArrayList
> >
> >
> > When processing the user input, the HtmlSelectOneRadio components are
> > located by using the findComponent() method of the UIComponent class.
> > This works well. Then the submitted or local value is evaluated
> > (taking the
> > one which is not null), and it's always the initially selected value, no
> > matter what had been selected by the user.
> >
> > I hope you can imagine what's going wrong...
> >
> >
> > Many thanks,
> >
> > Matthias
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] Auftrag
> > > von Martin Marinschek
> > > Gesendet: Mittwoch, 8. Februar 2006 20:19
> > > An: MyFaces Discussion
> > > Betreff: Re: Problem with evaluation of Tomahawk HtmlSelectOneRadio
> > > components inside UIData (programmatically created UI)
> > >
> > >
> > > Can you give us the JSP sources?
> > >
> > > regards,
> > >
> > > Martin
> > >
> > > On 2/8/06, Matthias Kahlau <[EMAIL PROTECTED]> wrote:
> > > > Hi!
> > > >
> > > >
> > > > I tried to use a Tomahawk HtmlDataTable to programmatically
> > > display a matrix
> > > > containing questions in the left column and some radiobuttons
> > > in the other
> > > > columns.
> > > >
> > > > I added a HtmlRadio component to each HtmlSimpleColumn
> > > instance. For each
> > > > row, I added a HtmlSelectOneRadio component to the table. The
> > HtmlRadio
> > > > components "for" attribute uses a value-binding to the current
> > > row object of
> > > > the data set, to get the ID of the related HtmlSelectOneRadio
> > component.
> > > >
> > > > I don't know if I've followed the right approach. The table
> > is displayed
> > > > correctly, but the evaluation of the selected radiobuttons
> > > doesn't work. It
> > > > doesn't matter was has been selected, I always get value="1" for each
> > > > HtmlSelectOneRadio component.
> > > >
> > > > Maybe this is the wrong approach. Do I have to use only one
> > > > HtmlSelectOneRadio component with a component binding, and process the
> > > > selections by iterating over the UIData's data set, like it
> > is done when
> > > > using JSP?
> > > >
> > > >
> > > > Following a Html code snippet of the data table:
> > > >
> > > > <table border="1" cellpadding="5" cellspacing="0">
> > > > <thead><tr><th width="150"></th><th>erste Am</th><th>zweite
> > > > Am</th><th>dritte Am</th><th>vierte Am</th></tr></thead>
> > > >
> > > > <tbody id="Form:_id15:tbody_element">
> > > >
> > > > <tr>
> > > > <td width="150">erste Teilfrage</td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_0:Frage_6_Teil_1"
> > checked="checked"
> > > > value="1" />
> > > > </label></td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_0:Frage_6_Teil_1" value="2" />
> > > > </label></td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_0:Frage_6_Teil_1" value="3" />
> > > > </label></td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_0:Frage_6_Teil_1" value="4" />
> > > > </label></td>
> > > > </tr>
> > > >
> > > >
> > > > <tr>
> > > > <td width="150">zweite Teilfrage</td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_1:Frage_6_Teil_2"
> > checked="checked"
> > > > value="1" />
> > > > </label></td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_1:Frage_6_Teil_2" value="2" />
> > > > </label></td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_1:Frage_6_Teil_2" value="3" />
> > > > </label></td>
> > > >
> > > > <td><label>
> > > > <input type="radio" name="Form:_id15_1:Frage_6_Teil_2" value="4"
> > > > /></label></td>
> > > > </tr>
> > > >
> > > > ....
> > > >
> > > > </tbody>
> > > > </table>
> > > >
> > > >
> > > >
> > > > Regards,
> > > >
> > > > Matthias
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> >
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to