Ejemplo n.º 1
0
  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();
  }
Ejemplo n.º 2
0
  private Widget createHandCards() {
    Project project = getCurrentProject();
    RequirementEstimationVote vote = requirement.getEstimationVote(getCurrentUser());
    Float voteValue = vote == null ? null : vote.getEstimatedWork();
    boolean showoff = requirement.isWorkEstimationVotingShowoff();

    TableBuilder tb = new TableBuilder();
    tb.setWidth(null);

    // ?-card
    PlanningPokerCardWidget qCard = null;
    if (!showoff && (voteValue == null || -1 != voteValue)) {
      qCard =
          new PlanningPokerCardWidget(
              -1, true, new SetEstimationClickHandler(-1), "Put this card on the table.");
    }
    tb.add(new PlanningPokerCardSlotWidget("I don't know.", qCard));
    tb.add(Gwt.createSpacer(5, 1));

    // value cards
    for (String value : Requirement.WORK_ESTIMATION_VALUES) {
      if (value.length() == 0) continue;
      float estimation = Float.parseFloat(value);
      PlanningPokerCardWidget card = null;
      if (!showoff && (voteValue == null || estimation != voteValue)) {
        card =
            new PlanningPokerCardWidget(
                estimation,
                true,
                new SetEstimationClickHandler(estimation),
                "Put this card on the table.");
      }
      tb.add(new PlanningPokerCardSlotWidget(value + " " + project.getEffortUnit(), card));
      tb.add(Gwt.createSpacer(5, 1));
    }

    return tb.createTable();
  }