本文整理汇总了Java中org.openide.explorer.view.BeanTreeView.expandNode方法的典型用法代码示例。如果您正苦于以下问题:Java BeanTreeView.expandNode方法的具体用法?Java BeanTreeView.expandNode怎么用?Java BeanTreeView.expandNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.explorer.view.BeanTreeView
的用法示例。
在下文中一共展示了BeanTreeView.expandNode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandAllNodes
import org.openide.explorer.view.BeanTreeView; //导入方法依赖的package包/类
private static void expandAllNodes (BeanTreeView btv, Node node, ExplorerManager mgr, JavaPlatform platform) {
btv.expandNode (node);
Children ch = node.getChildren();
if ( ch == Children.LEAF ) {
if (platform != null && platform.equals(node.getLookup().lookup(JavaPlatform.class))) {
try {
mgr.setSelectedNodes (new Node[] {node});
} catch (PropertyVetoException e) {
//Ignore it
}
}
return;
}
Node nodes[] = ch.getNodes( true );
for ( int i = 0; i < nodes.length; i++ ) {
expandAllNodes( btv, nodes[i], mgr, platform);
}
}
示例2: expandFirstLevel
import org.openide.explorer.view.BeanTreeView; //导入方法依赖的package包/类
private void expandFirstLevel(BeanTreeView btv) {
Node root = manager.getRootContext();
Children ch = root.getChildren();
if ( ch == Children.LEAF ) {
return;
}
Node nodes[] = ch.getNodes(true);
btv.expandNode(root);
for ( int i = 0; i < nodes.length; i++ ) {
btv.expandNode( nodes[i] );
if ( i == 0 ) {
try {
manager.setSelectedNodes( new Node[] { nodes[i] } );
}
catch ( java.beans.PropertyVetoException e ) {
// No selection for some reason
}
}
}
}
示例3: expandAllNodes
import org.openide.explorer.view.BeanTreeView; //导入方法依赖的package包/类
private static void expandAllNodes(BeanTreeView btv, Node node, ExplorerManager mgr, AndroidSdk platform) {
btv.expandNode(node);
Children ch = node.getChildren();
if (ch == Children.LEAF) {
if (platform != null && platform.equals(node.getLookup().lookup(AndroidSdk.class))) {
try {
mgr.setSelectedNodes(new Node[]{node});
} catch (PropertyVetoException e) {
//Ignore it
}
}
return;
}
Node nodes[] = ch.getNodes(true);
for (int i = 0; i < nodes.length; i++) {
expandAllNodes(btv, nodes[i], mgr, platform);
}
}
示例4: expandAllNodes
import org.openide.explorer.view.BeanTreeView; //导入方法依赖的package包/类
private static void expandAllNodes (BeanTreeView btv, Node node) {
btv.expandNode (node);
Children ch = node.getChildren();
if ( ch == Children.LEAF ) {
return;
}
Node nodes[] = ch.getNodes( true );
for ( int i = 0; i < nodes.length; i++ ) {
expandAllNodes( btv, nodes[i]);
}
}
示例5: initTreeView
import org.openide.explorer.view.BeanTreeView; //导入方法依赖的package包/类
/**
* Initializes the tree view.
*/
private void initTreeView() {
treeView = new BeanTreeView() {
{
tree.setCellRenderer(createTreeCellRenderer(tree.getCellRenderer()));
}
@Override
public void expandAll() {
// The original expandAll() doesn't work for us as it doesn't
// seem to wait for the calculation of sub-nodes.
Node root = manager.getRootContext();
expandAll(root);
// The view attempts to scroll to the expanded node
// and it does it with a delay. Hence, simple calls like
// tree.scrollRowToVisible(0) have no effect (are overriden
// later) => the dummy collapse and expansion attempts
// to work around that and keep the root node visible.
collapseNode(root);
expandNode(root);
}
/**
* Expands the whole sub-tree under the specified node.
*
* @param node root node of the sub-tree that should be expanded.
*/
private void expandAll(Node node) {
treeView.expandNode(node);
for (Node subNode : node.getChildren().getNodes(true)) {
if (!subNode.isLeaf()) {
expandAll(subNode);
}
}
}
};
treeView.setAllowedDragActions(DnDConstants.ACTION_NONE);
treeView.setAllowedDropActions(DnDConstants.ACTION_NONE);
treeView.setRootVisible(false);
add(treeView, BorderLayout.CENTER);
}