Example usage for javax.swing.tree DefaultTreeModel DefaultTreeModel

List of usage examples for javax.swing.tree DefaultTreeModel DefaultTreeModel

Introduction

In this page you can find the example usage for javax.swing.tree DefaultTreeModel DefaultTreeModel.

Prototype

@ConstructorProperties({ "root" })
public DefaultTreeModel(TreeNode root) 

Source Link

Document

Creates a tree in which any node can have children.

Usage

From source file:wilos.presentation.web.tree.TreeBean.java

private void buildTreeModel() {
    if (this.projectId != null && !this.projectId.equals(DEFAULT_PROJECT_ID)) {
        ProjectNode projectNode;/*w w w .j  ava  2s .c o  m*/
        if (this.selectedMode.equals(TASKS_MODE)) {
            projectNode = new ProjectNode(this.project, true, treeMap);
            this.webSessionService.setAttribute(WebSessionService.TREE_MODE, TASKS_MODE);
        } else {
            projectNode = new ProjectNode(this.project, false, treeMap);
            this.webSessionService.setAttribute(WebSessionService.TREE_MODE, ROLES_MODE);
        }
        this.model = new DefaultTreeModel(projectNode);
    } else {
        // Build the default tree.
        this.model = new DefaultTreeModel(this.getDefaultTree());
    }
}