From 8cfb84d9ec1570f7b14890edadebdf43a474be8c Mon Sep 17 00:00:00 2001 From: Automerge Date: Tue, 8 May 2012 09:06:50 +0000 Subject: [merge from 6.7] Don't activate tab when clicking close element (#7686) svn changeset:23690/svn branch:6.8 --- src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/com') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java index f1a5b31379..d3836bb177 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java @@ -350,6 +350,10 @@ public class VTabsheet extends VTabsheetBase implements Focusable, } return width; } + public Element getCloseButton() { + return closeButton; + } + } static class TabBar extends ComplexPanel implements ClickHandler, @@ -412,7 +416,14 @@ public class VTabsheet extends VTabsheetBase implements Focusable, } public void onClick(ClickEvent event) { - Widget caption = (Widget) event.getSource(); + TabCaption caption = (TabCaption) event.getSource(); + Element targetElement = event.getNativeEvent().getEventTarget() + .cast(); + // the tab should not be focused if the close button was clicked + if (targetElement == caption.getCloseButton()) { + return; + } + int index = getWidgetIndex(caption.getParent()); // IE needs explicit focus() if (BrowserInfo.get().isIE()) { -- cgit v1.2.3