예제 #1
0
  private void createValidators() {
    shortNameValidator = new ObservableRuleBasedValidator();
    BooleanBinding uniqueName =
        Bindings.createBooleanBinding(
            () -> {
              if (organisationProperty().get() != null) {
                return Utilities.shortnameIsUnique(
                    shortNameProperty().get(),
                    modelWrapper.get(),
                    organisationProperty().get().getTeams());
              } else {
                return true; // no project means this isn't for real yet.
              }
            },
            shortNameProperty(),
            organisationProperty());
    shortNameValidator.addRule(
        shortNameProperty().isNotNull(), ValidationMessage.error("Name must not be empty"));
    shortNameValidator.addRule(
        shortNameProperty().length().greaterThan(0),
        ValidationMessage.error("Name must not be empty"));
    shortNameValidator.addRule(
        shortNameProperty().length().lessThan(Utilities.SHORT_NAME_MAX_LENGTH),
        ValidationMessage.error(
            "Name must be less than " + Utilities.SHORT_NAME_MAX_LENGTH + " characters"));
    shortNameValidator.addRule(
        uniqueName, ValidationMessage.error("Name must be unique within organisation"));

    descriptionValidator = new ObservableRuleBasedValidator(); // always true

    // the other validators are input-constrained so need not be validated
    productOwnerValidator = new ObservableRuleBasedValidator(); // always true
    scrumMasterValidator = new ObservableRuleBasedValidator(); // always true
    teamMembersValidator = new ObservableRuleBasedValidator(); // always true
    devTeamValidator = new ObservableRuleBasedValidator(); // always true

    allValidator =
        new CompositeValidator(
            shortNameValidator,
            descriptionValidator,
            productOwnerValidator,
            scrumMasterValidator,
            teamMembersValidator,
            devTeamValidator);
  }
예제 #2
0
 protected ValidationStatus devTeamValidation() {
   return devTeamValidator.getValidationStatus();
 }
예제 #3
0
 protected ValidationStatus teamMembersValidation() {
   return teamMembersValidator.getValidationStatus();
 }
예제 #4
0
 protected ValidationStatus scrumMasterValidation() {
   return scrumMasterValidator.getValidationStatus();
 }
예제 #5
0
 protected ValidationStatus productOwnerValidation() {
   return productOwnerValidator.getValidationStatus();
 }
예제 #6
0
 protected ValidationStatus descriptionValidation() {
   return descriptionValidator.getValidationStatus();
 }
예제 #7
0
 protected ValidationStatus shortNameValidation() {
   return shortNameValidator.getValidationStatus();
 }