本文整理汇总了Java中com.vaadin.ui.Field.setRequiredError方法的典型用法代码示例。如果您正苦于以下问题:Java Field.setRequiredError方法的具体用法?Java Field.setRequiredError怎么用?Java Field.setRequiredError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Field
的用法示例。
在下文中一共展示了Field.setRequiredError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupField
import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
* Setup a renderer field, setting up validators if available.
* @param property Property
* @param field Field
*/
protected void setupField(P property, Field<?> field) {
PropertyColumn<T, P> column = getPropertyColumn(property);
if (column != null) {
if (column.isRequired()) {
field.setRequired(true);
if (column.getRequiredMessage() != null) {
field.setRequiredError(LocalizationContext.translate(column.getRequiredMessage(), true));
}
}
column.getValidators().forEach(v -> {
field.addValidator(v);
});
}
}
示例2: changeRequired
import com.vaadin.ui.Field; //导入方法依赖的package包/类
/** Change l'etat obligatoire d'un champs
* @param field
* @param isRequired
*/
private void changeRequired(Field<?> field, Boolean isRequired){
field.setRequired(isRequired);
if (isRequired){
field.setRequiredError(applicationContext.getMessage("validation.obigatoire", null, UI.getCurrent().getLocale()));
}else{
field.setRequiredError(null);
}
}
示例3: buildAndBind
import com.vaadin.ui.Field; //导入方法依赖的package包/类
/** ajoute le champs ainsi que le validateur, le required, et initialise le field
* @param caption
* @param propertyId
* @return le field
*/
public Field<?> buildAndBind(String caption, String propertyId) {
Field<?> field = super.buildAndBind(caption, propertyId);
if (MethodUtils.getIsNotNull(this.beanType,propertyId)){
field.setRequiredError(applicationContext.getMessage("validation.obigatoire", null, UI.getCurrent().getLocale()));
field.setRequired(true);
}
if (field instanceof AbstractTextField) {
((AbstractTextField) field).setNullRepresentation("");
((AbstractTextField) field).setNullSettingAllowed(true);
}
if (field instanceof DateField) {
((DateField)field).setParseErrorMessage(applicationContext.getMessage("validation.parse.date", null, UI.getCurrent().getLocale()));
}
if (field instanceof RequiredIntegerField) {
((RequiredIntegerField)field).setConversionError(applicationContext.getMessage("validation.parse.int", null, UI.getCurrent().getLocale()));
}
if (field instanceof I18nField) {
if (cacheController.getLangueEnServiceWithoutDefault().size()!=0){
field.setRequiredError(applicationContext.getMessage("validation.i18n.obigatoire", null, UI.getCurrent().getLocale()));
}
field.addValidator(new I18nValidator(applicationContext.getMessage("validation.i18n.one.missing", null, UI.getCurrent().getLocale()),
applicationContext.getMessage("validation.i18n.same.lang", null, UI.getCurrent().getLocale())));
}
IRequiredField requiredField = (IRequiredField) field;
requiredField.initField(true);
return field;
}