예제 #1
0
  private void fillClassOfServices(BoardsFilter filterObject, boolean loaded) {
    List<Dtos.ClassOfServiceDto> sorted =
        new ArrayList<Dtos.ClassOfServiceDto>(ClassOfServicesManager.getInstance().getAll());

    Collections.sort(
        sorted,
        new Comparator<Dtos.ClassOfServiceDto>() {
          @Override
          public int compare(
              Dtos.ClassOfServiceDto classOfServiceDto, Dtos.ClassOfServiceDto classOfServiceDto2) {
            return classOfServiceDto.getName().compareTo(classOfServiceDto2.getName());
          }
        });

    // add default class of service if not present
    if (sorted.size() == 0 || sorted.get(0).getId() != null) {
      sorted.add(0, ClassOfServicesManager.getInstance().getDefaultClassOfService());
    }

    for (Dtos.ClassOfServiceDto classOfServiceDto : sorted) {
      if (!loaded || filterObject.findById(classOfServiceDto) == -1) {
        filterObject.add(classOfServiceDto);
      }
      classOfServiceFilter.add(new ClassOfServiceFilterCheckBox(classOfServiceDto, filterObject));
    }
  }
예제 #2
0
  private void fillUsers(BoardsFilter filterObject, boolean loaded) {
    List<Dtos.UserDto> sorted = new ArrayList<Dtos.UserDto>(UsersManager.getInstance().getUsers());

    Collections.sort(
        sorted,
        new Comparator<Dtos.UserDto>() {
          @Override
          public int compare(Dtos.UserDto userDto, Dtos.UserDto userDto2) {
            return userDto.getUserName().compareTo(userDto2.getUserName());
          }
        });

    sorted.add(0, UsersManager.getInstance().getNoUser());

    for (Dtos.UserDto user : sorted) {
      if (!loaded || filterObject.findById(user) == -1) {
        filterObject.add(user);
      }
      userFilter.add(new UserFilterCheckBox(user, filterObject));
    }
  }
예제 #3
0
  private void fillProjectsOnBoards(BoardsFilter filterObject, boolean loaded) {
    MessageBus.unregisterListener(GetAllProjectsResponseMessage.class, projectsOnBoardsCollector);
    MessageBus.registerListener(GetAllProjectsResponseMessage.class, projectsOnBoardsCollector);
    projectsOnBoardsCollector.init();
    MessageBus.sendMessage(new GetAllProjectsRequestMessage(null, this));

    List<Dtos.BoardWithProjectsDto> boardsWithProjectsDtos = projectsOnBoardsCollector.getData();

    List<Dtos.BoardWithProjectsDto> shallowBoardsWithProjectsDtos =
        new ArrayList<Dtos.BoardWithProjectsDto>();
    for (Dtos.BoardWithProjectsDto boardWithProjectsDto : boardsWithProjectsDtos) {
      Dtos.BoardWithProjectsDto shallowBoardWithProjectsDto = DtoFactory.boardWithProjectsDto();
      shallowBoardWithProjectsDto.setBoard(asShallowBoard(boardWithProjectsDto.getBoard()));
      shallowBoardWithProjectsDto.setProjectsOnBoard(boardWithProjectsDto.getProjectsOnBoard());
      shallowBoardsWithProjectsDtos.add(shallowBoardWithProjectsDto);
    }

    Collections.sort(
        shallowBoardsWithProjectsDtos,
        new Comparator<Dtos.BoardWithProjectsDto>() {
          @Override
          public int compare(Dtos.BoardWithProjectsDto b1, Dtos.BoardWithProjectsDto b2) {
            return b1.getProjectsOnBoard()
                .getValues()
                .get(0)
                .getName()
                .compareTo(b2.getProjectsOnBoard().getValues().get(0).getName());
          }
        });

    for (Dtos.BoardWithProjectsDto boardWithProjectDtos : shallowBoardsWithProjectsDtos) {
      if (!loaded || filterObject.findById(boardWithProjectDtos) == -1) {
        filterObject.add(boardWithProjectDtos);
      }
      projectOnBoardFilter.add(
          new ProjectOnBoardFilterCheckBox(boardWithProjectDtos, filterObject));
    }
  }
예제 #4
0
  private void fillBoards(BoardsFilter filterObject, boolean loaded) {

    MessageBus.unregisterListener(GetAllBoardsResponseMessage.class, boardsCollector);
    MessageBus.registerListener(GetAllBoardsResponseMessage.class, boardsCollector);
    boardsCollector.init();
    MessageBus.sendMessage(
        new GetBoardsRequestMessage(
            null,
            new GetBoardsRequestMessage.Filter() {
              @Override
              public boolean apply(Dtos.BoardDto boardDto) {
                return true;
              }
            },
            this));

    List<Dtos.BoardDto> boards = boardsCollector.getData();
    List<Dtos.BoardDto> shallowBoards = new ArrayList<Dtos.BoardDto>();
    for (Dtos.BoardDto board : boards) {
      shallowBoards.add(asShallowBoard(board));
    }

    Collections.sort(
        shallowBoards,
        new Comparator<Dtos.BoardDto>() {
          @Override
          public int compare(Dtos.BoardDto b1, Dtos.BoardDto b2) {
            return b1.getName().compareTo(b2.getName());
          }
        });

    for (Dtos.BoardDto board : shallowBoards) {
      if (!loaded || filterObject.findById(board) == -1) {
        filterObject.add(board);
      }
      boardFilter.add(new BoardsFilterCheckBox(board, filterObject));
    }
  }