本文整理匯總了Java中org.apache.pivot.wtk.content.TreeNode類的典型用法代碼示例。如果您正苦於以下問題:Java TreeNode類的具體用法?Java TreeNode怎麽用?Java TreeNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TreeNode類屬於org.apache.pivot.wtk.content包,在下文中一共展示了TreeNode類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例3: fromBean
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
public TreeNode fromBean(Object bean) {
TreeBranch result = new TreeBranch();
BeanAdapter beanAdapter;
if (bean instanceof BeanAdapter) {
beanAdapter = (BeanAdapter) bean;
} else {
beanAdapter = new BeanAdapter(bean);
}
for (String property : beanAdapter) {
TreeNode node = new TreeNode();
node.setText(property);
result.add(node);
Object propertyValue = beanAdapter.get(property);
if (propertyValue != null) {
result.add(fromBean(propertyValue));
}
}
return null;
}
示例4: packToNode
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
/**
* Pack model to Tree view node
* @param P
* @return pack's new node instance
*/
public static TreeNode packToNode(Pack P) {
//TreeNode node = new TreeNode(P.getIcon(), P.getInstallName());
TreeNode node = new TreeNode(P.getIcon(), P.getName());
node.setUserData(P);//Save model data
return node;
}
示例5: equals
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
@Override public boolean equals(Object obj)//Packs compare
{
if (obj==null) return false;
if (obj instanceof Pack) {//With a Pack model
Pack P = (Pack) obj;
return this.name.toLowerCase().equals(P.getName().toLowerCase())//Name
&& this.path.toLowerCase().equals(P.getPath().toLowerCase());//Path
}
else if (obj instanceof TreeNode) {//With a TreeView Node
TreeNode node = (TreeNode) obj;
return this.name.toLowerCase().equals(node.getText().toLowerCase())//Name
&& this.group.equals(node.getParent());//Group
}
else return super.equals(obj);
}
示例6: getPack
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
/**
* Get Pack of a node
* @param node to cast
* @return Pack
*/
public Pack getPack(TreeNode node)
{
for(Pack P : PackFactory.getPacks()) {
if (P.getGroup() != null && P.equals(node))
return P;
}
return null;
}
示例7: removeNode
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
/**
* Remove a Group or Pack from TreeView
* @param group to remove
*/
public void removeNode(TreeNode node)
{
assert node != null;
if (node instanceof TreeBranch)// Group
{
TreeBranch branch = (TreeBranch) node;
Group group = getGroup(branch);
String path = group.getPath();
assert group != null;
unlinkGroup(group);
GroupFactory.removeGroup(group);
//TreeBranch remove
if (branch.getParent() != null)
branch.getParent().remove(branch);
else treeData.remove(branch);
Out.print(LOG_LEVEL.DEBUG, "Group removed: " + path);
}
else if (node instanceof TreeNode)// Pack
{
TreeBranch branch = node.getParent();
String name = getGroup(branch).getName();
Pack P = getPack(node);
P.setGroup(null);
//TreeNode remove
branch.remove(node);
Out.print(LOG_LEVEL.DEBUG, "Pack '" + P.getName() + "' removed from Group: "+name);
}
}
示例8: TaskDirScan
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
public TaskDirScan(ScanFrame source, String path, List<TreeNode> treeData, FilenameFilter filter,
String depthValue, boolean folderFilter)
{
this.scanFrame = source;
// point to data models lists
this.groups = scanFrame.facade.getGroups();
this.packs = scanFrame.facade.getPacks();
this.path = path;
this.treeData = treeData;
this.filter= filter;
this.depthValue = depthValue;
this.folderFilter = folderFilter;
}
示例9: createTreeNode
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
@Bean
@Lazy
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Override
public TreeNode createTreeNode() {
return new TreeNode();
}
示例10: render
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
@Override
public void render(Object node, Path path, int rowIndex, TreeView treeView,
boolean expanded, boolean selected, NodeCheckState checkState,
boolean highlighted, boolean disabled) {
if (node != null) {
RendererUtil.renderData(this, node);
} else {
super.render(new TreeNode(), path, rowIndex, treeView, expanded, selected,
checkState, highlighted, disabled);
}
}
示例11: ScanFacade
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
public ScanFacade()
{
treeData = new ArrayList<TreeNode>();
packs = new ArrayList<Pack>();
groups = new ArrayList<Group>();
}
示例12: getTreeData
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
public List<TreeNode> getTreeData()
{
return treeData;
}
示例13: fromNode
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
public void fromNode(Node node) {
clear();
TreeNode treeNode = traverseNode(node);
add(treeNode);
}
示例14: createTreeNode
import org.apache.pivot.wtk.content.TreeNode; //導入依賴的package包/類
public TreeNode createTreeNode();