]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added nullSelectionAllowed checkbox
authorArtur Signell <artur.signell@itmill.com>
Tue, 25 May 2010 06:39:24 +0000 (06:39 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 25 May 2010 06:39:24 +0000 (06:39 +0000)
svn changeset:13336/svn branch:6.3

tests/src/com/vaadin/tests/components/select/NativeSelects.java

index 46b5267e28d782577c1cea5d26aefc6f68993c5e..cd2c95d127d89f5f9bae16e6553dd10faf4359e7 100644 (file)
@@ -10,7 +10,7 @@ import com.vaadin.ui.Component;
 import com.vaadin.ui.NativeSelect;
 import com.vaadin.ui.Button.ClickEvent;
 
-public class NativeSelects extends ComponentTestCase {
+public class NativeSelects extends ComponentTestCase<NativeSelect> {
 
     private static final Object CAPTION = "caption";
     NativeSelect label[] = new NativeSelect[20];
@@ -95,7 +95,7 @@ public class NativeSelects extends ComponentTestCase {
         s.addContainerProperty(CAPTION, String.class, "");
         s.setItemCaptionPropertyId(CAPTION);
         s.setCaption(caption);
-
+        s.setNullSelectionAllowed(false);
         return s;
     }
 
@@ -135,19 +135,41 @@ public class NativeSelects extends ComponentTestCase {
                     }
                 });
 
+        CheckBox nullSelect = new CheckBox("Null selection allowed",
+                new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        boolean nullAllowed = event.getButton().booleanValue();
+                        setNullAllowed(nullAllowed);
+                    }
+                });
+
         errorIndicators.setValue(new Boolean(false));
         readonly.setValue(new Boolean(false));
         enabled.setValue(new Boolean(true));
+        nullSelect.setValue(new Boolean(false));
 
         errorIndicators.setImmediate(true);
         readonly.setImmediate(true);
         enabled.setImmediate(true);
+        nullSelect.setImmediate(true);
 
         actions.add(errorIndicators);
         actions.add(readonly);
         actions.add(enabled);
+        actions.add(nullSelect);
 
         return actions;
     }
 
+    protected void setNullAllowed(boolean on) {
+        for (NativeSelect c : getTestComponents()) {
+            if (c == null) {
+                continue;
+            }
+
+            c.setNullSelectionAllowed(on);
+        }
+
+    }
+
 }