import com.vaadin.terminal.gwt.client.ui.layout.ElementResizeEvent;
import com.vaadin.terminal.gwt.client.ui.layout.ElementResizeListener;
import com.vaadin.terminal.gwt.client.ui.layout.LayoutDependencyTree;
-import com.vaadin.terminal.gwt.client.ui.layout.RequiresOverflowAutoFix;
+import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
public class LayoutManager {
private static final String LOOP_ABORT_MESSAGE = "Aborting layout after 100 passes. This would probably be an infinite loop.";
}
private void doOverflowAutoFix(ComponentConnector connector) {
- if (connector.getParent() instanceof RequiresOverflowAutoFix
+ if (connector.getParent() instanceof MayScrollChildren
&& BrowserInfo.get().requiresOverflowAutoFix()
&& !"absolute".equals(connector.getWidget().getElement()
.getStyle().getPosition())) {
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.ui.VAccordion.StackItem;
-import com.vaadin.terminal.gwt.client.ui.layout.RequiresOverflowAutoFix;
+import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
import com.vaadin.ui.Accordion;
@Component(Accordion.class)
public class AccordionConnector extends TabsheetBaseConnector implements
- SimpleManagedLayout, RequiresOverflowAutoFix {
+ SimpleManagedLayout, MayScrollChildren {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.communication.RpcProxy;
import com.vaadin.terminal.gwt.client.communication.ServerRpc;
-import com.vaadin.terminal.gwt.client.ui.layout.RequiresOverflowAutoFix;
+import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
import com.vaadin.ui.Panel;
@Component(Panel.class)
public class PanelConnector extends AbstractComponentContainerConnector
implements Paintable, SimpleManagedLayout, PostLayoutListener,
- RequiresOverflowAutoFix {
+ MayScrollChildren {
public interface PanelServerRPC extends ClickRPC, ServerRpc {
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent;
import com.vaadin.terminal.gwt.client.communication.StateChangeEvent.StateChangeHandler;
import com.vaadin.terminal.gwt.client.ui.Component.LoadStyle;
-import com.vaadin.terminal.gwt.client.ui.layout.RequiresOverflowAutoFix;
+import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
import com.vaadin.ui.Root;
@Component(value = Root.class, loadStyle = LoadStyle.EAGER)
public class RootConnector extends AbstractComponentContainerConnector
- implements Paintable, RequiresOverflowAutoFix {
+ implements Paintable, MayScrollChildren {
public interface RootServerRPC extends ClickRPC, ServerRpc {
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
-import com.vaadin.terminal.gwt.client.ui.layout.RequiresOverflowAutoFix;
+import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
import com.vaadin.ui.TabSheet;
@Component(TabSheet.class)
public class TabsheetConnector extends TabsheetBaseConnector implements
- SimpleManagedLayout, RequiresOverflowAutoFix {
+ SimpleManagedLayout, MayScrollChildren {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
import com.vaadin.terminal.gwt.client.communication.ServerRpc;
import com.vaadin.terminal.gwt.client.ui.PanelConnector.PanelState;
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
-import com.vaadin.terminal.gwt.client.ui.layout.RequiresOverflowAutoFix;
+import com.vaadin.terminal.gwt.client.ui.layout.MayScrollChildren;
@Component(value = com.vaadin.ui.Window.class)
public class WindowConnector extends AbstractComponentContainerConnector
implements Paintable, BeforeShortcutActionListener,
- SimpleManagedLayout, PostLayoutListener, RequiresOverflowAutoFix {
+ SimpleManagedLayout, PostLayoutListener, MayScrollChildren {
public interface WindowServerRPC extends ClickRPC, ServerRpc {
}
layoutDependency.propagatePostLayoutMeasure();
}
}
+
+ // Should also go through the hierarchy to discover appeared or
+ // disappeared scrollbars
+ LayoutDependency potentiallyChangedScrollbar = findPotentiallyChangedScrollbar();
+ if (potentiallyChangedScrollbar != null) {
+ potentiallyChangedScrollbar.setNeedsMeasure(true);
+ }
+
+ }
+
+ /**
+ * Go up the hierarchy to find a component whose size might have changed
+ * in the other direction because changes to this component causes
+ * scrollbars to appear or disappear.
+ *
+ * @return
+ */
+ private LayoutDependency findPotentiallyChangedScrollbar() {
+ ComponentConnector currentConnector = connector;
+ while (true) {
+ ComponentContainerConnector parent = currentConnector
+ .getParent();
+ if (parent == null) {
+ return null;
+ }
+ if (parent instanceof MayScrollChildren) {
+ return getDependency(currentConnector,
+ getOppositeDirection());
+ }
+ currentConnector = parent;
+ }
+ }
+
+ private int getOppositeDirection() {
+ return direction == HORIZONTAL ? VERTICAL : HORIZONTAL;
}
public void markAsLayouted() {
--- /dev/null
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+package com.vaadin.terminal.gwt.client.ui.layout;
+
+import com.vaadin.terminal.gwt.client.ComponentContainerConnector;
+
+public interface MayScrollChildren extends ComponentContainerConnector {
+
+}
+++ /dev/null
-/*
-@VaadinApache2LicenseForJavaFiles@
- */
-package com.vaadin.terminal.gwt.client.ui.layout;
-
-import com.vaadin.terminal.gwt.client.ComponentContainerConnector;
-
-public interface RequiresOverflowAutoFix extends ComponentContainerConnector {
-
-}