]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes #3487: ReadOnlyExceptions for read-only ComboBox
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Wed, 7 Oct 2009 12:13:40 +0000 (12:13 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Wed, 7 Oct 2009 12:13:40 +0000 (12:13 +0000)
 * a read-only ComboBox sent a change event after focus->blur events.

svn changeset:9128/svn branch:6.2

src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java

index 9d1482952c384e16a7731c1a61e14e5bec4f141f..c349497aa3286d4aad898c39801d42b36ee6e7c9 100644 (file)
@@ -1037,7 +1037,7 @@ public class VFilterSelect extends Composite implements Paintable, Field,
 
     public void onFocus(FocusEvent event) {
         focused = true;
-        if (prompting) {
+        if (prompting && !readonly) {
             setPromptingOff("");
         }
         addStyleDependentName("focus");
@@ -1045,24 +1045,26 @@ public class VFilterSelect extends Composite implements Paintable, Field,
 
     public void onBlur(BlurEvent event) {
         focused = false;
-        // much of the TAB handling takes place here
-        if (tabPressed) {
-            tabPressed = false;
-            suggestionPopup.menu.doSelectedItemAction();
-            suggestionPopup.hide();
-        } else if (!suggestionPopup.isAttached()
-                || suggestionPopup.isJustClosed()) {
-            suggestionPopup.menu.doSelectedItemAction();
-        }
-        if (selectedOptionKey == null) {
-            setPromptingOn();
+        if (!readonly) {
+            // much of the TAB handling takes place here
+            if (tabPressed) {
+                tabPressed = false;
+                suggestionPopup.menu.doSelectedItemAction();
+                suggestionPopup.hide();
+            } else if (!suggestionPopup.isAttached()
+                    || suggestionPopup.isJustClosed()) {
+                suggestionPopup.menu.doSelectedItemAction();
+            }
+            if (selectedOptionKey == null) {
+                setPromptingOn();
+            }
         }
         removeStyleDependentName("focus");
     }
 
     public void focus() {
         focused = true;
-        if (prompting) {
+        if (prompting && !readonly) {
             setPromptingOff("");
         }
         tb.setFocus(true);