diff --git a/src/main/java/org/s4s/gui/views/ContactView.java b/src/main/java/org/s4s/gui/views/ContactView.java index 8f10ba825e9dd2f0227c9f7a3f07dd2a81544c7a..4cc167a505df7e22be53834fac945c55da9ce77a 100644 --- a/src/main/java/org/s4s/gui/views/ContactView.java +++ b/src/main/java/org/s4s/gui/views/ContactView.java @@ -10,7 +10,6 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -import org.s4s.services.util.EmailValidator; /** * Created by Max-Desktop on 16.05.2017. @@ -26,7 +25,6 @@ public class ContactView extends TemplateView{ setMargin(true); final TextField tfEMail = new TextField("E-Mail"); - tfEMail.addValidator(new EmailValidator()); final TextField tfBetreff = new TextField("Betreff"); final TextArea taNachricht = new TextArea("Ihr Anliegen"); final Button bSenden = new Button("Senden", FontAwesome.SEND); @@ -42,7 +40,7 @@ public class ContactView extends TemplateView{ this.setComponentAlignment(pKontakt, Alignment.MIDDLE_CENTER); pKontakt.setContent(vLayout); - + super.setUpFooterAndHeader(vLayout); } } diff --git a/src/main/java/org/s4s/services/util/EmailValidator.java b/src/main/java/org/s4s/services/util/EmailValidator.java index 921ff34648451068150b4a5b3f9f7ea9041ded2c..f7a051e89ec8bfacebcde9121c9f8054f6686648 100644 --- a/src/main/java/org/s4s/services/util/EmailValidator.java +++ b/src/main/java/org/s4s/services/util/EmailValidator.java @@ -1,41 +1,41 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.s4s.services.util; - -import com.vaadin.data.Validator; - -/** - * - * @author synot - */ -public class EmailValidator implements Validator { - /** - * Tests if the given value is valid - * @param value the value to test - */ - public boolean isValid(Object value) { - try { - validate(value); - } catch (Validator.InvalidValueException ive) { - return false; - } - return true; - } - - /** - * Validates - * @param value the value to test - */ - public void validate(Object value) throws Validator.InvalidValueException { - // Here value is a String containing what *should* be an e-mail address - if (value instanceof String) { - String email = (String)value; - // Match the email string against a (simplistic) regular expression matching e-mail addresses - if (!email.matches("^[_\\w\\.\\-]+@[\\w\\.-]+\\.[a-z]{2,6}$")) - throw new Validator.InvalidValueException("The e-mail address provided is not valid!"); - } - } -} +///* +// * To change this license header, choose License Headers in Project Properties. +// * To change this template file, choose Tools | Templates +// * and open the template in the editor. +// */ +//package org.s4s.services.util; +// +//import com.vaadin.data.Validator; +// +///** +// * +// * @author synot +// */ +//public class EmailValidator implements Validator { +// /** +// * Tests if the given value is valid +// * @param value the value to test +// */ +// public boolean isValid(Object value) { +// try { +// validate(value); +// } catch (Validator.InvalidValueException ive) { +// return false; +// } +// return true; +// } +// +// /** +// * Validates +// * @param value the value to test +// */ +// public void validate(Object value) throws Validator.InvalidValueException { +// // Here value is a String containing what *should* be an e-mail address +// if (value instanceof String) { +// String email = (String)value; +// // Match the email string against a (simplistic) regular expression matching e-mail addresses +// if (!email.matches("^[_\\w\\.\\-]+@[\\w\\.-]+\\.[a-z]{2,6}$")) +// throw new Validator.InvalidValueException("The e-mail address provided is not valid!"); +// } +// } +//}