Lior Vernia has uploaded a new change for review.

Change subject: webadmin: TypeAheadListBox to not override acceptable null
......................................................................

webadmin: TypeAheadListBox to not override acceptable null

Altered ListModelTypeAheadListBox to only visually override null
values if they're not allowed, so that when clicking outside of the
list box it won't seem like another choice was chosen (when in reality
the backing value is still null).

Change-Id: I35b34097c9068f2baaa0573c74ec6c930b915f71
Bug-Url: https://bugzilla.redhat.com/1042872
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadListBox.java
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/22466/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadListBox.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadListBox.java
index 51ec5b8..77efcd2 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadListBox.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/ListModelTypeAheadListBox.java
@@ -205,7 +205,7 @@
             if (getValue() != null) {
                 // something has been there, deleted on click inside and than 
hidden the box - restoring
                 
asSuggestBox().setText(renderer.getReplacementString(getValue()));
-            } else {
+            } else if (!acceptableValues.contains(null)) {
                 // nothing has been there, selecting the first accpetable value
                 setValue(acceptableValues.iterator().next());
             }
@@ -225,7 +225,11 @@
     @Override
     protected T asEntity(String provided) {
         if (provided == null) {
-            throw new IllegalArgumentException("Only non-null arguments are 
accepted"); //$NON-NLS-1$
+            if (acceptableValues.contains(null)) {
+                return null;
+            } else {
+                throw new IllegalArgumentException("Only non-null arguments 
are accepted"); //$NON-NLS-1$
+            }
         }
 
         for (T data : acceptableValues) {


-- 
To view, visit http://gerrit.ovirt.org/22466
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35b34097c9068f2baaa0573c74ec6c930b915f71
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Lior Vernia <lver...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to