summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2010-03-02 09:51:16 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2010-03-02 09:51:16 +0000
commitceb7c73918570aecd140c54561fc71f49e6271f3 (patch)
tree9f72517924573f00b090b0d255057e671bec95f8
parentcb5a4049999156bb668e065c22629d7c27248e63 (diff)
downloadvaadin-framework-ceb7c73918570aecd140c54561fc71f49e6271f3.tar.gz
vaadin-framework-ceb7c73918570aecd140c54561fc71f49e6271f3.zip
Added test case and fix for #3991
svn changeset:11582/svn branch:6.2
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java19
-rw-r--r--tests/src/com/vaadin/tests/components/select/SelectIconPlacement.java33
2 files changed, 51 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
index 2dcf7562ae..669b5b90ea 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java
@@ -631,6 +631,23 @@ public class VFilterSelect extends Composite implements Paintable, Field,
public void onLoad(LoadEvent event) {
updateRootWidth();
updateSelectedIconPosition();
+
+ /*
+ * We need to re-calculate the widths in IE at load time to
+ * ensure that the text is not placed behind the icon. #3991
+ */
+ if (BrowserInfo.get().isIE()) {
+ int tbWidth = Util.getRequiredWidth(tb);
+ int openerWidth = Util.getRequiredWidth(popupOpener);
+ int iconWidth = selectedItemIcon.isAttached() ? Util
+ .measureMarginLeft(tb.getElement())
+ - Util.measureMarginLeft(selectedItemIcon
+ .getElement()) : 0;
+
+ int w = tbWidth + openerWidth + iconWidth;
+ tb.setWidth((tbWidth - getTextboxPadding()) + "px");
+ setTextboxWidth(w);
+ }
}
});
@@ -883,8 +900,8 @@ public class VFilterSelect extends Composite implements Paintable, Field,
panel.remove(selectedItemIcon);
updateRootWidth();
} else {
- selectedItemIcon.setUrl(iconUri);
panel.insert(selectedItemIcon, 0);
+ selectedItemIcon.setUrl(iconUri);
updateRootWidth();
updateSelectedIconPosition();
}
diff --git a/tests/src/com/vaadin/tests/components/select/SelectIconPlacement.java b/tests/src/com/vaadin/tests/components/select/SelectIconPlacement.java
new file mode 100644
index 0000000000..2fcf730669
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/select/SelectIconPlacement.java
@@ -0,0 +1,33 @@
+package com.vaadin.tests.components.select;
+
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Select;
+
+public class SelectIconPlacement extends TestBase {
+ private static final long serialVersionUID = 1L;
+
+ private Select mySelect;
+
+ @Override
+ protected void setup() {
+ mySelect = new Select("Foo");
+ String bar = "FooBarBaz";
+ mySelect.addItem(bar);
+ mySelect.setItemIcon(bar, new ThemeResource("common/icons/error.png"));
+ mySelect.select(bar);
+ addComponent(mySelect);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A select with item icons pushes the caption of that item to the right to make room for the icon. It works fine in all browsers except IE8.<br/>"+
+ "Upon component render the icon and caption is on top of each others, and it corrects itself when you open the dropdown. ";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3991;
+ }
+
+}