Package com.smartgwt.client.widgets.tree

Examples of com.smartgwt.client.widgets.tree.Tree


    field.setCanFilter(true);
    field.setName("name");
    field.setTitle("<b>" + I18nProvider.getSampleMessages().sampleTitle("1.8.0") + "</b>");
    setFields(field);

    Tree tree = new Tree();
    tree.setModelType(TreeModelType.PARENT);
    tree.setIdField("nodeId");
    tree.setRootValue("topLevel");
    tree.setData(SampleArray.getSampleArray());

    setData(tree);
    // tree.openAll(tree.getRoot());
    tree.openFolder(tree.getChildren(tree.getRoot())[2]);
  }
View Full Code Here


            treeNode.setEnabled(item.isEnabled());
            treeNodes[i] = treeNode;
        }

        TreeNode rootNode = new EnhancedTreeNode(navigationSection.getName(), navigationSection.getTitle(), treeNodes);
        Tree tree = new Tree();
        tree.setRoot(rootNode);
        treeGrid.setData(tree);

        return treeGrid;
    }
View Full Code Here

        for (String name : treeGrids.keySet()) {
            TreeGrid treeGrid = treeGrids.get(name);
            if (!name.equals(sectionName)) {
                treeGrid.deselectAllRecords();
            } else {
                Tree tree = treeGrid.getTree();
                TreeNode node = tree.find(sectionName + "/" + pageName);
                if (node != null) {
                    treeGrid.selectSingleRecord(node);
                } else {
                    CoreGUI.getErrorHandler().handleError(MSG.view_leftNav_unknownPage(pageName, sectionName));
                }
View Full Code Here

                        rootNode.setIcon(icon);
                        rootNode.setID(String.valueOf(rootResourceGroup.getId()));
                        fakeRoot.setID(FAKE_ROOT_ID);
                        rootNode.setParentID(fakeRoot.getID());
                        fakeRoot.setChildren(new ResourceGroupEnhancedTreeNode[] { rootNode });
                        Tree tree = new Tree();
                        tree.setRoot(fakeRoot);
                        treeGrid.setData(tree);
                        treeGrid.selectRecord(rootNode);
                        break;

                    case COMPATIBLE:
View Full Code Here

        fakeRoot.setChildren(new ResourceGroupEnhancedTreeNode[] { rootNode });

        loadTree(rootNode, root, rootKey);

        Tree tree = new Tree();
        tree.setRoot(fakeRoot);
        org.rhq.coregui.client.util.TreeUtility.printTree(tree);

        treeGrid.setData(tree);
        return rootNode;
    }
View Full Code Here

                // First we need to ensure we have a properly populated parentResource (id and name, minimally),
                // get this from the parent ResourceTreeNode as resource.parentResource may not be set with
                // anything more than the id.
                Resource parentResource = resource.getParentResource();
                String parentResourceNodeId = ResourceTreeNode.idOf(parentResource);
                Tree tree = treeGrid.getTree();
                TreeNode parentResourceNode = tree.findById(parentResourceNodeId);
                if (null != parentResourceNode) {
                    parentResource = ((ResourceTreeNode) parentResourceNode).getResource();
                    resource.setParentResource(parentResource);
                }
                if (null == parentResource.getName()) {
View Full Code Here

                    serversGrid.setSortField(ATTRIB_NAME);

                    platformsGrid.setData(platformsRecords.toArray(new ListGridRecord[platformsRecords.size()]));
                    platformServicesGrid.setData(platformServicesRecords
                        .toArray(new ListGridRecord[platformServicesRecords.size()]));
                    Tree tree = new Tree();
                    tree.setModelType(TreeModelType.CHILDREN);
                    tree.setChildrenProperty(ATTRIB_CHILDREN);
                    TreeNode rootNode = new TreeNode("0");
                    tree.setRoot(rootNode);

                    for (Integer topServerId : topServers) {
                        ResourceTypeTreeNode topServerNode = serversNodes.get(topServerId);
                        topServerNode = topServerNode.copy();
                        fillHierarchy(topServerNode, serversNodes, childrenGraph);
                        tree.add(topServerNode, rootNode);
                    }
                    serversGrid.setData(tree);
                }

                private void fillHierarchy(ResourceTypeTreeNode node,
View Full Code Here

        if (!treeOnly) {
            CoreGUI.refresh();
        }

        // if this is the root just refresh from the top
        Tree tree = treeGrid.getTree();
        TreeNode refreshNode = tree.getParent(node);
        if (null == refreshNode.getName()) {
            tree.reloadChildren(node);
            return;
        }

        // reloads are performed only on resource nodes. find the first parental resource node, traversing
        // through autogroup and subcategory nodes as needed.
        while (!(refreshNode instanceof ResourceTreeNode)) {
            refreshNode = tree.getParent(refreshNode);
        }

        tree.reloadChildren(refreshNode);
    }
View Full Code Here

            }
        });
    }

    public void selectPath(ViewPath viewPath) {
        Tree theTree = getTree();

        if (viewPath.viewsLeft() > 0) {
            String key = "";
            for (ViewId view : viewPath.getViewPath().subList(2, viewPath.getViewPath().size())) {
                if (key.length() > 0) {
                    key += "_";
                } else {
                    key = String.valueOf(currentlySelectedBundleGroupId) + '_'; // all keys start with the parent group ID
                }

                key += view.getPath();

                TreeNode node = theTree.findById(key);

                // special case code to handle a "deployments" path. the path structure does not mirror the
                // tree structure, so we may have to manually force the "destinations" folder to open.
                if (node == null) {
                    if (key.endsWith("deployments")) {
                        String tempKey = key.replace("deployments", "destinations");
                        node = theTree.findById(tempKey);
                    }
                }

                if (node != null) {
                    // open the node, this will force a fetch of child data if necessary
                    theTree.openFolder(node);

                    // special case code to handle a "deployments" path. the path structure does not mirror the
                    // tree structure, so we may have to manually force the "destinations" folder to open, and
                    // then its children (deployment nodes)
                    if (key.endsWith("deployments")) {
                        theTree.openFolders(theTree.getChildren(node));
                    }
                } else {
                    // wait for data to get loaded...
                    pendingPath = new ViewPath(viewPath.toString());
                    return;
View Full Code Here

        addMember(treeGrid);
    }

    protected Tree buildTree() {
        Tree tree = new Tree();

        TreeNode root = new TreeNode(MSG.view_configCompare_configCompare());

        ArrayList<TreeNode> children = new ArrayList<TreeNode>();

        List<PropertyDefinition> nonGroupDefs = definition.getNonGroupedProperties();
        if (nonGroupDefs != null && !nonGroupDefs.isEmpty()) {
            TreeNode groupNode = new TreeNode(MSG.common_title_generalProp());
            buildNode(groupNode, nonGroupDefs, configs);
            children.add(groupNode);
        }

        for (PropertyGroupDefinition group : definition.getGroupDefinitions()) {
            TreeNode groupNode = new TreeNode(group.getDisplayName());
            buildNode(groupNode, definition.getPropertiesInGroup(group.getName()), configs);
            children.add(groupNode);
        }

        root.setChildren(children.toArray(new TreeNode[children.size()]));

        tree.setRoot(root);
        return tree;
    }
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.tree.Tree

Copyright © 2018 www.massapicom. 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.