Package com.gitblit.models

Examples of com.gitblit.models.UserChoice


    // owners palette
    List<UserChoice> owners = new ArrayList<UserChoice>();
    for (String owner : repositoryModel.owners) {
      UserModel o = app().users().getUserModel(owner);
      if (o != null) {
        owners.add(new UserChoice(o.getDisplayName(), o.username, o.emailAddress));
      } else {
        owners.add(new UserChoice(owner));
      }
    }
    List<UserChoice> persons = new ArrayList<UserChoice>();
    for (String person : app().users().getAllUsernames()) {
      UserModel o = app().users().getUserModel(person);
      if (o != null) {
        persons.add(new UserChoice(o.getDisplayName(), o.username, o.emailAddress));
      } else {
        persons.add(new UserChoice(person));
      }
    }
    final Palette<UserChoice> ownersPalette = new Palette<UserChoice>("owners", new ListModel<UserChoice>(owners), new CollectionModel<UserChoice>(
          persons), new ChoiceRenderer<UserChoice>(null, "userId"), 12, true);
View Full Code Here


  private List<UserChoice> getTeamUsers(List<String> teamUserIds) {
    List<UserChoice> teamUsers = new ArrayList<UserChoice>();
    for (String teamUserId : teamUserIds) {
      UserModel userModel = app().users().getUserModel(teamUserId);
      if (userModel!=null) {
        teamUsers.add(new UserChoice(userModel.displayName, userModel.username, userModel.emailAddress));
      }
    }
    return sortByDisplayName(teamUsers);
  }
View Full Code Here

    List<UserChoice> owners = new ArrayList<UserChoice>();
    List<UserChoice> persons = new ArrayList<UserChoice>();
    for (String owner : repositoryModel.owners) {
      UserModel o = app().users().getUserModel(owner);
      if (o != null) {
        owners.add(new UserChoice(o.getDisplayName(), o.username, o.emailAddress));
      } else {
        UserChoice userChoice = new UserChoice(owner);
        owners.add(userChoice);
        persons.add(userChoice);
      }
    }

    for (String person : app().users().getAllUsernames()) {
      UserModel o = app().users().getUserModel(person);
      if (o != null) {
        persons.add(new UserChoice(o.getDisplayName(), o.username, o.emailAddress));
      } else {
        persons.add(new UserChoice(person));
      }
    }
    final Palette<UserChoice> ownersPalette = new Palette<UserChoice>("owners", new ListModel<UserChoice>(owners), new CollectionModel<UserChoice>(
          persons), new ChoiceRenderer<UserChoice>(null, "userId"), 12, false);
View Full Code Here

  private List<UserChoice> getTeamUsers(List<String> teamUserIds) {
    List<UserChoice> teamUsers = new ArrayList<UserChoice>();
    for (String teamUserId : teamUserIds) {
      UserModel userModel = app().users().getUserModel(teamUserId);
      if (userModel!=null) {
        teamUsers.add(new UserChoice(userModel.displayName, userModel.username, userModel.emailAddress));
      }
    }
    return sortByDisplayName(teamUsers);
  }
View Full Code Here

*/
public class UserChoiceTest extends GitblitUnitTest {

  @Test(expected=IllegalArgumentException.class)
  public void creatingUserChoiceWithNullAsUserIdIsImpossible() {
    new UserChoice(null);
  }
View Full Code Here

    new UserChoice(null);
  }

  @Test(expected=IllegalArgumentException.class)
  public void creatingUserChoiceWithEmptyStringAsUserIdIsImpossible() {
    new UserChoice("");
  }
View Full Code Here

  }

  @Test
  public void toStringPrintsPlainUserIdWhenDisplayNameIsNull() {
    String userId = "runnerr";
    UserChoice userChoice = new UserChoice(userId);
    assertEquals("", userId, userChoice.toString());
  }
View Full Code Here

  }

  @Test
  public void toStringPrintsPlainUserIdWhenDisplayNameIsEmpty() {
    String userId = "runnerr";
    UserChoice userChoice = new UserChoice("", userId);
    assertEquals("", userId, userChoice.toString());
  }
View Full Code Here

  @Test
  public void toStringPrintsDisplaNameWithUserIdInBracketsWhenDisplayNameIsSet() {
    String userId = "runnerr";
    String displayName = "The Road Runner";
    UserChoice userChoice = new UserChoice(displayName, userId);
    assertEquals(
        "displayName + userId have to be concatenated to: displayName (userId)",
        displayName + " (" + userId + ")", userChoice.toString());
  }
View Full Code Here

TOP

Related Classes of com.gitblit.models.UserChoice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.