diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-09-26 09:43:01 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-09-26 09:43:01 +0000 |
commit | 5d4940c165e3c41f08b096cfde415b324aa260f6 (patch) | |
tree | 09b1325c187670015267276342af4aecb8285105 | |
parent | 4e58d66944ff8167b368646f9281d7c754ddf4c7 (diff) | |
download | vaadin-framework-5d4940c165e3c41f08b096cfde415b324aa260f6.tar.gz vaadin-framework-5d4940c165e3c41f08b096cfde415b324aa260f6.zip |
Changes for #5170 based on review
svn changeset:21292/svn branch:6.7
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java | 10 | ||||
-rw-r--r-- | 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
*/
|