DefaultMutableTreeNode next = (DefaultMutableTreeNode)path.getLastPathComponent(); if(first.isNodeChild(next)) {
/** Returns true if <code>aNode</code> is a child of this node. If * <code>aNode</code> is null, this method returns false. * * @return true if <code>aNode</code> is a child of this node; false if * <code>aNode</code> is null * */ public boolean isNodeChild(TreeNode aNode) { boolean retValue; loadKidsIfNeeded(); retValue = super.isNodeChild(aNode); return retValue; }
public void run() { if (!node.isNodeChild(placeholder)) { return; } node.remove(placeholder); if (clazz.getSuperclass() != Object.class) { renderFields(explorer, node, clazz.getSuperclass(), v); } for (Field fld : clazz.getDeclaredFields()) { if ((fld.getModifiers() & Modifier.STATIC) != 0) continue; fld.setAccessible(true); renderField(explorer, node, fld, v); } invokeLater(new Runnable() { public void run() { ((DefaultTreeModel) explorer.getModel()).reload(node); } }); explorer.deferred.remove(node); } };
public void run() { if (!node.isNodeChild(placeholder)) { return; } node.remove(placeholder); if (clazz.getSuperclass() != Object.class) { renderFields(explorer, node, clazz.getSuperclass(), v); } for (Field fld : clazz.getDeclaredFields()) { if ((fld.getModifiers() & Modifier.STATIC) != 0) continue; fld.setAccessible(true); renderField(explorer, node, fld, v); } invokeLater(new Runnable() { public void run() { ((DefaultTreeModel) explorer.getModel()).reload(node); } }); explorer.deferred.remove(node); } };
private boolean nodeAlreadyExists(String path) { DefaultMutableTreeNode aNode = new DefaultMutableTreeNode(path); String node = aNode.toString(); boolean isNodeChild = parentNode.isNodeChild(aNode); if (isNodeChild){ return isNodeChild; } for (int i = 0; i < parentNode.getChildCount(); i++) { DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) parentNode.getChildAt(i); String child = childNode.toString(); if (child.equalsIgnoreCase(node)) { isNodeChild = true; break; } } return isNodeChild; }
private boolean haveCompleteNode( JTree tree ) { int[] selRows = tree.getSelectionRows(); TreePath path = tree.getPathForRow( selRows[0] ); DefaultMutableTreeNode first = ( DefaultMutableTreeNode )path.getLastPathComponent(); int childCount = first.getChildCount(); // first has children and no children are selected. if ( childCount > 0 && selRows.length == 1 ) return false; // first may have children. for ( int i = 1; i < selRows.length; i++ ) { path = tree.getPathForRow( selRows[i] ); DefaultMutableTreeNode next = ( DefaultMutableTreeNode )path.getLastPathComponent(); if ( first.isNodeChild( next ) ) { // Found a child of first. if ( childCount > selRows.length - 1 ) { // Not all children of first are selected. return false; } } } return true; } }
if (first.isNodeChild(next)) {
path = tree.getPathForRow(selRows[i]); DefaultMutableTreeNode next = (DefaultMutableTreeNode) path.getLastPathComponent(); if (first.isNodeChild(next)) {