diff options
author | Artur Signell <artur@vaadin.com> | 2015-06-02 21:21:44 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-06-05 11:01:20 +0000 |
commit | 27f574154b5e27407370b6e072e5fa13d1d97797 (patch) | |
tree | 4ce666f0da18ddc2a8030518d6933073e4262920 /server/src/com/vaadin/ui/Grid.java | |
parent | 69714e4251b3ef16ef18d96282996f9f452ec3fe (diff) | |
download | vaadin-framework-27f574154b5e27407370b6e072e5fa13d1d97797.tar.gz vaadin-framework-27f574154b5e27407370b6e072e5fa13d1d97797.zip |
Better error messages for addColumn/setColumns (#18019, #17890)
Change-Id: Iadf455ae6cbc60e0ce0b88fe7c12df946ed08cf0
Diffstat (limited to 'server/src/com/vaadin/ui/Grid.java')
-rw-r--r-- | server/src/com/vaadin/ui/Grid.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index 96884d7fd5..2c442d6e43 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -4139,8 +4139,18 @@ public class Grid extends AbstractComponent implements SelectionNotifier, if (datasource.getContainerPropertyIds().contains(propertyId) && !columns.containsKey(propertyId)) { appendColumn(propertyId); - } else { + } else if (defaultContainer) { addColumnProperty(propertyId, String.class, ""); + } else { + if (columns.containsKey(propertyId)) { + throw new IllegalStateException("A column for property id '" + + propertyId.toString() + + "' already exists in this grid"); + } else { + throw new IllegalStateException("Property id '" + + propertyId.toString() + + "' does not exist in the container"); + } } // Inform the data provider of this new column. |