Search in sources :

Example 1 with TaskDependencyList

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

the class TaskDependencyColumn method setValueAt.

public void setValueAt(Object aValue, WBSNode node) {
    TaskDependencyList list;
    if (node.getIndentLevel() == 0 || node.isReadOnly())
        return;
    else if (aValue instanceof TaskDependencyList || aValue == null)
        list = (TaskDependencyList) aValue;
    else if (aValue instanceof String) {
        list = TaskDependencyList.valueOf((String) aValue);
        needsRecalc = true;
    } else
        return;
    node.setAttribute(TASK_LIST_ATTR, list);
    writeDependenciesToNode(node, list);
}
Also used : TaskDependencyList(teamdash.wbs.TaskDependencyList)

Example 2 with TaskDependencyList

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

the class TaskDependencyColumn method recalculate.

/** Recalculate data for a node and its descendants. Return true if changes
     * were made. */
private boolean recalculate(WBSModel wbs, WBSNode n) {
    boolean result = false;
    // retrieve the list of TaskDependencies for this node.
    TaskDependencyList list = (TaskDependencyList) n.getAttribute(TASK_LIST_ATTR);
    if (list != null) {
        // if that list exists, update each of its tasks.
        if (list.update(dependencySource))
            result = true;
    } else {
        // the list doesn't exist. Try recalculating it.
        list = readDependenciesForNode(n);
        if (list != null) {
            // the list wasn't there, but it needs to be. Save it.
            n.setAttribute(TASK_LIST_ATTR, list);
            result = true;
        }
    }
    WBSNode[] children = wbs.getChildren(n);
    for (int i = 0; i < children.length; i++) {
        if (recalculate(wbs, children[i]))
            result = true;
    }
    return result;
}
Also used : TaskDependencyList(teamdash.wbs.TaskDependencyList) WBSNode(teamdash.wbs.WBSNode)

Example 3 with TaskDependencyList

use of teamdash.wbs.TaskDependencyList 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)

Example 4 with TaskDependencyList

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

the class TaskDependencyColumn method getValueAt.

public Object getValueAt(WBSNode node) {
    TaskDependencyList list = (TaskDependencyList) node.getAttribute(TASK_LIST_ATTR);
    Object result = list;
    if (node.getIndentLevel() == 0 || node.isReadOnly())
        result = new ReadOnlyValue(result);
    return result;
}
Also used : ReadOnlyValue(teamdash.wbs.ReadOnlyValue) TaskDependencyList(teamdash.wbs.TaskDependencyList)

Aggregations

TaskDependencyList (teamdash.wbs.TaskDependencyList)4 ReadOnlyValue (teamdash.wbs.ReadOnlyValue)1 TaskDependency (teamdash.wbs.TaskDependency)1 WBSNode (teamdash.wbs.WBSNode)1