KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > jsfext > component > factory > basic > TreeAdaptorBase


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.tools.jsfext.component.factory.basic;
24
25 import com.sun.enterprise.tools.jsfext.layout.descriptor.LayoutComponent;
26
27 import java.util.Map JavaDoc;
28
29 import javax.faces.component.UIComponent;
30
31
32 /**
33  * <p> This class provides some of the implemenation for the methods required
34  * by the TreeAdaptor interface. This class may be extended to assist in
35  * implementing a TreeAdaptor implementation.</p>
36  *
37  * <p> The <code>TreeAdaptor</code> implementation must have a <code>public
38  * static TreeAdaptor getInstance(FacesContext, LayoutComponent,
39  * UIComponent)</code> method in order to get access to an instance of the
40  * <code>TreeAdaptor</code> instance.</p>
41  *
42  * @see TreeAdaptor
43  *
44  * @author Ken Paulsen (ken.paulsen@sun.com)
45  */

46 public abstract class TreeAdaptorBase implements TreeAdaptor {
47
48     /**
49      * <p> This Constructor does nothing. If you need to store a reference
50      * to the <code>LayoutComponent</code> or <code>UIComponent</code>
51      * associated with this <code>TreeAdaptor</code>, it may be more
52      * convenient to use a different constructor.</p>
53      */

54     protected TreeAdaptorBase() {
55     }
56
57     /**
58      * <p> This Constructor save the <code>LayoutComponent</code> and the
59      * <code>UIComponent</code> for easy use later.</p>
60      */

61     protected TreeAdaptorBase(LayoutComponent desc, UIComponent parent) {
62     setLayoutComponent(desc);
63     setParentUIComponent(parent);
64     }
65
66     /**
67      * <p> This method retrieves the <code>LayoutComponent</code> associated
68      * with this <code>TreeAdaptor</code>.</p>
69      */

70     public LayoutComponent getLayoutComponent() {
71     return _layoutComponent;
72     }
73
74     /**
75      * <p> This method sets the <code>LayoutComponent</code> associated
76      * with this <code>TreeAdaptor</code>.</p>
77      */

78     public void setLayoutComponent(LayoutComponent comp) {
79     _layoutComponent = comp;
80     }
81
82     /**
83      * <p> This method retrieves the <code>UIComponent</code> associated
84      * with this <code>TreeAdaptor</code>.</p>
85      */

86     public UIComponent getParentUIComponent() {
87     return _parent;
88     }
89
90     /**
91      * <p> This method sets the <code>UIComponent</code> associated with this
92      * <code>TreeAdaptor</code>.</p>
93      */

94     public void setParentUIComponent(UIComponent comp) {
95     _parent = comp;
96     }
97
98     /**
99      * <p> This method is called shortly after
100      * {@link #getInstance(FacesContext, LayoutComponent, UIComponent)}.
101      * It provides a place for post-creation initialization to take
102      * occur.</p>
103      *
104      * <p> This implemenation does nothing.</p>
105      */

106     public void init() {
107     }
108
109     /**
110      * <p> Returns the model object for the top <code>TreeNode</code>, this
111      * may contain sub <code>TreeNode</code>s.</p>
112      *
113      * <p> This implementation returns the value that was supplied by
114      * {@link #setTreeNodeObject()}. If that method is not explicitly
115      * called, then this implementation will return null.</p>
116      */

117     public Object JavaDoc getTreeNodeObject() {
118     return _topNodeObject;
119     }
120
121     /**
122      * <p> This method stores the top tree node model object.</p>
123      */

124     public void setTreeNodeObject(Object JavaDoc nodeObject) {
125     _topNodeObject = nodeObject;
126     }
127
128     /**
129      * <p> This method returns the <code>UIComponent</code> factory class
130      * implementation that should be used to create a
131      * <code>TreeNode</code> for the given tree node model object.</p>
132      */

133     public String JavaDoc getFactoryClass(Object JavaDoc nodeObject) {
134     return "com.sun.enterprise.tools.jsfext.component.factory.basic.TreeNodeFactory";
135     }
136
137     /**
138      * <p> This method returns any facets that should be applied to the
139      * <code>TreeNode</code> that is created for the given tree node
140      * model object. Useful facets for the standard
141      * <code>TreeNode</code> component are: "content" and "image".</p>
142      *
143      * <p> This implementation returns null (meaning no facets are to be
144      * used). You must override this method in order to provide
145      * facets.</p>
146      */

147     public Map JavaDoc getFacets(Object JavaDoc nodeObject) {
148     return null;
149     }
150
151     /**
152      * <p> Advanced framework feature which provides better handling for
153      * things such as expanding TreeNodes, beforeEncode, and other
154      * events.</p>
155      *
156      * <p> This method should return a <code>Map</code> of <code>List</code>
157      * of <code>Handler</code> objects. Each <code>List</code> in the
158      * <code>Map</code> should be registered under a key that cooresponds
159      * to to the "event" in which the <code>Handler</code>s should be
160      * invoked.</p>
161      *
162      * <p> This implementation returns null. This method must be overriden
163      * to take advantage of this feature.</p>
164      */

165     public Map JavaDoc getHandlersByType(Object JavaDoc nodeObject) {
166     return null;
167     }
168
169     private Object JavaDoc _topNodeObject = null;
170     private LayoutComponent _layoutComponent = null;
171     private UIComponent _parent = null;
172 }
173
Popular Tags