Hi Volker,

many thanks, it works now. I already tested it with the HtmlSelectOneRadio
components outside of UIData, but I got runtime errors because they hadn't
been found for the related HtmlRadio components. That's why I added them as
children to UIData, what solved the error, but the evaluation didn't work.

Using the HtmlSelectOneRadio components outside of UIData and specifying
absolute IDs in the for attribute did the trick... Now I can use a table
with table headers for each column, what hadn't been possible with
HtmlPanelGrid.


Regards,

Matthias

> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Auftrag
> von Volker Weber
> Gesendet: Donnerstag, 9. Februar 2006 11:18
> An: MyFaces Discussion
> Betreff: Re: AW: Problem with evaluation of Tomahawk HtmlSelectOneRadio
> components inside UIData (programmatically created UI)
>
>
> Hi Matthias,
>
> just an idea, may work or not, but worth a try imho:
>
> put the HtmlSelectOneRadio component(s) somewhere out of the uidata
> (e.g. as child of viewRoot) and set a id, also set a id to all parent
> namingcontainers.
>
> in the for attribute of the HtmlRadio components use a absolute id (e.g.
> ":[id_of_viewRoot]:[id_of_HtmlSelectOneRadio]", if HtmlSelectOneRadio is
> on top level).
>
> Not sure if this will work, but after a short look into
> HtmlRadioRenderer.java and implementation of findComponent() i think
> this could work.
>
> Regards,
>   Volker
>
> Matthias Kahlau 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
> >
> >
>
> --
> Don't answer to From: address!
> Mail to this account are droped if not recieved via mailinglist.
> To contact me direct create the mail address by
> concatenating my forename to my senders domain.

Reply via email to