From 5d4940c165e3c41f08b096cfde415b324aa260f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Mon, 26 Sep 2011 09:43:01 +0000 Subject: [PATCH] Changes for #5170 based on review svn changeset:21292/svn branch:6.7 --- .../vaadin/terminal/gwt/client/ui/VFilterSelect.java | 10 ++++++++-- src/com/vaadin/ui/ComboBox.java | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java index 2aec9d3bd0..2033f9708c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java @@ -991,12 +991,14 @@ public class VFilterSelect extends Composite implements Paintable, Field, enabled = !uidl.hasAttribute("disabled"); tb.setEnabled(enabled); - tb.setReadOnly(readonly || !textInputEnabled); + updateReadOnly(); if (client.updateComponent(this, uidl, true)) { return; } + // Inverse logic here to make the default case (text input enabled) + // work without additional UIDL messages boolean noTextInput = uidl.hasAttribute(ATTR_NO_TEXT_INPUT) && uidl.getBooleanAttribute(ATTR_NO_TEXT_INPUT); setTextInputEnabled(!noTextInput); @@ -1169,13 +1171,17 @@ public class VFilterSelect extends Composite implements Paintable, Field, initDone = true; } + private void updateReadOnly() { + tb.setReadOnly(readonly || !textInputEnabled); + } + private void setTextInputEnabled(boolean textInputEnabled) { if (this.textInputEnabled == textInputEnabled) { return; } this.textInputEnabled = textInputEnabled; - tb.setReadOnly(!textInputEnabled); + updateReadOnly(); if (textInputEnabled) { tb.getElement().getStyle().clearCursor(); diff --git a/src/com/vaadin/ui/ComboBox.java b/src/com/vaadin/ui/ComboBox.java index f32a8bb5ff..bea6e61a3f 100644 --- a/src/com/vaadin/ui/ComboBox.java +++ b/src/com/vaadin/ui/ComboBox.java @@ -99,7 +99,9 @@ public class ComboBox extends Select { /** * Sets whether it is possible to input text into the field or whether the - * field area of the component is just used to show what is selected. + * field area of the component is just used to show what is selected. By + * disabling text input, the comboBox will work in the same way as a + * {@link NativeSelect} * * @see #isTextInputAllowed() * @@ -115,7 +117,8 @@ public class ComboBox extends Select { /** * Returns true if the user can enter text into the field to either filter * the selections or enter a new value if {@link #isNewItemsAllowed()} - * returns true. + * returns true. If text input is disabled, the comboBox will work in the + * same way as a {@link NativeSelect} * * @return */ -- 2.39.5