Examples of TreeBranch


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

                obj = new FakeWindow((Window) obj);
            }
            // create the explorer tree
            componentToTreeNode = new HashMap<Object, TreeNode>();
            // the root node is not visible
            final TreeBranch rootbranch = new TreeBranch("");
            rootbranch.add(analyseObjectTree(obj));
            treeView.setTreeData(rootbranch);
            treeView.expandAll();
            // add the loaded widget to the display
            this.loadedComponent = (Component) obj;
            playgroundCardPane.add((Component) obj);
View Full Code Here

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

    @SuppressWarnings("unchecked")
    private TreeNode analyseObjectTree(Object container) {
        // We don't want the RowSequence object to show up in the tree, it doesn't look neat
        if (container instanceof TablePane) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            TablePane table = (TablePane) container;
            for (TablePane.Row row : table.getRows()) {
                TreeNode childBranch = analyseObjectTree(row);
                branch.add(childBranch);
            }
            setComponentIconOnTreeNode(container, branch);
            return branch;
        }

        // We don't want to analyse the components that are added as part of the
        // skin, so use similar logic to BXMLSerializer
        DefaultProperty defaultProperty = container.getClass().getAnnotation(DefaultProperty.class);
        if (defaultProperty != null) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            String defaultPropertyName = defaultProperty.value();
            BeanAdapter beanAdapter = new BeanAdapter(container);
            if (!beanAdapter.containsKey(defaultPropertyName)) {
                throw new IllegalStateException("default property " + defaultPropertyName
                    + " not found on " + container);
            }
            Object defaultPropertyValue = beanAdapter.get(defaultPropertyName);
            if (defaultPropertyValue != null) {
                if (defaultPropertyValue instanceof Component) {
                    TreeNode childBranch = analyseObjectTree(defaultPropertyValue);
                    branch.add(childBranch);
                }
            }
            // An empty branch looks untidy if it has an arrow next to it,
            // so make empty branches into nodes.
            if (branch.isEmpty()) {
                TreeNode node = new TreeNode(branch.getText());
                setComponentIconOnTreeNode(container, node);
                return node;
            }
            setComponentIconOnTreeNode(container, branch);
            return branch;
        }

        if (container instanceof Sequence<?>) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            Iterable<Object> sequence = (Iterable<Object>) container;
            for (Object child : sequence) {
                TreeNode childBranch = analyseObjectTree(child);
                branch.add(childBranch);
            }
            setComponentIconOnTreeNode(container, branch);
            return branch;
        }
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");

                    // workaround for PIVOT-734
                    Path path = tree.getSelectedPath();
                    tree.setBranchExpanded(path, true);

                    ((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

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

        declaredEventsTreeView.setTreeData(treeData);

        updating = true;
        try {
            for (Class<?> listenerInterface : buckets) {
                TreeBranch treeBranch = new TreeBranch(listenerInterface.getSimpleName());
                treeBranch.setComparator(treeNodeComparator);
                treeData.add(treeBranch);

                for (Method event : buckets.get(listenerInterface)) {
                    treeBranch.add(new EventNode(event));
                    eventLogger.getIncludeEvents().add(event);
                }
            }

            Sequence.Tree.ItemIterator<TreeNode> iter = Sequence.Tree.depthFirstIterator(treeData);
View Full Code Here

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

        declaredEventsTreeView.setTreeData(treeData);

        updating = true;
        try {
            for (Class<?> listenerInterface : buckets) {
                TreeBranch treeBranch = new TreeBranch(listenerInterface.getSimpleName());
                treeBranch.setComparator(treeNodeComparator);
                treeData.add(treeBranch);

                for (Method event : buckets.get(listenerInterface)) {
                    treeBranch.add(new EventNode(event));
                    eventLogger.getIncludeEvents().add(event);
                }
            }

            Sequence.Tree.ItemIterator<TreeNode> iter = Sequence.Tree.depthFirstIterator(treeData);
View Full Code Here

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

                obj = new FakeWindow((Window) obj);
            }
            // create the explorer tree
            componentToTreeNode = new HashMap<Object, TreeNode>();
            // the root node is not visible
            final TreeBranch rootbranch = new TreeBranch("");
            rootbranch.add(analyseObjectTree(obj));
            treeView.setTreeData(rootbranch);
            treeView.expandAll();
            // add the loaded widget to the display
            this.loadedComponent = (Component) obj;
            playgroundCardPane.add((Component) obj);
View Full Code Here

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

    @SuppressWarnings("unchecked")
    private TreeNode analyseObjectTree(Object container) {
        // We don't want the RowSequence object to show up in the tree, it doesn't look neat
        if (container instanceof TablePane) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            TablePane table = (TablePane) container;
            for (TablePane.Row row : table.getRows()) {
                TreeNode childBranch = analyseObjectTree(row);
                branch.add(childBranch);
            }
            setComponentIconOnTreeNode(container, branch);
            return branch;
        }

        // We don't want to analyse the components that are added as part of the
        // skin, so use similar logic to BXMLSerializer
        DefaultProperty defaultProperty = container.getClass().getAnnotation(DefaultProperty.class);
        if (defaultProperty != null) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            String defaultPropertyName = defaultProperty.value();
            BeanAdapter beanAdapter = new BeanAdapter(container);
            if (!beanAdapter.containsKey(defaultPropertyName)) {
                throw new IllegalStateException("default property " + defaultPropertyName
                    + " not found on " + container);
            }
            Object defaultPropertyValue = beanAdapter.get(defaultPropertyName);
            if (defaultPropertyValue != null) {
                if (defaultPropertyValue instanceof Component) {
                    TreeNode childBranch = analyseObjectTree(defaultPropertyValue);
                    branch.add(childBranch);
                }
            }
            // An empty branch looks untidy if it has an arrow next to it,
            // so make empty branches into nodes.
            if (branch.isEmpty()) {
                TreeNode node = new TreeNode(branch.getText());
                setComponentIconOnTreeNode(container, node);
                return node;
            } else {
                setComponentIconOnTreeNode(container, branch);
                return branch;
            }
        }

        if (container instanceof Sequence<?>) {
            TreeBranch branch = new TreeBranch(nameForObject(container));
            Iterable<Object> sequence = (Iterable<Object>) container;
            for (Object child : sequence) {
                TreeNode childBranch = analyseObjectTree(child);
                branch.add(childBranch);
            }
            setComponentIconOnTreeNode(container, branch);
            return branch;
        }
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");

                    // workaround for PIVOT-734
                    Path path = tree.getSelectedPath();
                    tree.setBranchExpanded(path, true);

                    ((TreeBranch)x).add(treeBranch);
                }

            }
        });

        treeButtonRemove.getButtonPressListeners().add(new ButtonPressListener() {
            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

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

            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() {
            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.