diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-05-04 08:56:54 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-05-04 08:56:54 +0000 |
commit | 7334a8f060de0bd1fde66344783ff3ed365a55d1 (patch) | |
tree | b2b942903764469e4c7c8b38c4dcc75f9977bff9 /src/com/itmill/toolkit/terminal/gwt | |
parent | 2fdf5dd7e6d627c90f6941e5d5fd31d1f8e4a27e (diff) | |
download | vaadin-framework-7334a8f060de0bd1fde66344783ff3ed365a55d1.tar.gz vaadin-framework-7334a8f060de0bd1fde66344783ff3ed365a55d1.zip |
Fix for #2880 - IE7: Tabsheet caption texts too short when using icons
svn changeset:7608/svn branch:6.0
Diffstat (limited to 'src/com/itmill/toolkit/terminal/gwt')
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/client/ICaption.java | 4 | ||||
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheet.java | 23 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java b/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java index d3e12769ad..f83bd035bb 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ICaption.java @@ -436,4 +436,8 @@ public class ICaption extends HTML { } } + protected Element getTextElement() { + return captionText; + } + } diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheet.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheet.java index 519ec6034a..e40b6ac0a8 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheet.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheet.java @@ -45,6 +45,29 @@ public class ITabsheet extends ITabsheetBase { } } + @Override + public void setWidth(String width) { + super.setWidth(width); + if (BrowserInfo.get().isIE7()) { + /* + * IE7 apparently has problems with calculating width for + * floated elements inside a DIV with padding. Set the width + * explicitly for the caption. + */ + fixTextWidth(); + } + } + + private void fixTextWidth() { + Element captionText = getTextElement(); + int captionWidth = Util.getRequiredWidth(captionText); + int scrollWidth = captionText.getScrollWidth(); + if (scrollWidth > captionWidth) { + captionWidth = scrollWidth; + } + captionText.getStyle().setPropertyPx("width", captionWidth); + } + } class TabBar extends ComplexPanel implements ClickListener { |