use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class EVWeekReport method getProjectKeys.
private Set<Integer> getProjectKeys(TableModel tasks, ProjectLocator loc) {
// scan the tasks in the plan and make a list of the IDs for the
// team projects they come from
Set<String> projectIDs = new HashSet();
for (int i = tasks.getRowCount(); i-- > 0; ) {
EVTask task = (EVTask) tasks.getValueAt(i, EVTaskList.EVTASK_NODE_COLUMN);
List<String> taskIds = task.getInheritedTaskIDs();
if (!taskIds.isEmpty()) {
// only use the first task ID. Subsequent IDs will be for
// master projects, which have no database representation.
String taskId = taskIds.get(0);
int colonPos = taskId.indexOf(':');
if (colonPos != -1)
projectIDs.add(taskId.substring(0, colonPos));
}
}
// now look up the keys for those projects in the database. The call
// to look up a project key will block if the project data hasn't
// been loaded yet, so this step will ensure that data has been loaded
// for all the projects in question before we proceed
Set<Integer> result = new HashSet();
for (String projectID : projectIDs) {
Integer key = loc.getKeyForProject(projectID, null);
if (key != null)
result.add(key);
}
return result;
}
use of net.sourceforge.processdash.ev.EVTask 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;
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class EVReport method createSimpleCsvColumns.
private List createSimpleCsvColumns() {
List result = new LinkedList();
result.add(new CsvColumn("Outline_Level") {
public void write(EVTask node, int depth) {
out.print(depth);
}
});
result.add(new CsvColumn("Name") {
public void write(EVTask node, int depth) {
writeStringCsvField(node.getName());
}
});
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 CsvHoursColumn("Duration") {
public double getNodeMinutes(EVTask node) {
return node.getPlanValue();
}
});
result.add(new CsvColumn("Resource_Names") {
public void writeNode(EVTask node, int depth) {
writeStringCsvField("");
}
public void writeLeaf(EVTask node, int depth) {
writeStringCsvField(node.getAssignedToText());
}
});
result.add(new CsvHoursColumn("Actual_Duration") {
public double getNodeMinutes(EVTask node) {
return node.getActualDirectTime();
}
});
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()));
}
});
return result;
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class MSProjectXmlWriter method assignTaskUid.
private void assignTaskUid(EVTask task) {
if (!tasksByObject.containsKey(task)) {
boolean shouldRegisterTaskIDs = false;
String taskKey;
List<String> taskIDs = task.getTaskIDs();
if (taskIDs != null && !taskIDs.isEmpty()) {
taskKey = taskIDs.get(0);
shouldRegisterTaskIDs = true;
} else {
taskKey = task.getFullName();
}
String keyToUse = taskKey;
EVTask other = tasksByKey.get(taskKey);
if (other != null) {
shouldRegisterTaskIDs = false;
if (other == task.getParent()) {
String who = task.getAssignedToText();
int personId = personUidMapper.getIdNoCreate(who);
if (personId > 0) {
keyToUse = taskKey = taskKey + ";" + personId;
other = tasksByKey.get(taskKey);
}
}
int num = 2;
while (other != null) {
keyToUse = taskKey + "#" + num++;
other = tasksByKey.get(keyToUse);
}
}
int id = taskUidMapper.getId(keyToUse);
tasksByObject.put(task, id);
tasksByKey.put(keyToUse, task);
if (shouldRegisterTaskIDs)
registerTaskIds(task, id);
}
}
Aggregations