Esempio n. 1
0
 /** @return a string array of the searchable fields for a model object */
 @Override
 public List<SearchableField> getSearchableStrings() {
   List<SearchableField> searchString = new ArrayList<>();
   searchString.addAll(
       Arrays.asList(
           new SearchableField("Short Name", getShortName()),
           new SearchableField("Description", getDescription())));
   searchString.add(new SearchableField("Members", Utilities.commaSeparatedValues(teamMembers)));
   if (productOwnerProperty().get() != null)
     searchString.add(new SearchableField("PO", getProductOwner().getShortName()));
   if (scrumMasterProperty().get() != null)
     searchString.add(new SearchableField("SM", getScrumMaster().getShortName()));
   return searchString;
 }
Esempio n. 2
0
 protected Supplier<List<Person>> scrumMasterSupplier() {
   return () -> {
     Skill smSkill = organisationProperty().get().getSmSkill();
     Person currentProductOwner = productOwnerProperty().get();
     List<Person> currentDevTeam = devTeamProperty().get();
     // person has sm skill and does not currently have any other role in the team
     return teamMembersProperty()
         .get()
         .stream()
         .filter(
             person ->
                 person.observableSkills().contains(smSkill)
                     && !person.equals(currentProductOwner)
                     && !currentDevTeam.contains(person))
         .collect(Collectors.toList());
   };
 }
Esempio n. 3
0
 public List<Person> getTeamMembers() {
   List<Person> list = new ArrayList<>();
   list.addAll(teamMembers);
   return list;
 }
Esempio n. 4
0
 public List<Person> getDevTeam() {
   List<Person> list = new ArrayList<>();
   list.addAll(devTeam);
   return list;
 }
Esempio n. 5
0
  public TeamViewModel() {
    createValidators();

    ListProperty<Person> peopleInOrganisation = new SimpleListProperty<>();
    peopleInOrganisation.bind(
        Bindings.createObjectBinding(
            () -> {
              if (organisationProperty().get() != null) {
                return organisationProperty().get().getPeople();
              } else {
                return FXCollections.observableArrayList();
              }
            },
            organisationProperty()));

    ListProperty<Team> teamsInOrganisation = new SimpleListProperty<>();
    teamsInOrganisation.bind(
        Bindings.createObjectBinding(
            () -> {
              if (organisationProperty().get() != null) {
                return organisationProperty().get().getTeams();
              } else {
                return FXCollections.observableArrayList();
              }
            },
            organisationProperty()));

    ListProperty<Person> peopleInTeams = new SimpleListProperty<>();
    peopleInTeams.bind(
        Bindings.createObjectBinding(
            () -> {
              return teamsInOrganisation
                  .stream()
                  .flatMap(team -> team.observableTeamMembers().stream()) // TODO listen
                  .collect(GoatCollectors.toObservableList());
            },
            teamsInOrganisation));

    eligibleTeamMembers = new SimpleListProperty<>();
    eligibleTeamMembers.bind(
        Bindings.createObjectBinding(
            () -> {
              return peopleInOrganisation
                  .stream()
                  .filter(
                      person ->
                          !peopleInTeams.contains(person) // no team in model
                              || person.getTeam() == modelWrapper.get()) // this team in model
                  .collect(GoatCollectors.toObservableList());
            },
            peopleInOrganisation,
            peopleInTeams));

    eligibleDevs = new SimpleListProperty<>();
    eligibleDevs.bind(
        Bindings.createObjectBinding(
            () -> {
              return teamMembersProperty()
                  .get()
                  .stream() // is in team
                  .filter(
                      person ->
                          !person.equals(productOwnerProperty().get()) // not PO
                              && !person.equals(scrumMasterProperty().get())) // not SM
                  .collect(GoatCollectors.toObservableList());
            },
            teamMembersProperty(),
            productOwnerProperty(),
            scrumMasterProperty()));

    teamMembersProperty()
        .addListener(
            (ListChangeListener.Change<? extends Person> change) -> {
              change.next();
              List<? extends Person> removed = change.getRemoved();
              devTeamProperty().removeAll(removed);
              if (removed.contains(productOwnerProperty().get())) {
                productOwnerProperty().set(null);
              }
              if (removed.contains(scrumMasterProperty().get())) {
                scrumMasterProperty().set(null);
              }
            });
  }