Package org.pasif.utils

Source Code of org.pasif.utils.ProjectTree

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) {
    }
}
TOP

Related Classes of org.pasif.utils.ProjectTree

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.