]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #2481, icon onloads now update tabsheet width
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 2 Feb 2009 10:02:40 +0000 (10:02 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 2 Feb 2009 10:02:40 +0000 (10:02 +0000)
svn changeset:6698/svn branch:trunk

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

index f5b330f0137caf917f3d5168fa4ff946e970377e..590e70f85be290cb38f946baa769ab87679b77da 100644 (file)
@@ -27,6 +27,22 @@ import com.itmill.toolkit.terminal.gwt.client.Util;
 
 public class ITabsheet extends ITabsheetBase {
 
+    private class TabSheetCaption extends ICaption {
+        TabSheetCaption() {
+            super(null, client);
+        }
+
+        @Override
+        public void onBrowserEvent(Event event) {
+            super.onBrowserEvent(event);
+            if (event.getTypeInt() == Event.ONLOAD && isDynamicWidth()) {
+                // icon onloads may change total width of tabsheet
+                updateDynamicWidth();
+            }
+        }
+
+    }
+
     class TabBar extends ComplexPanel implements ClickListener {
 
         private Element tr = DOM.createTR();
@@ -112,11 +128,11 @@ public class ITabsheet extends ITabsheetBase {
             return super.remove(w);
         }
 
-        public ICaption getTab(int index) {
+        public TabSheetCaption getTab(int index) {
             if (index >= getWidgetCount()) {
                 return null;
             }
-            return (ICaption) getWidget(index);
+            return (TabSheetCaption) getWidget(index);
         }
 
         public void setVisible(int index, boolean visible) {
@@ -401,9 +417,9 @@ public class ITabsheet extends ITabsheetBase {
     @Override
     protected void renderTab(final UIDL tabUidl, int index, boolean selected,
             boolean hidden) {
-        ICaption c = tb.getTab(index);
+        TabSheetCaption c = tb.getTab(index);
         if (c == null) {
-            c = new ICaption(null, client);
+            c = new TabSheetCaption();
             tb.addTab(c);
         }
         c.updateCaption(tabUidl);