Search in sources :

Example 51 with PropertyKey

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

the class PropTreeModel method getNodeForKey.

public TreeNode getNodeForKey(DashHierarchy props, PropertyKey key) {
    if (key == null)
        return null;
    if (rootKey.equals(key))
        return (TreeNode) getRoot();
    PropertyKey parentKey = key.getParent();
    int numChildren = props.getNumChildren(parentKey);
    TreeNode parent = getNodeForKey(props, parentKey);
    if (parent == null || parent.getChildCount() != numChildren)
        return null;
    PropertyKey childKey;
    for (int i = numChildren; i-- > 0; ) {
        childKey = props.getChildKey(parentKey, i);
        if (childKey.equals(key))
            return parent.getChildAt(i);
    }
    return null;
}
Also used : TreeNode(javax.swing.tree.TreeNode) MutableTreeNode(javax.swing.tree.MutableTreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 52 with PropertyKey

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

the class ScriptButton method updateAll.

private void updateAll() {
    String clickPref = Settings.getVal(DROP_DOWN_BEHAVIOR_PREF);
    clickOpensDefault = "true".equals(clickPref);
    setMainButtonBehavior(clickOpensDefault ? RUN_FIRST_MENU_OPTION : OPEN_DROP_DOWN_MENU);
    PropertyKey currentPhase = parent.getActiveTaskModel().getNode();
    path = (currentPhase == null ? null : currentPhase.path());
    setPaths(ScriptEnumerator.getScripts(parent, currentPhase));
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 53 with PropertyKey

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

the class TemplateLoader method createProcessRoot.

/**
     * The templates hierarchy needs a root.  However, that root cannot
     * be read from any file because its children are determined dynamically
     * by searching classpaths and template directories.  Once the children
     * are loaded from their various locations, this routine dynamically
     * builds their parent.
     *
     * NOTE: currently, the children are placed in alphabetical order.
     */
private static void createProcessRoot(DashHierarchy templates) {
    Enumeration nodes = templates.keys();
    Vector processes = new Vector();
    PropertyKey key, parent;
    while (nodes.hasMoreElements()) {
        key = (PropertyKey) nodes.nextElement();
        parent = key.getParent();
        if (parent != null && parent.equals(PropertyKey.ROOT))
            processes.add(key);
    }
    if (processes.size() > 0) {
        Collections.sort(processes);
        Prop p = new Prop();
        while (processes.size() > 0) p.addChild((PropertyKey) processes.remove(0), -1);
        templates.put(PropertyKey.ROOT, p);
    }
}
Also used : Enumeration(java.util.Enumeration) Prop(net.sourceforge.processdash.hier.Prop) Vector(java.util.Vector) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 54 with PropertyKey

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

the class TemplateInfo method addSafeNamesOfProcessPhases.

public static final void addSafeNamesOfProcessPhases(HierarchyNodeMapper m) {
    if (TEMPLATES == null)
        // about the phases in various metrics collection frameworks.
        return;
    for (Iterator i = TEMPLATES.entrySet().iterator(); i.hasNext(); ) {
        Map.Entry e = (Map.Entry) i.next();
        PropertyKey key = (PropertyKey) e.getKey();
        Prop prop = (Prop) e.getValue();
        if (PROCESS_PHASE_STATUS.equals(prop.getStatus())) {
            String phaseName = Prop.unqualifiedName(key.name());
            m.addSafeName(phaseName);
        }
    }
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) Iterator(java.util.Iterator) Map(java.util.Map) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 55 with PropertyKey

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

the class OpenDefectDialog method openNewDefectDialog.

private void openNewDefectDialog(DefectLogID defectLog, String path) {
    ProcessDashboard dash = getDash();
    PropertyKey task = dash.getHierarchy().findClosestKey(path);
    DefectDialog dlg = new DefectDialog(dash, defectLog.filename, defectLog.path, task);
    if (!defectLog.path.equals(dash.getCurrentPhase()))
        dlg.setTitle(defectLog.path.path());
}
Also used : ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Aggregations

PropertyKey (net.sourceforge.processdash.hier.PropertyKey)125 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)40 Prop (net.sourceforge.processdash.hier.Prop)16 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)10 SimpleData (net.sourceforge.processdash.data.SimpleData)7 ArrayList (java.util.ArrayList)6 Enumeration (java.util.Enumeration)6 IOException (java.io.IOException)5 Iterator (java.util.Iterator)5 StringTokenizer (java.util.StringTokenizer)5 TreePath (javax.swing.tree.TreePath)5 ListData (net.sourceforge.processdash.data.ListData)5 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)5 List (java.util.List)4 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)4 HierarchyAlterer (net.sourceforge.processdash.hier.HierarchyAlterer)4 HierarchyAlterationException (net.sourceforge.processdash.hier.HierarchyAlterer.HierarchyAlterationException)4 DefectLogID (net.sourceforge.processdash.log.defects.DefectLogID)4 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)4 Point (java.awt.Point)3