com.vaadin.ui.Field.isEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中com.vaadin.ui.Field.isEnabled()方法的一些代码示例,展示了Field.isEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.isEnabled()方法的具体详情如下:
包路径:com.vaadin.ui.Field
类名称:Field
方法名:isEnabled

Field.isEnabled介绍

暂无

代码示例

代码示例来源:origin: nz.co.senanque/madura-vaadin

public void dumpFields() {
  if (logger.isDebugEnabled()) {
    for (String propertyId: m_fieldList) {
      Field<?> field = getField(propertyId);
      logger.debug("Field {} Enabled: {} ReadOnly: {}",propertyId,field.isEnabled(),field.isReadOnly());
    }
  }
}
@Override

代码示例来源:origin: org.opennms.features.vaadin-components/core

/**
 * Validates the given field and sets the component error accordingly.
 * Please note, that the provided field must implement {@link Field} and must be a sub class of {@link AbstractComponent}.
 *
 * @param field The field to validate (must be a sub class of {@link AbstractComponent}).
 * @param swallowValidationExceptions Indicates if an InvalidValueException is swallowed and not propagated.
 *                             If false the first occurring InvalidValueException is thrown.
 * @throws Validator.InvalidValueException If the field is not valid (see {@link Validator#validate(Object)}.
 */
public static void validateField(Field<?> field, boolean swallowValidationExceptions) throws Validator.InvalidValueException {
  if (field instanceof AbstractComponent && field.isEnabled()) {
    try {
      field.validate();
      ((AbstractComponent) field).setComponentError(null);
    } catch (Validator.InvalidValueException ex) {
      // Some fields unify exceptions, we have to consider this
      if (ex.getMessage() == null) {
        ex = ex.getCauses()[0];
      }
      // set error message
      ((AbstractComponent) field).setComponentError(new UserError(ex.getMessage()));
      if (!swallowValidationExceptions) {
        throw ex;
      }
    }
  }
}

相关文章