Search in sources :

Example 21 with Prop

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

the class HierarchyEditor method moveUpIsLegal.

private boolean moveUpIsLegal(PropertyKey key) {
    Prop prop = useProps.pget(key);
    if (!isMoveable(prop.getStatus()))
        return false;
    PropertyKey parentKey = key.getParent();
    Prop parentProp = useProps.pget(parentKey);
    int pos = -1;
    for (int i = parentProp.getNumChildren(); i-- > 0; ) if (key.equals(parentProp.getChild(pos = i)))
        break;
    if (pos < 1)
        return false;
    PropertyKey siblingKey = parentProp.getChild(pos - 1);
    Prop siblingProp = useProps.pget(siblingKey);
    return isMoveable(siblingProp.getStatus());
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 22 with Prop

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

the class ExternalResourceArchiverXMLv1 method getTeamProcessIDsInUse.

/** Get the IDs of all team processes in use by this dashboard dataset */
private Set<String> getTeamProcessIDsInUse() {
    Set<String> templateIDs = getTeamProcessIDs();
    Set<String> result = new HashSet<String>();
    DashHierarchy hier = dashboardContext.getHierarchy();
    for (Iterator i = hier.values().iterator(); i.hasNext(); ) {
        Prop prop = (Prop) i.next();
        String oneID = prop.getID();
        if (oneID != null && oneID.endsWith("Root")) {
            int slashPos = oneID.indexOf('/');
            if (slashPos != -1) {
                String oneProcessID = oneID.substring(0, slashPos);
                if (templateIDs.contains(oneProcessID))
                    result.add(oneProcessID);
            }
        }
    }
    return result;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) Iterator(java.util.Iterator) HashSet(java.util.HashSet)

Example 23 with Prop

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

the class DefectLogEditor method reload.

protected void reload() {
    PropertyKey pKey;
    Prop prop;
    DefectLog dl;
    String defLogName;
    Defect[] defects;
    defectLogs.clear();
    Enumeration pKeys = useProps.keys();
    while (pKeys.hasMoreElements()) {
        pKey = (PropertyKey) pKeys.nextElement();
        prop = useProps.pget(pKey);
        defLogName = prop.getDefectLog();
        if (defLogName != null && defLogName.length() != 0) {
            dl = new DefectLog(dashboard.getDirectory() + defLogName, pKey.path(), data);
            defects = dl.readDefects();
            defectLogs.put(pKey, new DefectListID(pKey, dl, defects));
        }
    }
}
Also used : DefectLog(net.sourceforge.processdash.log.defects.DefectLog) Enumeration(java.util.Enumeration) Prop(net.sourceforge.processdash.hier.Prop) Defect(net.sourceforge.processdash.log.defects.Defect) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 24 with Prop

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

the class DefectLogEditor method hasDefLog.

private boolean hasDefLog(PropertyKey phase) {
    if (phase == null)
        return false;
    Prop prop = useProps.pget(phase);
    String defLogName = prop.getDefectLog();
    return (defLogName != null && defLogName.length() > 0);
}
Also used : Prop(net.sourceforge.processdash.hier.Prop)

Example 25 with Prop

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

the class DefectAnalyzer method run.

/** Perform some analysis task on all the defects under a given node
     *  in the hierarchy.
     *
     * @param props The PSPProperties object to be walked.
     * @param pKey  The PropertyKey of the node in the hierarchy where the
     *    analysis should start.
     * @param includeChildren if true, the node and all its children will be
     *    analyzed;  if false, only the node itself will be visited.
     * @param t An analysis task to perform.  Every defect encountered will
     *    be passed to the task, in turn.
     */
public static void run(DashHierarchy props, PropertyKey pKey, boolean includeChildren, Task t) {
    Prop prop = props.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, null);
        // read all the defects in that log, and
        Defect[] defects = dl.readDefects();
        for (int d = 0; d < defects.length; d++) if (// pass them to the analyzer task.
        defects[d] != null)
            t.analyze(path, defects[d]);
    }
    // recursively analyze all the children of this node.
    if (includeChildren)
        for (int i = 0; i < prop.getNumChildren(); i++) run(props, prop.getChild(i), includeChildren, t);
}
Also used : Prop(net.sourceforge.processdash.hier.Prop)

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