当前位置: 首页>>代码示例>>Java>>正文


Java TreeNode.children方法代码示例

本文整理汇总了Java中javax.swing.tree.TreeNode.children方法的典型用法代码示例。如果您正苦于以下问题:Java TreeNode.children方法的具体用法?Java TreeNode.children怎么用?Java TreeNode.children使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.tree.TreeNode的用法示例。


在下文中一共展示了TreeNode.children方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTreePath

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
public static TreePath getTreePath(JTreeOperator treeOperator, String targetNode, NodeConverter converter) {
    Stack<TreeNode> lifo = new Stack<TreeNode>();        
    lifo.push((TreeNode) treeOperator.getRoot());
    while(!lifo.isEmpty()) {
        TreeNode actNode = lifo.pop();
        if(targetNode.equals(converter.getDisplayName(actNode))) {
            List<TreeNode> path = new LinkedList<TreeNode>();
            path.add(actNode);
            actNode = actNode.getParent();
            while(actNode!=null) {
                path.add(0,actNode);
                actNode = actNode.getParent();
            }
            TreeNode[] res = path.toArray(new TreeNode[path.size()]);                
            return new TreePath(res);
        }
        final Enumeration children = actNode.children();            
        while(children.hasMoreElements()) {
            lifo.add((TreeNode)children.nextElement());
        }            
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:BeansTestCase.java

示例2: OntoTreeExpand

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
private void OntoTreeExpand( TreePath parent, boolean expand, Integer CurrNodeLevel, Integer Up2TreeLevel) {

    TreeNode node = (TreeNode)parent.getLastPathComponent();
    if (CurrNodeLevel >= Up2TreeLevel) {
    	return;
    }
    if (node.getChildCount() >= 0) {
        for (Enumeration<?> e=node.children(); e.hasMoreElements();) {
            TreeNode n = (TreeNode) e.nextElement();
            TreePath path = parent.pathByAddingChild(n);
            OntoTreeExpand(path, expand, CurrNodeLevel+1, Up2TreeLevel);
        }
    }    
    // Expansion or collapse must be done bottom-up
    if (expand) {
        ontoTree.expandPath(parent);
    } else {
    	ontoTree.collapsePath(parent);
    }
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:OntologyTab.java

示例3: OntoTreeExpand

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
/**
    * 
    * @param parent
    * @param expand
    * @param CurrNodeLevel
    * @param Up2TreeLevel
    */
private void OntoTreeExpand(TreePath parent, boolean expand, Integer CurrNodeLevel, Integer Up2TreeLevel) {
   
       TreeNode node = (TreeNode)parent.getLastPathComponent();
       if (CurrNodeLevel >= Up2TreeLevel) {
       	return;
       }
       if (node.getChildCount() >= 0) {
           for ( Enumeration<?> e=node.children(); e.hasMoreElements(); ) {
               TreeNode n = (TreeNode) e.nextElement();
               TreePath path = parent.pathByAddingChild(n);
               OntoTreeExpand(path, expand, CurrNodeLevel+1, Up2TreeLevel);
           }
       }    
       // Expansion or collapse must be done bottom-up
       if (expand) {
       	jTreeOntology.expandPath(parent);
       } else {
       	jTreeOntology.collapsePath(parent);
       }
   }
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:28,代码来源:BaseAgents.java

示例4: projectTreeExpand

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
/**
 * Project tree expand.
 *
 * @param parent the parent
 * @param expand the expand
 * @param currNodeLevel the current node level
 * @param up2TreeLevel the up2 tree level
 */
private void projectTreeExpand(TreePath parent, boolean expand, Integer currNodeLevel, Integer up2TreeLevel) {

	TreeNode node = (TreeNode) parent.getLastPathComponent();
	if (currNodeLevel >= up2TreeLevel) {
		return;
	}
	if (node.getChildCount() >= 0) {
		for (@SuppressWarnings("rawtypes")
		Enumeration e = node.children(); e.hasMoreElements();) {
			TreeNode n = (TreeNode) e.nextElement();
			TreePath path = parent.pathByAddingChild(n);
			projectTreeExpand(path, expand, currNodeLevel + 1, up2TreeLevel);
		}
	}
	// Expansion or collapse must be done bottom-up
	if (expand) {
		jTreeProject.expandPath(parent);
	} else {
		jTreeProject.collapsePath(parent);
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:30,代码来源:ProjectWindow.java

示例5: optionTreeExpand

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
/**
 * Option tree expand.
 *
 * @param parent the parent
 * @param expand the expand
 * @param currNodeLevel the curr node level
 * @param up2TreeLevel the up2 tree level
 */
private void optionTreeExpand(TreePath parent, boolean expand, Integer currNodeLevel, Integer up2TreeLevel) {
   
       TreeNode node = (TreeNode)parent.getLastPathComponent();
       if (currNodeLevel >= up2TreeLevel) {
       	return;
       }
       if (node.getChildCount() >= 0) {
           for ( @SuppressWarnings("rawtypes") Enumeration e=node.children(); e.hasMoreElements(); ) {
               TreeNode n = (TreeNode) e.nextElement();
               TreePath path = parent.pathByAddingChild(n);
               optionTreeExpand(path, expand, currNodeLevel+1, up2TreeLevel);
           }
       }    
       // Expansion or collapse must be done bottom-up
       if (expand) {
       	jTreeOptions.expandPath(parent);
       } else {
       	jTreeOptions.collapsePath(parent);
       }
   }
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:29,代码来源:OptionDialog.java

示例6: expandAll

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
private void expandAll(JTree tree, TreePath path, boolean expand) {
    TreeNode node = (TreeNode) path.getLastPathComponent();

    if (node.getChildCount() >= 0) {
        Enumeration enumeration = node.children();
        while (enumeration.hasMoreElements()) {
            TreeNode n = (TreeNode) enumeration.nextElement();
            TreePath p = path.pathByAddingChild(n);

            expandAll(tree, p, expand);
        }
    }

    if (expand) {
        tree.expandPath(path);
    } else {
        tree.collapsePath(path);
    }
}
 
开发者ID:HML-UnBBayes,项目名称:hml,代码行数:20,代码来源:TreePanel.java

示例7: expandOrCollapseAll

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
private void expandOrCollapseAll(TreePath parent, boolean expand) {
    TreeNode node = (TreeNode) parent.getLastPathComponent();
    if (node.getChildCount() > 0) {
        for (Enumeration<? extends TreeNode> e = node.children(); e.hasMoreElements();) {
            TreeNode n = e.nextElement();
            TreePath path = parent.pathByAddingChild(n);
            expandOrCollapseAll(path, expand);
        }
    }
    if (expand) {
        tree.expandPath(parent);
    } else {
        tree.collapsePath(parent);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:TreeView.java

示例8: expandAll

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
public static void expandAll(Tree tree, TreePath parent, boolean expand) {
    TreeNode node = (TreeNode) parent.getLastPathComponent();
    if (node.getChildCount() >= 0) {
        for (Enumeration e = node.children() ; e.hasMoreElements() ; ) {
            TreeNode n = (TreeNode) e.nextElement();
            TreePath path = parent.pathByAddingChild(n);
            expandAll(tree, path, expand);
        }
    }
    if (expand) {
        tree.expandPath(parent);
    } else {
        tree.collapsePath(parent);
    }
}
 
开发者ID:semihunaldi,项目名称:IdeaCurrency,代码行数:16,代码来源:Util.java

示例9: expandChildPathsAndSelectParent

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
private void expandChildPathsAndSelectParent(TreeNode parent)
{
	for( Enumeration<?> en = parent.children(); en.hasMoreElements(); )
	{
		TreeNode child = (TreeNode) en.nextElement();
		tree.expandPath(new TreePath(model.getPathToRoot(child)));
	}

	TreePath parentPath = new TreePath(model.getPathToRoot(parent));
	tree.expandPath(parentPath);
	tree.setSelectionPath(parentPath);
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:ExpressionBuilderFinder.java

示例10: expandTreeRecursively

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
private static void expandTreeRecursively(JTree tree, TreePath parent) {
    tree.expandPath(parent);
    TreeNode node = (TreeNode) parent.getLastPathComponent();
    if (node.getChildCount() >= 0) {
        for (Enumeration e = node.children(); e.hasMoreElements(); ) {
            TreeNode n = (TreeNode) e.nextElement();
            TreePath path = parent.pathByAddingChild(n);
            expandTreeRecursively(tree, path);
        }
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:12,代码来源:SwingUtils.java

示例11: expandAll

import javax.swing.tree.TreeNode; //导入方法依赖的package包/类
private void expandAll(final JTree tree, final TreePath parent) {
  final TreeNode node = (TreeNode) parent.getLastPathComponent();
  if (node.getChildCount() >= 0) {
    for (@SuppressWarnings("rawtypes")
    final Enumeration e = node.children(); e.hasMoreElements();) {
      final TreeNode n = (TreeNode) e.nextElement();
      final TreePath path = parent.pathByAddingChild(n);
      this.expandAll(tree, path);
    }
  }
  tree.expandPath(parent);
  // tree.collapsePath(parent);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:14,代码来源:MappingWizard.java


注:本文中的javax.swing.tree.TreeNode.children方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。