aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorPiotr Wilkin <piotr.wilkin@syndatis.com>2018-02-14 08:50:11 +0100
committerIlia Motornyi <elmot@vaadin.com>2018-02-14 09:50:11 +0200
commitfd4dedf921f6cf0f80bfedac8474562b41325e56 (patch)
tree1525309dadea9d8bbae74d04ea8650e17ee389dc /server/src
parent33647404e97b80bc12c7fde76d23ea4abe97bf4f (diff)
downloadvaadin-framework-fd4dedf921f6cf0f80bfedac8474562b41325e56.tar.gz
vaadin-framework-fd4dedf921f6cf0f80bfedac8474562b41325e56.zip
Fixes Grid editor visibility inside TabSheet (#10557)
Fixes #10146 Fixes #10543
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java15
-rw-r--r--server/src/main/java/com/vaadin/ui/TabSheet.java5
2 files changed, 20 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index d289ee4897..b42cff2cab 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -4753,4 +4753,19 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
}
}
+ @Override
+ public void setVisible(boolean visible) {
+ if (getEditor().isOpen() && !visible) {
+ getEditor().cancel();
+ }
+ super.setVisible(visible);
+ }
+
+ @Override
+ public void detach() {
+ if (getEditor().isOpen()) {
+ getEditor().cancel();
+ }
+ super.detach();
+ }
}
diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java
index a9ed1e9e02..5600745334 100644
--- a/server/src/main/java/com/vaadin/ui/TabSheet.java
+++ b/server/src/main/java/com/vaadin/ui/TabSheet.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Objects;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
@@ -584,6 +585,10 @@ public class TabSheet extends AbstractComponentContainer
*/
private void setSelected(Component component) {
Tab tab = tabs.get(selected);
+ if (tab != null && !Objects.equals(tab.getComponent(), component) && tab.getComponent() != null && tab.getComponent().isAttached()) {
+ tab.getComponent().detach();
+ tab.getComponent().attach(); // ugly hack
+ }
selected = component;
// Repaint of the selected component is needed as only the selected