コード例 #1
0
    @Override
    protected Field<?> onCreateField(Object propertyId) {
      if (propertyId.equals("roleid")) {
        return new AdminRoleSelectionField();
      } else if (propertyId.equals("email")) {
        final TextField tf = new TextField();
        tf.setNullRepresentation("");
        tf.setRequired(true);
        tf.setRequiredError("This field must be not null");
        return tf;
      }

      return null;
    }
コード例 #2
0
    @Override
    protected Field<?> onCreateField(final Object propertyId) {
      if (propertyId.equals("roleid")) {
        return new AdminRoleSelectionField();
      } else if (propertyId.equals("firstname")
          || propertyId.equals("lastname")
          || propertyId.equals("email")) {
        final TextField tf = new TextField();
        tf.setNullRepresentation("");
        tf.setRequired(true);
        tf.setRequiredError("This field must be not null");
        return tf;
      } else if (propertyId.equals("dateofbirth")) {
        return new DateComboboxSelectionField();
      } else if (propertyId.equals("timezone")) {
        TimeZoneSelectionField cboTimezone = new TimeZoneSelectionField(false);
        if (UserAddViewImpl.this.user.getTimezone() != null) {
          cboTimezone.setTimeZone(
              TimezoneMapper.getTimezoneExt(UserAddViewImpl.this.user.getTimezone()));
        } else {
          if (AppContext.getSession().getTimezone() != null) {
            cboTimezone.setTimeZone(
                TimezoneMapper.getTimezoneExt(AppContext.getSession().getTimezone()));
          }
        }
        return cboTimezone;
      } else if (propertyId.equals("country")) {
        final CountryComboBox cboCountry = new CountryComboBox();
        cboCountry.addValueChangeListener(
            new Property.ValueChangeListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void valueChange(final Property.ValueChangeEvent event) {
                UserAddViewImpl.this.user.setCountry((String) cboCountry.getValue());
              }
            });
        return cboCountry;
      }
      return null;
    }