summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tickets/Ticket1819.java
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket1819.java')
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1819.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1819.java b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java
new file mode 100644
index 0000000000..e16b2c2774
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java
@@ -0,0 +1,67 @@
+package com.vaadin.tests.tickets;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.Select;
+import com.vaadin.ui.Window;
+
+public class Ticket1819 extends com.vaadin.Application.LegacyApplication {
+
+ LinkedList<Select> listOfAllFields = new LinkedList<Select>();
+
+ @Override
+ public void init() {
+
+ final LegacyWindow main = new LegacyWindow("#1819");
+ setMainWindow(main);
+
+ com.vaadin.ui.Select s;
+
+ s = new Select("Select with null selection allowed");
+ s.setNullSelectionAllowed(true);
+ listOfAllFields.add(s);
+
+ s = new Select("Select with null selection NOT allowed");
+ s.setNullSelectionAllowed(false);
+ listOfAllFields.add(s);
+
+ for (Iterator<Select> i = listOfAllFields.iterator(); i.hasNext();) {
+ s = i.next();
+ main.addComponent(s);
+ s.addItem("-null-");
+ s.addItem("");
+ s.addItem("foo");
+ s.addItem("bar");
+ s.setNullSelectionItemId("-null-");
+ s.setImmediate(true);
+ }
+
+ Button checkValidity = new Button("Check validity of the fields");
+ main.addComponent(checkValidity);
+ checkValidity.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ StringBuffer msg = new StringBuffer();
+ for (Iterator<Select> i = listOfAllFields.iterator(); i
+ .hasNext();) {
+ AbstractField<?> af = i.next();
+ msg.append("<h1>" + af.getCaption() + "</h1>\n");
+ msg.append("Value=" + af.getValue() + "<br/>\n");
+ }
+ Window w = new Window("Status of the fields");
+ w.setModal(true);
+ w.addComponent(new Label(msg.toString(), ContentMode.XHTML));
+ main.addWindow(w);
+ }
+ });
+ }
+
+}