@@ -0,0 +1,2627 @@
+package com.itmill.toolkit.tests.tickets;%0A%0Aimport com.itmill.toolkit.Application;%0Aimport com.itmill.toolkit.data.Property;%0Aimport com.itmill.toolkit.data.Validator;%0Aimport com.itmill.toolkit.data.Property.ValueChangeEvent;%0Aimport com.itmill.toolkit.ui.TextField;%0Aimport com.itmill.toolkit.ui.Window;%0A%0Apublic class Ticket1900 extends Application %7B%0A%0A    TextField f%5B%5D = new TextField%5B5%5D;%0A    Window main = new Window(%22#1900 test%22);%0A%0A    @Override%0A    public void init() %7B%0A%0A        setMainWindow(main);%0A%0A        for (int i = 0; i %3C 5; i++) %7B%0A            final int j = i;%0A            f%5Bi%5D = new TextField(%22Testcase %22 + i);%0A            f%5Bi%5D.setImmediate(true);%0A            f%5Bi%5D.setRequired(true);%0A            main.addComponent(f%5Bi%5D);%0A            f%5Bi%5D.addListener(new Property.ValueChangeListener() %7B%0A                public void valueChange(ValueChangeEvent event) %7B%0A                    main.showNotification(%22Validity test%22, %22Testcase %22 + j%0A                            + %22 is %22 + (f%5Bj%5D.isValid() ? %22valid%22 : %22invalid%22));%0A                %7D%0A            %7D);%0A            f%5Bi%5D.addValidator(new ContainsValidator(%221%22));%0A            f%5Bi%5D.addValidator(new ContainsValidator(%222%22));%0A%0A        %7D%0A%0A        f%5B0%5D.setDescription(%22Field is empty, requiredError(null): *%22);%0A%0A        f%5B1%5D%0A                .setDescription(%22Field is empty, requiredError(%5C%22foo%5C%22): * (popup shows the validation error)%22);%0A        f%5B1%5D.setRequiredError(%22The field must not be empty%22);%0A%0A        f%5B2%5D%0A                .setDescription(%22Field is non-empty, validators do not give validation error: *%22);%0A        f%5B2%5D.setValue(%22valid 12%22);%0A%0A        f%5B3%5D%0A                .setDescription(%22Field is non-empty, requiredError(null), validators %22%0A                        + %22give validation error: * ! (popup shows the validation error)%22);%0A        f%5B3%5D.setValue(%22invalid%22);%0A%0A        f%5B4%5D%0A                .setDescription(%22Field is non-empty, requiredError(%5C%22foo%5C%22), validators %22%0A                        + %22give validation error: * ! (popup shows the validation error)%22);%0A        f%5B4%5D.setValue(%22invalid%22);%0A        f%5B4%5D.setRequiredError(%22The field must not be empty%22);%0A%0A    %7D%0A%0A    class ContainsValidator implements Validator %7B%0A        private final String c;%0A%0A        public ContainsValidator(String c) %7B%0A            this.c = c;%0A        %7D%0A%0A        public boolean isValid(Object value) %7B%0A            return value != null && value.toString().contains(c);%0A        %7D%0A%0A        public void validate(Object value) throws InvalidValueException %7B%0A            if (!isValid(value)) %7B%0A                throw new InvalidValueException(%22Value does not contain %22 + c);%0A            %7D%0A%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Test for #1900