package org.pasif.utils;
import java.io.File;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.TreeNode;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.XPP3Reader;
public class ProjectTree implements TreeWillExpandListener {
private TreeNode node;
private Document projectDocument;
private XPP3Reader reader = new XPP3Reader();
public ProjectTree() {
node = new DefaultMutableTreeNode("项目");
}
public void parseProjectFile(File file) throws Exception {
projectDocument = reader.read(file);
Element projectElement = projectDocument.getRootElement();
node = new DefaultMutableTreeNode(projectElement.selectSingleNode("./name"));
}
public TreeNode getNodes() {
return this.node;
}
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
}
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
}
public static void main(String[] args) {
}
}