output.printGolden("Search for a tree path");
TreePath rootPath = new TreePath(getRoot());
if(chooser.checkPath(rootPath, 0)) {
return(rootPath);
}
Waiter loadedWaiter = new Waiter(new Waitable() {
// fields used in getDescription() method
TreePath currentPath;
String requestedPath;
public Object actionProduced(Object obj) {
TreePathChooser chsr = (TreePathChooser)((Object[])obj)[0];
requestedPath = chsr.getDescription();
TreePath path = (TreePath)((Object[])obj)[1];
currentPath = path;
Object[] result = new Object[2];
Object[] children = getChildren(path.getLastPathComponent());
for(int j = 0; j < children.length; j++) {
result[0] = path.pathByAddingChild(children[j]);
if(chsr.checkPath((TreePath)result[0], j)) {
result[1] = Boolean.TRUE;
return(result);
}
if(chsr.hasAsParent((TreePath)result[0], j)) {
result[1] = Boolean.FALSE;
return(result);
}
}
return(null);
}
public String getDescription() {
return "Wait next node loaded under parent "+currentPath+ " when requested was "+requestedPath;
}
});
loadedWaiter.setTimeoutsToCloneOf(timeouts, "JTreeOperator.WaitNextNodeTimeout");
loadedWaiter.setOutput(output.createErrorOutput());
return(findPathPrimitive(rootPath, chooser, loadedWaiter));
}