Search in sources :

Example 6 with Prop

use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.

the class HierarchyEditor method canPaste.

private boolean canPaste(String parentID, String parentPath, Vector templateChildren, DefaultMutableTreeNode cutNode) {
    if (parentID == null || parentPath == null || cutNode == null || (templateChildren != null && templateChildren.size() == 0))
        return false;
    PropertyKey cutKey = treeModel.getPropKey(useProps, cutNode.getPath());
    String cutPath = cutKey.path();
    // disallow pasting a node into itself.
    if (cutPath.equals(parentPath) || // create an illegal recursive tree.
    parentPath.startsWith(cutPath + "/") || // already lives there!)
    parentPath.equals(cutKey.getParent().path()))
        return false;
    Prop cutProp = useProps.pget(cutKey);
    String cutID = cutProp.getID();
    /* match child with parent's allowed child list, if any */
    if (templateChildren != null && !templateChildren.contains(cutID))
        return false;
    /* match parent with child's required parent list, if any */
    String cutStatus = cutProp.getStatus();
    if (cutStatus == null)
        return true;
    /* no required parent */
    int idx = cutStatus.indexOf(REQUIRED_PARENT);
    if (idx == -1)
        return true;
    /* no required parent */
    StringTokenizer st = new StringTokenizer(cutStatus.substring(idx + 1), String.valueOf(REQUIRED_PARENT));
    while (st.hasMoreElements()) /* matches required parent */
    if (parentID.equals(st.nextElement()))
        return true;
    // moved under arbitrary plain nodes
    if ((cutID.endsWith("/IndivRoot") || cutID.endsWith("/Indiv2Root")) && "".equals(parentID))
        return true;
    return false;
}
Also used : StringTokenizer(java.util.StringTokenizer) Prop(net.sourceforge.processdash.hier.Prop) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 7 with Prop

use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.

the class TeamProjectBrowser method pruneForDisplay.

/**
     * Recursively prune items so the leaves of the tree are all team project
     * roots.
     * 
     * @param hier
     *            the hierarchy to prune
     * @param node
     *            one node to examine
     * @return true if this node should be pruned from the tree, false otherwise
     */
private boolean pruneForDisplay(DashHierarchy hier, PropertyKey node) {
    Prop p = hier.pget(node);
    String templateId = p.getID();
    boolean isProject = StringUtils.hasValue(templateId);
    if (isProject && filter != null && !filter.shouldShow(node.path())) {
        return true;
    }
    for (int i = p.getNumChildren(); i-- > 0; ) {
        PropertyKey child = p.getChild(i);
        boolean shouldPrune = isProject || pruneForDisplay(hier, child);
        if (shouldPrune)
            p.removeChild(i);
    }
    return isProject == false && p.getNumChildren() == 0;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 8 with Prop

use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.

the class TeamProjectBrowser method getOrCreateProp.

private Prop getOrCreateProp(DashHierarchy hier, PropertyKey key) {
    Prop prop = hier.pget(key);
    hier.put(key, prop);
    return prop;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop)

Example 9 with Prop

use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.

the class RepairDefectCounts method run.

private static void run(DashboardContext ctx, PropertyKey pKey, String dataDirectory) {
    Prop prop = ctx.getHierarchy().pget(pKey);
    String path = pKey.path();
    String defLogName = prop.getDefectLog();
    // If this node has a defect log,
    if (defLogName != null && defLogName.length() != 0) {
        DefectLog dl = new DefectLog(dataDirectory + defLogName, path, ctx.getData());
        // read all the defects in that log, and
        Defect[] defects = dl.readDefects();
        // recalculate the associated data.
        dl.recalculateData(defects, ctx);
    }
    // recursively analyze all the children of this node.
    for (int i = 0; i < prop.getNumChildren(); i++) run(ctx, prop.getChild(i), dataDirectory);
}
Also used : Prop(net.sourceforge.processdash.hier.Prop)

Example 10 with Prop

use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.

the class ImportedDefectManager method buildWbsIdMap.

private static void buildWbsIdMap(Map result, DashHierarchy props, PropertyKey pKey, DataRepository data) {
    Prop prop = props.pget(pKey);
    String path = pKey.path();
    // Get the WBS ID of this node in the hierarchy.
    String wbsId = getWbsId(data, path);
    if (!result.containsKey(wbsId))
        result.put(wbsId, path);
    // Check to see if this node supplies subcomponent info
    Map componentInfo = getWbsSubcomponentInfo(data, path, wbsId);
    if (componentInfo != null)
        result.putAll(componentInfo);
    // recursively scan all the children of this node.
    for (int i = 0; i < prop.getNumChildren(); i++) buildWbsIdMap(result, props, prop.getChild(i), data);
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Prop (net.sourceforge.processdash.hier.Prop)30 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)16 Iterator (java.util.Iterator)4 StringTokenizer (java.util.StringTokenizer)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 Map (java.util.Map)3 Vector (java.util.Vector)3 Enumeration (java.util.Enumeration)2 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1 TreeMap (java.util.TreeMap)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1 MutableTreeNode (javax.swing.tree.MutableTreeNode)1 TreeNode (javax.swing.tree.TreeNode)1 TreePath (javax.swing.tree.TreePath)1