Search in sources :

Example 1 with TaskDependency

use of teamdash.wbs.TaskDependency in project processdash by dtuma.

the class TaskDependencyColumn method writeDependenciesToNode.

/**
     * Save information from the given list of TaskDependency objects into the
     * ID_LIST and NAME attributes of the given node.
     */
private void writeDependenciesToNode(WBSNode node, TaskDependencyList list) {
    int pos = 0;
    if (list == null || list.isEmpty()) {
        node.setAttribute(ID_LIST_ATTR, null);
    } else {
        StringBuffer idList = new StringBuffer();
        for (Iterator i = list.iterator(); i.hasNext(); ) {
            TaskDependency d = (TaskDependency) i.next();
            idList.append(",").append(d.nodeID);
            node.setAttribute(NAME_ATTR_PREFIX + (pos++), d.displayName);
        }
        node.setAttribute(ID_LIST_ATTR, idList.substring(1));
    }
    for (int j = 0; j < 10; j++) node.setAttribute(NAME_ATTR_PREFIX + (pos++), null);
}
Also used : TaskDependency(teamdash.wbs.TaskDependency) Iterator(java.util.Iterator)

Example 2 with TaskDependency

use of teamdash.wbs.TaskDependency in project processdash by dtuma.

the class TaskDependencyColumn method readDependenciesForNode.

/**
     * Read the data contained in the ID_LIST and NAME attributes, and construct
     * a list of TaskDependency objects. If this task has no dependencies,
     * returns null.
     */
private TaskDependencyList readDependenciesForNode(WBSNode node) {
    String idList = (String) node.getAttribute(ID_LIST_ATTR);
    if (idList == null || idList.length() == 0)
        return null;
    TaskDependencyList result = new TaskDependencyList();
    String[] ids = idList.split(",");
    for (int i = 0; i < ids.length; i++) {
        String id = ids[i];
        String name = (String) node.getAttribute(NAME_ATTR_PREFIX + i);
        TaskDependency d = new TaskDependency(id, name);
        d.update(dependencySource);
        node.setAttribute(NAME_ATTR_PREFIX + i, d.displayName);
        result.add(d);
    }
    return result;
}
Also used : TaskDependency(teamdash.wbs.TaskDependency) TaskDependencyList(teamdash.wbs.TaskDependencyList)

Aggregations

TaskDependency (teamdash.wbs.TaskDependency)2 Iterator (java.util.Iterator)1 TaskDependencyList (teamdash.wbs.TaskDependencyList)1