KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > webapp > model > NodeInfo


1 /*
2  * (c) Rob Gordon 2005
3  */

4 package org.oddjob.webapp.model;
5
6 /**
7  * Collect together job node information for use
8  * in the tree view.
9  *
10  * @author Rob Gordon.
11  *
12  */

13 public class NodeInfo {
14
15     /** The node name. */
16     private final String JavaDoc nodeName;
17     
18     /** A list of the refIds of any children. */
19     private final String JavaDoc[] childRefIds;
20     
21     /** The iconId of the node */
22     private final String JavaDoc iconId;
23     
24     /**
25      * Constructor.
26      *
27      * @param nodeName The node name.
28      * @param childRefIds A list of the refIds of any children.
29      * @param iconId The icon id.
30      */

31     public NodeInfo (String JavaDoc nodeName,
32             String JavaDoc[] childRefIds,
33             String JavaDoc iconId) {
34         if (childRefIds == null) {
35             throw new NullPointerException JavaDoc("childRefId[] should be an empty array, not null.");
36         }
37         this.nodeName = nodeName;
38         this.childRefIds = childRefIds;
39         this.iconId = iconId;
40     }
41
42     /**
43      * Get child refIds.
44      *
45      * @return An array of child refIds, never Null.
46      */

47     public String JavaDoc[] getChildRefIds() {
48         return childRefIds;
49     }
50
51     /**
52      * Get the Icon id.
53      *
54      * @return The icon id.
55      */

56     public String JavaDoc getIconId() {
57         return iconId;
58     }
59
60     /**
61      * Get the node name.
62      *
63      * @return The node name.
64      */

65     public String JavaDoc getNodeName() {
66         return nodeName;
67     }
68     
69     /**
70      * Has this node got children.
71      *
72      * @return True if this node has children, false if it doesn't.
73      */

74     public boolean getHasChildren() {
75         return !(childRefIds.length == 0);
76     }
77 }
78
Popular Tags