public List<Task> getClaimedTasks(User user) { List<Task> tasks = new ArrayList<Task>(); for (Requirement req : getRequirements()) { tasks.addAll(req.getClaimedTasks(user)); } return tasks; }
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(); }
@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; }
public static int sumBurnedWork(Iterable<Requirement> requirements) { int sum = 0; for (Requirement requirement : requirements) { sum += requirement.getBurnedWork(); } return sum; }
public boolean deleteTask(Task task) { for (Requirement requirement : getRequirements()) { boolean b = requirement.getTasks().remove(task); if (b) return true; } return false; }
public List<Requirement> getRequirementsByThemes(Collection<String> themes) { List<Requirement> ret = new ArrayList<Requirement>(); for (Requirement requirement : getRequirements()) { for (String theme : themes) { if (requirement.containsTheme(theme) && !ret.contains(requirement)) ret.add(requirement); } } return ret; }
public List<Requirement> getProductBacklogRequirements() { List<Requirement> ret = new ArrayList<Requirement>(); for (Requirement requirement : getRequirements()) { if (requirement.isClosed()) continue; if (requirement.isInCurrentSprint()) continue; ret.add(requirement); } return ret; }
@Override public void updateLocalModificationTime() { super.updateLocalModificationTime(); try { Requirement requirement = getRequirement(); if (requirement != null) requirement.updateLocalModificationTime(); } catch (EntityDoesNotExistException ex) { return; } }
@Override protected void onExecute() { DateAndTime time = DateAndTime.now(); for (int i = 0; i < COUNT; i++) { final Requirement req = new Requirement(getCurrentProject()); req.setLabel("Generated Story " + time + " - #" + i); req.setDescription(longText()); req.setTestDescription(longText()); dao.createRequirement(req); } }
public List<String> getThemes() { Set<String> themes = new HashSet<String>(); for (Requirement requirement : getRequirements()) { if (requirement.isClosed()) continue; themes.addAll(requirement.getThemes()); } for (Issue issue : getIssues()) { if (issue.isClosed()) continue; themes.addAll(issue.getThemes()); } List<String> ret = new ArrayList<String>(themes); Collections.sort(ret); return ret; }
public String getLongLabel(boolean showOwner, boolean showRequirement) { StringBuilder sb = new StringBuilder(); sb.append(getLabel()); if (showOwner && isOwnerSet()) { sb.append(" (").append(getOwner().getName()).append(')'); } if (showRequirement) { Requirement requirement = getRequirement(); sb.append(" (") .append(requirement.getReference()) .append(" ") .append(requirement.getLabel()) .append(')'); } return sb.toString(); }
@Override protected void onUpdateHeader(BlockHeaderWidget header) { Requirement requirement = getObject(); header.setDragHandle(requirement.getReference()); Image statusImage = null; if (requirement.isRejected()) { statusImage = Img.bundle.reqRejected().createImage(); statusImage.setTitle("Rejected."); } else if (requirement.isClosed()) { statusImage = Img.bundle.reqClosed().createImage(); statusImage.setTitle("Accepted."); } else if (requirement.isTasksClosed()) { statusImage = Img.bundle.reqTasksClosed().createImage(); statusImage.setTitle("All tasks done."); } statusIcon.setWidget(statusImage); }
@Override protected void onInitializationHeader(BlockHeaderWidget header) { Requirement requirement = getObject(); decidableOnInitialization = requirement.isDecidable(); statusIcon = header.addIconWrapper(); header.addText(requirement.getLabelModel()); header.addText(requirement.getThemesAsStringModel(), true, false); header.addText(requirement.getTaskStatusLabelModel(), true); header.appendCell(new EmoticonsWidget(requirement), null, true); header.addMenuAction(new RejectRequirementAction(requirement)); header.addMenuAction(new FixRequirementAction(requirement)); header.addMenuAction(new CloseRequirementAction(requirement)); header.addMenuAction(new ReopenRequirementAction(requirement)); header.addMenuAction(new RemoveRequirementFromSprintAction(requirement)); header.addMenuAction(new ActivateChangeHistoryAction(requirement)); header.addMenuAction(new CreateTaskAction(requirement)); }
@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; }
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(); }
@Override protected void onUpdateHeader(BlockHeaderWidget header) { Task task = getObject(); header.setDragHandle(task.getReference()); Image statusImage = null; if (task.isClosed()) { statusImage = Img.bundle.tskClosed().createImage(); statusImage.setTitle("Closed."); } else if (task.isBlocked()) { statusImage = Img.bundle.tskBlocked().createImage(); statusImage.setTitle("Blocked by " + task.getImpediment().getReferenceAndLabel() + "."); } else if (task.isOwnerSet()) { statusImage = Img.bundle.tskClaimed().createImage(); statusImage.setTitle("Claimed by " + task.getOwner().getName() + "."); } statusIcon.setWidget(statusImage); if (requirementLabel != null) { Requirement req = task.getRequirement(); requirementLabel.setText(req.getReference() + " " + req.getLabel()); } if (ownerLabel != null) ownerLabel.setText(task.isOwnerSet() ? task.getOwner().getName() : null); header.setCenter(task.getLabel()); }
public void updateRequirementsModificationTimes() { for (Requirement requirement : getRequirements()) { requirement.updateLocalModificationTime(); } }
@Override protected void onExecute() { Task task = requirement.createNewTask(); Scope.get().getComponent(ProjectWorkspaceWidgets.class).showTask(task); }
/** @param relative The story, before which the new story should be placed. Optional. */ public Requirement createNewRequirement(Requirement relative, boolean before, boolean split) { Requirement item = new Requirement(this); if (split) { String theme = relative.getLabel(); List<String> themes = relative.getThemes(); if (!themes.contains(theme)) themes.add(theme); relative.setThemes(themes); relative.setDirty(true); item.setEpic(relative); item.setThemes(themes); item.setDescription(relative.getDescription()); item.setTestDescription(relative.getTestDescription()); item.setQualitys(relative.getQualitys()); } if (relative == null) { updateRequirementsOrder(); } else { List<Requirement> requirements = getProductBacklogRequirements(); requirements.remove(item); Collections.sort(requirements, getRequirementsOrderComparator()); int idx = requirements.indexOf(relative); if (!before) idx++; requirements.add(idx, item); updateRequirementsOrder(requirements); } getDao().createRequirement(item); return item; }