/** Get the nodes as an enumeration. * @return enumeration of nodes */ public final Enumeration<Node> nodes() { return Enumerations.array(getNodes()); }
/** Find a child node by name. * This may be overridden in subclasses to provide a more advanced way of finding the * child, but the default implementation simply scans through the list of nodes * to find the first one with the requested name. * <p>Normally the list of nodes should have been computed by the time this returns, * but see {@link #getNodes()} for an important caveat as to why this may not * be doing what you want and what to do instead. * @param name (code) name of child node to find or <code>null</code> if any arbitrary child may * be returned * @return the node or <code>null</code> if it could not be found */ public Node findChild(String name) { Node[] list = getNodes(); if (list.length == 0) { return null; } if (name == null) { // return any node return list[0]; } for (int i = 0; i < list.length; i++) { if (name.equals(list[i].getName())) { // ok, we have found it return list[i]; } } return null; }
public Node[] callGetNodes(boolean optimalResult) { Node[] hold = null; if (optimalResult) { hold = original.getChildren().getNodes(true); } hold = Children.this.getNodes(); return hold; }
public Node[] callGetNodes(boolean optimalResult) { Node[] hold = null; if (optimalResult) { hold = original.getChildren().getNodes(true); } hold = Children.this.getNodes(); return hold; }
private void updateKeys() { final boolean LOG_ENABLED = LOGGER.isLoggable(Level.FINER); if (LOG_ENABLED) { LOGGER.finer("updateKeys() " + this); // NOI18N } ChildrenAdapter cha = nodeL; if (cha != null) { if (LOG_ENABLED) { LOGGER.finer(" getting original nodes"); // NOI18N } Node[] arr = original.getChildren().getNodes(); if (LOG_ENABLED) { LOGGER.finer(" setKeys(), keys: " + Arrays.toString(arr)); // NOI18N } setKeys(arr); if (!origSupport.isInitialized()) { origSupport.notifySetEntries(); } } }
@Override public void run() { children.remove(children.getNodes()); } });
@Override public void run() { logger.finest(">>>> removing current children..."); children.remove(children.getNodes()); } });
private void refreshChildren() { Node[] origChildren = original.getChildren().getNodes(); for (Node node : origChildren) { refreshKey(node); } } }
private void refreshChildren() { Node[] origChildren = original.getChildren().getNodes(); for (Node node : origChildren) { refreshKey(node); } } }
/** Selects the added nodes */ public void select () { if (added != null) { // if initialized => wait till finished update node.getChildren().getNodes(true); // and select the right nodes org.openide.nodes.Children.MUTEX.readAccess (this); } }
public Node findNode(FileObject objectToSelect) { Node[] nodes = getChildren().getNodes(); for( Node node : nodes) { ProjectItemNode projectItemNode = (ProjectItemNode) node; Node foundNode = projectItemNode.findNode(objectToSelect); if( null != foundNode ) { return foundNode; } } return null; }
public ContextNode findNode(FileObject objectToSelect) { Node[] nodes = getChildren().getNodes(); for( Node node : nodes) { ContextNode foundNode = ((ContextNode)node).findNode(objectToSelect); if( null != foundNode ) { return foundNode; } } return null; } }
public void actionPerformed (@Nonnull final ActionEvent event) { final Node[] all = containerNode.getChildren().getNodes(); containerNode.getChildren().remove(all); } };
private void sortNodes() { Node[] origNodes = original.getChildren().getNodes(); if (isSortingActive()) { Node[] sortedNodes = new Node[origNodes.length]; System.arraycopy(origNodes, 0, sortedNodes, 0, origNodes.length); Collections.sort(Arrays.asList(sortedNodes), getRowComparator()); setKeys(sortedNodes); } else { setKeys(origNodes); } } }
private Node findChild(Node node, String name, int i) { node.getChildren ().getNodes (true); Node newSubfolder = node.getChildren ().findChild (name); if (newSubfolder == null && i > 0) { try { Thread.sleep(333); } catch (InterruptedException ex) { } newSubfolder = findChild(node, name, i--); } return newSubfolder; }
@Override public void refreshView() { Node [] rootNodes = getRoot().getChildren().getNodes(); if(rootNodes != null) { for(Node n: rootNodes) { if(n instanceof SectionNode) { ((SectionNode) n).refreshSubtree(); } } } }
/** Synchronize the root context from the manager of this Explorer. */ final void synchronizeRootContext() { NodeTableModel ntm = (NodeTableModel)table.getModel(); ntm.setNodes(manager.getRootContext().getChildren().getNodes()); }
private int getNodePosition (Node n) { Index supp = getIndexSupport (n); DataFolder df = n.getParentNode ().getLookup ().lookup (DataFolder.class); df.getNodeDelegate ().getChildren ().getNodes (true); int pos = supp.indexOf (n); // #141851: getNodes()/getNodePosition() is not called under Children.MUTEX // therefore it is not guaranteed that node will be found (node could be deleted meanwhile) // assert pos != -1 : "Node " + n + " has position " + pos + " in children " + Arrays.asList (n.getParentNode ().getChildren ().getNodes ()); return pos; }
@Override protected void storeToDataModel() { for (Node n : getExplorerManager().getRootContext().getChildren().getNodes()) { ModeNode mn = (ModeNode)n; if (mn.isSelected()) { data.defineMode(mn.getName(), mn.text); } } }