Package com.smartgwt.client.widgets.tree

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


            ListGrid platformServicesList = getCustomResourceTypeListGrid();
            SectionStackSection platformServices = new SectionStackSection(MSG.view_adminTemplates_platformServices());
            platformServices.setExpanded(true);
            platformServices.addItem(platformServicesList);

            TreeGrid serversTreeGrid = new CustomResourceTypeTreeGrid();
            SectionStackSection servers = new SectionStackSection(MSG.view_adminTemplates_servers());
            servers.setExpanded(true);
            servers.addItem(serversTreeGrid);

            sectionStack.addSection(platforms);
View Full Code Here


    @Override
    protected void onDraw() {
        super.onDraw();

        TreeGrid treeGrid = new TreeGrid();
        treeGrid.setWidth100();

        treeGrid.setLoadDataOnDemand(false);

        TreeGridField[] fields = new TreeGridField[2 + titles.size()];

        TreeGridField nameField = new TreeGridField("name", MSG.common_title_name(), 250);
        nameField.setFrozen(true);
        nameField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                if (listGridRecord == null || listGridRecord.getAttributeAsBoolean(ATTRIB_ALL_SAME)) {
                    return String.valueOf(o);
                } else {
                    return "<span style=\"color: red;\">" + String.valueOf(o) + "</span>";
                }
            }
        });

        TreeGridField typeField = new TreeGridField("type", MSG.common_title_type(), 80);

        fields[0] = nameField;
        fields[1] = typeField;

        int i = 2;
        for (String title : titles) {
            TreeGridField columnField = new TreeGridField(title, title, 150);
            columnField.setCellFormatter(new CellFormatter() {
                public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                    if (!(listGridRecord instanceof ComparisonTreeNode)) {
                        return "";
                    } else if (listGridRecord.getAttributeAsBoolean(ATTRIB_ALL_SAME)) {
                        return String.valueOf(o);
                    } else {
                        return "<span style=\"color: red;\">" + String.valueOf(o) + "</span>";
                    }
                }
            });
            fields[i++] = columnField;
        }

        treeGrid.setFields(fields);

        treeGrid.setData(buildTree());

        addMember(treeGrid);
    }
View Full Code Here

     *
     * @param tree: tree to add to the pannel.
     * @return TreeGrid: new treegrid.
     */
    private TreeGrid createTreeGrid(final Tree tree, String title) {
        final TreeGrid treeGridAux = new TreeGrid();
        treeGridAux.setWidth("100%");
        treeGridAux.setHeight("100%");

        //create the fields of the TreeGrid.
        final int widthField = 300;
        TreeGridField field = new TreeGridField("Name", title, widthField);
        field.setCanSort(false);
        field.setShowAlternateStyle(true);
        treeGridAux.setFields(field);

        //configure the handlers of the TreeGrid
        treeGridAux.addDrawHandler(new DrawHandler() {
            @Override
            public void onDraw(DrawEvent event) {
                tree.openAll();
            }
        });

        CellClickHandler a = new CellClickHandler(){
            @Override
            public void onCellClick(CellClickEvent event) {
                recordPersonSelected = (TreeNodePerson) event.getRecord();
            }
        };
        treeGridAux.addCellClickHandler(a);

        //add the fields to the treeGrid.
        treeGridAux.setData(tree);
        return treeGridAux;
    }
View Full Code Here

     */
    private void restartTreeGridFree() {
        treeGrid.clear();
        Tree treeAux = createTree();
        treeAux.setData(nodesTreeFree);
        TreeGrid treeGrid2 = createTreeGrid(treeAux, constants.peopleFree());
        treeGrid = treeGrid2;
        treeGrid.getData().openAll();

        treeGrid.setGenerateClickOnEnter(false);
        treeGrid.setGenerateDoubleClickOnEnter(false);
View Full Code Here

        employeeTree.setParentIdField("ReportsTo");
        employeeTree.setNameProperty("Name");
        employeeTree.setRootValue(1);
        employeeTree.setData(employeeData);
      
        TreeGrid employeeTreeGrid = new TreeGrid();
        employeeTreeGrid.setWidth(500);
        employeeTreeGrid.setHeight(400);
        employeeTreeGrid.setNodeIcon("icons/16/person.png");
        employeeTreeGrid.setFolderIcon("icons/16/person.png");
        employeeTreeGrid.setShowOpenIcons(false);
        employeeTreeGrid.setShowDropIcons(false);
        employeeTreeGrid.setClosedIconSuffix("");
        employeeTreeGrid.setFields(new TreeGridField("Name"));
        employeeTreeGrid.setData(employeeTree);
       
        employeeTreeGrid.getData().openAll();
       
        return employeeTreeGrid;
    }
