summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAutomerge <automerge@vaadin.com>2012-02-14 14:06:37 +0000
committerAutomerge <automerge@vaadin.com>2012-02-14 14:06:37 +0000
commitcc4914f4969141fcdc92f636ccb67b84c99f32f7 (patch)
tree4087b0796846b7c5e4e0e143f891285f49255264 /src
parent36f749b4f83086a5306726ad607c9bb3a0fa7526 (diff)
downloadvaadin-framework-cc4914f4969141fcdc92f636ccb67b84c99f32f7.tar.gz
vaadin-framework-cc4914f4969141fcdc92f636ccb67b84c99f32f7.zip
[merge from 6.7] #5833 and #7013 combo box width fix and tests
svn changeset:23000/svn branch:6.8
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
index e261286cb7..5cf02532b1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
@@ -1842,14 +1842,6 @@ public class VFilterSelect extends Composite implements Paintable, Field,
*/
int tbWidth = Util.getRequiredWidth(tb);
- if (popupWidth < 0) {
- /*
- * Only use the first page popup width so the textbox will not
- * get resized whenever the popup is resized.
- */
- popupWidth = Util.getRequiredWidth(popupOpener);
- }
-
/*
* Note: iconWidth is here calculated as a negative pixel value so
* you should consider this in further calculations.
@@ -1858,7 +1850,7 @@ public class VFilterSelect extends Composite implements Paintable, Field,
.measureMarginLeft(tb.getElement())
- Util.measureMarginLeft(selectedItemIcon.getElement()) : 0;
- int w = tbWidth + popupWidth + iconWidth;
+ int w = tbWidth + getPopUpOpenerWidth() + iconWidth;
/*
* When the select has a undefined with we need to check that we are
@@ -1895,6 +1887,20 @@ public class VFilterSelect extends Composite implements Paintable, Field,
}
/**
+ * Only use the first page popup width so the textbox will not get resized
+ * whenever the popup is resized. This also resolves issue where toggling
+ * combo box between read only and normal state makes it grow larger.
+ *
+ * @return Width of popup opener
+ */
+ private int getPopUpOpenerWidth() {
+ if (popupWidth < 0) {
+ popupWidth = Util.getRequiredWidth(popupOpener);
+ }
+ return popupWidth;
+ }
+
+ /**
* Get the width of the select in pixels where the text area and icon has
* been included.
*
@@ -1921,10 +1927,10 @@ public class VFilterSelect extends Composite implements Paintable, Field,
*/
private void setTextboxWidth(int componentWidth) {
int padding = getTextboxPadding();
- int popupOpenerWidth = Util.getRequiredWidth(popupOpener);
int iconWidth = selectedItemIcon.isAttached() ? Util
.getRequiredWidth(selectedItemIcon) : 0;
- int textboxWidth = componentWidth - padding - popupOpenerWidth
+
+ int textboxWidth = componentWidth - padding - getPopUpOpenerWidth()
- iconWidth;
if (textboxWidth < 0) {
textboxWidth = 0;