ListView listView = new ListView("cells", rowCells) {
protected void populateItem(ListItem item) {
Column column = excelFile.getColumns().get(item.getIndex());
item.add(new Label("heading", column.getLabel()));
final Cell cell = (Cell) item.getModelObject();
TextArea textArea = new TextArea("value");
textArea.setModel(new IModel() {
public Object getObject() {
return cell.getValue();
}
public void setObject(Object o) {
cell.setValue(o);
}
public void detach() {
}
});
textArea.setLabel(new Model(column.getLabel()));
textArea.add(new ErrorHighlighter());
Object value = cell.getValue();
if (value != null) {
if (value instanceof Date) {
textArea.setType(Date.class);
} else if (value instanceof Double) {
textArea.setType(Double.class);
}
}
item.add(textArea);
if (column.getColumnHeading() != null) {
item.add(CLASS_SELECTED);
textArea.setEnabled(false);
}
}
};
listView.setReuseItems(true);