KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdnc > JNTreeTable


1 /*
2  * $Id: JNTreeTable.java,v 1.4 2004/09/01 05:00:33 davidson1 Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.jdnc;
9
10 import javax.swing.Icon JavaDoc;
11 import javax.swing.JScrollPane JavaDoc;
12
13 import org.jdesktop.swing.decorator.FilterPipeline;
14 import org.jdesktop.swing.JXTreeTable;
15 import org.jdesktop.swing.treetable.DefaultTreeTableModel;
16 import org.jdesktop.swing.treetable.TreeTableModel;
17
18 /**
19  * Encapsulates JXTreeTable functionality inside a JNComponent.
20  *
21  * @author Ramesh Gupta
22  *
23  * @javabean.class
24  * displayName="Tree Table Component"
25  * name="JNTreeTable"
26  * shortDesctiption="A tree table control"
27  */

28 public class JNTreeTable extends JNTable {
29     /**
30      * Default constructor
31      */

32     public JNTreeTable() {
33         this(new DefaultTreeTableModel());
34     }
35
36     /**
37      * Creates a new JNTreeTable component that presents a JXTreeTable view for
38      * the specified model.
39      *
40      * @param model data model for the tree table
41      * @exception throws IllegalArgumentException if model is null
42      */

43     public JNTreeTable(TreeTableModel model) {
44         super(new JXTreeTable(model));
45     }
46
47     /**
48      * Returns the tree table for this component.
49      *
50      * @return the tree table for this component
51      */

52     public JXTreeTable getTreeTable() {
53         return (JXTreeTable) jxtable;
54     }
55
56     /**
57      * Returns the data model for the tree table.
58      *
59      * @return the data model for the tree table
60      */

61     public TreeTableModel getTreeTableModel() {
62         return ((JXTreeTable) jxtable).getTreeTableModel();
63     }
64
65     /**
66      * Sets the data model for the tree table.
67      *
68      * @param model data model for the tree table
69      * @exception throws IllegalArgumentException if model is null
70      *
71      * @javabean.property shorDescription="Set the tree table model"
72      */

73     public void setTreeTableModel(TreeTableModel model) {
74         ((JXTreeTable) jxtable).setTreeTableModel(model);
75     }
76
77     public void setFilters(FilterPipeline pipeline) {
78         // can't filter hierarchical structures
79
}
80
81     public void setCollapsedIcon(Icon JavaDoc icon) {
82         ((JXTreeTable) jxtable).setCollapsedIcon(icon);
83     }
84
85     public void setExpandedIcon(Icon JavaDoc icon) {
86         ((JXTreeTable) jxtable).setExpandedIcon(icon);
87     }
88
89     public void setOpenIcon(Icon JavaDoc icon) {
90         ((JXTreeTable) jxtable).setOpenIcon(icon);
91     }
92
93     public void setClosedIcon(Icon JavaDoc icon) {
94         ((JXTreeTable) jxtable).setClosedIcon(icon);
95     }
96
97     public void setLeafIcon(Icon JavaDoc icon) {
98         ((JXTreeTable) jxtable).setLeafIcon(icon);
99     }
100     /**
101      * Collapses specified row in the tree table.
102      */

103     public void collapseRow(int row) {
104         ((JXTreeTable) jxtable).collapseRow(row);
105     }
106
107     /**
108      * Expands all nodes in the tree table.
109      */

110     public void expandRow(int row) {
111         ((JXTreeTable) jxtable).expandRow(row);
112     }
113
114     /**
115      * Collapses all nodes in the tree table.
116      */

117     public void collapseAll() {
118         ((JXTreeTable) jxtable).collapseAll();
119     }
120
121     /**
122      * Expands all nodes in the tree table.
123      */

124     public void expandAll() {
125         ((JXTreeTable) jxtable).expandAll();
126     }
127 }
128
Popular Tags