Wicket border and repeater containing the boder body
I tried something today, and it didn't work. I understand why, bu I was
wondering if there is any way to make it work. (Or a another way for the
same result)
I have this markup :
<wicket:border>
<form wicket:id="form">
<div wicket:id="list">
<wicket:body />
</div>
<input type="submit" style="display: hidden;"/>
</form>
</wicket:border>
And the following java :
public abstract class BorderListPanel<D> extends Border {
protected abstract void populateDetailsItem(ListItem<D> item);
public BorderListPanel(String id, IModel<? extends List<? extends D>>
model) {
super(id, model);
ListView<D> list = new ListView<D>("list", (IModel<? extends
List<? extends D>>) getDefaultModel()){
@Override
protected void populateItem(ListItem<D> item) {
populateDetailsItem(item);
}
};
Form form = new Form("form");
form.add(list);
addToBorder(form);
}
}
And then I tried to use it :
new BorderListPanel<String>("listPanel", listModel) {
@Override
protected void populateDetailsItem(final ListItem<String> item) {
item.add(new Label<String>("label", item.getModelObject());
}
}
<div wicket:id="listPanel">
<span wicket:id="label"></span>
</div>
And it crash with this error :
Unable to find component with id 'label' in [BorderBodyContainer
[Component id = listPanel_body]]
Expected: '...:listPanel_body.label'.
Found with similar names: '...:form:list:0:label'
I understand that it does not like to put the body in a repeater. So, is
there any way to achieve what I want ? Or should I search another way ?
No comments:
Post a Comment