aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-01 17:36:16 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-04 09:46:40 +0000
commitd3cfb79c223a772d3baec8476a9d15716bade1ff (patch)
treed155b8d1216bc63fc0a4e0fc6787b5fcf637f19f /server/src
parent4dc3f49029355dd9a0958f43d36d74da7300c39f (diff)
downloadvaadin-framework-d3cfb79c223a772d3baec8476a9d15716bade1ff.tar.gz
vaadin-framework-d3cfb79c223a772d3baec8476a9d15716bade1ff.zip
Extend addColumn to support arbitrary data types (#13334)
Change-Id: I3bd9d4b6fb6c4b289421c6982ba28d893a97908e
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/ui/Grid.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index c307de84a5..c617917555 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -2333,22 +2333,27 @@ public class Grid extends AbstractComponent implements SelectionChangeNotifier,
/**
* Adds a new Column to Grid. This function makes sure that the property
* with the given id and data type exists in the container. If property does
- * not exists, it will be created. Default value for the new property is 0.
+ * not exists, it will be created.
+ * <p>
+ * Default value for the new property is 0 if type is Integer, Double and
+ * Float. If type is String, default value is an empty string. For all other
+ * types the default value is null.
* <p>
* Note that adding a new property is only done for the default container
* that Grid sets up with the default constructor.
*
* @param propertyId
* the property id of the new column
+ * @param type
+ * the data type for the new property
* @return the new column
*
* @throws IllegalStateException
* if column for given property already exists in this grid or
* property already exists in the container with wrong type
*/
- public <T extends Number> Column addColumn(Object propertyId, Class<T> type)
- throws IllegalStateException {
- addColumnProperty(propertyId, type, 0);
+ public Column addColumn(Object propertyId, Class<?> type) {
+ addColumnProperty(propertyId, type, null);
return getColumn(propertyId);
}