public abstract class UIHelper extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NOTIFICATION_DELAY |
Constructor and Description |
---|
UIHelper() |
Modifier and Type | Method and Description |
---|---|
static com.vaadin.ui.Button |
createButton(String buttonCaption,
String buttonDescription,
com.vaadin.server.Resource icon,
com.vaadin.ui.Button.ClickListener clickListener) |
static com.vaadin.ui.Label |
createLabel(String caption,
String content) |
static <T> T |
getCurrent(Class<T> clazz) |
static String |
loadContentFromFile(Class<?> clazz,
String resourceName)
Loads the
resourceName from the classpath using the given
clazz . |
static void |
showNotification(String message) |
static void |
showNotification(String title,
String message,
com.vaadin.ui.Notification.Type type) |
static void |
showNotification(String title,
String message,
com.vaadin.ui.Notification.Type type,
int delayMsec) |
static void |
showValidationError(String errorMessage)
Shows a validation error to the user.
|
static void |
validateField(com.vaadin.ui.Field<?> field,
boolean swallowValidationExceptions)
Validates the given field and sets the component error accordingly.
|
static void |
validateFields(Collection<com.vaadin.ui.Field<?>> fields,
boolean swallowValidationExceptions) |
public static com.vaadin.ui.Button createButton(String buttonCaption, String buttonDescription, com.vaadin.server.Resource icon, com.vaadin.ui.Button.ClickListener clickListener)
public static String loadContentFromFile(Class<?> clazz, String resourceName)
resourceName
from the classpath using the given
clazz
. If the resource couldn't be loaded an empty string is
returned.clazz
- The class to use for loading the resource.resourceName
- The name of the resource to be loaded (e.g.
/folder/filename.txt)public static void showValidationError(String errorMessage)
errorMessage
- the error message.public static <T> T getCurrent(Class<T> clazz)
public static void showNotification(String message)
public static void showNotification(String title, String message, com.vaadin.ui.Notification.Type type)
public static void showNotification(String title, String message, com.vaadin.ui.Notification.Type type, int delayMsec)
public static void validateField(com.vaadin.ui.Field<?> field, boolean swallowValidationExceptions) throws com.vaadin.data.Validator.InvalidValueException
Field
and must be a sub class of AbstractComponent
.field
- The field to validate (must be a sub class of AbstractComponent
).swallowValidationExceptions
- Indicates if an InvalidValueException is swallowed and not propagated.
If false the first occurring InvalidValueException is thrown.Validator.InvalidValueException
- If the field is not valid (see Validator.validate(Object)
.public static void validateFields(Collection<com.vaadin.ui.Field<?>> fields, boolean swallowValidationExceptions)
Copyright © 2017. All rights reserved.