use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class AbstractTreeNode method getPossibleParentNode.
@Override
public TreeNode getPossibleParentNode(String pattern) {
// simplify by bailing out early if preconditions are not met...
if (pattern == null || pattern.length() <= 0 || pattern.indexOf('*') >= 0)
return null;
TreeNode node = null;
int longest = 0;
for (TreeNode n : traverse(true)) {
String aname = n.getCompletePathName();
if (aname == null)
// defensive pgming
continue;
if (pattern.startsWith(aname) || pattern.startsWith(aname.replace("\\", ""))) {
int thisLength = aname.length();
// keep the longest match ONLY!
if (node == null || thisLength > longest) {
node = n;
longest = thisLength;
}
}
}
return node;
}
use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class AbstractTreeNode method findNodeInTreeNormalized.
private TreeNode findNodeInTreeNormalized(String desiredName) {
if (!ok(desiredName))
return null;
desiredName = decodeNameToDots(desiredName);
TreeNode node = normalizedChildren.get(desiredName);
// one more try. GUI sometimes chops off the starting "server".
if (node == null && !desiredName.startsWith("server.")) {
node = normalizedChildren.get("server." + desiredName);
// to "instance1.server.blah"
if (node == null && (desiredName = insertServerString(desiredName)) != null)
node = normalizedChildren.get(desiredName);
}
return node;
}
use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class AbstractTreeNode method traverse.
/**
* Returns all the nodes under the current tree
* @return List of all nodes in the current tree
*/
@Override
public List<TreeNode> traverse(boolean ignoreDisabled) {
// System.out.println ("Node: " + this.getName ()+ " is enabled "+isEnabled());
List<TreeNode> list = new ArrayList<TreeNode>();
if (ignoreDisabled) {
if (!this.enabled) {
return list;
}
}
list.add(this);
if (!hasChildNodes()) {
return list;
}
Collection<TreeNode> childList = children.values();
for (TreeNode node : childList) {
list.addAll(node.traverse(ignoreDisabled));
}
return list;
}
Aggregations