]> source.dussan.org Git - vaadin-framework.git/commitdiff
Properly lock the width of the combo box text field (#8313)
authorLeif Åstrand <leif@vaadin.com>
Thu, 23 Feb 2012 07:20:31 +0000 (09:20 +0200)
committerLeif Åstrand <leif@vaadin.com>
Thu, 23 Feb 2012 07:20:31 +0000 (09:20 +0200)
src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java

index 83956ecf03efce281e8732df3459ec71c10eb01d..d4d9e99dea40a0513a46744e3fb5c80396f7d3e5 100644 (file)
@@ -1576,6 +1576,15 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
                     && suggestionPopupMinWidth > w) {
                 setWidth(suggestionPopupMinWidth + "px");
             }
+
+            /*
+             * Lock the textbox width to its current value if it's not already
+             * locked
+             */
+            if (!tb.getElement().getStyle().getWidth().endsWith("px")) {
+                tb.setWidth((tb.getOffsetWidth() - selectedItemIcon
+                        .getOffsetWidth()) + "px");
+            }
         }
     }
 
@@ -1592,9 +1601,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
     @Override
     public void setWidth(String width) {
         super.setWidth(width);
-        if (width.length() == 0) {
-            tb.setWidth("");
-        } else {
+        if (width.length() != 0) {
             tb.setWidth("100%");
         }
     }