KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.apache.myfaces.taglib.UIComponentTagBase;
20 import javax.faces.component.UIComponent;
21 import javax.faces.context.FacesContext;
22 import javax.faces.el.ValueBinding;
23 import org.apache.myfaces.renderkit.JSFAttr;
24
25 /**
26  * @author Sean Schofield
27  * @version $Revision: 1.7 $ $Date: 2005/03/16 19:32:01 $
28  */

29
30 public class TreeTag extends UIComponentTagBase //UIComponentBodyTagBase
31
{
32     private String JavaDoc _value;
33     private String JavaDoc _var;
34     private String JavaDoc _varNodeToggler;
35     private String JavaDoc _showLines;
36     private String JavaDoc _showNav;
37     private String JavaDoc _clientSideToggle;
38     private String JavaDoc _showRootNode;
39
40     public void release()
41     {
42         super.release();
43
44         _value=null;
45         _var=null;
46         _varNodeToggler=null;
47         _showLines = null;
48         _showNav = null;
49         _clientSideToggle = null;
50         _showRootNode = null;
51     }
52
53     public String JavaDoc getComponentType()
54     {
55         return "org.apache.myfaces.HtmlTree2";
56     }
57
58     public String JavaDoc getRendererType()
59     {
60         return "org.apache.myfaces.HtmlTree2";
61     }
62
63     public void setValue(String JavaDoc value)
64     {
65         _value = value;
66     }
67
68     /**
69      * @param var The var to set.
70      */

71     public void setVar(String JavaDoc var)
72     {
73         _var = var;
74     }
75
76     public void setVarNodeToggler(String JavaDoc varNodeToggler)
77     {
78         _varNodeToggler = varNodeToggler;
79     }
80
81     public void setShowLines(String JavaDoc showLines)
82     {
83         _showLines = showLines;
84     }
85
86     public void setShowNav(String JavaDoc showNav)
87     {
88         _showNav = showNav;
89     }
90
91     public void setClientSideToggle(String JavaDoc clientSideToggle)
92     {
93         _clientSideToggle = clientSideToggle;
94     }
95     
96     public void setShowRootNode(String JavaDoc showRootNode)
97     {
98         _showRootNode = showRootNode;
99     }
100
101     protected void setProperties(UIComponent component)
102     {
103         super.setProperties(component);
104
105         FacesContext context = getFacesContext();
106
107         if (_value != null)
108         {
109             ValueBinding vb = context.getApplication().createValueBinding(_value);
110             component.setValueBinding("value", vb);
111         }
112
113         if (_var != null)
114         {
115             ((HtmlTree)component).setVar(_var);
116         }
117
118         if (_varNodeToggler != null)
119         {
120             ((HtmlTree)component).setVarNodeToggler(_varNodeToggler);
121         }
122
123         setBooleanProperty(component, JSFAttr.SHOW_NAV, _showNav);
124         setBooleanProperty(component, JSFAttr.SHOW_LINES, _showLines);
125         setBooleanProperty(component, JSFAttr.CLIENT_SIDE_TOGGLE, _clientSideToggle);
126         setBooleanProperty(component, JSFAttr.SHOW_ROOT_NODE, _showRootNode);
127     }
128 }
129
Popular Tags