Ah! Now I see! but how would find component work if the HtmlSelectOneRadio is not a child of UIData?
regards, Martin On 2/8/06, Matthias Kahlau <[EMAIL PROTECTED]> wrote: > > For UIData, not a thousand components represent thousand rows, > > but only one. > > But I didn't use only one HtmlSelectOneRadio component for all rows. > Instead, I use many HtmlSelectOneRadio components, one component for one > row. > > Using one HtmlSelectOneRadio component for all rows had only been a > potential solution. Your explanation kills this idea for the moment, but I > think it doesn't explain why my current solution doesn't work... > > > Regards, > > Matthias > > > -----Ursprüngliche Nachricht----- > > Von: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] Auftrag > > von Martin Marinschek > > Gesendet: Mittwoch, 8. Februar 2006 23:24 > > An: Matthias Kahlau > > Cc: MyFaces Discussion > > Betreff: Re: Problem with evaluation of Tomahawk HtmlSelectOneRadio > > components inside UIData (programmatically created UI) > > > > > > Yes, it has somehting to do with UIData. > > > > For UIData, not a thousand components represent thousand rows, > > but only one. > > > > Much like in Swing... So it's a little different there... > > > > regards, > > > > Martin > > > > On 2/8/06, Matthias Kahlau <[EMAIL PROTECTED]> wrote: > > > Thanks Martin, > > > > > > but do you know, why I might get components that aren't properly > > > initialized? > > > > > > I wonder about that, because processing the user input after > > locating the > > > components by using findComponent works for all the other > > question types I > > > use (without UIData), e. g. by using > > > > > > - only one HtmlSelectOneRadio component and some HtmlRadio components, > > > - only one HtmlSelectManyCheckbox component and some HtmlCheckbox > > > components, > > > - only one HtmlInputText or HtmlInputTextarea > > > > > > Has this sth. to do with UIData? > > > > > > > > > Regards, > > > > > > Matthias > > > > > > > -----Ursprüngliche Nachricht----- > > > > Von: [EMAIL PROTECTED] > > > > > > [mailto:[EMAIL PROTECTED] Auftrag > > > > von Martin Marinschek > > > > Gesendet: Mittwoch, 8. Februar 2006 23:05 > > > > An: MyFaces Discussion > > > > Betreff: Re: Problem with evaluation of Tomahawk HtmlSelectOneRadio > > > > components inside UIData (programmatically created UI) > > > > > > > > > > > > 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 > > > > > > > > > > > > -- > > > > 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