Package com.smartgwt.client.widgets.tree

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


            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
                return record.getAttributeAsString("Job") + ": " + value;
            }
        });
       
        TreeGrid employeeTreeGrid = new TreeGrid();

        employeeTreeGrid.setWidth(500);
        employeeTreeGrid.setHeight(400);
        employeeTreeGrid.setNodeIcon("icons/16/person.png");
        employeeTreeGrid.setFolderIcon("icons/16/person.png");
        employeeTreeGrid.setCanReorderRecords(true);
        employeeTreeGrid.setCanAcceptDroppedRecords(true);
        employeeTreeGrid.setShowOpenIcons(false);
        employeeTreeGrid.setDropIconSuffix("into");
        employeeTreeGrid.setClosedIconSuffix("");
        employeeTreeGrid.setData(employeeTree);
        employeeTreeGrid.setFields(formattedField);
       
        return employeeTreeGrid;
    }
View Full Code Here


        employeeTree.setParentIdField("ReportsTo");
        employeeTree.setOpenProperty("isOpen");
        employeeTree.setData(employeeData);


        final TreeGrid employeeTreeGrid = new TreeGrid();
        employeeTreeGrid.setWidth(200);
        employeeTreeGrid.setHeight(240);
        employeeTreeGrid.setNodeIcon("icons/16/person.png");
        employeeTreeGrid.setFolderIcon("icons/16/person.png");
        employeeTreeGrid.setShowOpenIcons(false);
        employeeTreeGrid.setShowDropIcons(false);
        employeeTreeGrid.setClosedIconSuffix("");
        employeeTreeGrid.setData(employeeTree);
        employeeTreeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
        employeeTreeGrid.setShowSelectedStyle(false);
        employeeTreeGrid.setShowPartialSelection(true);
        employeeTreeGrid.setCascadeSelection(true);

        employeeTreeGrid.addDrawHandler(new DrawHandler() {
            public void onDraw(DrawEvent event) {
                employeeTreeGrid.getTree().openAll();
            }
        });

        DynamicForm df = new DynamicForm();

        final CheckboxItem partialSelection = new CheckboxItem("partialSelect", "Allow Partial Selection");
        partialSelection.setDefaultValue(true);
        partialSelection.addChangeHandler(new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                boolean selected = partialSelection.getValueAsBoolean();
                employeeTreeGrid.setShowPartialSelection(!selected);
                employeeTreeGrid.redraw();
            }
        });

        df.setFields(partialSelection);
View Full Code Here

            return DESCRIPTION;
        }
    }

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

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

        treeGrid.setFields(field);

        Tree tree = new Tree();
        tree.setModelType(TreeModelType.PARENT);
        //tree.setRootValue("1");
        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});

        tree.setRoot(root);

        treeGrid.setData(tree);

        return treeGrid;
    }
View Full Code Here

        }
    }

    public Canvas getViewPanel() {
        //TODO fix sample
        final TreeGrid treeGrid = new TreeGrid();
        treeGrid.setLoadDataOnDemand(false);
        treeGrid.setWidth(500);
        treeGrid.setHeight(400);
        treeGrid.setDataSource(EmployeeXmlDS.getInstance());
        treeGrid.setNodeIcon("icons/16/person.png");
        treeGrid.setFolderIcon("icons/16/person.png");
        treeGrid.setAutoFetchData(true);


        TreeGridField nameField = new TreeGridField("Name", 150);
        TreeGridField jobField = new TreeGridField("Job", 150);
        TreeGridField salaryField = new TreeGridField("Salary");

        treeGrid.setFields(nameField, jobField, salaryField);
       
        treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
            public void onDataArrived(DataArrivedEvent event) {
                treeGrid.getData().openAll();
            }
        });
       
        return treeGrid;
    }
View Full Code Here

                    new AnimateTreeNode("Lion")
                )
            )
        ));
       
        TreeGrid animalTreeGrid = new TreeGrid();
        animalTreeGrid.setData(animalTree);
        animalTreeGrid.setWidth(300);
        animalTreeGrid.setHeight(300);
        animalTreeGrid.setAnimateFolders(true);
        animalTreeGrid.setAnimateFolderSpeed(100);    
       
        VLayout layout = new VLayout();
        layout.setMembersMargin(10);
        layout.addChild(animalTreeGrid);
        return layout;
View Full Code Here

    public Canvas getViewPanel() {

        EmployeeXmlDS employeesDS = EmployeeXmlDS.getInstance();

        final TreeGrid treeGrid = new TreeGrid();
        treeGrid.setLoadDataOnDemand(false);
        treeGrid.setWidth(500);
        treeGrid.setHeight(400);
        treeGrid.setDataSource(employeesDS);
        treeGrid.setCanEdit(true);
        treeGrid.setNodeIcon("icons/16/person.png");
        treeGrid.setFolderIcon("icons/16/person.png");
        treeGrid.setAutoFetchData(true);
        treeGrid.setCanFreezeFields(true);
        treeGrid.setCanReparentNodes(true);       

        TreeGridField nameField = new TreeGridField("Name", 150);
        nameField.setFrozen(true);

        TreeGridField jobField = new TreeGridField("Job", 150);
        TreeGridField employeeTypeField = new TreeGridField("EmployeeType", 150);
        TreeGridField employeeStatusField = new TreeGridField("EmployeeStatus", 150);
        TreeGridField salaryField = new TreeGridField("Salary");
        TreeGridField genderField = new TreeGridField("Gender");
        TreeGridField maritalStatusField = new TreeGridField("MaritalStatus");

        treeGrid.setFields(nameField, jobField, employeeTypeField,employeeStatusField,
                salaryField, genderField, maritalStatusField);

        return treeGrid;
    }
View Full Code Here

    SectionStackSection section = new SectionStackSection();
    section.setCanCollapse(false);
    section.setExpanded(true);
    section.setResizeable(true);

    TreeGrid tree = new TreeGrid();
    tree.setWidth100();
    tree.setHeight100();
    tree.setAnimateFolderTime(100);
    tree.setAnimateFolders(true);
    tree.setAnimateFolderSpeed(1000);
    tree.setShowSortArrow(SortArrow.CORNER);
    tree.setShowAllRecords(true);
    tree.setLoadDataOnDemand(false);
    tree.setCanSort(false);
    tree.setCellHeight(17);
    tree.setShowHeader(false);

    TreeGridField field = new TreeGridField();
    field.setCanFilter(true);
    field.setName("name");
    field.setTitle("<b>SmartGWT Showcase</b>");
    tree.setFields(field);

    Tree treeData = new Tree();
    treeData.setModelType(TreeModelType.PARENT);
    treeData.setNameProperty("name");
    treeData.setOpenProperty("isOpen");
    treeData.setIdField("nodeID");
    treeData.setParentIdField("parentNodeID");
    treeData.setRootValue("root");
    treeData.setData(DemoData.getAddressBookTreeData());

    tree.setData(treeData);
    section.setItems(tree);

    setSections(section);
  }
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() {
            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

     */
    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

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.