Examples of TreeBranch


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

                editableTreeView = (TreeView)bxmlSerializer.getNamespace().get("editableTreeView");
                checkTreeView = (TreeView)bxmlSerializer.getNamespace().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

        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

    @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

        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

                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

                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

        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

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