Пример #1
0
  @Override
  protected Widget onInitialization() {
    setHeight100();

    lockInfo = new LockInfoWidget();
    HeaderWidget header = new HeaderWidget();
    sidebar = new SwitcherWidget(true);
    workarea.setStyleName("Workspace-body-center-content");

    ScrollPanel workareaScroller =
        new ScrollPanel(Gwt.createDiv("Workspace-body-center-content", workarea));
    workareaScroller.getElement().setId("workarea-scroller");
    workareaScroller.setHeight("100%");
    workarea.setScrollPanel(workareaScroller);

    FlowPanel body = new FlowPanel();
    body.setStyleName("Workspace-body");
    body.add(Gwt.createDiv("Workspace-body-west", sidebar));
    body.add(Gwt.createDiv("Workspace-body-center", workareaScroller));

    FlowPanel workspace = Gwt.createFlowPanel(Gwt.createDiv("Workspace-header", header), body);
    workspace.setStyleName("Workspace");

    locker = new LockWidget(workspace);

    return new FullscreenPanel(locker);
  }
Пример #2
0
  @Override
  protected Widget onExtendedInitialization() {
    Requirement requirement = getObject();

    requirementWidget =
        new RequirementWidget(requirement, false, false, true, false, false, false, false);
    taskList = new BlockListWidget<Task>(TaskInRequirementBlock.FACTORY);
    taskList.setAutoSorter(requirement.getTasksOrderComparator());
    if (requirement.getProject().isTeamMember(getCurrentUser())) {
      taskList.setDndSorting(true);
      taskList.setMoveObserver(new MoveObserver());
    }
    createTaskButton = new ButtonWidget(new CreateTaskAction(requirement));
    changeHistoryWidget = new ChangeHistoryWidget(requirement);

    FlowPanel left = new FlowPanel();
    left.add(requirementWidget);
    left.add(taskList);
    left.add(Gwt.createDiv("CreateTaskButtonWrapper", createTaskButton));
    left.add(changeHistoryWidget);

    right = new FlowPanel();
    if (requirement.isDecidable() && requirement.getProject().isProductOwner(getCurrentUser())) {
      right.add(RequirementWidget.createActionsPanelForCompletedRequirement(requirement));
      right.add(Gwt.createSpacer(1, 10));
    }
    right.add(ScrumGwt.createEmoticonsAndComments(requirement));

    bodyWidget = TableBuilder.row(20, left, right);
    return bodyWidget;
  }
Пример #3
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();
  }
Пример #4
0
 @Override
 protected void onUpdateBody() {
   requirementWidget.update();
   taskList.setObjects(getObject().getTasks());
   taskList.update();
   Gwt.update(right, createTaskButton);
   changeHistoryWidget.update();
 }
Пример #5
0
 private Widget createDayContent(Date date) {
   FlowPanel panel = new FlowPanel();
   for (String info : calendar.getInfos(date)) {
     panel.add(Gwt.createDiv("DayListWidget-date-info", info));
   }
   panel.add(createEventList(date));
   return panel;
 }
Пример #6
0
 public String getTaskStatusLabel() {
   List<Task> tasks = getTasksInSprint();
   int burned = Task.sumBurnedWork(tasks);
   int remaining = Task.sumRemainingWork(getTasksInSprint());
   if (remaining == 0)
     return tasks.isEmpty() ? "no tasks planned yet" : "100% completed, " + burned + " hrs burned";
   int burnedPercent = Gwt.percent(burned + remaining, burned);
   return burnedPercent + "% completed, " + remaining + " hrs left";
 }
Пример #7
0
  public void showDate(Date dateToShow) {
    this.date = dateToShow;
    updateBeginAndEnd();

    lists.clear();
    selectionManager.clear();

    FlexTable table = new FlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.getColumnFormatter().setWidth(0, "25px");
    table.getColumnFormatter().setWidth(1, "40px");
    table.getColumnFormatter().setWidth(2, "30px");
    table.getColumnFormatter().setWidth(3, "40px");

    // table.setBorderWidth(1);
    int row = 0;
    Date d = begin;
    int month = 0;
    int week = 0;
    while (d.compareTo(end) <= 0) {
      int w = d.getWeek();
      if (w != week) {
        week = w;
        Widget weekWidget = Gwt.createDiv("DayListWidget-week", String.valueOf(week));
        table.setWidget(row, 0, weekWidget);
      }
      int m = d.getMonth();
      if (m != month) {
        month = m;
        Widget monthWidget = Gwt.createDiv("DayListWidget-month", Gwt.getMonthShort(month));
        table.setWidget(row, 1, monthWidget);
      }
      table.setWidget(row, 2, Gwt.createDiv("DayListWidget-date", Gwt.formatDay(d.toJavaDate())));
      table.setWidget(
          row, 3, Gwt.createDiv("DayListWidget-date", Gwt.formatWeekdayShort(d.toJavaDate())));
      table.setWidget(row, 4, createDayContent(d));

      formatRow(table, row);
      d = d.nextDay();
      row++;
    }

    Widget downloadLink =
        ScrumGwt.createPdfLink(
            "Download as PDF", "calendar", "from", begin.toString(), "to", end.toString());
    wrapper.setWidget(Gwt.createFlowPanel(table, Gwt.createSpacer(1, 10), downloadLink));
  }
