use of net.sourceforge.processdash.ev.EVTaskDependency in project processdash by dtuma.
the class TaskDependencyAnalyzer method getHtmlTable.
public String getHtmlTable(String tableAttrs, int iconSize, String stopUrl, String checkUrl, String reverseUrl, String misorderedUrl, String misorderedReverseUrl, String sep, boolean includeBodyTags, boolean includeTooltips) {
if (dependencies == null || getStatus() == NO_DEPENDENCIES)
return null;
String iconSizeHtml = "' width='" + iconSize + "' height='" + iconSize;
StringBuffer descr = new StringBuffer();
if (includeBodyTags)
descr.append("<html><body><b>").append(getRes("Explanation_All")).append("</b>");
descr.append("<table");
if (tableAttrs != null)
descr.append(" ").append(tableAttrs);
descr.append(">");
for (Iterator i = dependencies.iterator(); i.hasNext(); ) {
EVTaskDependency d = (EVTaskDependency) i.next();
descr.append("<tr><td ");
if (d.isUnresolvable()) {
if (includeTooltips)
descr.append(getTooltip(HAS_ERROR));
descr.append("style='text-align:center; " + "color:red; font-weight:bold'>").append(resources.getHTML("Dependency.Unresolved.Text")).append("</td>");
} else if (d.isReverse()) {
if (d.isIncomplete() == false) {
if (includeTooltips)
descr.append(getTooltip(HAS_COMPLETED_REVERSE));
descr.append("style='text-align:center'><img src='").append(checkUrl).append(iconSizeHtml).append("'></td>");
} else if (d.isMisordered()) {
if (includeTooltips)
descr.append(getTooltip(HAS_MISORDERED_REVERSE));
descr.append("style='text-align:center'><img src='").append(misorderedReverseUrl).append(iconSizeHtml).append("'></td>");
} else {
if (includeTooltips)
descr.append(getTooltip(HAS_REVERSE));
descr.append("style='text-align:center'><img src='").append(reverseUrl).append(iconSizeHtml).append("'></td>");
}
} else if (d.isCollab()) {
if (includeTooltips)
descr.append(getTooltip(HAS_COLLAB));
descr.append("style='text-align:center'><img src='").append(reverseUrl).append(iconSizeHtml).append("'></td>");
} else if (d.isIncomplete()) {
if (d.isMisordered()) {
if (includeTooltips)
descr.append(getTooltip(HAS_MISORDERED_INCOMPLETE));
descr.append("style='text-align:center'><img src='").append(misorderedUrl).append(iconSizeHtml).append("'></td>");
} else {
if (includeTooltips)
descr.append(getTooltip(HAS_INCOMPLETE));
descr.append("style='text-align:center'><img src='").append(stopUrl).append(iconSizeHtml).append("'></td>");
}
} else {
if (includeTooltips)
descr.append(getTooltip(ALL_COMPLETE));
descr.append("style='text-align:center'><img src='").append(checkUrl).append(iconSizeHtml).append("'></td>");
}
descr.append("<td style='text-align:left' nowrap>");
if (d.isReverse()) {
String key;
if (d.isIncomplete() == false) {
key = "Dependency.Reverse_Completed.Display";
} else if (d.isMisordered()) {
key = "Dependency.Reverse_Misordered.Display";
} else {
key = "Dependency.Reverse.Display";
}
descr.append(resources.getHTML(key));
} else if (d.isCollab()) {
descr.append(getRes(HAS_COLLAB, "Display", true));
} else {
descr.append(nvl(d.getDisplayName()));
}
descr.append(getBriefDetails(d, sep, hideNames));
descr.append("</td></tr>");
}
descr.append("</table>");
if (includeBodyTags)
descr.append("</body></html>");
return descr.toString();
}
use of net.sourceforge.processdash.ev.EVTaskDependency in project processdash by dtuma.
the class EVReport method createCsvColumns.
private List createCsvColumns() {
List result = new LinkedList();
final Map idNumbers = new HashMap();
final Map taskIDs = new HashMap();
result.add(new CsvColumn("ID") {
int id = 1;
public void doPrepWork(EVTask root, EVTask node, int depth) {
idNumbers.put(node, new Integer(id++));
}
public void write(EVTask node, int depth) {
out.print(idNumbers.get(node));
}
});
result.add(new CsvColumn("Name") {
public void write(EVTask node, int depth) {
writeStringCsvField(node.getName());
}
});
result.add(new CsvColumn("Outline_Level") {
public void write(EVTask node, int depth) {
out.print(depth);
}
});
result.add(new CsvColumn("Predecessors") {
public void doPrepWork(EVTask root, EVTask node, int depth) {
// populate the taskIDs map so we can look up dashboard tasks
// by their taskID later.
List nodeIDs = node.getTaskIDs();
if (nodeIDs != null)
for (Iterator i = nodeIDs.iterator(); i.hasNext(); ) {
String id = (String) i.next();
taskIDs.put(id, node);
}
}
public void write(EVTask node, int depth) {
List dependencies = node.getDependencies();
if (dependencies == null || dependencies.isEmpty())
return;
List predIDs = new LinkedList();
for (Iterator i = dependencies.iterator(); i.hasNext(); ) {
// find the dashboard task named by each dependency.
EVTaskDependency d = (EVTaskDependency) i.next();
String dashTaskID = d.getTaskID();
Object predTask = taskIDs.get(dashTaskID);
if (predTask == null)
continue;
// look up the ID number we assigned to it in this CSV
// export file, and add that ID number to our list.
Object csvIdNumber = idNumbers.get(predTask);
if (csvIdNumber == null)
continue;
predIDs.add(csvIdNumber);
}
if (!predIDs.isEmpty())
writeStringCsvField(StringUtils.join(predIDs, ","));
}
});
// result.add(new CsvDateColumn("Start_Date") {
// public Date getNodeDate(EVTask node) {
// return node.getPlanStartDate();
// }
// });
result.add(new CsvDateColumn("Finish_Date") {
public Date getNodeDate(EVTask node) {
Date result = node.getActualDate();
if (result == null)
result = node.getPlanDate();
return result;
}
});
result.add(new CsvColumn("Percent_Complete") {
public void writeNode(EVTask node, int depth) {
out.print("0");
}
public void writeLeaf(EVTask node, int depth) {
out.print(cleanupPercentComplete(node.getPercentCompleteText()));
}
});
// result.add(new CsvDateColumn("Actual_Start") {
// public Date getNodeDate(EVTask node) {
// return nullToNA(node.getActualStartDate());
// }
// });
//
// result.add(new CsvDateColumn("Actual_Finish") {
// public Date getNodeDate(EVTask node) {
// return nullToNA(node.getActualDate());
// }
// });
result.add(new // "Scheduled_Work") {
CsvHoursColumn(// "Scheduled_Work") {
"Duration") {
public double getNodeMinutes(EVTask node) {
return node.getPlanValue();
}
});
result.add(new // "Actual_Work") {
CsvHoursColumn(// "Actual_Work") {
"Actual_Duration") {
public double getNodeMinutes(EVTask node) {
return node.getActualDirectTime();
}
});
result.add(new CsvColumn("Resource_Names") {
public void writeLeaf(EVTask node, int depth) {
writeStringCsvField(node.getAssignedToText());
}
});
return result;
}
use of net.sourceforge.processdash.ev.EVTaskDependency in project processdash by dtuma.
the class EVWeekReport method findUpcomingDependencies.
private void findUpcomingDependencies(TableModel tasks, Map<String, DependencyForCoord> upcomingDependencies, int taskRowNum, Date projDate, Date cutoffDate, String ignoreIndividual) {
boolean beforeCutoff = compareDates(projDate, cutoffDate) <= 0;
Collection deps = (Collection) tasks.getValueAt(taskRowNum, EVTaskList.DEPENDENCIES_COLUMN);
if (deps != null) {
for (Iterator j = deps.iterator(); j.hasNext(); ) {
EVTaskDependency d = (EVTaskDependency) j.next();
// skip unresolvable, reverse, and collab dependencies
if (d.isUnresolvable() || d.isReverse() || d.isCollab())
continue;
// skip dependencies that have been satisfied
if (!(d.getPercentComplete() < 1))
continue;
// don't warn an individual when he depends on himself
if (ignoreIndividual != null && ignoreIndividual.equals(d.getAssignedTo()))
continue;
if (d.isMisordered() || beforeCutoff) {
String taskID = d.getTaskID();
DependencyForCoord coord = upcomingDependencies.get(taskID);
if (coord == null) {
coord = new DependencyForCoord(d);
upcomingDependencies.put(taskID, coord);
}
coord.addMatchingTask(new RowNumWithDate(taskRowNum, projDate));
}
}
}
}
use of net.sourceforge.processdash.ev.EVTaskDependency in project processdash by dtuma.
the class EVWeekReport method findReverseDependencies.
private void findReverseDependencies(TableModel tasks, List<RevDependencyForCoord> reverseDependencies, Date cutoffDate, int taskRowNum) {
Collection deps = (Collection) tasks.getValueAt(taskRowNum, EVTaskList.DEPENDENCIES_COLUMN);
if (deps != null) {
for (Iterator j = deps.iterator(); j.hasNext(); ) {
EVTaskDependency d = (EVTaskDependency) j.next();
if (!d.isReverse())
continue;
if (d.isMisordered() || compareDates(d.getProjectedDate(), cutoffDate) <= 0) {
RevDependencyForCoord revDep = new RevDependencyForCoord(taskRowNum, d);
reverseDependencies.add(revDep);
}
}
}
}
use of net.sourceforge.processdash.ev.EVTaskDependency in project processdash by dtuma.
the class TaskDependencyCellEditor method getTableCellEditorComponent.
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
this.taskName = null;
this.dependencies = new ArrayList();
this.madeChange = false;
JTreeTable jTreeTable = (JTreeTable) table;
JTree jTree = jTreeTable.getTree();
TreePath path = jTree.getPathForRow(row);
EVTask node = null;
if (path != null) {
if (path.getLastPathComponent() instanceof EVTask)
node = (EVTask) path.getLastPathComponent();
this.taskName = node.getFullName();
}
if (value instanceof Collection) {
for (Iterator i = ((Collection) value).iterator(); i.hasNext(); ) {
Object obj = i.next();
if (obj instanceof EVTaskDependency) {
EVTaskDependency d = (EVTaskDependency) obj;
// reverse/collab dependencies aren't editable - skip them
if (!d.isReverse() && !d.isCollab())
dependencies.add(d);
}
}
}
// lookup the cell renderer for this row/column. It will probably
// be a task DependencyCellRenderer. If so, copy the icon it is
// displaying so we have a similar appearance.
Component rend = table.getCellRenderer(row, column).getTableCellRendererComponent(table, value, isSelected, false, row, column);
if (rend instanceof JLabel)
button.setIcon(((JLabel) rend).getIcon());
else
button.setIcon(null);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
button.doClick();
}
});
return button;
}
Aggregations