Hi,
I'm trying to get some input setup in a listview, seeing as I cannot know how
many input fields there will be, or the type. The issue I'm getting is that the
input is always null, not whatever I jot into the box. I've
setReuseProperty(true), but that didn't solve the issue.
When I submit, which is done from a modalwindow, I get a null pointer exception
on the rerender of the panel containing the information. I can't for the life
of me understand what causes the problem, a few creative breakpoints show it as
setting null all over the line.
Alexander
The code is as follows
final Form form = new Form("form", new CompoundPropertyModel(line));
form.setOutputMarkupId(true);
add(form);
ListView listview = new PropertyListView("elements", elements) {
private static final long serialVersionUID = 1L;
int count = 0;
@Override
public void populateItem( final ListItem item ) {
final CvElement<?> element = (CvElement<?>)
item.getModelObject();
item.add(new Label("label", labels.get(count)));
if (element.getType() == ElementType.PRIMITIVE)
item.add(new PrimitivePanel("input", element));
if (element.getType() == ElementType.LIST)
item.add(new DropDownPanel("input", element));
if (element.getType() == ElementType.DOUBLELIST)
;
count++;
}
};
form.add(listview.setReuseItems(true));
The only panel I'm currently testing on is the PrimitivePanel, which has the
following code:
public class PrimitivePanel extends BasePanel {
private static final long serialVersionUID = 1L;
public PrimitivePanel ( final String id, final CvElement<?> element ) {
super(id);
final FormComponent fc = new TextField("value.value");
fc.setRequired(element.isRequired());
add(fc);
}
}