summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-09-03 11:36:57 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-09-03 11:36:57 +0000
commit7b4ee8d70ef4742002dc1b605bf470e01b218b5a (patch)
tree78c9b24e18103f86e3dd825c3218593af74d6116
parent557bd6bee16d8fca2eccddf06bec013eb157115e (diff)
downloadvaadin-framework-7b4ee8d70ef4742002dc1b605bf470e01b218b5a.tar.gz
vaadin-framework-7b4ee8d70ef4742002dc1b605bf470e01b218b5a.zip
fixes #3266, spacer td can now be a bit themed in TabSheet (this is done in reindeer theme)
svn changeset:8651/svn branch:6.1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
index 3949b0d32e..9d3a16ebfa 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
@@ -8,7 +8,10 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
+import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.TableCellElement;
+import com.google.gwt.dom.client.TableElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Command;
@@ -457,14 +460,16 @@ public class VTabsheet extends VTabsheetBase {
}
private void updateDynamicWidth() {
- // Find tab width
- int tabsWidth = 0;
+ // Find width consumed by tabs
+ TableCellElement spacerCell = ((TableElement) tb.getElement().cast())
+ .getRows().getItem(0).getCells().getItem(tb.getTabCount());
- int count = tb.getTabCount();
- for (int i = 0; i < count; i++) {
- Element tabTd = tb.getTab(i).getElement().getParentElement().cast();
- tabsWidth += tabTd.getOffsetWidth();
- }
+ int spacerWidth = spacerCell.getOffsetWidth();
+ DivElement div = (DivElement) spacerCell.getFirstChildElement();
+
+ int spacerMinWidth = spacerCell.getOffsetWidth() - div.getOffsetWidth();
+
+ int tabsWidth = tb.getOffsetWidth() - spacerWidth + spacerMinWidth;
// Find content width
Style style = tp.getElement().getStyle();