本文整理汇总了Java中org.openide.nodes.ChildFactory类的典型用法代码示例。如果您正苦于以下问题:Java ChildFactory类的具体用法?Java ChildFactory怎么用?Java ChildFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChildFactory类属于org.openide.nodes包,在下文中一共展示了ChildFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTreeChildren
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
private static Children createTreeChildren(final DependencyNode dn, final Lookup tcLookup) {
if (!dn.hasChildren()) {
return Children.LEAF;
}
return Children.create(new ChildFactory<DependencyNode>() {
@Override
protected Node createNodeForKey(DependencyNode key) {
return new TreeNode(key, tcLookup);
}
@Override
protected boolean createKeys(List<DependencyNode> toPopulate) {
toPopulate.addAll(dn.getChildren());
return true;
}
}, false);
}
示例2: StructureItemNode
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
public StructureItemNode(final StructureItem item) {
super(Children.create(new ChildFactory<StructureItem>() {
@Override protected boolean createKeys(List<StructureItem> toPopulate) {
toPopulate.addAll(item.getNestedItems());
return true;
}
@Override
protected Node createNodeForKey(StructureItem key) {
return new StructureItemNode(key);
}
}, false), Lookups.fixed(new OpenCookie() {
@Override public void open() {
ElementHandle elementHandle = item.getElementHandle();
FileObject file = elementHandle != null ? elementHandle.getFileObject() : null;
if (file != null) {
UiUtils.open(file, (int) item.getPosition());
}
}
}));
this.item = item;
setDisplayName(item.getName());
}
示例3: makeChildren
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
private static Children makeChildren(final HudsonJob job) {
if (job.getColor() == Color.secured) {
return Children.LEAF;
}
return Children.create(new ChildFactory<Object>() {
final Object WORKSPACE = new Object();
protected @Override boolean createKeys(List<Object> toPopulate) {
if (job.getRemoteWorkspace() != null) {
toPopulate.add(WORKSPACE);
}
for (HudsonJobBuild b : job.getBuilds()) {
// Processing one build at a time, make sure its result is known (blocking call).
b.getResult();
toPopulate.add(b);
}
return true;
}
protected @Override Node createNodeForKey(Object key) {
if (key == WORKSPACE) {
return new HudsonWorkspaceNode(job);
} else {
return new HudsonJobBuildNode((HudsonJobBuild) key);
}
}
}, true);
}
示例4: MatDefNode
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
public MatDefNode(final Lookup lookup) {
super(Children.create(new ChildFactory<TechniqueBlock>() {
@Override
protected boolean createKeys(List<TechniqueBlock> list) {
list.addAll(lookup.lookup(MatDefBlock.class).getTechniques());
return true;
}
@Override
protected Node createNodeForKey(TechniqueBlock key) {
return new TechniqueNode(lookup, key);
}
}, true),lookup);
setName(lookup.lookup(MatDefBlock.class).getName());
}
示例5: constructor
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
/** To be called in constructor only. */
private void constructor() {
ic.add(ic); // needed for D&D linking between viewers
initComponents();
em = new ExplorerManager();
rootDefault = new AbstractNode(Children.LEAF);
rootDefault.setDisplayName("root");
root = rootDefault;
em.setRootContext(root);
Outline outline = table.getOutline();
outline.setRootVisible(false);
outline.setPopupUsedFromTheCorner(true);
outline.setFullyNonEditable(true);
outline.setDefaultRenderer(Node.Property.class, new CustomOutlineCellRenderer());
TableColumnModel columnModel = outline.getColumnModel();
ETableColumn column = (ETableColumn) columnModel.getColumn(0);
((ETableColumnModel) columnModel).setColumnHidden(column, true);
// listening for data in our lookup
dataResult = lkp.lookupResult(ChildFactory.class);
dataResult.addLookupListener(this);
}
示例6: createListChildren
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
private static Children createListChildren(final Collection<DependencyNode> dns, final Lookup tcLookup) {
return Children.create(new ChildFactory<DependencyNode>() {
@Override
protected Node createNodeForKey(DependencyNode key) {
return new ListNode(key, tcLookup);
}
@Override
protected boolean createKeys(List<DependencyNode> toPopulate) {
toPopulate.addAll(dns);
return true;
}
}, false);
}
示例7: AddDependencyUI
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
public AddDependencyUI(String libDef) {
initComponents();
lblDescription.setText(NbBundle.getMessage(AddDependencyUI.class, "LBL_Description", libDef));//NOI18N
addButton = new JButton(NbBundle.getMessage(AddDependencyUI.class, "BTN_Add"));//NOI18N
addButton.setEnabled(false);
Node openProjectsNode = new AbstractNode(Children.create(new ChildFactory<Project>() {
protected @Override boolean createKeys(List<Project> toPopulate) {
for (Project project : OpenProjects.getDefault().getOpenProjects()) {
if (project.getLookup().lookup(NbMavenProject.class) != null) {
toPopulate.add(project);
}
}
return true;
}
protected @Override Node createNodeForKey(Project key) {
return new OpenProjectNode(key);
}
}, true));
explorerManager.setRootContext(openProjectsNode);
BeanTreeView beanTreeView = (BeanTreeView) jScrollPane1;
beanTreeView.setPopupAllowed(false);
beanTreeView.setRootVisible(false);
explorerManager.addPropertyChangeListener(new PropertyChangeListener() {
public @Override void propertyChange(PropertyChangeEvent event) {
if (event.getPropertyName().equals("selectedNodes")) {//NOI18N
Node[] selectedNodes = explorerManager.getSelectedNodes();
boolean enable=false;
for (Node node : selectedNodes) {
if (node instanceof OpenProjectNode) {
enable=true;
break;
}
}
addButton.setEnabled(enable);
}
}
});
}
示例8: constructSemiLogicalView
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
public static Node constructSemiLogicalView(final AnalysisResult errors, final boolean byCategory) {
return new AbstractNode(Children.create(new ChildFactory<Node>() {
@Override protected boolean createKeys(List<Node> toPopulate) {
constructSemiLogicalView(errors, byCategory, toPopulate);
return true;
}
@Override protected Node createNodeForKey(Node key) {
return key;
}
}, true));
}
示例9: constructSemiLogicalViewChildren
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
private static Children constructSemiLogicalViewChildren(final LogicalViewCache lvc, final Map<FileObject, Map<AnalyzerFactory, List<ErrorDescription>>> errors, final Map<ErrorDescription,Project> errorsToProjects) {
return Children.create(new ChildFactory<Node>() {
@Override protected boolean createKeys(List<Node> toPopulate) {
toPopulate.addAll(constructSemiLogicalViewNodes(lvc, errors, errorsToProjects));
return true;
}
@Override protected Node createNodeForKey(Node key) {
return key;
}
}, true);
}
示例10: createChildren
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
private Children createChildren(final List<ExecutionEventObject.Tree> childrenNodes) {
if (childrenNodes.isEmpty()) {
return Children.LEAF;
}
return Children.create(new ChildFactory<ExecutionEventObject.Tree>() {
@Override
protected boolean createKeys(List<ExecutionEventObject.Tree> toPopulate) {
if (showOnlyErrors) {
for (ExecutionEventObject.Tree item : childrenNodes) {
ExecutionEventObject end = item.getEndEvent();
if (end != null) {
if (
ExecutionEvent.Type.ProjectFailed.equals(end.type) ||
ExecutionEvent.Type.MojoFailed.equals(end.type) ||
ExecutionEvent.Type.ForkedProjectFailed.equals(end.type) ||
ExecutionEvent.Type.ForkFailed.equals(end.type))
{
toPopulate.add(item);
}
}
}
} else {
toPopulate.addAll(childrenNodes);
}
return true;
}
@Override
protected Node createNodeForKey(ExecutionEventObject.Tree key) {
return createNodeForExecutionEventTree(key);
}
}, false);
}
示例11: createChildren
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
private static Children createChildren(final List<Node> otherList) {
Children c = Children.create(new ChildFactory<Node>() {
@Override
protected boolean createKeys(final List<Node> toPopulate) {
toPopulate.addAll(otherList);
return true;
}
@Override
protected Node createNodeForKey(Node key) {
return key;
}
}, false);
return c;
}
示例12: createWaitNode
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
private Node createWaitNode() {
AbstractNode n = new AbstractNode(Children.LEAF) {
public @Override
Action[] getActions(boolean context) {
return new Action[0];
}
};
n.setIconBaseWithExtension("org/openide/nodes/wait.gif"); //NOI18N
n.setDisplayName(NbBundle.getMessage(ChildFactory.class, "LBL_WAIT")); //NOI18N
return n;
}
示例13: CinematicEventNode
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
public CinematicEventNode(Event event) {
super(Children.create(new ChildFactory<Event>() {
@Override
protected boolean createKeys(List<Event> toPopulate) {
return true;
}
}, true));
this.event = event;
}
示例14: createWaitNode
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
static Node createWaitNode() {
AbstractNode n = new AbstractNode(Children.LEAF);
n.setIconBaseWithExtension("org/openide/nodes/wait.gif"); //NOI18N
n.setDisplayName(NbBundle.getMessage(ChildFactory.class, "LBL_WAIT")); //NOI18N
return n;
}
示例15: resultChanged
import org.openide.nodes.ChildFactory; //导入依赖的package包/类
@Override
public void resultChanged(LookupEvent ev) {
initComponents();
Collection<? extends ChildFactory> childFactories = dataResult.allInstances();
if (childFactories.isEmpty()) {
em.setRootContext(rootDefault);
toolbar.setActivated(false);
return; // have nothing to display
}
if (childFactories.size() > 1) {
throw new IllegalStateException("Outline Component recieved more than one ChildFactory in its lookup, should not happen.");
}
table.setPropertyColumns(
"mzMono", "m/z mono",
"charge", "Charge",
"mzLo", "m/z lo",
"mzHi", "m/z hi",
"rtLo", "RT lo",
"rtHi", "RT hi",
"identified", "Identified",
"name", "Name");
ChildFactory childFactory = childFactories.iterator().next();
kids = Children.create(childFactory, true);
root = new AbstractNode(kids);
em.setRootContext(root);
TableColumnModel columnModel = table.getOutline().getColumnModel();
ETableColumn column = (ETableColumn) columnModel.getColumn(0);
((ETableColumnModel) columnModel).setColumnHidden(column, true);
table.getOutline().setDefaultRenderer(Node.Property.class, new CustomOutlineCellRenderer());
// TODO: ACHTUNG: never checked if the selected nodes are actually proxied
// by the top component
//Put the Nodes into the Lookup of the TopComponent,
//so that the Properties window will be synchronized:
Lookup explorerManagerLookup = ExplorerUtils.createLookup(em, getActionMap());
Container parent = getParent();
if (parent instanceof BMTopComponent) {
BMTopComponent tc = (BMTopComponent)parent;
tc.setProxiedLookup(explorerManagerLookup);
}
toolbar.setActivated(true);
}