modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 45 +++++++--- 1 file changed, 32 insertions(+), 13 deletions(-)
New commits: commit 640d99dd1e5eee10434dc41ac0b81338d17b5835 Author: John Sanda jsanda@redhat.com Date: Fri Jan 6 17:14:29 2012 -0500
updating javadocs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java index 7a3a717..b7eeac2 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java @@ -32,7 +32,8 @@ import java.util.Map; /** * A tab set where each {@link TwoLevelTab tab} has one or more {@link SubTab subtab}s. * - * @author Greg Hinkle + * @author Jay Shaughnessy + * @author John Sanda */ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
commit 419f3637d95562d1d6d90edb97ae73a7f0c6bf6c Author: John Sanda jsanda@redhat.com Date: Fri Jan 6 15:51:06 2012 -0500
[BZ 772259] Do not reset the pane property when a tab is being hidden
I am not sure what has changed with respect to Tab and TabSet since SmartGWT 2.4, but resetting the pane property on the Tab that is being hidden results in the tab staying visible. This commit remedies the problem by not resetting the pane when the tab is hidden, and instead caching both the tab and its pane. Then when the tab is made visible again, the pane is reset.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java index 6978045..7a3a717 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java @@ -18,9 +18,6 @@ */ package org.rhq.enterprise.gui.coregui.client.components.tab;
-import java.util.LinkedHashMap; -import java.util.Map; - import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.History; @@ -29,6 +26,9 @@ import com.smartgwt.client.widgets.tab.Tab; import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
+import java.util.LinkedHashMap; +import java.util.Map; + /** * A tab set where each {@link TwoLevelTab tab} has one or more {@link SubTab subtab}s. * @@ -36,8 +36,18 @@ import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; */ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
- /** maps Tab locator IDs to Tabs. */ - private Map<String, TwoLevelTab> hiddenTabs = new LinkedHashMap<String, TwoLevelTab>(); + private static class TabPanePair { + public TwoLevelTab tab; + public Canvas pane; + + public TabPanePair(TwoLevelTab tab, Canvas pane) { + this.tab= tab; + this.pane = pane; + } + } + + /** maps Tab locator IDs to Tabs and their associated panes. */ + private Map<String, TabPanePair> hiddenTabs = new LinkedHashMap<String, TabPanePair>();
private boolean ignoreSelectEvents = false;
@@ -80,16 +90,22 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T Canvas contentPane = tab.getPane(); updateTab(tab, null); removeTab(tab); - // Reset the pane on the tab, since the call to updateTab() above nulled it out. - tab.setPane(contentPane);
- hiddenTabs.put(tab.getLocatorId(), tab); + // Previously we called tab.setPane(contentPane) here to reset the + // pane. With the upgrade to SmartGWT 3.0 however, resetting the + // pane prevents the tab from being hidden. This issue was logged + // under https://bugzilla.redhat.com/show_bug.cgi?id=772259. Note + // that we need to hold onto both the tab and its pane so that the + // tab content can be displayed when the tab is made visible again. + // We hold onto the tab and its pane in a TabPanePair. + hiddenTabs.put(tab.getLocatorId(), new TabPanePair(tab, contentPane)); } else { if (!hiddenTabs.containsKey(tab.getLocatorId())) { return; }
- hiddenTabs.remove(tab.getLocatorId()); + TabPanePair pair = hiddenTabs.remove(tab.getLocatorId()); + tab.setPane(pair.pane); addTab(tab); } } @@ -98,8 +114,8 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T for (TwoLevelTab tab : getTabs()) { tab.getLayout().destroyViews(); } - for (TwoLevelTab tab : hiddenTabs.values()) { - tab.getLayout().destroyViews(); + for (TabPanePair pair : hiddenTabs.values()) { + pair.tab.getLayout().destroyViews(); } }
@@ -188,7 +204,9 @@ public class TwoLevelTabSet extends NamedTabSet implements TabSelectedHandler, T public void destroy() { // add the hidden tabs back under the TabSet. This will get them destroyed by smartgwt when the tabset // goes away. There is no explicit Tab.destroy(). - for (TwoLevelTab tab : hiddenTabs.values()) { + for (TabPanePair pair : hiddenTabs.values()) { + Tab tab = pair.tab; + tab.setPane(pair.pane); addTab(tab); } for (TwoLevelTab tab : getTabs()) {
rhq-commits@lists.fedorahosted.org