Created
December 1, 2016 18:49
-
-
Save bashizip/37a27c0a8aba3b1eed7e39092625357b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.asfrdc.gstockmild.frontend.util; | |
import com.vaadin.data.Validator; | |
import com.vaadin.data.fieldgroup.FieldGroup; | |
import com.vaadin.ui.Field; | |
import com.vaadin.ui.Notification; | |
import java.util.Map; | |
/** | |
* | |
* @author bashizip | |
*/ | |
public class VaadinFieldGoupValidator { | |
public static void showInvalidFileds(FieldGroup.CommitException e) { | |
StringBuilder sb = new StringBuilder(); | |
Map<Field<?>, Validator.InvalidValueException> errMap = e.getInvalidFields(); | |
sb.append(errMap.size()).append("\tValidation errors !").append("\n\n"); | |
int i = 1; | |
for (Field<?> field : errMap.keySet()) { | |
String caption = field.getCaption(); | |
String invalidExc = errMap.get(field).getMessage(); | |
sb.append(i).append(".\t").append(caption).append(": ").append(invalidExc).append("\n"); | |
i++; | |
} | |
Notification.show(null, | |
sb.toString(), | |
Notification.Type.ERROR_MESSAGE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment