Browse Source

Making setEditable friendlier (#11869)

* Making setEditable friendlier

The current behavior is not buggy, so this PR is an enhancement

Fixes https://github.com/vaadin/framework/issues/8718

* Improved JavaDoc
tags/8.10.0.beta1
Tatu Lund 4 years ago
parent
commit
a799444d83
1 changed files with 9 additions and 3 deletions
  1. 9
    3
      server/src/main/java/com/vaadin/ui/Grid.java

+ 9
- 3
server/src/main/java/com/vaadin/ui/Grid.java View File

@@ -1948,13 +1948,19 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
* @param editable
* {@code true} if column is editable; {@code false} if not
* @return this column
* @throws IllegalStateException
* if editable is true and column has no editor binding or
* component defined
*
* @see #setEditorComponent(HasValue, Setter)
* @see #setEditorBinding(Binding)
*/
public Column<T, V> setEditable(boolean editable) {
Objects.requireNonNull(editorBinding,
"Column has no editor binding or component defined");
public Column<T, V> setEditable(boolean editable)
throws IllegalStateException {
if (editable && editorBinding == null) {
throw new IllegalStateException(
"Column has no editor binding or component defined");
}
getState().editable = editable;
return this;
}

Loading…
Cancel
Save