Search in sources :

Example 16 with WBSNode

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

the class ProjectChangeListFactory method summarizeTimeChanges.

private boolean summarizeTimeChanges(Map<Integer, ProjectWbsTimeChange> timeChanges, TreeNode<Integer, WBSNodeContent> node) {
    Map<Integer, ProjectWbsTimeChange> childChanges = new HashMap();
    for (TreeNode<Integer, WBSNodeContent> child : node.getChildren()) {
        // recursively summarize time changes for this branch of the tree
        boolean childIsZero = summarizeTimeChanges(timeChanges, child);
        if (childChanges != null) {
            Integer childID = child.getID();
            ProjectWbsTimeChange childChange = timeChanges.get(childID);
            if (childChange != null)
                // collect the changes for all of our children
                childChanges.put(childID, childChange);
            else if (!childIsZero)
                // if this child has time but no time change, do not
                // consider creating a summary at the parent node level
                childChanges = null;
        }
    }
    // if we found a child with no time changes, don't summarize this node
    if (childChanges == null)
        return false;
    if (childChanges.isEmpty()) {
        // true to indicate that this node is zero as well.
        if (!node.getChildren().isEmpty())
            return true;
        // this is a leaf node. Return true if we have zero time.
        ProjectWbsTimeChange test = new ProjectWbsTimeChange(null, node.getContent(), node.getContent(), indivTimeAttrs, teamMemberNames, author, timestamp);
        return test.getNewTotalTime() == 0;
    }
    // summarization to succeed.
    if (childChanges.size() == 1) {
        Integer childID = childChanges.keySet().iterator().next();
        ProjectWbsTimeChange single = timeChanges.remove(childID);
        timeChanges.put(node.getID(), single);
        return false;
    }
    // if all of our children had time changes, this is indicative of a
    // top-down edit (such as scaling, task assignment, etc). create a
    // summarized change to represent the time changes that have occurred
    // in this branch of the tree.
    WBSNode wbsNode = node.getContent().getWBSNode();
    ProjectWbsTimeChange summarized = new ProjectWbsTimeChange(wbsNode, new ArrayList(childChanges.values()), indivTimeAttrs, teamMemberNames, author, timestamp);
    timeChanges.put(node.getID(), summarized);
    // remove the children's now-redundant changes from the change list
    for (Integer childID : childChanges.keySet()) timeChanges.remove(childID);
    return false;
}
Also used : HashMap(java.util.HashMap) WBSNodeContent(teamdash.wbs.AbstractWBSModelMerger.WBSNodeContent) ArrayList(java.util.ArrayList) WBSNode(teamdash.wbs.WBSNode)

Example 17 with WBSNode

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

the class BlameDataFactory method getParentName.

private String getParentName(WBSModel model, Integer nodeID) {
    WBSNode node = model.getNodeMap().get(nodeID);
    WBSNode parent = model.getParent(node);
    String parentName = model.getFullName(parent);
    return parentName;
}
Also used : WBSNode(teamdash.wbs.WBSNode)

Example 18 with WBSNode

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

the class ProjectWbsNodeChange method buildReportRows.

