Skip to content

Commit

Permalink
sto236 SprintHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
witek committed Jun 30, 2015
1 parent 560cce4 commit c4de4c1
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 34 deletions.
6 changes: 4 additions & 2 deletions src/main/java/scrum/client/ScrumGwtApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ public void handleServiceCallError(String serviceCall, List<ErrorWrapper> errors
abort(sb.toString());
}

private void abort(String message) {
Scope.get().getComponent(Ui.class).getWorkspace().abort(message);
@Override
protected void onAborted(String message) {
super.onAborted(message);
Scope.get().getComponent(Pinger.class).shutdown();
Scope.get().getComponent(Dao.class).clearAllEntities();
Scope.get().getComponent(Ui.class).getWorkspace().abort(message);
}

@Override
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/scrum/client/project/Project.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright 2011 Witoslaw Koczewsi <[email protected]>, Artjom Kochtchi
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
* General Public License as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
*
* You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -68,7 +68,6 @@ public class Project extends GProject implements ForumSupport {
private static final String effortUnit = "pts";
public static final String INIT_LABEL = "New Project";

public transient boolean historyLoaded;
private transient RequirementsOrderComparator requirementsOrderComparator;
private transient Comparator<Issue> issuesOrderComparator;

Expand Down
52 changes: 52 additions & 0 deletions src/main/java/scrum/client/sprint/LoadSprintHistoryAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2011 Witoslaw Koczewsi <[email protected]>
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
* General Public License as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with this program. If not,
* see <http://www.gnu.org/licenses/>.
*/
package scrum.client.sprint;

import scrum.client.common.AScrumAction;
import scrum.client.common.TooltipBuilder;
import scrum.client.core.EventBus;

public class LoadSprintHistoryAction extends AScrumAction {

private Sprint sprint;

public LoadSprintHistoryAction(Sprint sprint) {
super();
this.sprint = sprint;
}

@Override
protected void updateTooltip(TooltipBuilder tb) {
tb.setText("Request details for this sprints history");
}

@Override
protected void onExecute() {
new RequestHistorySprintServiceCall(sprint.getId()).execute(new Runnable() {

@Override
public void run() {
sprint.historyLoaded = true;
EventBus.get().visibleDataChanged();
}
});
}

@Override
public String getLabel() {
return "Load Sprint history details";
}

}
10 changes: 6 additions & 4 deletions src/main/java/scrum/client/sprint/Sprint.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright 2011 Witoslaw Koczewsi <[email protected]>, Artjom Kochtchi
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
* General Public License as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
*
* You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -52,6 +52,8 @@ public class Sprint extends GSprint implements ForumSupport, ReferenceSupport, L
private transient Comparator<Task> tasksOrderComparator;
private transient RequirementsOrderComparator requirementsOrderComparator;

public transient boolean historyLoaded;

public Sprint(Project project, String label) {
setProject(project);
setLabel(label);
Expand Down Expand Up @@ -431,7 +433,7 @@ public String getValue() {
for (StoryInfo story : stories) {
sb.append("\n* ").append(story.getReference()).append(" ").append(story.getLabel());
sb.append(" ''").append(story.getEstimatedWorkAsString()).append(", ")
.append(story.getBurnedWorkAsString()).append("''");
.append(story.getBurnedWorkAsString()).append("''");
for (TaskInfo task : story.getTasks()) {
sb.append("\n * ").append(task.getReference()).append(" ").append(task.getLabel());
sb.append(" ''").append(task.getBurnedWork()).append(" hrs.''");
Expand Down
23 changes: 17 additions & 6 deletions src/main/java/scrum/client/sprint/SprintHistorySprintWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package scrum.client.sprint;

import ilarkesto.core.base.ChangeIndicator;
import ilarkesto.gwt.client.ButtonWidget;
import ilarkesto.gwt.client.Gwt;

import java.util.Set;
Expand All @@ -25,13 +26,15 @@
import scrum.client.project.Requirement;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;

public class SprintHistorySprintWidget extends AScrumWidget {

private Sprint sprint;
private BlockListWidget<Requirement> requirementList;
private ChangeIndicator changeIndicator = new ChangeIndicator();
private SimplePanel wrapper;

public SprintHistorySprintWidget(Sprint sprint) {
super();
Expand All @@ -40,24 +43,32 @@ public SprintHistorySprintWidget(Sprint sprint) {

@Override
protected Widget onInitialization() {
SprintReport report = sprint.getSprintReport();
requirementList = new BlockListWidget<Requirement>(RequirementInHistoryBlock.createFactory(sprint));
requirementList.setAutoSorter(report != null ? report.getRequirementsOrderComparator() : sprint
.getRequirementsOrderComparator());
wrapper = new SimplePanel();

HTML pdfLink = ScrumGwt.createPdfLink("Download Report as PDF", "sprintReport", sprint);
return Gwt.createFlowPanel(new SprintWidget(sprint), requirementList, pdfLink);
wrapper.setWidget(Gwt.createHorizontalPanel(10, pdfLink,
new ButtonWidget(new LoadSprintHistoryAction(sprint)).update()));

return wrapper;
}

@Override
protected void onUpdate() {
if (!sprint.historyLoaded) return;

requirementList = new BlockListWidget<Requirement>(RequirementInHistoryBlock.createFactory(sprint));
SprintReport report = sprint.getSprintReport();
if (sprint.getProject().historyLoaded && report != null) {
if (report != null) {
requirementList.setAutoSorter(report.getRequirementsOrderComparator());
Set<Requirement> allRequirements = report.getAllRequirements();
if (changeIndicator.update(allRequirements)) {
requirementList.setObjects(allRequirements);
}
}

HTML pdfLink = ScrumGwt.createPdfLink("Download Report as PDF", "sprintReport", sprint);
wrapper.setWidget(Gwt.createFlowPanel(new SprintWidget(sprint), requirementList, pdfLink));

super.onUpdate();
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/scrum/client/sprint/SprintHistoryWidget.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright 2011 Witoslaw Koczewsi <[email protected]>, Artjom Kochtchi
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
* General Public License as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
*
* You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -41,7 +41,6 @@ protected Widget onInitialization() {

@Override
public void run() {
getCurrentProject().historyLoaded = true;
update();
}
});
Expand All @@ -54,7 +53,8 @@ protected void onUpdate() {
if (changeIndicator.update(sprints)) {
page.clear();
for (Sprint sprint : sprints) {
page.addHeader(sprint.getReferenceAndLabel());
page.addHeader(sprint.getReferenceAndLabel() + " | " + sprint.getBegin().format() + " - "
+ sprint.getEnd());

SprintHistorySprintWidget widget = sprintWidgets.get(sprint);
if (widget == null) {
Expand Down
30 changes: 17 additions & 13 deletions src/main/java/scrum/server/ScrumServiceImpl.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright 2011 Witoslaw Koczewsi <[email protected]>, Artjom Kochtchi
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
* General Public License as published by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
*
* You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -88,6 +88,8 @@ public class ScrumServiceImpl extends GScrumServiceImpl {
private transient CommentDao commentDao;
private transient ScrumWebApplication webApplication;
private transient ChangeDao changeDao;

@In
private transient SprintDao sprintDao;

@In
Expand Down Expand Up @@ -227,8 +229,15 @@ public void onRequestHistorySprint(GwtConversation conversation, String sprintId
assertProjectSelected(conversation);
Sprint sprint = sprintDao.getById(sprintId);
SprintReport report = sprint.getSprintReport();
conversation.sendToClient(report);
conversation.sendToClient(getAssociatedEntities(report));
if (report != null) {
conversation.sendToClient(report);
conversation.sendToClient(getAssociatedEntities(report));
conversation.sendToClient(report.getCompletedRequirements());
conversation.sendToClient(report.getRejectedRequirements());
conversation.sendToClient(report.getSprintSwitchRequirementChanges());
conversation.sendToClient(report.getClosedTasks());
conversation.sendToClient(report.getOpenTasks());
}
}

@Override
Expand All @@ -242,7 +251,7 @@ public void onPullStoryToSprint(GwtConversation conversation, String storyId) {
sprint.pullStory(story, currentUser);

postProjectEvent(conversation, currentUser.getName() + " pulled " + story.getReferenceAndLabel()
+ " to current sprint", story);
+ " to current sprint", story);

sendToClients(conversation, sprint);
sendToClients(conversation, story);
Expand All @@ -259,7 +268,7 @@ public void onKickStoryFromSprint(GwtConversation conversation, String storyId)
sprint.kickRequirement(story, currentUser);

postProjectEvent(conversation, currentUser.getName() + " kicked " + story.getReferenceAndLabel()
+ " from current sprint", story);
+ " from current sprint", story);

sendToClients(conversation, story.getTasksInSprint());
sendToClients(conversation, story);
Expand Down Expand Up @@ -729,7 +738,7 @@ private void onRequirementChanged(GwtConversation conversation, Requirement requ
} else {
postProjectEvent(conversation,
currentUser.getName() + " kicked " + requirement.getReferenceAndLabel()
+ " from current sprint", requirement);
+ " from current sprint", requirement);
subscriptionService.notifySubscribers(requirement, "Story kicked from current Sprint",
conversation.getProject(), null);
}
Expand Down Expand Up @@ -909,11 +918,6 @@ private Set<AEntity> getAssociatedEntities(AEntity entity) {
if (entity instanceof SprintReport) {
SprintReport report = (SprintReport) entity;
ret.add(report.getSprint());
ret.addAll(report.getCompletedRequirements());
ret.addAll(report.getRejectedRequirements());
ret.addAll(report.getSprintSwitchRequirementChanges());
ret.addAll(report.getClosedTasks());
ret.addAll(report.getOpenTasks());
}

return ret;
Expand Down

0 comments on commit c4de4c1

Please sign in to comment.