本文整理匯總了Java中org.openide.nodes.Children.LEAF屬性的典型用法代碼示例。如果您正苦於以下問題:Java Children.LEAF屬性的具體用法?Java Children.LEAF怎麽用?Java Children.LEAF使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.nodes.Children
的用法示例。
在下文中一共展示了Children.LEAF屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: VersionNode
/** Creates a new instance of VersionNode */
public VersionNode(NBVersionInfo versionInfo, boolean javadoc, boolean source) {
super(Children.LEAF);
hasJavadoc = javadoc;
hasSources = source;
this.nbvi = versionInfo;
setName(versionInfo.getVersion());
setDisplayName(versionInfo.getVersion() + " [ " + versionInfo.getType()
+ (versionInfo.getClassifier() != null ? ("," + versionInfo.getClassifier()) : "") + " ] "
+ " - "+versionInfo.getRepoId()
);
setIconBaseWithExtension(IconResources.ICON_DEPENDENCY_JAR);
}
示例2: testChangeOfNodeDoesNotFireChangeInActionMap
public void testChangeOfNodeDoesNotFireChangeInActionMap() {
ActionMap am = (ActionMap)tc.getLookup().lookup(ActionMap.class);
assertNotNull(am);
Node m1 = new AbstractNode(Children.LEAF);
m1.setName("old m1");
Node m2 = new AbstractNode(Children.LEAF);
m2.setName("new m2");
tc.setActivatedNodes(new Node[] { m1 });
assertEquals("No change in ActionMap 1", 0, cnt);
tc.setActivatedNodes(new Node[] { m2 });
assertEquals("No change in ActionMap 2", 0, cnt);
tc.setActivatedNodes(new Node[0]);
assertEquals("No change in ActionMap 3", 0, cnt);
tc.setActivatedNodes(null);
assertEquals("No change in ActionMap 4", 0, cnt);
ActionMap am2 = (ActionMap)tc.getLookup().lookup(ActionMap.class);
assertEquals("Still the same action map", am, am2);
}
示例3: createNodes
@Override
protected Node[] createNodes(Node key) {
Node [] orig = super.createNodes (key);
Node [] filtered = new Node [orig.length];
for (int i = 0; i < orig.length; i++) {
FileObject fo = orig[i].getLookup ().lookup(FileObject.class);
boolean isTemplate;
if (fo != null) {
isTemplate = isTemplate(fo);
} else {
DataObject dobj = getDOFromNode (orig [i]);
isTemplate = dobj.isTemplate();
}
if (isTemplate) {
filtered [i] = new TemplateNode (orig [i], Children.LEAF);
} else {
filtered [i] = new TemplateNode (orig [i]);
}
}
return filtered;
}
示例4: testEnable
public void testEnable() {
OpenLocalExplorerAction action = new OpenLocalExplorerAction();
Node leaf = new AbstractNode(Children.LEAF);
Node parent = new AbstractNode(new Children.Array());
assertFalse(action.enable(null));
assertFalse(action.enable(new Node[0]));
assertTrue(action.enable(new Node[] {parent}));
assertFalse(action.enable(new Node[] {leaf}));
assertFalse(action.enable(new Node[] {parent, parent}));
}
示例5: RepositoryPathNode
private RepositoryPathNode(BrowserClient client, RepositoryPathEntry entry, boolean repositoryFolder) {
super(entry.getSvnNodeKind() == SVNNodeKind.DIR ? new RepositoryPathChildren(client) : Children.LEAF);
this.entry = entry;
this.client = client;
this.repositoryFolder = repositoryFolder;
initProperties();
}
示例6: CallstackFrameNode
/**
* Creates a new instance of CallstackFrameNode
*
* @param frameInfo line of a callstack, e.g. <code>foo.bar.Baz:314</code>
* @param displayName display name for the node, or <code>null</code>
* to use the default display name for the given
* callstack frame info
*/
public CallstackFrameNode(final String frameInfo,
final String displayName) {
super(Children.LEAF);
setDisplayName(displayName != null
? displayName
: frameInfo); //NOI18N
this.frameInfo = frameInfo;
}
示例7: createNodes
/** Creates nodes for nodes.
*/
@Override
protected Node[] createNodes(Node key) {
Node n = key;
String nodeName = n.getDisplayName();
DataObject obj = null;
DataShadow shadow = n.getCookie(DataShadow.class);
if (shadow != null) {
// I need DataNode here to get localized name of the
// shadow, but without the ugly "(->)" at the end
DataNode dn = new DataNode(shadow, Children.LEAF);
nodeName = dn.getDisplayName();
obj = shadow.getOriginal();
n = obj.getNodeDelegate();
}
if (obj == null)
obj = n.getCookie(DataObject.class);
if (obj != null) {
if (obj.isTemplate ()) {
// on normal nodes stop recursion
return new Node[] { new DataShadowFilterNode (n, Children.LEAF, nodeName) };
}
if (acceptDataObject (obj)) {
// on folders use normal filtering
return new Node[] { new DataShadowFilterNode (n, new DataShadowFilterChildren (n), nodeName) };
}
}
return new Node[] {};
}
示例8: testSetChildren
@RandomlyFails // NB-Core-Build #7155: row 1 vs. count 1 with UI [email protected] (from view.getTableValueAt(1))
public void testSetChildren() throws InterruptedException {
TestNode root = new TestNode(Children.LEAF, "root");
TreeNode ta = Visualizer.findVisualizer(root);
view = new TTV(root);
DialogDescriptor dd = new DialogDescriptor(view, "", false, null);
Dialog d = DialogDisplayer.getDefault().createDialog(dd);
makeVisible(d);
assertEquals(0, ta.getChildCount());
view.sort(0, false);
root.doSetChildren(new StringKeys("0", "1", "2"));
Thread.sleep(1000);
assertEquals(3, ta.getChildCount());
assertEquals("2", view.getTableValueAt(1));
assertEquals("1", view.getTableValueAt(2));
assertEquals("0", view.getTableValueAt(3));
view.sort(0, true);
root.doSetChildren(new StringKeys("5", "6"));
Thread.sleep(1000);
assertEquals(2, ta.getChildCount());
assertEquals("5", view.getTableValueAt(1));
assertEquals("6", view.getTableValueAt(2));
root.doSetChildren(Children.LEAF);
Thread.sleep(1000);
assertEquals(0, ta.getChildCount());
}
示例9: getContextDisplayName
private String getContextDisplayName (List<File> files) {
Node[] nodes = new Node[files.size()];
for (int i = 0; i < files.size(); ++i) {
final File file = files.get(i);
nodes[i] = new AbstractNode(Children.LEAF, Lookups.fixed(file)) {
@Override
public String getName () {
return file.getName();
}
};
}
return getContextDisplayName(nodes);
}
示例10: testRemoveAndAddNodes
/**
* Removes selected node by calling Children.Array.remove
*/
public void testRemoveAndAddNodes() {
final Children c = new Array();
Node n = new AbstractNode (c);
final PListView lv = new PListView();
final ExplorerPanel p = new ExplorerPanel();
p.add(lv, BorderLayout.CENTER);
p.getExplorerManager().setRootContext(n);
p.open();
Node[] children = new Node[NO_OF_NODES];
for (int i = 0; i < NO_OF_NODES; i++) {
children[i] = new AbstractNode(Children.LEAF);
children[i].setDisplayName(Integer.toString(i));
children[i].setName(Integer.toString(i));
c.add(new Node[] { children[i] } );
}
//Thread.sleep(2000);
try {
// Waiting for until the view is updated.
// This should not be necessary
try {
SwingUtilities.invokeAndWait( new EmptyRunnable() );
} catch (InterruptedException ie) {
fail ("Caught InterruptedException:" + ie.getMessage ());
} catch (InvocationTargetException ite) {
fail ("Caught InvocationTargetException: " + ite.getMessage ());
}
p.getExplorerManager().setSelectedNodes(new Node[] {children[0]} );
} catch (PropertyVetoException pve) {
fail ("Caught the PropertyVetoException when set selected node " + children[0].getName ()+ ".");
}
for (int i = 0; i < NO_OF_NODES; i++) {
c.remove(new Node [] { children[i] } );
children[i] = new AbstractNode(Children.LEAF);
children[i].setDisplayName(Integer.toString(i));
children[i].setName(Integer.toString(i));
c.add(new Node[] { children[i] } );
//Thread.sleep(350);
}
assertEquals(NO_OF_NODES, c.getNodesCount());
}
示例11: NoHelpNode
public NoHelpNode() {
super(Children.LEAF);
}
示例12: TNode
public TNode() {
super(Children.LEAF);
setName("TNode"); // or, super.setName if needed
setDisplayName("TNode");
}
示例13: doTestNoChangeWhenSomethingIsChangedOnNotActivatedNode
private void doTestNoChangeWhenSomethingIsChangedOnNotActivatedNode(int initialSize) {
Object obj = new OpenCookie() { public void open() {} };
Lookup.Result<OpenCookie> res = lookup.lookup(new Lookup.Template<OpenCookie>(OpenCookie.class));
Lookup.Result<Node> nodeRes = lookup.lookup(new Lookup.Template<Node>(Node.class));
InstanceContent ic = new InstanceContent();
CountingLookup cnt = new CountingLookup(ic);
AbstractNode ac = new AbstractNode(Children.LEAF, cnt);
for (int i = 0; i < initialSize; i++) {
ic.add(new Integer(i));
}
top.setActivatedNodes(new Node[] { ac });
assertEquals("One node there", 1, get.getActivatedNodes().length);
assertEquals("It is the ac one", ac, get.getActivatedNodes()[0]);
ic.add(obj);
L listener = new L();
res.allItems();
nodeRes.allItems();
res.addLookupListener(listener);
Collection allListeners = cnt.listeners;
assertEquals("Has the cookie", 1, res.allItems().size());
listener.check("No changes yet", 0);
ic.remove(obj);
assertEquals("Does not have the cookie", 0, res.allItems().size());
listener.check("One change", 1);
top.setActivatedNodes(new N[0]);
assertEquals("The nodes are empty", 0, get.getActivatedNodes().length);
listener.check("No change", 0);
cnt.queries = 0;
ic.add(obj);
ic.add(ac);
listener.check("Removing the object or node from not active node does not send any event", 0);
nodeRes.allItems();
listener.check("Queriing for node does generate an event", 0);
assertEquals("No Queries to the not active node made", 0, cnt.queries);
assertEquals("No listeneners on cookies", allListeners, cnt.listeners);
}
示例14: OpenProjectNode
public OpenProjectNode(NbMavenProjectImpl project) {
super(Children.LEAF);
this.project = project;
pi = ProjectUtils.getInformation(project);
}
示例15: createEmptyNode
private static Node createEmptyNode() {
AbstractNode an = new AbstractNode(Children.LEAF);
return an;
}