From: Artur Signell Date: Thu, 21 May 2009 15:38:51 +0000 (+0000) Subject: Fixed #2995 - Tooltip for a TabSheet tab does not show X-Git-Tag: 6.7.0.beta1~2808 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a0fe7168b157befc43d2e3993b7ed7895bc13164;p=vaadin-framework.git Fixed #2995 - Tooltip for a TabSheet tab does not show svn changeset:7941/svn branch:6.0 --- diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java index e9a63c86b2..49d3546eb8 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java @@ -22,6 +22,7 @@ import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.Paintable; import com.vaadin.terminal.gwt.client.RenderInformation; import com.vaadin.terminal.gwt.client.RenderSpace; +import com.vaadin.terminal.gwt.client.TooltipInfo; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; import com.vaadin.terminal.gwt.client.VCaption; @@ -33,6 +34,24 @@ public class VTabsheet extends VTabsheetBase { super(null, client); } + @Override + public boolean updateCaption(UIDL uidl) { + if (uidl.hasAttribute(ATTRIBUTE_DESCRIPTION) + || uidl.hasAttribute(ATTRIBUTE_ERROR)) { + TooltipInfo tooltipInfo = new TooltipInfo(); + tooltipInfo.setTitle(uidl + .getStringAttribute(ATTRIBUTE_DESCRIPTION)); + if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { + tooltipInfo.setErrorUidl(uidl.getErrors()); + } + client.registerTooltip(getElement(), tooltipInfo); + } else { + client.registerTooltip(getElement(), ""); + } + + return super.updateCaption(uidl); + } + @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); @@ -43,6 +62,8 @@ public class VTabsheet extends VTabsheetBase { } updateTabScroller(); } + + client.handleTooltipEvent(event, VTabsheet.this); } @Override diff --git a/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.java b/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.java index 9636125009..18934e9318 100644 --- a/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.java +++ b/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.java @@ -1,5 +1,6 @@ package com.vaadin.tests.components.tabsheet; +import com.vaadin.terminal.UserError; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet; @@ -25,6 +26,11 @@ public class TabsheetTooltip extends TestBase { Tab tab = tabSheet.addTab(l, "Tab", null); tab.setDescription("This is a tab"); + tab.setComponentError(new UserError("abc error")); + + Tab tab2 = tabSheet.addTab(new Label("Another label, d'oh"), "Tab 2", + null); + tab2.setDescription("This is another tab"); addComponent(tabSheet); }