本文整理汇总了Java中com.unnamed.b.atv.model.TreeNode.addChild方法的典型用法代码示例。如果您正苦于以下问题:Java TreeNode.addChild方法的具体用法?Java TreeNode.addChild怎么用?Java TreeNode.addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.unnamed.b.atv.model.TreeNode
的用法示例。
在下文中一共展示了TreeNode.addChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseMetaDataAndAdd
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
private static void parseMetaDataAndAdd(Bundle metaData, TreeNode parent) {
if (metaData != null){
TreeNode nodes = new TreeNode("meta-datas [" + metaData.keySet().size() + "]");
Iterator<String> it = metaData.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
String value = "";
value = metaData.getString(key);
if (null == value) {
value = "@" + metaData.getInt(key) + "";
}
TreeNode node = new TreeNode("meta-data");
node.addChildren(new TreeNode("key: " + key), new TreeNode("value: " + value));
nodes.addChild(node);
}
parent.addChild(nodes);
}
}
示例2: addNode
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
public void addNode(TreeNode parent, final TreeNode nodeToAdd) {
parent.addChild(nodeToAdd);
if (parent.isExpanded()) {
final TreeNode.BaseNodeViewHolder parentViewHolder = getViewHolderForNode(parent);
addNode(parentViewHolder.getNodeItemsView(), nodeToAdd);
}
}
示例3: fromCommentNode
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
public TreeNode fromCommentNode(CommentNode node)
{
TreeNode myNode = new TreeNode(node);
myNode.setExpanded(true);
myNode.setViewHolder(new CommentNodeViewHolder(this.context));
List<CommentNode> children = node.getChildren();
for (CommentNode child : children) {
myNode.addChild(this.fromCommentNode(child));
}
return myNode;
}
示例4: recourse
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
private void recourse(ForumItemTree rootForum, TreeNode rootNode) {
if (rootForum.getForums() == null) return;
for (ForumItemTree item : rootForum.getForums()) {
TreeNode child = new TreeNode(item);
recourse(item, child);
rootNode.addChild(child);
}
}
示例5: fillDownloadsFolder
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
private void fillDownloadsFolder(TreeNode node) {
TreeNode downloads = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Downloads" + (counter++)));
node.addChild(downloads);
if (counter < 5) {
fillDownloadsFolder(downloads);
}
}
示例6: fillFolder
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
private void fillFolder(TreeNode folder) {
TreeNode currentNode = folder;
for (int i = 0; i < 10; i++) {
TreeNode file = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, NAME)).setViewHolder(new SelectableHeaderHolder(getActivity()));
currentNode.addChild(file);
currentNode = file;
}
}
示例7: fillFolder
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
private void fillFolder(TreeNode folder) {
TreeNode currentNode = folder;
for (int i = 0; i < 4; i++) {
TreeNode file = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, NAME + " " + i));
currentNode.addChild(file);
currentNode = file;
}
}
示例8: depthSearchBuilder
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
private void depthSearchBuilder(TreeNode node, long parentID, List<Category> categories) {
while(currentIndex < categories.size())
{
Category c = categories.get(currentIndex);
if(c.getParent_category_id() == parentID) {
TreeNode childNode = new TreeNode(new TreeItemHolder.TreeItem(c));
currentIndex++;
depthSearchBuilder(childNode, c.getCategoryId(), categories);
node.addChild(childNode);
} else {
return;
}
}
}
示例9: showAccountsAndClusters
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
@Override
public void showAccountsAndClusters(SortedMap<MovirtAccount, List<Cluster>> map) {
AccountsTreeItem.ActiveSelectionChangedListener changedListener = presenter::onActiveSelectionChanged;
AccountsTreeItem.LongClickListener longClickListener = presenter::onLongClickListener;
TreeNode anchor = TreeNode.root();
AccountsTreeItem rootData = new AccountsTreeItem(null, null, changedListener, longClickListener);
drawerRoot = new TreeNode(rootData)
.setViewHolder(new AccountsTreeHolder(this))
.setExpanded(true);
anchor.addChild(drawerRoot);
for (Map.Entry<MovirtAccount, List<Cluster>> entry : map.entrySet()) {
AccountsTreeItem accountData = new AccountsTreeItem(entry.getKey(), null, changedListener, longClickListener);
TreeNode accountNode = new TreeNode(accountData)
.setViewHolder(new AccountsTreeHolder(this))
.setExpanded(true);
drawerRoot.addChild(accountNode);
for (Cluster cluster : entry.getValue()) {
AccountsTreeItem clusterData = new AccountsTreeItem(entry.getKey(), cluster, changedListener, longClickListener);
TreeNode newClusterNode = new TreeNode(clusterData)
.setViewHolder(new AccountsTreeHolder(this))
.setExpanded(true);
accountNode.addChild(newClusterNode);
}
}
AndroidTreeView atv = new AndroidTreeView(this, anchor);
atv.setUseAutoToggle(false);
atv.setSelectionModeEnabled(true);
atv.setDefaultContainerStyle(R.style.LargePaddingTreeNode);
selectionDrawer.removeAllViews(); // remove previous tree
selectionDrawer.addView(atv.getView());
}
示例10: gpxFile2TreeNode
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
public static TreeNode gpxFile2TreeNode(File gpxFile) {
try {
Gpx gpx = GpxUtils.parseGpx(new FileInputStream(gpxFile));
GpxHolder.GpxTreeItem.Builder gpx_builder = new GpxHolder.GpxTreeItem.Builder();
TreeNode gpxRoot = new TreeNode(gpx_builder
.setType(GpxHolder.ITEM_TYPE_GPX)
.setIcon(GpxHolder.ITEM_ICON_GPX)
.setName(gpxFile.getName())
.setPath(gpxFile.getPath())
.setGpx(gpx)
.build());
List<Track> tracks = gpx.getTracks();
if (tracks.size() > 1) {
TreeNode node_trks = new TreeNode(gpx_builder
.setType(GpxHolder.ITEM_TYPE_GPX)
.setIcon(GpxHolder.ITEM_ICON_TRACK)
.setName("航跡")
.build());
gpxRoot.addChild(node_trks);
addTrks2Node(node_trks, tracks);
} else {
addTrks2Node(gpxRoot, tracks);
}
List<WayPoint> wpts = gpx.getWayPoints();
if (wpts.size() > 1) {
TreeNode node_wpts = new TreeNode(gpx_builder
.setType(GpxHolder.ITEM_TYPE_WAYPOINTS)
.setIcon(GpxHolder.ITEM_ICON_WAYPOINT)
.setName("航點")
.build());
gpxRoot.addChild(node_wpts);
addWpts2Node(node_wpts, wpts);
} else {
addWpts2Node(gpxRoot, wpts);
}
return gpxRoot;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例11: fromSubmission
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
public TreeNode fromSubmission(Submission submission)
{
TreeNode rootNode = new TreeNode(null);
TreeNode postNode = new TreeNode(submission);
postNode.setViewHolder(new SubmissionNodeViewHolder(this.context));
rootNode.addChild(postNode);
List<CommentNode> comments = submission.getComments().getChildren();
for (CommentNode comment : comments) {
rootNode.addChild(this.commentTreeNodeAdapter.fromCommentNode(comment));
}
return rootNode;
}
示例12: onCreateView
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_default, null, false);
ViewGroup containerView = (ViewGroup) rootView.findViewById(R.id.container);
statusBar = (TextView) rootView.findViewById(R.id.status_bar);
TreeNode root = TreeNode.root();
TreeNode computerRoot = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_laptop, "My Computer"));
TreeNode myDocuments = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "My Documents"));
TreeNode downloads = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Downloads"));
TreeNode file1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 1"));
TreeNode file2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 2"));
TreeNode file3 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 3"));
TreeNode file4 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "Folder 4"));
fillDownloadsFolder(downloads);
downloads.addChildren(file1, file2, file3, file4);
TreeNode myMedia = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo_library, "Photos"));
TreeNode photo1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "Folder 1"));
TreeNode photo2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "Folder 2"));
TreeNode photo3 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "Folder 3"));
myMedia.addChildren(photo1, photo2, photo3);
myDocuments.addChild(downloads);
computerRoot.addChildren(myDocuments, myMedia);
root.addChildren(computerRoot);
tView = new AndroidTreeView(getActivity(), root);
tView.setDefaultAnimation(true);
tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom);
tView.setDefaultViewHolder(IconTreeItemHolder.class);
tView.setDefaultNodeClickListener(nodeClickListener);
tView.setDefaultNodeLongClickListener(nodeLongClickListener);
containerView.addView(tView.getView());
if (savedInstanceState != null) {
String state = savedInstanceState.getString("tState");
if (!TextUtils.isEmpty(state)) {
tView.restoreState(state);
}
}
return rootView;
}
示例13: onCreate
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mindmapLayout = (RelativeLayout) findViewById(R.id.mindmapLayout);
mindmapLayout.setX(mindmapLayout.getX() - (1920 - 1080));
input = (EditText) findViewById(R.id.input);
TreeNode root = TreeNode.root();
TreeNode computerRoot = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_cloud, "Happiness"));
first_root = computerRoot;
current_root = first_root;
TreeNode myDocuments = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Money"));
TreeNode downloads = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "luxury"));
TreeNode file1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "gold"));
TreeNode file2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "sliver"));
TreeNode file3 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "gem"));
TreeNode file4 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "ivory"));
downloads.addChildren(file1, file2, file3, file4);
TreeNode myMedia = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo_library, "life"));
TreeNode photo1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "health"));
TreeNode photo2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "love"));
TreeNode photo3 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "stability"));
myMedia.addChildren(photo1, photo2, photo3);
myDocuments.addChild(downloads);
computerRoot.addChildren(myDocuments, myMedia);
root.addChildren(computerRoot);
/////////////////////////////////////////////////////////////////
tView = new AndroidTreeView(this, root);
tView.setDefaultAnimation(true);
tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom);
tView.setDefaultViewHolder(IconTreeItemHolder.class);
tView.setDefaultNodeClickListener(nodeClickListener);
tView.setDefaultNodeLongClickListener(nodeLongClickListener);
RelativeLayout containerView = (RelativeLayout) findViewById(R.id.item);
tView_result = tView.getView();
containerView.addView(tView_result);
////////////////////////////////////////////////////////////////////////////////////////
setMView(first_root);
}
示例14: initializeCategoryTree
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
private void initializeCategoryTree()
{
List<Category> roots = mViewModel.getAllCategories();
HashMap<Long, Category> children = mViewModel.getChildrenCategories();
TreeNode root = TreeNode.root();
if(!roots.isEmpty())
{
currentCategory = roots.get(0).getName();
statusBarTextView.setText(currentCategory);
}
currentIndex = 0;
boolean skipEverythingButAllProducts = true;
while(currentIndex < roots.size())
{
Category c = roots.get(currentIndex++);
if(c.getParent_category_id() == 0) {
TreeNode node = new TreeNode(new TreeItemHolder.TreeItem(c));
depthSearchBuilder(node, c.getCategoryId(), roots);
root.addChild(node);
if(skipEverythingButAllProducts && currentIndex > 0) break;
}
}
mTreeView = new AndroidTreeView(getActivity(), root);
mTreeView.setDefaultViewHolder(TreeItemHolder.class);
mTreeView.setDefaultAnimation(false);
mTreeView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom);
mTreeView.setDefaultNodeClickListener(new TreeNode.TreeNodeClickListener() {
@Override
public void onClick(TreeNode treeNode, Object o) {
currentCategory = treeNode.getValue().toString();
TreeItemHolder treeNodeViewHolder = (TreeItemHolder) treeNode.getViewHolder();
treeNodeViewHolder.setActive(true);
if (lastSelectedNode != null && lastSelectedNode != treeNodeViewHolder) {
lastSelectedNode.setActive(false);
}
lastSelectedNode = treeNodeViewHolder;
statusBarTextView.setText(currentCategory);
}
});
treeViewContainer.addView(mTreeView.getView());
/* Delete, if root is not 'all products' */
mTreeView.expandLevel(1);
}
示例15: onCreateView
import com.unnamed.b.atv.model.TreeNode; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_default, null, false);
ViewGroup containerView = (ViewGroup) rootView.findViewById(R.id.container);
statusBar = (TextView) rootView.findViewById(R.id.status_bar);
TreeNode root = TreeNode.root();
TreeNode computerRoot = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_laptop, "My Computer"));
TreeNode myDocuments = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "My Documents"));
TreeNode downloads = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_folder, "Downloads"));
TreeNode file1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "File 1"));
TreeNode file2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "File 2"));
TreeNode file3 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "File 3"));
TreeNode file4 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_drive_file, "File 4"));
fillDownloadsFolder(downloads);
downloads.addChildren(file1, file2, file3, file4);
TreeNode myMedia = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo_library, "Photos"));
TreeNode photo1 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "Photo 1"));
TreeNode photo2 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "Photo 2"));
TreeNode photo3 = new TreeNode(new IconTreeItemHolder.IconTreeItem(R.string.ic_photo, "Photo 3"));
myMedia.addChildren(photo1, photo2, photo3);
myDocuments.addChild(downloads);
computerRoot.addChildren(myDocuments, myMedia);
root.addChildren(computerRoot);
tView = new AndroidTreeView(getActivity(), root);
tView.setDefaultContainerStyle(R.style.TreeNodeStyleCustom);
tView.setDefaultViewHolder(IconTreeItemHolder.class);
tView.setDefaultNodeClickListener(nodeClickListener);
containerView.addView(tView.getView());
if (savedInstanceState != null) {
String state = savedInstanceState.getString("tState");
if (!TextUtils.isEmpty(state)) {
tView.restoreState(state);
}
}
return rootView;
}