diff options
author | Sauli Tähkäpää <sauli@vaadin.com> | 2014-06-26 09:35:05 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-06-26 10:11:23 +0000 |
commit | 949fb45841374204307b50f48d0d2d9ab921deb6 (patch) | |
tree | 5b67758f7e0a9983ca88979576971edaf180b58c /client | |
parent | 9a84fb14f2b7fc3c405f1446a007d5b9cd796c97 (diff) | |
download | vaadin-framework-949fb45841374204307b50f48d0d2d9ab921deb6.tar.gz vaadin-framework-949fb45841374204307b50f48d0d2d9ab921deb6.zip |
Revert "Add scrollbars to ComboBox suggestion popup if low on screen estate (#11929)"
This reverts commit ede8fbaad050c98682df9da935caf59a3a3787c6.
Change-Id: I6d2b6ad3901ac50782a9c8af6847c0b917d6027d
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VFilterSelect.java | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java index 7157ef99b3..004072d04a 100644 --- a/client/src/com/vaadin/client/ui/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/VFilterSelect.java @@ -30,7 +30,6 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Display; -import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; @@ -213,8 +212,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, private final Element down = DOM.createDiv(); private final Element status = DOM.createDiv(); - private int desiredHeight = -1; - private boolean isPagingEnabled = true; private long lastAutoClosed; @@ -231,7 +228,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, debug("VFS.SP: constructor()"); setOwner(VFilterSelect.this); menu = new SuggestionMenu(); - menu.getElement().getStyle().setOverflowY(Overflow.AUTO); setWidget(menu); getElement().getStyle().setZIndex(Z_INDEX); @@ -554,12 +550,16 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, public void setPosition(int offsetWidth, int offsetHeight) { debug("VFS.SP: setPosition()"); - int top = getPopupTop(); - int left = getPopupLeft(); + int top = -1; + int left = -1; - if (desiredHeight < 0) { - desiredHeight = offsetHeight; + // reset menu size and retrieve its "natural" size + menu.setHeight(""); + if (currentPage > 0) { + // fix height to avoid height change when getting to last page + menu.fixHeightTo(pageLength); } + offsetHeight = getOffsetHeight(); final int desiredWidth = getMainWidth(); Element menuFirstChild = menu.getElement().getFirstChildElement(); @@ -585,20 +585,16 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, getContainerElement().getStyle().setWidth(rootWidth, Unit.PX); } - final int spaceAvailableBelow = Window.getClientHeight() - - (top - Window.getScrollTop()); - final int spaceAvailableAbove = top - Window.getScrollTop() - - VFilterSelect.this.getOffsetHeight(); - if (spaceAvailableBelow < desiredHeight - && spaceAvailableBelow < spaceAvailableAbove) { + if (offsetHeight + getPopupTop() > Window.getClientHeight() + + Window.getScrollTop()) { // popup on top of input instead - top -= desiredHeight + VFilterSelect.this.getOffsetHeight(); - offsetHeight = desiredHeight; + top = getPopupTop() - offsetHeight + - VFilterSelect.this.getOffsetHeight(); if (top < 0) { - offsetHeight += top; top = 0; } } else { + top = getPopupTop(); /* * Take popup top margin into account. getPopupTop() returns the * top value including the margin but the value we give must not @@ -606,19 +602,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ int topMargin = (top - topPosition); top -= topMargin; - offsetHeight = Math.min(desiredHeight, spaceAvailableBelow); - } - - /* - * Resize popup and menu if calculated height doesn't match the - * actual height - */ - if (getOffsetHeight() != offsetHeight) { - int menuHeight = offsetHeight - up.getOffsetHeight() - - down.getOffsetHeight() - status.getOffsetHeight(); - menu.setHeight(menuHeight + "px"); - getContainerElement().getStyle().setHeight(offsetHeight, - Unit.PX); } // fetch real width (mac FF bugs here due GWT popups overflow:auto ) @@ -631,6 +614,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, if (left < 0) { left = 0; } + } else { + left = getPopupLeft(); } setPopupPosition(left, top); } |