KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.List JavaDoc;
26 import java.util.Map JavaDoc;
27
28 import javax.faces.component.UIComponent;
29
30
31 /**
32  * <p> This interface defines the methods required by
33  * {@link DynamicTreeNodeFactory}. By providing these methods, you are
34  * able to interface some tree structure with the
35  * {@link DynamicTreeNodeFactory} so that whole or partial trees can be
36  * created without having to do any tree conversion work (the work is done
37  * by the <code>TreeAdaptor</code> implementation in conjunction with the
38  * {@link DynamicTreeNodeFactory}).</p>
39  *
40  * <p> The <code>TreeAdaptor</code> implementation must have a <code>public
41  * static TreeAdaptor getInstance(FacesContext, LayoutComponent,
42  * UIComponent)</code> method in order to get access to an instance of the
43  * <code>TreeAdaptor</code> instance.</p>
44  *
45  * @author Ken Paulsen (ken.paulsen@sun.com)
46  */

47 public interface TreeAdaptor {
48
49     /**
50      * <p> This method is called shortly after
51      * {@link #getInstance(FacesContext, LayoutComponent, UIComponent)}.
52      * It provides a place for post-creation initialization to take
53      * occur.</p>
54      */

55     public void init();
56
57     /**
58      * <p> Returns the model object for the top <code>TreeNode</code>, this
59      * may contain sub <code>TreeNode</code>s.</p>
60      */

61     public Object JavaDoc getTreeNodeObject();
62
63     /**
64      * <p> Returns child <code>TreeNode</code>s for the given
65      * <code>TreeNode</code> model Object.</p>
66      */

67     public List JavaDoc getChildTreeNodeObjects(Object JavaDoc nodeObject);
68
69     /**
70      * <p> This method returns the <code>UIComponent</code> factory class
71      * implementation that should be used to create a
72      * <code>TreeNode</code> for the given tree node model object.</p>
73      */

74     public String JavaDoc getFactoryClass(Object JavaDoc nodeObject);
75
76     /**
77      * <p> This method returns the "options" that should be supplied to the
78      * factory that creates the <code>TreeNode</code> for the given tree
79      * node model object.</p>
80      *
81      * <p> Some useful options for the standard <code>TreeNode</code>
82      * component include:<p>
83      *
84      * <ul><li>text</li>
85      * <li>url</li>
86      * <li>imageURL</li>
87      * <li>target</li>
88      * <li>action<li>
89      * <li>actionListener</li>
90      * <li>expanded</li></ul>
91      *
92      * <p> See Tree / TreeNode component documentation for more details.</p>
93      */

94     public Map JavaDoc getFactoryOptions(Object JavaDoc nodeObject);
95
96     /**
97      * <p> This method returns the <code>id</code> for the given tree node
98      * model object.</p>
99      */

100     public String JavaDoc getId(Object JavaDoc nodeObject);
101
102     /**
103      * <p> This method returns any facets that should be applied to the
104      * <code>TreeNode</code> that is created for the given tree node
105      * model object. Useful facets for the standard
106      * <code>TreeNode</code> component are: "content" and "image".</p>
107      */

108     public Map JavaDoc getFacets(UIComponent comp, Object JavaDoc nodeObject);
109
110     /**
111      * <p> Advanced framework feature which provides better handling for
112      * things such as expanding TreeNodes, beforeEncode, and other
113      * events.</p>
114      *
115      * <p> This method should return a <code>Map</code> of <code>List</code>
116      * of <code>Handler</code> objects. Each <code>List</code> in the
117      * <code>Map</code> should be registered under a key that cooresponds
118      * to to the "event" in which the <code>Handler</code>s should be
119      * invoked.</p>
120      */

121     public Map JavaDoc getHandlersByType(UIComponent comp, Object JavaDoc nodeObject);
122 }
123
Popular Tags