Пример #8
0
 @Override
 protected void onUpdate() {
   TableBuilder tb = new TableBuilder();
   tb.setWidth(null);
   tb.setCellSpacing(5);
   for (Map.Entry<String, Integer> entry : dao.getEntityCounts().entrySet()) {
     tb.addRow(Gwt.createFieldLabel(entry.getKey()), new Label(String.valueOf(entry.getValue())));
   }
   entityCountWrapper.setWidget(tb.createTable());
   stateInformationWrapper.setWidget(createStateInformation());
   super.onUpdate();
 }
Пример #9
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());
  }
Пример #10
0
  @Override
  protected Widget onInitialization() {
    cardSlotsWrapper = new SimplePanel();
    handCardsWrapper = new SimplePanel();
    actionsWrapper = new SimplePanel();

    FlowPanel pokerTable = new FlowPanel();
    pokerTable.setStyleName("PlanningPokerWidget-table");
    pokerTable.add(createTableBranding());
    pokerTable.add(cardSlotsWrapper);
    if (getCurrentProject().isTeamMember(getCurrentUser())) {
      pokerTable.add(Gwt.createSpacer(1, 20));
      pokerTable.add(handCardsWrapper);
    }
    pokerTable.add(Gwt.createSpacer(1, 20));
    pokerTable.add(actionsWrapper);

    SimplePanel pokerTableBorder = Gwt.createDiv("PlanningPokerWidget-table-border", pokerTable);

    return pokerTableBorder;
  }
Пример #11
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();
  }
Пример #12
0
  public void abort(String message) {
    Log.DEBUG("Locking UI for ABORT:", message);
    lockInfo.showBug(message + " Restarting your session...");
    locker.lock(lockInfo);
    Gwt.runLater(
        20000,
        new Runnable() {

          @Override
          public void run() {
            Window.Location.reload();
          }
        });
  }
Пример #13
0
  @Override
  protected Widget onInitialization() {
    list = new BlockListWidget<Task>(new TaskBlock.TaskBlockFactory(container), this.dropAction);
    list.setSelectionManager(container.getSelectionManager());
    list.setMinHeight(100);
    list.setAutoSorter(requirement.getTasksOrderComparator());
    if (requirement.getProject().isTeamMember(getCurrentUser())) {
      list.setDndSorting(createTaskButton);
      list.setMoveObserver(new MoveObserver());
    }

    FlowPanel panel = new FlowPanel();
    panel.add(list);
    if (createTaskButton)
      panel.add(
          Gwt.createDiv(
              "CreateTaskButtonWrapper",
              new ButtonWidget(new CreateTaskAction(requirement)).update()));

    return panel;
  }
Пример #14
0
 private Widget createPageNavigator(int commentCount) {
   TableBuilder tb = new TableBuilder();
   tb.setWidth(null);
   tb.addFieldLabel("Pages:");
   int page = 1;
   int endIdx = COMMENTS_PER_PAGE - 1;
   tb.addSpacer(5, 1);
   if (currentPage > 1) {
     tb.add(
         Gwt.createDiv(
             "CommentsWidget-pageNavigator-page",
             new HyperlinkWidget(new ShowPageAction("<", currentPage - 1))));
   } else {
     tb.add(Gwt.createDiv("CommentsWidget-pageNavigator-page-disabled", "<"));
   }
   tb.addSpacer(5, 1);
   while (true) {
     tb.addSpacer(5, 1);
     if (currentPage == page) {
       tb.add(Gwt.createDiv("CommentsWidget-pageNavigator-currentPage", String.valueOf(page)));
     } else {
       tb.add(
           Gwt.createDiv(
               "CommentsWidget-pageNavigator-page",
               new HyperlinkWidget(new ShowPageAction(String.valueOf(page), page))));
     }
     if (endIdx >= commentCount - 1) break;
     page++;
     endIdx += COMMENTS_PER_PAGE;
   }
   tb.addSpacer(10, 1);
   if (page > currentPage) {
     tb.add(
         Gwt.createDiv(
             "CommentsWidget-pageNavigator-page",
             new HyperlinkWidget(new ShowPageAction(">", currentPage + 1))));
   } else {
     tb.add(Gwt.createDiv("CommentsWidget-pageNavigator-page-disabled", ">"));
   }
   return Gwt.createDiv("CommentsWidget-pageNavigator", tb.createTable());
 }
Пример #15
0
 @Override
 public void initialize() {
   workspace = new WorkspaceWidget();
   Gwt.setRootWidget(workspace);
 }
Пример #16
0
 private Widget createTableBranding() {
   return Gwt.createDiv("PlanningPokerWidget-table-branding", "Planning Poker");
 }
Пример #17
0
 @Override
 protected void onExecute() {
   if (!Gwt.confirm("Deleting a file is unrecoverable. Delete it anyway?")) return;
   getCurrentProject().deleteFile(file);
 }
Пример #18
0
 public void updateUrgentIssuesOrder(List<Issue> issues) {
   setUrgentIssuesOrderIds(Gwt.getIdsAsList(issues));
 }
Пример #19
0
 public void updateRequirementsOrder(List<Requirement> requirements) {
   setRequirementsOrderIds(Gwt.getIdsAsList(requirements));
   updateRequirementsModificationTimes();
 }
Пример #20
0
 public void updateTasksOrder(List<Task> tasks) {
   setTasksOrderIds(Gwt.getIdsAsList(tasks));
 }
Пример #21
0
 public void changeValue(T newValue) {
   T oldValue = getValue();
   if (Gwt.equals(oldValue, newValue)) return;
   onChangeValue(oldValue, newValue);
   setValue(newValue);
 }