@Override
public List<ProjectChangeReportRow> buildReportRows() {
    List<ProjectChangeReportRow> result = new ArrayList();
    // add an initial row naming the parent node
    result.add(new ProjectChangeReportRow(0, true, "wbsChange", null, fmt(getNode()), true, "wbs/" + getNode().getTreeNodeID()));
    // now add rows for each of the affected children
    for (Entry<WBSNode, Object> e : children.entrySet()) {
        WBSNode child = e.getKey();
        Object changeType = e.getValue();
        if (changeType instanceof RowData) {
            RowData data = (RowData) changeType;
            result.add(new //
            ProjectChangeReportRow(//
            2, //
            false, //
            data.getIcon(), //
            data.getIconTooltip(), data.getMessageHtml(child.getName()), false, null));
            addChildRows(result, child, 2);
        } else {
            String icon = "wbsChangeNode" + changeType;
            String iconTooltip = resources.getString("Wbs.Node." + changeType + "_Icon_Tooltip");
            WbsNodeTimeReportRow row = new WbsNodeTimeReportRow(child, 2, icon, iconTooltip);
            result.add(row);
            addChildRows(result, row, child, 2);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) WBSNode(teamdash.wbs.WBSNode)

Example 19 with WBSNode

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

the class BlameHistoryDialog method setBlameComments.

private boolean setBlameComments(BlameCaretPos caretPos) {
    breadcrumb.clear();
    blameChanges.clearRows();
    dataProblems.setCurrentNode(null);
    rejectAction.setEnabled(false);
    if (caretPos == null || blameData == null)
        return false;
    if (!caretPos.isSingleCell()) {
        int numChanges = blameData.countAnnotations(caretPos);
        String message = resources.format("Message.Multiple_FMT", numChanges);
        blameChanges.showMessage(message);
        return numChanges > 0;
    }
    ModelType modelType = caretPos.getModelType();
    BlameModelData modelData = blameData.get(modelType);
    if (modelData == null)
        return false;
    Integer nodeID = caretPos.getSingleNode();
    BlameNodeData nodeData = modelData.get(nodeID);
    if (nodeData == null)
        return false;
    WBSNode node = wbsDataModel.getWBSModel().getNodeMap().get(nodeID);
    String nodePath = (node == null ? null : node.getFullName());
    String columnID = caretPos.getSingleColumn();
    if (WBSNodeColumn.COLUMN_ID.equals(columnID)) {
        breadcrumb.setPath(nodePath, null);
        blameChanges.setBlameNodeStructure(nodeData);
        dataProblems.setCurrentNode(nodeID);
        rejectAction.setEnabled(true);
        return nodeData.hasStructuralChange();
    }
    if (nodeData.getAttributes() == null)
        return false;
    for (BlameValueList val : nodeData.getAttributes().values()) {
        if (val.columnMatches(columnID)) {
            int col = wbsDataModel.findColumn(columnID);
            String columnName = wbsDataModel.getColumnName(col);
            breadcrumb.setPath(nodePath, columnName);
            blameChanges.setBlameValueList(val);
            dataProblems.setCurrentNode(nodeID);
            rejectAction.setEnabled(true);
            return true;
        }
    }
    return false;
}
Also used : BlameNodeData(teamdash.hist.BlameNodeData) BlameModelData(teamdash.hist.BlameModelData) BlameValueList(teamdash.hist.BlameValueList) ModelType(teamdash.merge.ModelType) WBSNode(teamdash.wbs.WBSNode)

Example 20 with WBSNode

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

the class BlameSelectionListener method actionPerformed.

public void actionPerformed(ActionEvent e) {
    if (!hasFocus())
        return;
    int[] selectedRows = table.getSelectedRows();
    int[] selectedColumns = table.getSelectedColumns();
    if (selectedRows.length == 0 || selectedColumns.length == 0)
        return;
    WBSModel wbsModel;
    List<String> columns = new ArrayList(selectedColumns.length);
    if (table.getModel() instanceof DataTableModel) {
        wbsModel = ((DataTableModel) table.getModel()).getWBSModel();
        for (int i = 0; i < selectedColumns.length; i++) {
            String identifier = (String) table.getColumnModel().getColumn(selectedColumns[i]).getIdentifier();
            columns.add(identifier);
        }
    } else {
        wbsModel = (WBSModel) table.getModel();
        columns.add(WBSNodeColumn.COLUMN_ID);
    }
    List<Integer> nodes = new ArrayList();
    for (int i = 0; i < selectedRows.length; i++) {
        WBSNode node = wbsModel.getNodeForRow(selectedRows[i]);
        nodes.add(node.getTreeNodeID());
    }
    BlameCaretPos caretPos = new BlameCaretPos(wbsModel.getModelType(), nodes, columns);
    if (SET_EMPTY_CARETS || blameData.countAnnotations(caretPos) > 0)
        blameData.setCaretPos(caretPos);
}
Also used : WBSModel(teamdash.wbs.WBSModel) ArrayList(java.util.ArrayList) DataTableModel(teamdash.wbs.DataTableModel) WBSNode(teamdash.wbs.WBSNode) BlameCaretPos(teamdash.hist.BlameCaretPos)

Aggregations

WBSNode (teamdash.wbs.WBSNode)40 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Change (net.sourceforge.processdash.ui.lib.autocomplete.AssignedToEditList.Change)2 WBSNodeContent (teamdash.wbs.AbstractWBSModelMerger.WBSNodeContent)2 DataTableModel (teamdash.wbs.DataTableModel)2 NumericDataValue (teamdash.wbs.NumericDataValue)2 Color (java.awt.Color)1 Date (java.util.Date)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Random (java.util.Random)1 Matcher (java.util.regex.Matcher)1 AssignedToEditList (net.sourceforge.processdash.ui.lib.autocomplete.AssignedToEditList)1 HSSFRow (org.apache.poi.hssf.usermodel.HSSFRow)1 BlameCaretPos (teamdash.hist.BlameCaretPos)1 BlameModelData (teamdash.hist.BlameModelData)1 BlameNodeData (teamdash.hist.BlameNodeData)1