Skip to content

Commit

Permalink
put implementation behind a feature falg
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Aug 28, 2022
1 parent 21c622a commit 30e9b9a
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ private TimePicker(LocalTime time, boolean isInitialValueOptional) {

addValueChangeListener(e -> validate());

addClientValidatedEventListener(event -> validate());
if (isFeatureFlagEnabled(FeatureFlags.ENFORCE_FIELD_VALIDATION)) {
addClientValidatedEventListener(event -> validate());
}
}

/**
Expand Down Expand Up @@ -289,11 +291,15 @@ public Validator<LocalTime> getDefaultValidator() {
@Override
public Registration addValidationStatusChangeListener(
ValidationStatusChangeListener<LocalTime> listener) {
return addClientValidatedEventListener(event -> {
listener.validationStatusChanged(
new ValidationStatusChangeEvent<LocalTime>(this,
!isInvalid()));
});
if (isFeatureFlagEnabled(FeatureFlags.ENFORCE_FIELD_VALIDATION)) {
return addClientValidatedEventListener(event -> {
listener.validationStatusChanged(
new ValidationStatusChangeEvent<LocalTime>(this,
!isInvalid()));
});
}

return null;
}

private ValidationResult checkValidity(LocalTime value) {
Expand Down Expand Up @@ -476,7 +482,12 @@ protected void onAttach(AttachEvent attachEvent) {
super.onAttach(attachEvent);
initConnector();
requestLocaleUpdate();
ClientValidationUtil.preventWebComponentFromSettingItselfToValid(this);
if (isFeatureFlagEnabled(FeatureFlags.ENFORCE_FIELD_VALIDATION)) {
ClientValidationUtil
.preventWebComponentFromSettingItselfToValid(this);
} else {
FieldValidationUtil.disableClientValidation(this);
}
}

private void initConnector() {
Expand Down

0 comments on commit 30e9b9a

Please sign in to comment.