aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-08 13:24:49 +0200
committerHenrik Paul <henrik@vaadin.com>2014-12-09 08:01:52 +0000
commitad102516f706cd84ca1e3c98de891aaf67d560a7 (patch)
tree60ddc55b460b7a30a74432b08efc64837af480a6 /client/src
parent44c001568254102445c5e352e2e509f091ab1dec (diff)
downloadvaadin-framework-ad102516f706cd84ca1e3c98de891aaf67d560a7.tar.gz
vaadin-framework-ad102516f706cd84ca1e3c98de891aaf67d560a7.zip
Make client side grid column API fluid (#13334)
Change-Id: Iba646d7be5d159b8a3e7aeb3676a557875bd6686
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/ui/grid/Grid.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/client/src/com/vaadin/client/ui/grid/Grid.java b/client/src/com/vaadin/client/ui/grid/Grid.java
index ddd020a0e1..46296bd83d 100644
--- a/client/src/com/vaadin/client/ui/grid/Grid.java
+++ b/client/src/com/vaadin/client/ui/grid/Grid.java
@@ -1407,13 +1407,15 @@ public class Grid<T> extends ResizeComposite implements
}
@Override
- public void setWidth(int pixels) {
+ public GridColumn<Boolean, T> setWidth(int pixels) {
if (pixels != getWidth() && initDone) {
throw new UnsupportedOperationException("The selection "
+ "column cannot be modified after init");
} else {
super.setWidth(pixels);
}
+
+ return this;
}
@Override
@@ -1778,11 +1780,12 @@ public class Grid<T> extends ResizeComposite implements
*
* @param headerText
* The header text for this column
+ * @return the column itself
*
* @throws IllegalArgumentException
* if given header text is null
*/
- public void setHeaderText(String headerText) {
+ public GridColumn<C, T> setHeaderText(String headerText) {
if (headerText == null) {
throw new IllegalArgumentException(
"Header text cannot be null.");
@@ -1794,6 +1797,8 @@ public class Grid<T> extends ResizeComposite implements
updateHeader();
}
}
+
+ return (GridColumn<C, T>) this;
}
private void updateHeader() {
@@ -1834,11 +1839,12 @@ public class Grid<T> extends ResizeComposite implements
*
* @param renderer
* The renderer to use for rendering the cells
+ * @return the column itself
*
* @throws IllegalArgumentException
* if given Renderer is null
*/
- public void setRenderer(Renderer<? super C> renderer)
+ public GridColumn<C, T> setRenderer(Renderer<? super C> renderer)
throws IllegalArgumentException {
if (renderer == null) {
throw new IllegalArgumentException("Renderer cannot be null.");
@@ -1848,6 +1854,8 @@ public class Grid<T> extends ResizeComposite implements
if (grid != null) {
grid.refreshBody();
}
+
+ return (GridColumn<C, T>) this;
}
/**
@@ -1856,8 +1864,9 @@ public class Grid<T> extends ResizeComposite implements
*
* @param pixels
* the width in pixels or negative for auto sizing
+ * @return the column itself
*/
- public void setWidth(int pixels) {
+ public GridColumn<C, T> setWidth(int pixels) {
width = pixels;
if (grid != null) {
@@ -1866,6 +1875,8 @@ public class Grid<T> extends ResizeComposite implements
.getColumnConfiguration();
conf.setColumnWidth(index, pixels);
}
+
+ return (GridColumn<C, T>) this;
}
/**
@@ -1889,14 +1900,17 @@ public class Grid<T> extends ResizeComposite implements
*
* @param sortable
* <code>true</code> when column sort indicators are visible.
+ * @return the column itself
*/
- public void setSortable(boolean sortable) {
+ public GridColumn<C, T> setSortable(boolean sortable) {
if (this.sortable != sortable) {
this.sortable = sortable;
if (grid != null) {
grid.refreshHeader();
}
}
+
+ return (GridColumn<C, T>) this;
}
/**