From 72f0c03a6ef00ecc7d9852dee210c8543b9c2f6b Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 25 May 2010 06:39:24 +0000 Subject: [PATCH] Added nullSelectionAllowed checkbox svn changeset:13336/svn branch:6.3 --- .../components/select/NativeSelects.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/src/com/vaadin/tests/components/select/NativeSelects.java b/tests/src/com/vaadin/tests/components/select/NativeSelects.java index 46b5267e28..cd2c95d127 100644 --- a/tests/src/com/vaadin/tests/components/select/NativeSelects.java +++ b/tests/src/com/vaadin/tests/components/select/NativeSelects.java @@ -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 { 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); + } + + } + } -- 2.39.5