From ec84019baed55886583aeec8d0730102cecf69b7 Mon Sep 17 00:00:00 2001
From: Timo Jeremy Pinzauti <timo.pinzauti@smail.inf.h-brs.de>
Date: Tue, 23 May 2017 19:40:56 +0200
Subject: [PATCH] =?UTF-8?q?Letzte=20=C3=84nderungen=20am=20ContactView.=20?=
 =?UTF-8?q?Leider=20klappt=20der=20Validator=20noch=20nicht.=20Scheint=20a?=
 =?UTF-8?q?n=20lokalen=20Problemen=20zu=20liegen.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../java/org/s4s/gui/views/ContactView.java   |  4 +-
 .../org/s4s/services/util/EmailValidator.java | 82 +++++++++----------
 2 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/src/main/java/org/s4s/gui/views/ContactView.java b/src/main/java/org/s4s/gui/views/ContactView.java
index 8f10ba8..4cc167a 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 921ff34..f7a051e 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!");
+//        }
+//    }
+//}
-- 
GitLab