use of javax.swing.table.TableModel in project processdash by dtuma.
the class TimeLoggingSimulation method performTimeLogEdit.
// private void waitForHierarchyEditorClose() {
// // some time will go by, not on the AWT thread, while the changes are
// // applied. We'll know it's done when the hierarchy editor frame is
// // no longer visible.
// while (true) {
// Frame f = findFrame(Hierarchy_Resources
// .getString("HierarchyEditor"));
// if (f == null || f.isShowing() == false)
// break;
// sleep(20);
// }
// }
private void performTimeLogEdit() {
int[] currentPath = this.currentPath;
JMenu cMenu = harness.getConfigureButton().getMenu(0);
JMenuItem hierarchyMenuItem = cMenu.getItem(1);
hierarchyMenuItem.doClick();
Frame f = findFrame(Time_resources.getString("Time_Log_Editor_Window_Title"));
JTable dataTable = (JTable) findEmbeddedComponent(f, JTable.class);
TableModel timeData = dataTable.getModel();
boolean currentEntryExists = currentEntryExists();
boolean currentEntryAltered = editSomeEntries(f, timeData, currentPath, currentEntryExists);
// click the "Close" button
click(f, 590, 380);
print("about to save time log edits");
// "save changes?" window will appear, and offer to save changes.
// type "Enter" to accept the save offer.
type(KeyEvent.VK_ENTER);
print("time log edits saved.");
if (currentEntryAltered)
user.interrupt();
}
use of javax.swing.table.TableModel in project processdash by dtuma.
the class EVWeekReport method writeReport.
private void writeReport(String taskListName, EVTaskList evModel, Date effDate, EVReportSettings settings, EVTaskFilter taskFilter, EVTaskListFilter privacyFilter, int purpose) throws IOException {
EVSchedule schedule = evModel.getSchedule();
double totalPlanTime = schedule.getMetrics().totalPlan();
boolean hideNames = settings.getBool(EVReport.CUSTOMIZE_HIDE_NAMES);
boolean showAssignedTo = (evModel instanceof EVTaskListRollup) && !hideNames;
boolean showTimingIcons = (evModel instanceof EVTaskListData && !isExporting() && purpose == PLAIN_REPORT);
boolean showMilestones = evModel.showMilestoneColumn();
boolean showLabels = evModel.showLabelsColumn();
int numOptionalCols = //
(showAssignedTo ? 1 : 0) + (showMilestones ? 1 : 0) + (showLabels ? 1 : 0);
boolean monthly = isMonthly(settings);
Resources effRes = (monthly ? monthRes : resources);
// Calculate the dates one week/month before and after the effective date.
Date lastWeek, nextWeek;
if (monthly) {
long eff = effDate.getTime();
lastWeek = roundToMonthEnd(new Date(eff - 5 * MILLIS_PER_WEEK));
nextWeek = roundToMonthEnd(new Date(eff + MILLIS_PER_WEEK));
} else {
lastWeek = adjustDate(effDate, -EVSchedule.WEEK_MILLIS);
nextWeek = adjustDate(effDate, EVSchedule.WEEK_MILLIS);
}
Date startDate = schedule.getStartDate();
if (lastWeek.before(startDate))
lastWeek = startDate;
Date effDateDisplay = new Date(effDate.getTime() - 1000);
Date nextWeekDisplay = new Date(nextWeek.getTime() - 1000);
// calculate flags describing whether the actual current date falls
// within our reporting period
long now = System.currentTimeMillis();
boolean reportingPeriodIncludesToday = (lastWeek.getTime() < now && now <= effDate.getTime());
boolean reportingPeriodPrecedesToday = (effDate.getTime() < now && now <= nextWeek.getTime());
// Calculate future cutoff dates for task dependency display
Date dependDate = getFutureCutoffDate(effDate, Settings.getInt("ev.numDependencyWeeks", monthly ? 5 : 3));
Date revDependDate = getFutureCutoffDate(effDate, Settings.getInt("ev.numReverseDependencyWeeks", 6));
// Get a slice of the schedule representing the previous week.
EVSchedule filteredSchedule = getEvSchedule(evModel, taskFilter);
EVSchedule.Period weekSlice = EVScheduleRollup.getSlice(filteredSchedule, lastWeek, effDate);
// Now scan the task list looking for information we need.
TableModel tasks = evModel.getSimpleTableModel(taskFilter);
int taskListLen = tasks.getRowCount();
// keep track of tasks that should be displayed in the three lists.
boolean[] completedLastWeek = new boolean[taskListLen];
boolean[] inProgressThisWeek = new boolean[taskListLen];
boolean[] dueThroughNextWeek = new boolean[taskListLen];
byte[] progress = new byte[taskListLen];
Map<String, DependencyForCoord> upcomingDependencies = new HashMap<String, DependencyForCoord>();
List<RevDependencyForCoord> reverseDependencies = new ArrayList<RevDependencyForCoord>();
Arrays.fill(completedLastWeek, false);
Arrays.fill(inProgressThisWeek, false);
Arrays.fill(dueThroughNextWeek, false);
boolean oneCompletedLastWeek = false;
boolean oneInProgressThisWeek = false;
boolean oneDueNextWeek = false;
// keep track of the people assigned to the current schedule
Set allIndividuals = new HashSet();
String ignoreIndividual = null;
if (evModel instanceof EVTaskListData && purpose == PLAIN_REPORT)
allIndividuals.add(ignoreIndividual = getOwner());
// retrieve information about the actual time that was logged to tasks
// during the effective time period
double[] actualTimeThisWeek = getActualTimeSpent(tasks, lastWeek, effDate);
double completedTasksTimeThisWeek = 0;
double inProgressTasksTimeThisWeek = 0;
// keep track of the two total plan/actual time to date for
// completed tasks.
double completedTasksTotalPlanTime = 0;
double completedTasksTotalActualTime = 0;
// keep track of plan and actual value, this week and to date
double planValueThisWeek = 0;
double valueEarnedThisWeek = 0;
double planValueToDate = 0;
double valueEarnedToDate = 0;
for (int i = 0; i < taskListLen; i++) {
double taskValue = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_DTIME_COLUMN));
Date completed = (Date) tasks.getValueAt(i, EVTaskList.DATE_COMPLETE_COLUMN);
// check to see if the task was due this week, or in the past
Date due = (Date) tasks.getValueAt(i, EVTaskList.PLAN_DATE_COLUMN);
if (due != null && due.before(effDate)) {
planValueToDate += taskValue;
if (!due.before(lastWeek))
planValueThisWeek += taskValue;
}
if (completed != null && completed.before(effDate)) {
completedTasksTotalPlanTime += taskValue;
completedTasksTotalActualTime += parseTime(tasks.getValueAt(i, -EVTaskList.ACT_DTIME_COLUMN));
valueEarnedToDate += taskValue;
if (!completed.before(lastWeek) && completed.before(nextWeek)) {
completedLastWeek[i] = oneCompletedLastWeek = true;
completedTasksTimeThisWeek += actualTimeThisWeek[i];
valueEarnedThisWeek += taskValue;
} else if (actualTimeThisWeek[i] > 0) {
// if the task was marked complete in the past, but
// someone logged time against it this week, display
// it in the "in progress" table.
inProgressThisWeek[i] = oneInProgressThisWeek = true;
inProgressTasksTimeThisWeek += actualTimeThisWeek[i];
}
} else {
Date replannedDue = (Date) tasks.getValueAt(i, EVTaskList.REPLAN_DATE_COLUMN);
Date taskStarted = (Date) tasks.getValueAt(i, EVTaskList.ACT_START_DATE_COLUMN);
// Check to see if the task was in progress this week
if (taskStarted != null && taskStarted.before(effDate) && (completed == null || completed.after(effDate))) {
inProgressThisWeek[i] = oneInProgressThisWeek = true;
inProgressTasksTimeThisWeek += actualTimeThisWeek[i];
}
// Check to see if the task is due next week
if ((due != null && due.after(startDate) && due.before(nextWeek)) || (replannedDue != null && replannedDue.after(startDate) && replannedDue.before(nextWeek))) {
dueThroughNextWeek[i] = oneDueNextWeek = true;
}
if ((inProgressThisWeek[i] || dueThroughNextWeek[i]) && (due != null)) {
if (!due.after(effDate))
progress[i] = BEHIND_SCHEDULE;
else if (due.after(nextWeek))
progress[i] = AHEAD_OF_SCHEDULE;
}
Date projectedDate = (Date) tasks.getValueAt(i, EVTaskList.PROJ_DATE_COLUMN);
findUpcomingDependencies(tasks, upcomingDependencies, i, projectedDate, dependDate, ignoreIndividual);
// point in collecting reverse dependencies.
if (!hideNames)
findReverseDependencies(tasks, reverseDependencies, revDependDate, i);
}
List assignedTo = (List) tasks.getValueAt(i, -EVTaskList.ASSIGNED_TO_COLUMN);
if (assignedTo != null)
allIndividuals.addAll(assignedTo);
}
double cpi = completedTasksTotalPlanTime / completedTasksTotalActualTime;
boolean showTimeThisWeek = (completedTasksTimeThisWeek > 0 || inProgressTasksTimeThisWeek > 0);
// look up planned values from the schedule, if appropriate
if (!monthly || Settings.getBool("ev.month.extrapolatePV", true)) {
planValueThisWeek = weekSlice.planValue();
planValueToDate = weekSlice.getCumPlanValue();
}
// look up earned values from the schedule, if not in monthly mode
if (!monthly) {
valueEarnedThisWeek = weekSlice.earnedValue();
valueEarnedToDate = weekSlice.getCumEarnedValue();
}
if (isTopLevel(purpose)) {
String taskListDisplayName = EVTaskList.cleanupName(taskListName);
String titleHTML = effRes.format("Title_FMT", taskListDisplayName);
titleHTML = HTMLUtils.escapeEntities(titleHTML);
StringBuffer header = new StringBuffer(HEADER_HTML);
StringUtils.findAndReplace(header, TITLE_VAR, titleHTML);
if (taskFilter != null)
header.insert(header.indexOf("</head>"), FILTER_HEADER_HTML);
if (isExportingToExcel())
StringUtils.findAndReplace(header, "hideIfCollapsed", "ignore");
out.print(header);
out.print("<h2>");
String endDateStr = monthly ? formatMonth(effDateDisplay) : encodeHTML(effDateDisplay);
out.print(effRes.format("Header_HTML_FMT", endDateStr));
if (!isExporting() || getParameter(EFF_DATE_PARAM) == null) {
if (lastWeek.compareTo(startDate) > 0)
printNavLink(lastWeek, "Previous", settings, purpose);
printNavLink(nextWeek, "Next", settings, purpose);
if (!isExporting())
printGoToDateLink(effDate, schedule, settings, purpose);
}
out.print("</h2>\n");
EVReport.printFilterInfo(out, taskFilter, settings, isExporting(), isExportingToExcel());
EVReport.printScheduleErrors(out, filteredSchedule.getMetrics().getErrors());
} else {
out.print("<div class='");
out.print(purpose == LEAF_REPORT ? "collapsed" : "expanded");
out.print("'><h2>");
printExpansionIcon();
out.print(encodeHTML(taskListName));
out.print("</h2>\n");
out.print("<div class='subsection");
if (purpose != LEAF_REPORT)
out.print(" hideIfCollapsed");
out.print("'>");
}
String indivDetail = "";
if (purpose == LEAF_REPORT)
indivDetail = " class='hideIfCollapsed'";
String hh = (purpose == SPLIT_REPORT ? "h2" : "h3");
String personalDataID = evModel.getPersonalDataID();
boolean shouldHideSummary = (privacyFilter != null && personalDataID != null && privacyFilter.include(personalDataID) == false);
if (!shouldHideSummary) {
interpOut("<" + hh + indivDetail + ">${Summary.Header}");
if (isTopLevel(purpose) && showAssignedTo && !isExporting()) {
String splitLink = (String) env.get("REQUEST_URI");
if (purpose == PLAIN_REPORT)
splitLink = HTMLUtils.appendQuery(splitLink, SPLIT_PARAM, "t");
else
splitLink = HTMLUtils.removeParam(splitLink, SPLIT_PARAM);
out.print(" <span class='nav'><a href='");
out.print(splitLink);
out.print("'>");
out.print(resources.getHTML(purpose == PLAIN_REPORT ? "Show_Split" : "Show_Rollup"));
out.print("</a></span>");
}
out.print("</" + hh + ">");
out.print("<table border=1 name='summary'><tr><td></td><td></td>");
if (taskFilter == null)
interpOut("<td class=header colspan=3>${Summary.Direct_Hours}" + "</td><td></td>");
interpOut("<td class=header colspan=3>${Summary.Earned_Value}" + //
"</td></tr>\n" + "<tr><td></td><td></td>");
if (taskFilter == null)
interpOut("<td class=header>${Summary.Plan}</td>" + "<td class=header>${Summary.Actual}</td>" + "<td class=header>${Summary.Ratio}</td><td></td>");
interpOut("<td class=header>${Summary.Plan}</td>" + "<td class=header>${Summary.Actual}</td>" + "<td class=header>${Summary.Ratio}</td></tr>\n");
String thisWeekKey;
String keySuffix = (monthly ? "_Month" : "_Week");
if (reportingPeriodIncludesToday)
thisWeekKey = "This" + keySuffix;
else if (reportingPeriodPrecedesToday)
thisWeekKey = "Last" + keySuffix;
else
thisWeekKey = "This_Period";
out.print("<tr><td class=left>" + effRes.getHTML("Summary." + thisWeekKey) + "</td><td></td>");
if (taskFilter == null) {
double directTimeThisWeek;
if (monthly)
directTimeThisWeek = sumActualTime(actualTimeThisWeek);
else
directTimeThisWeek = weekSlice.getActualDirectTime();
printTimeData(weekSlice.getPlanDirectTime(), directTimeThisWeek);
out.print("<td></td>");
}
printPctData(//
planValueThisWeek / totalPlanTime, valueEarnedThisWeek / totalPlanTime);
out.print("</tr>\n");
out.print("<tr><td class=left>" + encodeHTML(resources.format("Summary.To_Date_FMT", effDateDisplay)) + "</td><td></td>");
double directTimeToDate = 0;
if (taskFilter == null) {
if (monthly)
directTimeToDate = schedule.get(0).getActualDirectTime() + sumActualTime(getActualTimeSpent(tasks, startDate, effDate));
else
directTimeToDate = weekSlice.getCumActualDirectTime();
printTimeData(weekSlice.getCumPlanDirectTime(), directTimeToDate);
out.print("<td></td>");
}
printPctData(//
planValueToDate / totalPlanTime, valueEarnedToDate / totalPlanTime);
out.print("</tr>\n");
double numWeeks = Double.NaN;
if (startDate != null)
numWeeks = (effDate.getTime() - startDate.getTime() - EVSchedule.dstDifference(startDate.getTime(), effDate.getTime())) / (double) MILLIS_PER_WEEK;
if (monthly) {
numWeeks = numWeeks / WEEKS_PER_MONTH;
interpOut("<tr" + indivDetail + "><td class=left>" + "${Month.Summary.Average_per_Month}</td><td></td>");
} else {
interpOut("<tr" + indivDetail + "><td class=left>${Summary.Average_per_Week}</td><td></td>");
}
if (taskFilter == null) {
double planTimePerWeek = weekSlice.getCumPlanDirectTime() / numWeeks;
double actualTimePerWeek = directTimeToDate / numWeeks;
printTimeData(planTimePerWeek, actualTimePerWeek);
out.print("<td></td>");
}
double planEVPerWeek = planValueToDate / (totalPlanTime * numWeeks);
double actualEVPerWeek = valueEarnedToDate / (totalPlanTime * numWeeks);
printPctData(planEVPerWeek, actualEVPerWeek);
out.print("</tr>\n");
if (taskFilter == null) {
interpOut("<tr" + indivDetail + "><td class=left>${Summary.Completed_Tasks_To_Date}" + "</td><td></td>");
printData(formatTime(completedTasksTotalPlanTime), formatTime(completedTasksTotalActualTime), 1.0 / cpi, "timeFmt");
out.print("<td></td><td></td><td></td><td></td></tr>\n");
}
out.print("</table>\n");
}
if (purpose == PLAIN_REPORT || purpose == LEAF_REPORT) {
out.print("<div class='hideIfCollapsed'>\n");
// create a table writer with appropriate renderers.
HTMLTableWriter tableWriter = createTableWriter(evModel, hideNames, showTimingIcons);
// to draw the completed tasks table, remove the "task with timing
// icons" renderer if it happens to be in use.
HTMLTableWriter.CellRenderer taskRenderer = tableWriter.getCellRenderer(EVTaskList.TASK_COLUMN);
tableWriter.setCellRenderer(EVTaskList.TASK_COLUMN, EVReport.EV_CELL_RENDERER);
String completedTasksTooltip = encodeHTML(resources.format("Completed_Tasks.Header_Tip_FMT", lastWeek, effDateDisplay));
String completedTasksHeader;
if (reportingPeriodIncludesToday)
completedTasksHeader = effRes.getHTML("Completed_Tasks.Header");
else if (reportingPeriodPrecedesToday)
completedTasksHeader = effRes.getHTML("Completed_Tasks.Header_Last");
else if (monthly)
completedTasksHeader = effRes.format("Completed_Tasks.Header_Month_HTML_FMT", formatMonth(effDateDisplay));
else
completedTasksHeader = completedTasksTooltip;
out.print("<h3 title='" + completedTasksTooltip + "'>" + completedTasksHeader + "</h3>\n");
if (!oneCompletedLastWeek)
interpOut("<p><i>${None}</i>\n");
else {
printCompletedTaskTableHeader(showTimeThisWeek, showAssignedTo, showMilestones, showLabels, monthly);
double totalPlannedTime = 0;
double totalActualTime = 0;
double totalPlannedValue = 0;
for (int i = 0; i < taskListLen; i++) {
if (!completedLastWeek[i])
continue;
double taskPlannedTime = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_TIME_COLUMN));
double taskActualTime = parseTime(tasks.getValueAt(i, -EVTaskList.ACT_TIME_COLUMN));
double taskPlannedValue = ((Double) tasks.getValueAt(i, -EVTaskList.PLAN_VALUE_COLUMN)).doubleValue();
totalPlannedTime += taskPlannedTime;
totalActualTime += taskActualTime;
totalPlannedValue += taskPlannedValue;
printCompletedLine(tableWriter, tasks, i, showTimeThisWeek ? actualTimeThisWeek : null, showAssignedTo, showMilestones, showLabels);
}
interpOut("<tr class='sortbottom'><td><b>${Completed_Tasks.Total}" + " </b></td><td class='timeFmt'>");
out.print(formatTime(totalPlannedTime) + "</td>");
out.print("<td class='timeFmt'>");
out.print(formatTime(totalActualTime) + "</td>");
if (showTimeThisWeek) {
out.print("<td class='timeFmt'>");
out.print(formatTime(completedTasksTimeThisWeek) + "</td>");
}
if (totalPlannedTime > 0) {
double totalPctSpent = totalActualTime / totalPlannedTime;
out.print("<td>" + EVSchedule.formatPercent(totalPctSpent) + "</td>");
} else {
out.print("<td> </td>");
}
// Empty td for assigned to, planned date, and labels columns
int noSumCol = 1 + numOptionalCols;
for (int i = 0; i < noSumCol; ++i) out.print("<td> </td>");
out.print("<td>" + EVSchedule.formatPercent(totalPlannedValue) + "</td></tr>\n");
out.println("</table>");
}
// put the "task with timing icons" renderer back in place if necessary
tableWriter.setCellRenderer(EVTaskList.TASK_COLUMN, taskRenderer);
String inProgressTooltip = encodeHTML(resources.format("Tasks_In_Progress.Header_Tip_FMT", effDateDisplay));
String inProgressHeader;
if (reportingPeriodIncludesToday || reportingPeriodPrecedesToday)
inProgressHeader = effRes.getHTML("Tasks_In_Progress.Header");
else
inProgressHeader = encodeHTML(resources.format("Tasks_In_Progress.Header_Long_FMT", effDateDisplay));
out.print("<h3 title='" + inProgressTooltip + "'>" + inProgressHeader + "</h3>\n");
if (!oneInProgressThisWeek)
interpOut("<p><i>${None}</i>\n");
else {
printUncompletedTaskTableHeader(showTimeThisWeek, showAssignedTo, showMilestones, showLabels, true, monthly);
double totalPlannedTime = 0;
double totalActualTime = 0;
double totalPlannedValue = 0;
double totalPlannedTimeRemaining = 0;
double totalUnearnedValue = 0;
for (int i = 0; i < taskListLen; ++i) {
if (!inProgressThisWeek[i])
continue;
double taskPlannedTime = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_TIME_COLUMN));
double taskActualTime = parseTime(tasks.getValueAt(i, -EVTaskList.ACT_TIME_COLUMN));
double taskPlannedValue = ((Double) tasks.getValueAt(i, -EVTaskList.PLAN_VALUE_COLUMN)).doubleValue();
double taskPlannedTimeRemaining = taskPlannedTime - taskActualTime;
double taskUnearnedValue = computeUnearnedValue(tasks, i);
totalPlannedTime += taskPlannedTime;
totalActualTime += taskActualTime;
totalPlannedValue += taskPlannedValue;
totalPlannedTimeRemaining += (taskPlannedTimeRemaining > 0) ? taskPlannedTimeRemaining : 0;
totalUnearnedValue += taskUnearnedValue;
printInProgressLine(tableWriter, tasks, progress[i], i, taskPlannedTimeRemaining, showTimeThisWeek ? actualTimeThisWeek : null, showAssignedTo, showMilestones, showLabels, taskUnearnedValue);
}
interpOut("<tr class='sortbottom'><td><b>${Tasks_In_Progress.Total}" + " </b></td><td class='timeFmt'>");
out.print(formatTime(totalPlannedTime) + "</td>");
out.print("<td class='timeFmt'>");
out.print(formatTime(totalActualTime) + "</td>");
if (showTimeThisWeek) {
out.print("<td class='timeFmt'>");
out.print(formatTime(inProgressTasksTimeThisWeek) + "</td>");
}
out.print("<td>" + EVSchedule.formatPercent(totalPlannedValue) + "</td>");
if (totalPlannedTime > 0) {
double totalPctSpent = totalActualTime / totalPlannedTime;
out.print("<td>" + EVSchedule.formatPercent(totalPctSpent) + "</td>");
} else {
out.print("<td> </td>");
}
// Empty td because there is no total for Planned Date and Dep.
int noSumCol = 2 + numOptionalCols;
for (int i = 0; i < noSumCol; ++i) out.print("<td> </td>");
out.print("<td class='timeFmt'>");
out.print(formatTime(totalPlannedTimeRemaining) + "</td>");
out.println("<td>" + EVSchedule.formatPercent(totalUnearnedValue) + "</td>");
out.println("</tr>\n</table>");
}
String dueTasksTooltip = encodeHTML(resources.format("Due_Tasks.Header_Tip_FMT", effDateDisplay, nextWeekDisplay));
String dueTasksHeader;
if (reportingPeriodIncludesToday)
dueTasksHeader = effRes.getHTML("Due_Tasks.Header");
else if (reportingPeriodPrecedesToday)
dueTasksHeader = effRes.getHTML("Due_Tasks.Header_This");
else
dueTasksHeader = encodeHTML(resources.format("Due_Tasks.Header_Long_FMT", nextWeekDisplay));
out.print("<h3 title='" + dueTasksTooltip + "'>" + dueTasksHeader + "</h3>\n");
if (!oneDueNextWeek)
interpOut("<p><i>${None}</i>\n");
else {
printUncompletedTaskTableHeader(false, showAssignedTo, showMilestones, showLabels, false, monthly);
double timeRemaining = 0;
for (int i = 0; i < taskListLen; i++) if (dueThroughNextWeek[i]) {
double forecastTimeRemaining = computeTaskForecastTimeRemaining(tasks, i, cpi);
printDueLine(tableWriter, tasks, progress[i], i, cpi, forecastTimeRemaining, showAssignedTo, showMilestones, showLabels);
if (progress[i] != AHEAD_OF_SCHEDULE && forecastTimeRemaining > 0)
timeRemaining += forecastTimeRemaining;
}
out.print("<tr class='sortbottom'><td align=right colspan=");
int colspan = 6 + numOptionalCols;
out.print(Integer.toString(colspan));
interpOut("><b>${Due_Tasks.Total}" + " </b></td><td class='timeFmt'>");
out.print(formatTime(timeRemaining));
out.println("</td></tr>\n</table>");
}
out.print("</div>\n");
} else {
EVTaskListRollup parentEVModel = (EVTaskListRollup) evModel;
for (int i = 0; i < parentEVModel.getSubScheduleCount(); i++) {
EVTaskList childModel = parentEVModel.getSubSchedule(i);
String childName = EVTaskList.cleanupName(childModel.getTaskListName());
int childPurpose = (childModel instanceof EVTaskListRollup ? SUB_REPORT : LEAF_REPORT);
writeReport(childName, childModel, effDate, settings, taskFilter, privacyFilter, childPurpose);
}
}
if (!isTopLevel(purpose)) {
// end the "subsection" div we started earlier.
out.print("</div></div>");
} else {
interpOut("<" + hh + ">${Dependencies.Header}</" + hh + ">\n");
discardInternalReverseDependencies(upcomingDependencies, reverseDependencies, allIndividuals);
if (upcomingDependencies.isEmpty() && reverseDependencies.isEmpty())
interpOut("<p><i>${None}</i>\n");
else {
if (!hideNames && !reverseDependencies.isEmpty())
printReverseDependencyTable(tasks, reverseDependencies, showAssignedTo);
List<DependencyForCoord> depsForCoord = new ArrayList<DependencyForCoord>(upcomingDependencies.values());
Collections.sort(depsForCoord);
int pos = 0;
for (DependencyForCoord coord : depsForCoord) {
printUpcomingDependencies(coord, tasks, showAssignedTo, hideNames, showMilestones, showLabels, pos++);
}
}
if (isExporting())
EVReport.writeExportFooter(out);
if (!isExportingToExcel())
interpOut(EXPORT_HTML);
out.print(FOOTER_HTML);
}
}
use of javax.swing.table.TableModel in project processdash by dtuma.
the class TaskListNavigator method reloadMenus.
private synchronized void reloadMenus() {
Set subscriptionsToDelete = new HashSet(listeningToData);
if (taskList != null) {
TableModel table = taskList.getSimpleTableModel();
List todoTasks = new ArrayList();
List completedTasks = new ArrayList();
for (int i = 0; i < table.getRowCount(); i++) {
String path = (String) table.getValueAt(i, EVTaskList.TASK_COLUMN);
if (path == null || path.trim().length() == 0)
continue;
if (taskListPath != null && !Filter.pathMatches(path, taskListPath))
continue;
if (table.getValueAt(i, EVTaskList.DATE_COMPLETE_COLUMN) == null)
todoTasks.add(path);
else
completedTasks.add(path);
String dataName = DataRepository.createDataName(path, "Completed");
subscriptionsToDelete.remove(dataName);
if (listeningToData.contains(dataName) == false) {
context.getData().addDataListener(dataName, this, false);
listeningToData.add(dataName);
}
}
quickTasks = new TaskListFlatTreeTableModel(todoTasks, completedTasks);
int maxItemsPerMenu = Settings.getInt("hierarchyMenu.maxItems", 20);
String currentPath = activeTaskModel.getPath();
numTodoItems = todoTasks.size();
menu.removeAll();
allItems.clear();
addMenuItems(menu, todoTasks, maxItemsPerMenu, currentPath);
if (!completedTasks.isEmpty()) {
// this makes the most recently completed tasks the easiest to
// navigate to, and the oldest tasks are buried deep in the menu.
Collections.reverse(completedTasks);
completedTasksMenu.removeAll();
addMenuItems(completedTasksMenu, completedTasks, maxItemsPerMenu, currentPath);
if (menu.getItemCount() > 0 && menu.getItem(0) instanceof TaskJMenuItem)
menu.insertSeparator(0);
menu.insert(completedTasksMenu, 0);
}
if (menu.getMenuComponentCount() == 0) {
JMenuItem emptyList = new JMenuItem();
emptyList.setText(resources.format("Navigator.Empty_List_FMT", taskList.getDisplayName()));
emptyList.setEnabled(false);
menu.add(emptyList);
}
// an active task
if (StringUtils.hasValue(taskListName)) {
JMenuItem openTaskAndSchedule = new JMenuItem();
openTaskAndSchedule.setText(resources.getString("Navigator.Open_Task_And_Schedule"));
openTaskAndSchedule.setFont(plainFont);
openTaskAndSchedule.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (StringUtils.hasValue(taskListName))
TaskScheduleChooser.open(context, taskListName);
}
});
menu.insertSeparator(menu.getItemCount());
menu.add(openTaskAndSchedule);
}
}
for (Iterator i = subscriptionsToDelete.iterator(); i.hasNext(); ) {
String dataName = (String) i.next();
context.getData().removeDataListener(dataName, this);
}
}
Aggregations