diff options
author | Marc Englund <marc.englund@itmill.com> | 2008-08-18 10:15:11 +0000 |
---|---|---|
committer | Marc Englund <marc.englund@itmill.com> | 2008-08-18 10:15:11 +0000 |
commit | 71e6d124fd4820d103a4c24e1182e3bc4552a74d (patch) | |
tree | 151bf869aad36655c72314d84fb0b7a8aef03d8c /src/com/itmill/toolkit/ui/Table.java | |
parent | ceaf814bba7b68aba4eaf30f9a4b3fcb730e58d5 (diff) | |
download | vaadin-framework-71e6d124fd4820d103a4c24e1182e3bc4552a74d.tar.gz vaadin-framework-71e6d124fd4820d103a4c24e1182e3bc4552a74d.zip |
addItem(Object[],Object) now ignores generated columns. Fixes #1967.
svn changeset:5204/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/Table.java')
-rw-r--r-- | src/com/itmill/toolkit/ui/Table.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/com/itmill/toolkit/ui/Table.java b/src/com/itmill/toolkit/ui/Table.java index 940eb21612..5ffebbc630 100644 --- a/src/com/itmill/toolkit/ui/Table.java +++ b/src/com/itmill/toolkit/ui/Table.java @@ -1425,7 +1425,8 @@ public class Table extends AbstractSelect implements Action.Container, } /** - * 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 @@ -1440,10 +1441,16 @@ public class Table extends AbstractSelect implements Action.Container, 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; } @@ -1463,8 +1470,8 @@ public class Table extends AbstractSelect implements Action.Container, } // 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)) { |