Search in sources :

Example 56 with PropertyKey

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

the class DefectLogEditor method rename.

public static void rename(DashHierarchy oldProps, DashHierarchy newProps, String oldPrefix, String newPrefix, ProcessDashboard dashboard) {
    PropertyKey oldKey = PropertyKey.fromPath(oldPrefix);
    String oldLogName = oldProps.pget(oldKey).getDefectLog();
    if (oldLogName != null && oldLogName.length() > 0) {
        // don't need to worry.
        return;
    }
    DefectLogID oldLog = oldProps.defectLog(oldKey, dashboard.getDirectory());
    if (oldLog == null) {
        // we don't need to worry.
        return;
    }
    String logPath = oldLog.path.path();
    oldPrefix = oldPrefix.substring(logPath.length() + 1);
    PropertyKey newKey = PropertyKey.fromPath(newPrefix);
    DefectLogID newLog = newProps.defectLog(newKey, dashboard.getDirectory());
    if (newLog == null) {
        // Should this ever happen???
        return;
    }
    String newLogPath = newLog.path.path();
    newPrefix = newPrefix.substring(newLogPath.length() + 1);
    if (oldPrefix.equals(newPrefix)) {
        // the node owning the defect log, we don't need to worry.
        return;
    }
    if (!oldLog.filename.equals(newLog.filename)) {
        // Should this ever happen???
        return;
    }
    DefectLog log = new DefectLog(newLog.filename, newLogPath, null);
    log.performInternalRename(oldPrefix, newPrefix);
}
Also used : DefectLog(net.sourceforge.processdash.log.defects.DefectLog) DefectLogID(net.sourceforge.processdash.log.defects.DefectLogID) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 57 with PropertyKey

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

the class OpenTimeLogEditor method getAugmentedHierarchy.

private DashHierarchy getAugmentedHierarchy() {
    // create a copy of the standard hierarchy
    DashHierarchy result = new DashHierarchy(getPSPProperties().dataPath);
    result.copy(getPSPProperties());
    // find the leaves in the hierarchy, and augment each leaf with
    // supplementary children provided from data element specifications
    DataRepository data = getDataRepository();
    Enumeration<PropertyKey> leaves = result.getLeaves(PropertyKey.ROOT);
    while (leaves.hasMoreElements()) {
        PropertyKey leaf = leaves.nextElement();
        augmentHierarchy(result, leaf, data);
    }
    return result;
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 58 with PropertyKey

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

the class OpenTimeLogEditor method augmentHierarchy.

private void augmentHierarchy(DashHierarchy hier, PropertyKey parentNode, Element parentXml) {
    Prop parentProp = (Prop) hier.get(parentNode);
    if (parentProp == null)
        return;
    for (Element childXml : XMLUtils.getChildElements(parentXml)) {
        String childName = childXml.getAttribute("name");
        PropertyKey childNode = new PropertyKey(parentNode, childName);
        parentProp.addChild(childNode, -1);
        hier.put(childNode, new Prop());
        augmentHierarchy(hier, childNode, childXml);
    }
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) Element(org.w3c.dom.Element) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 59 with PropertyKey

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

the class TimeLogEditor method narrowToPath.

public void narrowToPath(String path) {
    PropertyKey key = useProps.findExistingKey(path);
    if (key == null)
        throw new IllegalArgumentException("Path not found");
    treeModel.setRootKey(key);
    treeModel.reload(useProps);
    tree.setRootVisible(!PropertyKey.ROOT.equals(key));
    expandRoot();
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 60 with PropertyKey

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

the class DefectLogEditor method getSelectedPath.

String getSelectedPath() {
    DefaultMutableTreeNode selected = getSelectedNode();
    if (selected == null)
        return "";
    PropertyKey key = treeModel.getPropKey(useProps, selected.getPath());
    return (key == null ? "" : key.path());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) 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