//original code:
private RadioChoiceGroup findGroup() {
MarkupContainer parent = getParent();
while (parent != null) {
if (parent instanceof RadioChoiceGroup) {
return (RadioChoiceGroup) parent;
}
}
//..... omit
}
this make findGroup() run infinitely.
I try to fix this by:
private RadioChoiceGroup findGroup() {
MarkupContainer parent = getParent();
while (parent != null) {
if (parent instanceof RadioChoiceGroup) {
return (RadioChoiceGroup) parent;
} else {
parent = parent.getParent();
}
}
// omit....
}
and now work !
On 10/17/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
the singleradiochoice is not tied *directly* to the group. Its requirement is that the group component be somewhere above in the hierrachy. so per your example:RadioChoiceGroup group=new RadioChoiceGroup(....);group.add(list);...-Igor
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Ingram Chen
Sent: Monday, October 17, 2005 12:18 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Standalong Radio component ?Thank quick response ! This almost fit my requirement. but SingleRadioChoice seems tight to RadioChoiceGroup. My form is dynamic constructed from database, so I need to use ListView to build, like:
ListView list = new ListView("checks", listOfData) {
@Override
protected void populateItem(ListItem item) {
item.add(new SingleRadioChoice("choice", new PropertyModel(myModel,"selected"));
Data data = "" item.getModelObject() ;
item.add(new TextField("input", new PropertyModel(data, "input"));
}
};
Any Idea ?
On 10/17/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:Yes, wicket lacks one of these. Just threw one together, let me know if it works for you or if you find any bugs. Something like this is too small for a wicket-stuff project, any ideas what i should do with it?Basically it works like this.Person p=new Person(); /// this is the modelRadioChoiceGroup group=new RadioChoiceGroup("group", new PropertyModel(p, "name"));g.add(new SingleRadioChoice("c1", new Model("bob"));g.add(new SingleRadioChoice("c2", new Model("dean"));----<span wicket:id="group"><input type="radio" wicket:id="c1">choose bob</input><br/><input type="radio" wicket:id="c1">choose dean</input><br/></span>the single choice components connect to the group by searching up the component hierarchy for the first group.-Igor
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Ingram Chen
Sent: Sunday, October 16, 2005 8:58 PM
To: wicket-user@lists.sourceforge.net
Subject: [Wicket-user] Standalong Radio component ?I know there is a RadioChoice component and it works great.... , but IChoiceRenderer
seems not enough when I need to do like:
<p>Choose your anwer:</p>
<input type="radio" >Answer 1 </input><br/>
<input type="radio" >Answer 2 </input><br/>
<input type="radio" >Other: <input type="text" name="others" /> </input><br/>
Is there a standalone radio componet like CheckBox ?
Or another way to solve above problem ?
Thanks
--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen
--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen
--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen