KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jndi > browser > model > JNDIContext


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.jndi.browser.model;
8
9 import java.awt.Component JavaDoc;
10 import java.beans.Customizer JavaDoc;
11 import java.beans.beancontext.BeanContextChildComponentProxy JavaDoc;
12 import java.util.Iterator JavaDoc;
13
14 import org.ejtools.adwt.GenericCustomizer;
15 import org.ejtools.beans.Sort;
16 import org.ejtools.beans.beancontext.CustomBeanContextServicesSupport;
17
18 /**
19  * Ancestor of all element in the JNDI tree. Represents a JNDI Context and can contains other context.
20  *
21  * @author letiemble
22  * @created 13 décembre 2001
23  * @version $Revision: 1.2 $
24  * @javabean:class displayName="JNDI Context"
25  * shortDescription="JNDI Context"
26  * @javabean:icons color16="/toolbarButtonGraphics/general/Folder16.gif"
27  * @javabean:property name="name"
28  * class="java.lang.String"
29  * displayName="Name"
30  * shortDescription="Name of the context"
31  */

32 public class JNDIContext extends CustomBeanContextServicesSupport implements BeanContextChildComponentProxy JavaDoc
33 {
34    /** Customizer of the JavaBean */
35    protected transient Customizer JavaDoc c = null;
36    /** Class name of the context */
37    protected String JavaDoc className = "";
38    /** Name of the context */
39    protected String JavaDoc name = "";
40
41
42    /** Constructor for the JndiServer object */
43    public JNDIContext()
44    {
45       super();
46    }
47
48
49    /**
50     * Gets the class name of the context
51     *
52     * @return The class name string
53     */

54    public String JavaDoc getClassName()
55    {
56       return this.className;
57    }
58
59
60    /**
61     * Gets the JavaBean customizer of the context
62     *
63     * @return The customizer
64     */

65    public Component JavaDoc getComponent()
66    {
67       // Lazy creation
68
if (c == null)
69       {
70          c = new GenericCustomizer(true, this);
71       }
72       return (Component JavaDoc) c;
73    }
74
75
76    /**
77     * Gets the name of the context
78     *
79     * @return The name string
80     */

81    public String JavaDoc getName()
82    {
83       return this.name;
84    }
85
86
87    /**
88     * Return the children of this context as an iterator
89     *
90     * @return The sorted iterator by class and by name
91     */

92    public Iterator JavaDoc iterator()
93    {
94       return Sort.sortByName(super.iterator());
95    }
96
97
98    /**
99     * Implementation of toString() method
100     *
101     * @return The name of the context
102     */

103    public String JavaDoc toString()
104    {
105       return name == null ? "Undefined" : name;
106    }
107
108
109    /**
110     * Sets the class name of this context
111     *
112     * @param className The class name
113     */

114    protected void setClassName(String JavaDoc className)
115    {
116       this.className = className;
117    }
118
119
120    /**
121     * Sets the name of this context
122     *
123     * @param name The name
124     */

125    protected void setName(String JavaDoc name)
126    {
127       String JavaDoc old = this.name;
128       this.name = name;
129       this.firePropertyChange("name", old, this.name);
130    }
131 }
132
Popular Tags