Examples of TreeBranch


Examples of barsuift.simLife.tree.TreeBranch

                // test translation
                Transform3D transform3D = new Transform3D();
                transformGroup.getTransform(transform3D);
                Vector3d translationVector = new Vector3d();
                transform3D.get(translationVector);
                TreeBranch treeBranch = mockTree.getBranches().get(nbBranchesFound);
                Point3d branchTranslationPoint = treeBranch.getBranch3D().getState().getTranslationVector()
                        .toPointValue();
                Vector3d expectedTranslationVector = new Vector3d(branchTranslationPoint);
                VectorTestHelper.assertVectorEquals(expectedTranslationVector, translationVector);

                // test one branch found
View Full Code Here

Examples of barsuift.simLife.tree.TreeBranch

                // test translation
                Transform3D transform3D = new Transform3D();
                transformGroup.getTransform(transform3D);
                Vector3d translationVector = new Vector3d();
                transform3D.get(translationVector);
                TreeBranch treeBranch = mockTree.getBranches().get(nbBranchesFound);
                Vector3d expectedTranslationVector = treeBranch.getBranch3D().getTranslationVector();
                VectorTestHelper.assertVectorEquals(expectedTranslationVector, translationVector);

                // test one branch found
                Structure3DHelper.assertExactlyOneGroup(transformGroup);
                Group specificGroupForTheBranch = (Group) transformGroup.getChild(0);
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

        if (promptDecorator != null) {
            treeView.getDecorators().remove(promptDecorator);
            promptDecorator = null;
        }

        TreeBranch treeData = new TreeBranch();
        treeData.add(build(value));
        treeView.setTreeData(treeData);
        treeView.expandBranch(new Path(0));
    }
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

    @SuppressWarnings("unchecked")
    private static TreeNode build(Object value) {
        TreeNode treeNode;

        if (value instanceof Map<?, ?>) {
            TreeBranch treeBranch = new TreeBranch("{}");

            Map<String, Object> map = (Map<String, Object>)value;
            for (String key : map) {
                TreeNode valueNode = build(map.get(key));

                String text = valueNode.getText();
                if (text == null) {
                    valueNode.setText(key);
                } else {
                    valueNode.setText(key + " : " + text);
                }

                treeBranch.add(valueNode);
            }

            treeNode = treeBranch;
        } else if (value instanceof List<?>) {
            TreeBranch treeBranch = new TreeBranch("[]");

            List<Object> list = (List<Object>)value;
            for (int i = 0, n = list.getLength(); i < n; i++) {
                TreeNode itemNode = build(list.get(i));

                String text = itemNode.getText();
                if (text == null) {
                    itemNode.setText("[" + i + "]");
                } else {
                    itemNode.setText("[" + i + "] " + text);
                }

                treeBranch.add(itemNode);
            }

            treeNode = treeBranch;
        } else if (value instanceof String) {
            treeNode = new TreeNode("\"" + value.toString() + "\"");
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

                editableTreeView = (TreeView)wtkxSerializer.get("editableTreeView");
                checkTreeView = (TreeView)wtkxSerializer.get("checkTreeView");

                rollup.setContent(component);

                TreeBranch treeData = (TreeBranch)editableTreeView.getTreeData();
                treeData.setComparator(new TreeNodeComparator());

                checkTreeView.setDisabledNodeFilter(new Filter<TreeNode>() {
                    @Override
                    public boolean include(TreeNode treeNode) {
                        boolean include = false;
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

                this.editableTreeView = (TreeView)bxmlSerializer.getNamespace().get("editableTreeView");
                this.checkTreeView = (TreeView)bxmlSerializer.getNamespace().get("checkTreeView");

                rollup.setContent(this.component);

                TreeBranch treeData = (TreeBranch)this.editableTreeView.getTreeData();
                treeData.setComparator(new TreeNodeComparator());

                this.checkTreeView.setDisabledNodeFilter(new Filter<TreeNode>() {
                    @Override
                    public boolean include(TreeNode treeNode) {
                        boolean include = false;
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

        if (promptDecorator != null) {
            treeView.getDecorators().remove(promptDecorator);
            promptDecorator = null;
        }

        TreeBranch treeData = new TreeBranch();
        treeData.add(build(value));
        treeView.setTreeData(treeData);
        treeView.expandBranch(new Path(0));
    }
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

    @SuppressWarnings("unchecked")
    private static TreeNode build(Object value) {
        TreeNode treeNode;

        if (value instanceof Map<?, ?>) {
            TreeBranch treeBranch = new TreeBranch("{}");
            treeBranch.setComparator(new Comparator<TreeNode>() {
                @Override
                public int compare(TreeNode treeNode1, TreeNode treeNode2) {
                    return treeNode1.getText().compareTo(treeNode2.getText());
                }
            });

            Map<String, Object> map = (Map<String, Object>)value;
            for (String key : map) {
                TreeNode valueNode = build(map.get(key));

                String text = valueNode.getText();
                if (text == null) {
                    valueNode.setText(key);
                } else {
                    valueNode.setText(key + " : " + text);
                }

                treeBranch.add(valueNode);
            }

            treeNode = treeBranch;
        } else if (value instanceof List<?>) {
            TreeBranch treeBranch = new TreeBranch("[]");

            List<Object> list = (List<Object>)value;
            for (int i = 0, n = list.getLength(); i < n; i++) {
                TreeNode itemNode = build(list.get(i));

                String text = itemNode.getText();
                if (text == null) {
                    itemNode.setText("[" + i + "]");
                } else {
                    itemNode.setText("[" + i + "] " + text);
                }

                treeBranch.add(itemNode);
            }

            treeNode = treeBranch;
        } else if (value instanceof String) {
            treeNode = new TreeNode("\"" + value.toString() + "\"");
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

            @Override
            public void buttonPressed(Button button) {
                TreeNode selectedNode = (TreeNode) tree.getSelectedNode();
                System.out.println("delete :: " + selectedNode);
                if (selectedNode != null) {
                    TreeBranch parent = selectedNode.getParent();
                    if (parent != null) {
                        parent.remove(selectedNode);
                    }
                }
            }
        });
    }
View Full Code Here

Examples of org.apache.pivot.wtk.content.TreeBranch

                Object x = tree.getSelectedNode();
                System.out.println("add a 'new branch' element to the selected element :: " + x);

                if (x != null && x instanceof TreeBranch)
                {
                    TreeBranch treeBranch = new TreeBranch("new branch");
                    ((TreeBranch)x).add(treeBranch);
                }

            }
        });

        treeButtonRemove.getButtonPressListeners().add(new ButtonPressListener() {
            @Override
            public void buttonPressed(Button button) {
                Object x = tree.getSelectedNode();
                System.out.println("remove a 'new branch' element under the selected element :: " + x);

                if (x != null && x instanceof TreeBranch)
                {
                    TreeBranch treeBranch = new TreeBranch("new branch");
                    ((TreeBranch)x).remove(treeBranch);
                }

            }
        });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.