private Widget createCardSlots() {
    TableBuilder tb = new TableBuilder();
    tb.setWidth(null);
    for (User user : getCurrentProject().getTeamMembers()) {
      boolean currentUser = user == getCurrentUser();
      RequirementEstimationVote vote = requirement.getEstimationVote(user);
      Float estimation = vote == null ? null : vote.getEstimatedWork();
      LOG.debug("Estimation:", user.getName(), "->", estimation);

      Widget card;
      if (estimation == null) {
        card = null;
      } else {
        ClickHandler clickHandler = null;
        String clickTooltip = null;
        if (requirement.isWorkEstimationVotingShowoff()) {
          clickHandler = new SelectEstimationClickHandler(estimation);
          clickTooltip =
              "Use this card as the estimation for this Story. Planning Poker will be closed.";
        } else if (currentUser) {
          clickHandler = new RemoveEstimationClickHandler();
          clickTooltip = "Remove this card from table.";
        }
        boolean visible = requirement.isWorkEstimationVotingShowoff();
        card = new PlanningPokerCardWidget(estimation, visible, clickHandler, clickTooltip);
      }

      tb.add(new PlanningPokerCardSlotWidget(user.getName(), card));
      tb.add(Gwt.createSpacer(5, 1));
    }
    return tb.createTable();
  }
示例#2
0
 public void start() {
   evalHistoryToken(History.getToken());
   if (!historyToken.isProjectIdSet()) {
     User user = auth.getUser();
     Project project = user.getCurrentProject();
     if (project == null || user.isAdmin()) {
       gotoProjectSelector();
     } else {
       gotoProject(project.getId());
     }
   }
 }
示例#3
0
  @Override
  protected void onUpdate() {
    TableBuilder tb = new TableBuilder();
    tb.setWidth(null);
    Set<User> users = getCurrentProject().getUsersSelecting(entity);
    boolean first = true;
    for (User user : users) {
      if (user == getCurrentUser()) continue;
      if (first) {
        first = false;
      } else {
        tb.add(new Label(","));
        tb.add(Gwt.createSpacer(3, 1));
      }

      Label label = Gwt.createInline(user.getName());
      label.getElement().getStyle().setProperty("color", user.getProjectConfig().getColor());
      tb.add(label);
    }
    wrapper.setWidget(tb.createTable());
  }
示例#4
0
 @Override
 public boolean isEditable() {
   User currentUser = Scope.get().getComponent(Auth.class).getUser();
   return currentUser.isAdmin() || isAdmin(currentUser);
 }