]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #2880 - IE7: Tabsheet caption texts too short when using icons
authorArtur Signell <artur.signell@itmill.com>
Mon, 4 May 2009 08:56:54 +0000 (08:56 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 4 May 2009 08:56:54 +0000 (08:56 +0000)
svn changeset:7608/svn branch:6.0

src/com/itmill/toolkit/terminal/gwt/client/ICaption.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ITabsheet.java

index d3e12769ad1b84a42299615dc1f04f7b5a185d1f..f83bd035bbb43544444d0b35f4b63e346f0a46bf 100644 (file)
@@ -436,4 +436,8 @@ public class ICaption extends HTML {
         }
     }
 
+    protected Element getTextElement() {
+        return captionText;
+    }
+
 }
index 519ec6034a7c58d35228bbecbfa6e0f3ae5d8cca..e40b6ac0a81406e3b4976535bff9a26c52153d1e 100644 (file)
@@ -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 {