summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-01-31 09:57:11 +0200
committerArtur Signell <artur@vaadin.com>2012-01-31 10:00:09 +0200
commit3e5fe705967911dae4c39e556df970272c8622ea (patch)
tree47f89a6b9b1c8ac52dfc9c4ed3e428f3efe1d653 /src
parentff18e06fbdf6975039edad123babcb661a51f9b2 (diff)
downloadvaadin-framework-3e5fe705967911dae4c39e556df970272c8622ea.tar.gz
vaadin-framework-3e5fe705967911dae4c39e556df970272c8622ea.zip
Split Accordion and TabSheet into widget + paintable
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VAccordion.java60
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java68
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java90
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java79
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java96
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java82
-rw-r--r--src/com/vaadin/ui/Accordion.java5
-rw-r--r--src/com/vaadin/ui/TabSheet.java4
8 files changed, 276 insertions, 208 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java b/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java
index 7fe87713c3..3e4f21477b 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VAccordion.java
@@ -15,7 +15,6 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ContainerResizedListener;
import com.vaadin.terminal.gwt.client.RenderInformation;
import com.vaadin.terminal.gwt.client.RenderSpace;
@@ -36,58 +35,23 @@ public class VAccordion extends VTabsheetBase implements
private String width = "";
- private HashMap<StackItem, UIDL> lazyUpdateMap = new HashMap<StackItem, UIDL>();
+ HashMap<StackItem, UIDL> lazyUpdateMap = new HashMap<StackItem, UIDL>();
private RenderSpace renderSpace = new RenderSpace(0, 0, true);
- private StackItem openTab = null;
+ StackItem openTab = null;
- private boolean rendering = false;
+ boolean rendering = false;
- private int selectedUIDLItemIndex = -1;
+ int selectedUIDLItemIndex = -1;
- private RenderInformation renderInformation = new RenderInformation();
+ RenderInformation renderInformation = new RenderInformation();
public VAccordion() {
super(CLASSNAME);
}
@Override
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- rendering = true;
- selectedUIDLItemIndex = -1;
- super.updateFromUIDL(uidl, client);
- /*
- * Render content after all tabs have been created and we know how large
- * the content area is
- */
- if (selectedUIDLItemIndex >= 0) {
- StackItem selectedItem = getStackItem(selectedUIDLItemIndex);
- UIDL selectedTabUIDL = lazyUpdateMap.remove(selectedItem);
- open(selectedUIDLItemIndex);
-
- selectedItem.setContent(selectedTabUIDL);
- } else if (!uidl.getBooleanAttribute("cached") && openTab != null) {
- close(openTab);
- }
-
- iLayout();
- // finally render possible hidden tabs
- if (lazyUpdateMap.size() > 0) {
- for (Iterator iterator = lazyUpdateMap.keySet().iterator(); iterator
- .hasNext();) {
- StackItem item = (StackItem) iterator.next();
- item.setContent(lazyUpdateMap.get(item));
- }
- lazyUpdateMap.clear();
- }
-
- renderInformation.updateSize(getElement());
-
- rendering = false;
- }
-
- @Override
protected void renderTab(UIDL tabUidl, int index, boolean selected,
boolean hidden) {
StackItem item;
@@ -182,7 +146,7 @@ public class VAccordion extends VTabsheetBase implements
return item;
}
- private void open(int itemIndex) {
+ void open(int itemIndex) {
StackItem item = (StackItem) getWidget(itemIndex);
boolean alreadyOpen = false;
if (openTab != null) {
@@ -205,7 +169,7 @@ public class VAccordion extends VTabsheetBase implements
updateOpenTabSize();
}
- private void close(StackItem item) {
+ void close(StackItem item) {
if (!item.isOpen()) {
return;
}
@@ -581,10 +545,6 @@ public class VAccordion extends VTabsheetBase implements
}
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
- /* Accordion does not render its children's captions */
- }
-
public boolean requestLayout(Set<Widget> children) {
if (!isDynamicHeight() && !isDynamicWidth()) {
/*
@@ -646,12 +606,8 @@ public class VAccordion extends VTabsheetBase implements
return null;
}
- private StackItem getStackItem(int index) {
+ StackItem getStackItem(int index) {
return (StackItem) getWidget(index);
}
- public Widget getWidgetForPaintable() {
- return this;
- }
-
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java
new file mode 100644
index 0000000000..3f28818073
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java
@@ -0,0 +1,68 @@
+package com.vaadin.terminal.gwt.client.ui;
+
+import java.util.Iterator;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.client.UIDL;
+import com.vaadin.terminal.gwt.client.VPaintableWidget;
+import com.vaadin.terminal.gwt.client.ui.VAccordion.StackItem;
+
+public class VAccordionPaintable extends VTabsheetBasePaintable {
+
+ @Override
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ getWidgetForPaintable().rendering = true;
+ getWidgetForPaintable().selectedUIDLItemIndex = -1;
+ super.updateFromUIDL(uidl, client);
+ /*
+ * Render content after all tabs have been created and we know how large
+ * the content area is
+ */
+ if (getWidgetForPaintable().selectedUIDLItemIndex >= 0) {
+ StackItem selectedItem = getWidgetForPaintable().getStackItem(
+ getWidgetForPaintable().selectedUIDLItemIndex);
+ UIDL selectedTabUIDL = getWidgetForPaintable().lazyUpdateMap
+ .remove(selectedItem);
+ getWidgetForPaintable().open(
+ getWidgetForPaintable().selectedUIDLItemIndex);
+
+ selectedItem.setContent(selectedTabUIDL);
+ } else if (!uidl.getBooleanAttribute("cached")
+ && getWidgetForPaintable().openTab != null) {
+ getWidgetForPaintable().close(getWidgetForPaintable().openTab);
+ }
+
+ getWidgetForPaintable().iLayout();
+ // finally render possible hidden tabs
+ if (getWidgetForPaintable().lazyUpdateMap.size() > 0) {
+ for (Iterator iterator = getWidgetForPaintable().lazyUpdateMap
+ .keySet().iterator(); iterator.hasNext();) {
+ StackItem item = (StackItem) iterator.next();
+ item.setContent(getWidgetForPaintable().lazyUpdateMap.get(item));
+ }
+ getWidgetForPaintable().lazyUpdateMap.clear();
+ }
+
+ getWidgetForPaintable().renderInformation
+ .updateSize(getWidgetForPaintable().getElement());
+
+ getWidgetForPaintable().rendering = false;
+ }
+
+ @Override
+ public VAccordion getWidgetForPaintable() {
+ return (VAccordion) super.getWidgetForPaintable();
+ }
+
+ @Override
+ protected Widget createWidget() {
+ return GWT.create(VAccordion.class);
+ }
+
+ public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ /* Accordion does not render its children's captions */
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
index 74ff328710..553a4d673e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
@@ -54,7 +54,7 @@ public class VTabsheet extends VTabsheetBase {
/**
* Representation of a single "tab" shown in the TabBar
- *
+ *
*/
private static class Tab extends SimplePanel {
private static final String TD_CLASSNAME = CLASSNAME + "-tabitemcell";
@@ -206,9 +206,10 @@ public class VTabsheet extends VTabsheetBase {
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
tooltipInfo.setErrorUidl(uidl.getErrors());
}
- client.registerTooltip(getTabsheet(), getElement(), tooltipInfo);
+ client.registerWidgetTooltip(getTabsheet(), getElement(),
+ tooltipInfo);
} else {
- client.registerTooltip(getTabsheet(), getElement(), null);
+ client.registerWidgetTooltip(getTabsheet(), getElement(), null);
}
boolean ret = super.updateCaption(uidl);
@@ -236,7 +237,7 @@ public class VTabsheet extends VTabsheetBase {
if (event.getTypeInt() == Event.ONLOAD) {
getTabsheet().tabSizeMightHaveChanged(getTab());
}
- client.handleTooltipEvent(event, getTabsheet(), getElement());
+ client.handleWidgetTooltipEvent(event, getTabsheet(), getElement());
}
public Tab getTab() {
@@ -469,7 +470,7 @@ public class VTabsheet extends VTabsheetBase {
// Can't use "style" as it's already in use
public static final String TAB_STYLE_NAME = "tabstyle";
- private final Element tabs; // tabbar and 'scroller' container
+ final Element tabs; // tabbar and 'scroller' container
private final Element scroller; // tab-scroller element
private final Element scrollerNext; // tab-scroller next button element
private final Element scrollerPrev; // tab-scroller prev button element
@@ -480,15 +481,15 @@ public class VTabsheet extends VTabsheetBase {
private int scrollerIndex = 0;
private final TabBar tb = new TabBar(this);
- private final VTabsheetPanel tp = new VTabsheetPanel();
+ final VTabsheetPanel tp = new VTabsheetPanel();
private final Element contentNode, deco;
private String height;
private String width;
- private boolean waitingForResponse;
+ boolean waitingForResponse;
- private final RenderInformation renderInformation = new RenderInformation();
+ final RenderInformation renderInformation = new RenderInformation();
/**
* Previous visible widget is set invisible with CSS (not display: none, but
@@ -497,7 +498,7 @@ public class VTabsheet extends VTabsheetBase {
*/
private Widget previousVisibleWidget;
- private boolean rendering = false;
+ boolean rendering = false;
private String currentStyle;
@@ -545,11 +546,11 @@ public class VTabsheet extends VTabsheetBase {
client.updateVariable(id, "close", tabKeys.get(tabIndex), true);
}
- private boolean isDynamicWidth() {
+ boolean isDynamicWidth() {
return width == null || width.equals("");
}
- private boolean isDynamicHeight() {
+ boolean isDynamicHeight() {
return height == null || height.equals("");
}
@@ -633,60 +634,7 @@ public class VTabsheet extends VTabsheetBase {
return scrollerIndex > index;
}
- @Override
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- rendering = true;
-
- if (!uidl.getBooleanAttribute("cached")) {
- // Handle stylename changes before generics (might affect size
- // calculations)
- handleStyleNames(uidl);
- }
-
- super.updateFromUIDL(uidl, client);
- if (cachedUpdate) {
- rendering = false;
- return;
- }
-
- // tabs; push or not
- if (!isDynamicWidth()) {
- // FIXME: This makes tab sheet tabs go to 1px width on every update
- // and then back to original width
- // update width later, in updateTabScroller();
- DOM.setStyleAttribute(tabs, "width", "1px");
- DOM.setStyleAttribute(tabs, "overflow", "hidden");
- } else {
- showAllTabs();
- DOM.setStyleAttribute(tabs, "width", "");
- DOM.setStyleAttribute(tabs, "overflow", "visible");
- updateDynamicWidth();
- }
-
- if (!isDynamicHeight()) {
- // Must update height after the styles have been set
- updateContentNodeHeight();
- updateOpenTabSize();
- }
-
- iLayout();
-
- // Re run relative size update to ensure optimal scrollbars
- // TODO isolate to situation that visible tab has undefined height
- try {
- client.handleComponentRelativeSize(tp.getWidget(tp
- .getVisibleWidget()));
- } catch (Exception e) {
- // Ignore, most likely empty tabsheet
- }
-
- renderInformation.updateSize(getElement());
-
- waitingForResponse = false;
- rendering = false;
- }
-
- private void handleStyleNames(UIDL uidl) {
+ void handleStyleNames(UIDL uidl) {
// Add proper stylenames for all elements (easier to prevent unwanted
// style inheritance)
if (uidl.hasAttribute("style")) {
@@ -728,7 +676,7 @@ public class VTabsheet extends VTabsheetBase {
}
}
- private void updateDynamicWidth() {
+ void updateDynamicWidth() {
// Find width consumed by tabs
TableCellElement spacerCell = ((TableElement) tb.getElement().cast())
.getRows().getItem(0).getCells().getItem(tb.getTabCount());
@@ -923,7 +871,7 @@ public class VTabsheet extends VTabsheetBase {
}
}
- private void updateContentNodeHeight() {
+ void updateContentNodeHeight() {
if (height != null && !"".equals(height)) {
int contentHeight = getOffsetHeight();
contentHeight -= DOM.getElementPropertyInt(deco, "offsetHeight");
@@ -990,7 +938,7 @@ public class VTabsheet extends VTabsheetBase {
* position: absolute (to work around a firefox flickering bug) we must keep
* this up-to-date by hand.
*/
- private void updateOpenTabSize() {
+ void updateOpenTabSize() {
/*
* The overflow=auto element must have a height specified, otherwise it
* will be just as high as the contents and no scrollbars will appear
@@ -1066,7 +1014,7 @@ public class VTabsheet extends VTabsheetBase {
}
- private void showAllTabs() {
+ void showAllTabs() {
scrollerIndex = tb.getFirstVisibleTab();
for (int i = 0; i < tb.getTabCount(); i++) {
Tab t = tb.getTab(i);
@@ -1114,10 +1062,6 @@ public class VTabsheet extends VTabsheetBase {
tp.replaceComponent(oldComponent, newComponent);
}
- public void updateCaption(VPaintableWidget component, UIDL uidl) {
- /* Tabsheet does not render its children's captions */
- }
-
public boolean requestLayout(Set<Widget> children) {
if (!isDynamicHeight() && !isDynamicWidth()) {
/*
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java
index 9dd74474f3..17f66f74bf 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java
@@ -12,12 +12,10 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.terminal.gwt.client.Container;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.VPaintableMap;
import com.vaadin.terminal.gwt.client.VPaintableWidget;
-abstract class VTabsheetBase extends ComplexPanel implements Container {
+abstract class VTabsheetBase extends ComplexPanel {
String id;
ApplicationConnection client;
@@ -34,81 +32,6 @@ abstract class VTabsheetBase extends ComplexPanel implements Container {
setStyleName(classname);
}
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- this.client = client;
-
- // Ensure correct implementation
- cachedUpdate = client.updateComponent(this, uidl, true);
- if (cachedUpdate) {
- return;
- }
-
- // Update member references
- id = uidl.getId();
- disabled = uidl.hasAttribute("disabled");
-
- // Render content
- final UIDL tabs = uidl.getChildUIDL(0);
-
- // Paintables in the TabSheet before update
- ArrayList<Widget> oldWidgets = new ArrayList<Widget>();
- for (Iterator<Widget> iterator = getWidgetIterator(); iterator
- .hasNext();) {
- oldWidgets.add(iterator.next());
- }
-
- // Clear previous values
- tabKeys.clear();
- disabledTabKeys.clear();
-
- int index = 0;
- for (final Iterator<Object> it = tabs.getChildIterator(); it.hasNext();) {
- final UIDL tab = (UIDL) it.next();
- final String key = tab.getStringAttribute("key");
- final boolean selected = tab.getBooleanAttribute("selected");
- final boolean hidden = tab.getBooleanAttribute("hidden");
-
- if (tab.getBooleanAttribute("disabled")) {
- disabledTabKeys.add(key);
- }
-
- tabKeys.add(key);
-
- if (selected) {
- activeTabIndex = index;
- }
- renderTab(tab, index, selected, hidden);
- index++;
- }
-
- int tabCount = getTabCount();
- while (tabCount-- > index) {
- removeTab(index);
- }
-
- for (int i = 0; i < getTabCount(); i++) {
- VPaintableWidget p = getTab(i);
- // During the initial rendering the paintable might be null (this is
- // weird...)
- if (p != null) {
- oldWidgets.remove(p.getWidgetForPaintable());
- }
- }
-
- // Perform unregister for any paintables removed during update
- for (Iterator<Widget> iterator = oldWidgets.iterator(); iterator
- .hasNext();) {
- Widget oldWidget = iterator.next();
- VPaintableWidget oldPaintable = VPaintableMap.get(client)
- .getPaintable(oldWidget);
- if (oldWidget.isAttached()) {
- oldWidget.removeFromParent();
- }
- VPaintableMap.get(client).unregisterPaintable(oldPaintable);
- }
-
- }
-
/**
* @return a list of currently shown Paintables
*
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java
new file mode 100644
index 0000000000..3fbc52c2ca
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java
@@ -0,0 +1,96 @@
+package com.vaadin.terminal.gwt.client.ui;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.client.UIDL;
+import com.vaadin.terminal.gwt.client.VPaintableMap;
+import com.vaadin.terminal.gwt.client.VPaintableWidget;
+
+public abstract class VTabsheetBasePaintable extends
+ VAbstractPaintableWidgetContainer {
+
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ getWidgetForPaintable().client = client;
+
+ // Ensure correct implementation
+ getWidgetForPaintable().cachedUpdate = client.updateComponent(this,
+ uidl, true);
+ if (getWidgetForPaintable().cachedUpdate) {
+ return;
+ }
+
+ // Update member references
+ getWidgetForPaintable().id = uidl.getId();
+ getWidgetForPaintable().disabled = uidl.hasAttribute("disabled");
+
+ // Render content
+ final UIDL tabs = uidl.getChildUIDL(0);
+
+ // Paintables in the TabSheet before update
+ ArrayList<Widget> oldWidgets = new ArrayList<Widget>();
+ for (Iterator<Widget> iterator = getWidgetForPaintable()
+ .getWidgetIterator(); iterator.hasNext();) {
+ oldWidgets.add(iterator.next());
+ }
+
+ // Clear previous values
+ getWidgetForPaintable().tabKeys.clear();
+ getWidgetForPaintable().disabledTabKeys.clear();
+
+ int index = 0;
+ for (final Iterator<Object> it = tabs.getChildIterator(); it.hasNext();) {
+ final UIDL tab = (UIDL) it.next();
+ final String key = tab.getStringAttribute("key");
+ final boolean selected = tab.getBooleanAttribute("selected");
+ final boolean hidden = tab.getBooleanAttribute("hidden");
+
+ if (tab.getBooleanAttribute("disabled")) {
+ getWidgetForPaintable().disabledTabKeys.add(key);
+ }
+
+ getWidgetForPaintable().tabKeys.add(key);
+
+ if (selected) {
+ getWidgetForPaintable().activeTabIndex = index;
+ }
+ getWidgetForPaintable().renderTab(tab, index, selected, hidden);
+ index++;
+ }
+
+ int tabCount = getWidgetForPaintable().getTabCount();
+ while (tabCount-- > index) {
+ getWidgetForPaintable().removeTab(index);
+ }
+
+ for (int i = 0; i < getWidgetForPaintable().getTabCount(); i++) {
+ VPaintableWidget p = getWidgetForPaintable().getTab(i);
+ // During the initial rendering the paintable might be null (this is
+ // weird...)
+ if (p != null) {
+ oldWidgets.remove(p.getWidgetForPaintable());
+ }
+ }
+
+ // Perform unregister for any paintables removed during update
+ for (Iterator<Widget> iterator = oldWidgets.iterator(); iterator
+ .hasNext();) {
+ Widget oldWidget = iterator.next();
+ VPaintableWidget oldPaintable = VPaintableMap.get(client)
+ .getPaintable(oldWidget);
+ if (oldWidget.isAttached()) {
+ oldWidget.removeFromParent();
+ }
+ VPaintableMap.get(client).unregisterPaintable(oldPaintable);
+ }
+
+ }
+
+ @Override
+ public VTabsheetBase getWidgetForPaintable() {
+ return (VTabsheetBase) super.getWidgetForPaintable();
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java
new file mode 100644
index 0000000000..e8d6da757e
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java
@@ -0,0 +1,82 @@
+package com.vaadin.terminal.gwt.client.ui;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.client.UIDL;
+import com.vaadin.terminal.gwt.client.VPaintableWidget;
+
+public class VTabsheetPaintable extends VTabsheetBasePaintable {
+
+ @Override
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ getWidgetForPaintable().rendering = true;
+
+ if (!uidl.getBooleanAttribute("cached")) {
+ // Handle stylename changes before generics (might affect size
+ // calculations)
+ getWidgetForPaintable().handleStyleNames(uidl);
+ }
+
+ super.updateFromUIDL(uidl, client);
+ if (getWidgetForPaintable().cachedUpdate) {
+ getWidgetForPaintable().rendering = false;
+ return;
+ }
+
+ // tabs; push or not
+ if (!getWidgetForPaintable().isDynamicWidth()) {
+ // FIXME: This makes tab sheet tabs go to 1px width on every update
+ // and then back to original width
+ // update width later, in updateTabScroller();
+ DOM.setStyleAttribute(getWidgetForPaintable().tabs, "width", "1px");
+ DOM.setStyleAttribute(getWidgetForPaintable().tabs, "overflow",
+ "hidden");
+ } else {
+ getWidgetForPaintable().showAllTabs();
+ DOM.setStyleAttribute(getWidgetForPaintable().tabs, "width", "");
+ DOM.setStyleAttribute(getWidgetForPaintable().tabs, "overflow",
+ "visible");
+ getWidgetForPaintable().updateDynamicWidth();
+ }
+
+ if (!getWidgetForPaintable().isDynamicHeight()) {
+ // Must update height after the styles have been set
+ getWidgetForPaintable().updateContentNodeHeight();
+ getWidgetForPaintable().updateOpenTabSize();
+ }
+
+ getWidgetForPaintable().iLayout();
+
+ // Re run relative size update to ensure optimal scrollbars
+ // TODO isolate to situation that visible tab has undefined height
+ try {
+ client.handleComponentRelativeSize(getWidgetForPaintable().tp
+ .getWidget(getWidgetForPaintable().tp.getVisibleWidget()));
+ } catch (Exception e) {
+ // Ignore, most likely empty tabsheet
+ }
+
+ getWidgetForPaintable().renderInformation
+ .updateSize(getWidgetForPaintable().getElement());
+
+ getWidgetForPaintable().waitingForResponse = false;
+ getWidgetForPaintable().rendering = false;
+ }
+
+ @Override
+ protected Widget createWidget() {
+ return GWT.create(VTabsheet.class);
+ }
+
+ @Override
+ public VTabsheet getWidgetForPaintable() {
+ return (VTabsheet) super.getWidgetForPaintable();
+ }
+
+ public void updateCaption(VPaintableWidget component, UIDL uidl) {
+ /* Tabsheet does not render its children's captions */
+ }
+
+}
diff --git a/src/com/vaadin/ui/Accordion.java b/src/com/vaadin/ui/Accordion.java
index 5cf805615c..4ee75326ff 100644
--- a/src/com/vaadin/ui/Accordion.java
+++ b/src/com/vaadin/ui/Accordion.java
@@ -3,7 +3,7 @@
*/
package com.vaadin.ui;
-import com.vaadin.terminal.gwt.client.ui.VAccordion;
+import com.vaadin.terminal.gwt.client.ui.VAccordionPaintable;
/**
* An accordion is a component similar to a {@link TabSheet}, but with a
@@ -16,8 +16,7 @@ import com.vaadin.terminal.gwt.client.ui.VAccordion;
*
* @see TabSheet
*/
-@SuppressWarnings("serial")
-@ClientWidget(VAccordion.class)
+@ClientWidget(VAccordionPaintable.class)
public class Accordion extends TabSheet {
}
diff --git a/src/com/vaadin/ui/TabSheet.java b/src/com/vaadin/ui/TabSheet.java
index a13c336943..e256c51cfd 100644
--- a/src/com/vaadin/ui/TabSheet.java
+++ b/src/com/vaadin/ui/TabSheet.java
@@ -20,6 +20,7 @@ import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Resource;
import com.vaadin.terminal.gwt.client.ui.VTabsheet;
+import com.vaadin.terminal.gwt.client.ui.VTabsheetPaintable;
import com.vaadin.terminal.gwt.server.CommunicationManager;
import com.vaadin.ui.themes.Reindeer;
import com.vaadin.ui.themes.Runo;
@@ -53,8 +54,7 @@ import com.vaadin.ui.themes.Runo;
* @VERSION@
* @since 3.0
*/
-@SuppressWarnings("serial")
-@ClientWidget(VTabsheet.class)
+@ClientWidget(VTabsheetPaintable.class)
public class TabSheet extends AbstractComponentContainer {
/**