1 16 package org.apache.myfaces.examples.listexample; 17 18 import java.io.Serializable ; 19 20 import org.apache.myfaces.custom.tree.DefaultMutableTreeNode; 21 import org.apache.myfaces.custom.tree.model.DefaultTreeModel; 22 23 30 public class TreeTable implements Serializable 31 { 32 private DefaultTreeModel treeModel; 33 34 37 public TreeTable(DefaultTreeModel treeModel) 38 { 39 this.treeModel = treeModel; 40 } 41 42 47 public TreeTable() 48 { 49 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeItem(1, "XY", "9001", "XY 9001")); 50 DefaultMutableTreeNode a = new DefaultMutableTreeNode(new TreeItem(2, "A", "9001", "A 9001")); 51 root.insert(a); 52 DefaultMutableTreeNode b = new DefaultMutableTreeNode(new TreeItem(3, "B", "9001", "B 9001")); 53 root.insert(b); 54 DefaultMutableTreeNode c = new DefaultMutableTreeNode(new TreeItem(4, "C", "9001", "C 9001")); 55 root.insert(c); 56 57 DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TreeItem(5, "a1", "9002", "a1 9002")); 58 a.insert(node); 59 node = new DefaultMutableTreeNode(new TreeItem(6, "a2", "9002", "a2 9002")); 60 a.insert(node); 61 node = new DefaultMutableTreeNode(new TreeItem(7, "a3", "9002", "a3 9002")); 62 a.insert(node); 63 node = new DefaultMutableTreeNode(new TreeItem(8, "b", "9002", "b 9002")); 64 b.insert(node); 65 66 a = node; 67 node = new DefaultMutableTreeNode(new TreeItem(9, "x1", "9003", "x1 9003")); 68 a.insert(node); 69 node = new DefaultMutableTreeNode(new TreeItem(9, "x2", "9003", "x2 9003")); 70 a.insert(node); 71 72 this.treeModel = new DefaultTreeModel(root); 73 } 74 75 78 public DefaultTreeModel getTreeModel() 79 { 80 return treeModel; 81 } 82 83 86 public void setTreeModel(DefaultTreeModel treeModel) 87 { 88 this.treeModel = treeModel; 89 } 90 } 91 | Popular Tags |