View Full Code Here

     */
    private void restartTreeGridWork() {
        treeGridWork.clear();
        Tree treeAux = createTree();
        treeAux.setData(nodesTreeWork);
        TreeGrid treeGrid2 = createTreeGrid(treeAux, constants.peopleAssigned());
        treeGridWork = treeGrid2;
        treeGridWork.getData().openAll();

        treeGridWork.setGenerateClickOnEnter(false);
        treeGridWork.setGenerateDoubleClickOnEnter(false);
View Full Code Here

        employeeTree.setModelType(TreeModelType.CHILDREN);
        employeeTree.setNameProperty("Name");
        employeeTree.setChildrenProperty("directReports");
        employeeTree.setRoot(employeeRoot);
       
        TreeGrid employeeTreeGrid = new TreeGrid();
        employeeTreeGrid.setWidth(500);
        employeeTreeGrid.setHeight(400);
        employeeTreeGrid.setNodeIcon("icons/16/person.png");
        employeeTreeGrid.setFolderIcon("icons/16/person.png");
        employeeTreeGrid.setShowOpenIcons(false);
        employeeTreeGrid.setShowDropIcons(false);
        employeeTreeGrid.setClosedIconSuffix("");
        employeeTreeGrid.setFields(new TreeGridField("Name"));
        employeeTreeGrid.setData(employeeTree);
       
        employeeTreeGrid.getData().openAll();
       
        return employeeTreeGrid;
    }
View Full Code Here

            return DESCRIPTION;
        }
    }

    public Canvas getViewPanel() {      
        TreeGrid employeeTreeGrid = new TreeGrid();
        employeeTreeGrid.setWidth(500);
        employeeTreeGrid.setHeight(400);
        employeeTreeGrid.setNodeIcon("icons/16/person.png");
        employeeTreeGrid.setFolderIcon("icons/16/person.png");
        employeeTreeGrid.setShowOpenIcons(false);
        employeeTreeGrid.setShowDropIcons(false);
        employeeTreeGrid.setClosedIconSuffix("");
        employeeTreeGrid.setAutoFetchData(true);
        employeeTreeGrid.setDataSource(EmployeeXmlDS.getInstance());
       
        return employeeTreeGrid;
    }
View Full Code Here

            return DESCRIPTION;
        }
    }

    public Canvas getViewPanel() {
        TreeGrid treeGrid = new TreeGrid();
        treeGrid.setWidth(300);
        treeGrid.setHeight(400);

        TreeGridField field = new TreeGridField("Name", "Tree from local data");
        field.setCanSort(false);

        treeGrid.setFields(field);

        final Tree tree = new Tree();
        tree.setModelType(TreeModelType.PARENT);
        tree.setNameProperty("Name");
        tree.setIdField("EmployeeId");
        tree.setParentIdField("ReportsTo");
        tree.setShowRoot(true);

        EmployeeTreeNode root = new EmployeeTreeNode("4", "1", "Charles Madigen");
        EmployeeTreeNode node2 = new EmployeeTreeNode("188", "4", "Rogine Leger");
        EmployeeTreeNode node3 = new EmployeeTreeNode("189", "4", "Gene Porter");
        EmployeeTreeNode node4 = new EmployeeTreeNode("265", "189", "Olivier Doucet");
        EmployeeTreeNode node5 = new EmployeeTreeNode("264", "189", "Cheryl Pearson");
        tree.setData(new TreeNode[]{root, node2, node3, node4, node5});

        treeGrid.addDrawHandler(new DrawHandler() {
            public void onDraw(DrawEvent event) {
                tree.openAll();
            }
        });
       
        treeGrid.setData(tree);

        return treeGrid;
    }
View Full Code Here

     * configure the grid that contains the tree received.
     * @param tree
     * @return TreeGrid
     */
    private TreeGrid createTreeGridThemes(final Tree tree) {
        final TreeGrid treeGrid = new TreeGrid();
        treeGrid.setHeight100();
        treeGrid.setWidth100();

        //create the fields of the TreeGrid.
        TreeGridField field = new TreeGridField("Name", constants.name());
        field.setIcon("edit.png");
        field.setCanSort(false);
        field.setShowAlternateStyle(true);

        TreeGridField nameField = new TreeGridField("nodeInfo", constants.description());
        nameField.setIcon("descripcion.jpg");
        nameField.setShowAlternateStyle(true);
/*
        TreeGridField priorityField = new TreeGridField("priority", constants.priority());
        priorityField.setIcon("priority.jpg");
        priorityField.setWidth("12%");
        priorityField.setShowAlternateStyle(true);
*/
        TreeGridField initialEstimationField = new TreeGridField("initialEstimation",constants.initialEstimation());
        initialEstimationField.setWidth("12%");
        initialEstimationField.setIcon("clock.jpg");
        initialEstimationField.setShowAlternateStyle(true);

        TreeGridField currentEstimationField = new TreeGridField("currentEstimation",constants.currentEstimation());
        currentEstimationField.setWidth("12%");
        currentEstimationField.setIcon("clock.jpg");
        currentEstimationField.setShowAlternateStyle(true);
/*
        TreeGridField stateField = new TreeGridField("state",constants.state());
        stateField.setWidth("12%");
        stateField.setIcon("state.jpg");
        stateField.setShowAlternateStyle(true);
*/
        //treeGrid.setFields(field, priorityField, initialEstimationField, currentEstimationField, stateField, nameField);
        treeGrid.setFields(field, initialEstimationField, currentEstimationField,  nameField);

        treeGrid.addDrawHandler(new DrawHandler() {
            @Override
            public void onDraw(DrawEvent event) {
                tree.openAll();
            }
        });
        treeGrid.setSortField("Name");
        treeGrid.markForRedraw();
        //add the fields to the treeGrid.
        treeGrid.setData(tree);
         //start the handlers.
        handlersTreeGridThemes(treeGrid, tree);

        return treeGrid;
    }
View Full Code Here

TOP

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

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.