Example usage for javax.swing.tree DefaultMutableTreeNode isNodeDescendant

List of usage examples for javax.swing.tree DefaultMutableTreeNode isNodeDescendant

Introduction

In this page you can find the example usage for javax.swing.tree DefaultMutableTreeNode isNodeDescendant.

Prototype

public boolean isNodeDescendant(DefaultMutableTreeNode anotherNode) 

Source Link

Document

Returns true if anotherNode is a descendant of this node -- if it is this node, one of this node's children, or a descendant of one of this node's children.

Usage

From source file:streamme.visuals.Main.java

public void addToPlaylist(DefaultMutableTreeNode node, int listIdx, boolean recursive) {
    DefaultMutableTreeNode leaf = node.getFirstLeaf();
    while (node.isNodeDescendant(leaf)) {
        DataNode dn = (DataNode) leaf.getUserObject();
        javax.swing.tree.TreeNode[] tree = leaf.getPath();
        String path = StreamMe.OPTIONS.getOutputPath();
        for (int i = 1; i < tree.length; i++) {
            path += "\\" + ((DataNode) ((DefaultMutableTreeNode) tree[i]).getUserObject()).getName();
        }//from w  w w . j  av  a2  s.co  m
        PlaylistManager.get().addToPlaylist(listIdx, dn.toFileLink(path));
        leaf = leaf.getNextLeaf();
    }
}