KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > tree2 > TreeNodeBase


1 /*
2  * Copyright 2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.myfaces.custom.tree2;
18
19 import java.util.List JavaDoc;
20 import java.util.ArrayList JavaDoc;
21
22 public class TreeNodeBase implements TreeNode
23 {
24     private ArrayList JavaDoc children = new ArrayList JavaDoc();
25     private String JavaDoc type;
26     private String JavaDoc description;
27     private boolean leaf;
28     private String JavaDoc identifier;
29     private boolean expanded;
30
31     public TreeNodeBase()
32     {}
33     
34     public TreeNodeBase(String JavaDoc type, String JavaDoc description, boolean leaf)
35     {
36         this(type, description, null, leaf);
37     }
38
39     public TreeNodeBase(String JavaDoc type, String JavaDoc description, String JavaDoc identifier, boolean leaf)
40     {
41         this.type = type;
42         this.description = description;
43         this.identifier = identifier;
44         this.leaf = leaf;
45     }
46
47     public boolean isLeaf()
48     {
49         return leaf;
50     }
51     
52     public void setLeaf(boolean leaf)
53     {
54         this.leaf = leaf;
55     }
56
57     public List JavaDoc getChildren()
58     {
59         return children;
60     }
61
62     public String JavaDoc getType()
63     {
64         return type;
65     }
66
67     public void setType(String JavaDoc type)
68     {
69         this.type = type;
70     }
71     
72     public void setDescription(String JavaDoc description)
73     {
74         this.description = description;
75     }
76     
77     public String JavaDoc getDescription()
78     {
79         return description;
80     }
81     
82     public void setIdentifier(String JavaDoc identifier)
83     {
84         this.identifier = identifier;
85     }
86     
87     public String JavaDoc getIdentifier()
88     {
89         return identifier;
90     }
91     
92     public int getChildCount()
93     {
94         return getChildren().size();
95     }
96 }
97
Popular Tags