Hello.
I have a panel that contains a form, which contains a list view with two
items, a label and a button. I have tried a gajillion different
combinations, but I keep getting the "unable to find component" error.
Any hints that you can provide would be HUGELY appreciated.
The panel markup is:
<wicket:panel>
<form wicket:id="prf">
<div wicket:id="uPages">
<span wicket:id="pn"></span>
<input wicket:id="rmvPage" type="submit"
value="Remove" />
</div>
</form>
<form wicket:id="paf">
<input wicket:id="name" type="text"></input>
<input wicket:id="addPage" type="submit" value="Add
Page" />
</form>
</wicket:panel>
The code for the panel and so on is:
public PageManagePanel(String id)
{
super(id) ;
add(new PageRemoveForm("prf"));
add(new PageAddForm("paf")) ;
}
PageRemoveForm:
public PageRemoveForm(String id)
{
super(id, Page.class);
uPages = Utility.getUnassignedPages() ;
unassignedPages = new ListView("uPages", uPages)
{
private static final long serialVersionUID = 200803188L;
protected void populateItem(ListItem listItem)
{
final Page curPage = (Page)listItem.getModelObject()
;
Label pn = new Label("pn", curPage.getName()) ;
Button rp = new Button("rmvPage")
{
private static final long serialVersionUID =
20080319L;
public void onSubmit()
{
Utility.removePage(curPage);
}
};
add(pn) ;
add(rp) ;
}
public boolean isVisible()
{
if (uPages.isEmpty())
{
return (false) ;
}
return (true);
}
};
add(unassignedPages) ;
}
PageAddForm:
public PageAddForm(String id)
{
super(id, Page.class);
newPage = new TextField("name") ;
addPage = new Button("addPage") ;
add(newPage) ;
add(addPage) ;
}
@Override
protected void onSubmit()
{
super.onSubmit() ;
clearPersistentObject() ;
}