}
/**
- * Adds the new row to table and fill the visible cells with given values.
+ * Adds the new row to table and fill the visible cells (except generated
+ * columns) with given values.
*
* @param cells
* the Object array that is used for filling the visible
public Object addItem(Object[] cells, Object itemId)
throws UnsupportedOperationException {
- final Object[] cols = getVisibleColumns();
-
+ // remove generated columns from the list of columns being assigned
+ final LinkedList availableCols = new LinkedList();
+ for (Iterator it = visibleColumns.iterator(); it.hasNext();) {
+ Object id = it.next();
+ if (!columnGenerators.containsKey(id)) {
+ availableCols.add(id);
+ }
+ }
// Checks that a correct number of cells are given
- if (cells.length != cols.length) {
+ if (cells.length != availableCols.size()) {
return null;
}
}
// Fills the item properties
- for (int i = 0; i < cols.length; i++) {
- item.getItemProperty(cols[i]).setValue(cells[i]);
+ for (int i = 0; i < availableCols.size(); i++) {
+ item.getItemProperty(availableCols.get(i)).setValue(cells[i]);
}
if (!(items instanceof Container.ItemSetChangeNotifier)) {