summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-12-29 13:11:20 +0200
committerGitHub <noreply@github.com>2017-12-29 13:11:20 +0200
commit46da9629b108fa7977061ac72b9a7a1d1fe80c3d (patch)
treec3f38380d9b3cf2fd272ec3a76d1ba47bcacc607 /server
parent0663acc47174bf86c02cdb7291e1c0d7b98551ed (diff)
downloadvaadin-framework-46da9629b108fa7977061ac72b9a7a1d1fe80c3d.tar.gz
vaadin-framework-46da9629b108fa7977061ac72b9a7a1d1fe80c3d.zip
Implement widget event handling for Columns in Grid (#10412)
Fixes #7833
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java36
1 files changed, 35 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 64a09d8d96..58945bfc46 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -2056,6 +2056,40 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
}
/**
+ * Sets whether Grid should handle events in this Column from Components
+ * and Widgets rendered by certain Renderers. By default the events are
+ * not handled.
+ * <p>
+ * <strong>Note:</strong> Enabling this feature will for example select
+ * a row when a component is clicked. For example in the case of a
+ * {@link ComboBox} or {@link TextField} it might be problematic as the
+ * component gets re-rendered and might lose focus.
+ *
+ * @param widgetEventsAllowed
+ * {@code true} to handle events; {@code false} to not
+ * @return this column
+ */
+ public Column<T, V> setWidgetEventsAllowed(
+ boolean widgetEventsAllowed) {
+ if (getState(false).widgetEventsAllowed != widgetEventsAllowed) {
+ getState().widgetEventsAllowed = widgetEventsAllowed;
+ }
+ return this;
+ }
+
+ /**
+ * Gets whether Grid is handling the events in this Column from
+ * Component and Widgets.
+ *
+ * @see #setWidgetEventsAllowed(boolean)
+ *
+ * @return {@code true} if handling events; {@code false} if not
+ */
+ public boolean isWidgetEventsAllowed() {
+ return getState(false).widgetEventsAllowed;
+ }
+
+ /**
* Gets the grid that this column belongs to.
*
* @return the grid that this column belongs to, or <code>null</code> if
@@ -2589,8 +2623,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
* <p>
* You can add columns for nested properties with dot notation, eg.
* <code>"property.nestedProperty"</code>
-
*
+ *
* @param propertyName
* the property name of the new column, not <code>null</code>
* @param renderer