]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix TabSheet becomes unresponsive after setSelectedTab (#14710)
authorGuillermo Alvarez <guillermo@vaadin.com>
Fri, 17 Oct 2014 08:00:37 +0000 (11:00 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 21 Oct 2014 10:19:25 +0000 (10:19 +0000)
Fixed unresponsiveness issue without removing the waitingForResponse
flag from VTabsheet. The flag is now set in revertToSharedStateSelection

Change-Id: I62cabc44d4ac4c284b0b35921d8624483b0150be

client/src/com/vaadin/client/ui/VTabsheet.java
client/src/com/vaadin/client/ui/tabsheet/TabsheetConnector.java

index 9c3af5c568a1ff074bc5152d66c9756f10912602..745f2bca61089a7c9448207d29abad42980bf38d 100644 (file)
@@ -694,6 +694,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
 
     private final Element deco;
 
+    /** For internal use only. May be removed or replaced in the future. */
+    public boolean waitingForResponse;
+
     private String currentStyle;
 
     /**
@@ -701,7 +704,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
      */
     private boolean canSelectTab(final int tabIndex) {
         Tab tab = tb.getTab(tabIndex);
-        if (getApplicationConnection() == null || disabled) {
+        if (getApplicationConnection() == null || disabled
+                || waitingForResponse) {
             return false;
         }
         if (!tab.isEnabledOnServer() || tab.isHiddenOnServer()) {
@@ -735,6 +739,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware
 
             getRpcProxy().setSelected(tabKeys.get(tabIndex).toString());
 
+            waitingForResponse = true;
+
             tb.getTab(tabIndex).focus(); // move keyboard focus to active tab
 
             return true;
index 94961a6a507e4d1e6ebecef7c0a4faa6c69dc594..d49581eaad2b919943437a19a881ce460514b0b7 100644 (file)
@@ -41,7 +41,7 @@ public class TabsheetConnector extends TabsheetBaseConnector implements
                     final String key = getState().tabs.get(i).key;
                     final boolean selected = key.equals(getState().selected);
                     if (selected) {
-                        getWidget().setActiveTabIndex(i);
+                        getWidget().waitingForResponse = false;
                         getWidget().selectTab(i);
                         break;
                     }