Package

Source Code of TopicSpaceTree

import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import org.apache.ws.notification.topics.Topic;
import java.util.Iterator;
/**
*
* @author  Stefan Lischke
*/
public class TopicSpaceTree {
    private JTree tree;
    /** Creates a new instance of TopicSpaceTree */
    public TopicSpaceTree(PubSubWSmanager pman) { 
        DefaultMutableTreeNode root = new DefaultMutableTreeNode("TopicSpace");

        Iterator rootit =pman.topicSpace.topicIterator();
        while(rootit.hasNext()){
            Topic t = (Topic)rootit.next();
            root.add(recurse(t));
        }
        tree = new JTree(root);
//        tree.setRootVisible(true);       
    }
       
    private DefaultMutableTreeNode recurse(Topic t){
        DefaultMutableTreeNode tn = new DefaultMutableTreeNode(t);
        Iterator it = t.topicIterator();
       // System.out.println("topic "+t.getName());
        while(it.hasNext()){
            Topic tc = (Topic)it.next();
            tn.add(recurse(tc));
        }
        return tn;
    }
   
    public JTree getTree(){
        return tree;
    }
    /*
    public class TopicTreeNode extends DefaultMutableTreeNode{
        public TopicTreeNode(Topic t){
            super.()
        }
    }*/
TOP

Related Classes of TopicSpaceTree

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.