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);
}
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;
}
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);
}
}
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();
}
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());
}
Aggregations