use of net.sourceforge.processdash.hier.Prop 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.Prop in project processdash by dtuma.
the class DataExtractionScaffold method openDataFiles.
private void openDataFiles(String property_directory, PropertyKey key) throws FileNotFoundException, IOException, InvalidDatafileFormat {
Prop val = hierarchy.pget(key);
String id = val.getID();
String dataFile = val.getDataFile();
if (shouldLoadDataFile(id, dataFile)) {
// System.out.println("opening datafile for " + key.path());
data.openDatafile(key.path(), property_directory + dataFile);
}
if (!shouldPruneDataLoad(id)) {
for (int i = 0; i < hierarchy.getNumChildren(key); i++) {
openDataFiles(property_directory, hierarchy.getChildKey(key, i));
}
}
}
use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class HierarchyEditor method moveUp.
private void moveUp(DefaultMutableTreeNode node) {
if (node == null || node == (DefaultMutableTreeNode) treeModel.getRoot())
return;
// Check to make certain that the move is legal.
Object[] path = node.getPath();
PropertyKey key = treeModel.getPropKey(useProps, path);
if (!moveUpIsLegal(key))
return;
// First, make the change in the properties object.
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
int index = parentNode.getIndex(node);
PropertyKey parentKey = key.getParent();
Prop parentProp = useProps.pget(parentKey);
parentProp.moveChildUp(index);
// Next, make the change in the tree model.
treeModel.useTreeModelListener(false);
parentNode.insert(node, index - 1);
treeModel.useTreeModelListener(true);
treeModel.nodeStructureChanged(parentNode);
setDirty(true);
}
use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class HierarchyEditor method updateTemplateMenu.
public void updateTemplateMenu(Vector tList, String id) {
Prop p;
int idx;
JMenu addTemplateMenu = this.addTemplateMenu;
JMenuItem menuItem;
String val;
PropertyKey tKey = PropertyKey.ROOT;
boolean enableMenu = false;
// clear the JMenu
addTemplateMenu.removeAll();
// System.out.println("Update:" + id);
for (int ii = 0; ii < templates.getNumChildren(tKey); ii++) {
p = templates.pget(templates.getChildKey(tKey, ii));
// System.out.println("Update: testing " +p.getID());
if ((tList != null) && (!tList.contains(p.getID())))
continue;
// System.out.println("Update: test2 " +p.getStatus());
val = p.getStatus();
if ((val != null) && ((idx = val.indexOf(REQUIRED_PARENT)) >= 0)) {
//check for reqd parent
if (id == null)
continue;
boolean found = false;
StringTokenizer st = new StringTokenizer(val.substring(idx + 1), String.valueOf(REQUIRED_PARENT));
while (st.hasMoreElements() && !found) found = id.equals(st.nextElement());
if (!found)
continue;
}
val = templates.getChildName(tKey, ii);
String display = Prop.unqualifiedName(val);
// System.out.println("Update: passed " + val);
enableMenu = true;
if (addTemplateMenu.getItemCount() > 18)
addTemplateMenu = (JMenu) addTemplateMenu.add(new JMenu(resource.getDlgString("More")), 0);
menuItem = addTemplateMenu.add(new JMenuItem(display));
menuItem.addActionListener(new AddTemplateAction(val));
}
this.addTemplateMenu.setEnabled(enableMenu);
}
use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class PropTreeModel method reload.
private void reload(DashHierarchy props, DefaultMutableTreeNode node, PropertyKey key) {
DefaultMutableTreeNode child;
int childIndex = 0;
//set the current node name
Prop value = props.pget(key);
if (!key.name().equals(node.getUserObject())) {
node.setUserObject(key.name());
nodeChanged(node);
}
int numPropChildren = value.getNumChildren();
while (numPropChildren > childIndex) {
if (getChildCount(node) <= childIndex) {
child = new DefaultMutableTreeNode("changeMeLater");
insertNodeInto(child, node, childIndex);
} else
child = (DefaultMutableTreeNode) getChild(node, childIndex);
reload(props, child, props.getChildKey(key, childIndex));
childIndex++;
}
while (getChildCount(node) > numPropChildren) removeNodeFromParent((MutableTreeNode) getChild(node, getChildCount(node) - 1));
}
Aggregations