本文整理汇总了Java中org.openide.nodes.Children.getNodesCount方法的典型用法代码示例。如果您正苦于以下问题:Java Children.getNodesCount方法的具体用法?Java Children.getNodesCount怎么用?Java Children.getNodesCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.nodes.Children
的用法示例。
在下文中一共展示了Children.getNodesCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandOnlyChilds
import org.openide.nodes.Children; //导入方法依赖的package包/类
private void expandOnlyChilds(Node parent) {
setExpansionListenerEnabled(false);
try {
Node node = parent;
while (node != null) {
Children children = node.getChildren();
if (children.getNodesCount(true) == 1) {
node = children.getNodeAt(0);
outlineView.expandNode(node);
} else {
node = null;
}
}
} finally {
setExpansionListenerEnabled(true);
}
}
示例2: requestFocusTreeOrTable
import org.openide.nodes.Children; //导入方法依赖的package包/类
void requestFocusTreeOrTable() {
if (treeViewShowing) {
treeView.requestFocusInWindow();
} else if (tableView != null) {
tableView.getTable().requestFocusInWindow();
}
Node selectedNode = getTreeSelectedNode();
if (selectedNode == null) {
Children rootChildren = explorerManager.getRootContext().getChildren();
if (rootChildren.getNodesCount() > 0) {
try {
explorerManager.setSelectedNodes(new Node[] { rootChildren.getNodeAt(0) });
} catch (PropertyVetoException ex) {
// Ignored
}
}
}
}
示例3: createInnerPanel
import org.openide.nodes.Children; //导入方法依赖的package包/类
/**
* Creates an inner panel for this and populates
* it with the children of this node (if there are any).
*/
public SectionNodeInnerPanel createInnerPanel() {
Children children = getChildren();
if (children.getNodesCount() == 0) {
return createNodeInnerPanel();
} else {
BoxPanel boxPanel = new BoxPanel(sectionNodeView);
populateBoxPanel(boxPanel);
return boxPanel;
}
}
示例4: testNodesHaveDataObjectInLookup
import org.openide.nodes.Children; //导入方法依赖的package包/类
public void testNodesHaveDataObjectInLookup() throws Exception {
FileObject fa = FileUtil.createData(FileUtil.getConfigRoot(), "FK/A");
FileObject fb = FileUtil.createData(FileUtil.getConfigRoot(), "FK/B");
FileObject bb = FileUtil.getConfigFile("/FK");
DataFolder folder = DataFolder.findFolder(bb);
final CountDownLatch latch = new CountDownLatch(1);
FormKitDataLoader.waiter = latch;
// wake up in 3s
RequestProcessor.getDefault().post(new Runnable() {
@Override
public void run() {
latch.countDown();
}
}, 3000);
Pool.setLoader(FormKitDataLoader.class);
final Children ch = folder.getNodeDelegate().getChildren();
int cnt = ch.getNodesCount(true);
assertEquals("Two children", 2, cnt);
FileObject af = ch.getNodeAt(0).getLookup().lookup(FileObject.class);
assertEquals("The right file a", fa, af);
FileObject bf = ch.getNodeAt(1).getLookup().lookup(FileObject.class);
assertEquals("The right file b", fb, bf);
FormKitDataLoader.assertMode = false;
DataObject a = ch.getNodeAt(0).getLookup().lookup(DataObject.class);
DataObject b = ch.getNodeAt(1).getLookup().lookup(DataObject.class);
assertSame("Node is there #0", ch.getNodeAt(0), ch.getNodeAt(0).getLookup().lookup(Node.class));
assertSame("Node is there #1", ch.getNodeAt(1), ch.getNodeAt(1).getLookup().lookup(Node.class));
latch.countDown();
assertNotNull("Obj A found", a);
assertNotNull("Obj B found", b);
assertEquals("Right primary File A", fa, a.getPrimaryFile());
assertEquals("Right primary File B", fb, b.getPrimaryFile());
}