本文整理匯總了Java中org.apache.pivot.wtk.content.TreeNode.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeNode.getParent方法的具體用法?Java TreeNode.getParent怎麽用?Java TreeNode.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.pivot.wtk.content.TreeNode
的用法示例。
在下文中一共展示了TreeNode.getParent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: nodeToPath
import org.apache.pivot.wtk.content.TreeNode; //導入方法依賴的package包/類
/**
* Tree view Node to String array path from Tree view root
* @param NODE
* @return path array of parent groups
*/
public static String[] nodeToPath(TreeNode NODE) {
java.util.List<String> backList = new java.util.ArrayList<String>();
//Return back in hierarchy
TreeNode Ntmp = NODE;
do {
backList.add(Ntmp.getText());
Ntmp = Ntmp.getParent();
} while(Ntmp != null);
//Copy the hierarchy from top to bottom
String[] PATH = new String[backList.size()];
int i = 0;
ListIterator<String> it = backList.listIterator(backList.size());
while(it.hasPrevious()) {
PATH[i++] = it.previous();
}
return PATH;
}
示例2: getCheckedPacks
import org.apache.pivot.wtk.content.TreeNode; //導入方法依賴的package包/類
/**
* Get only packs checked in treeview
* @param sequence of checked paths in treeview
* @return list of checked packs
*/
public List<Pack> getCheckedPacks(Sequence<Path> list) {
List<Pack> selected = new ArrayList<Pack>();
if (list.getLength() > 0) {
Path p;
for(int i = 0; i < list.getLength(); i++) {
p = list.get(i);
TreeNode node = treeData.get(p.get(0));
for(Pack P:packs) {
if (node.getParent() == null && P.getName().equalsIgnoreCase(node.getText()) ) {
selected.add(P);
break;
}
}
}
}
return selected;
}