KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > tree > renderkit > html > HtmlTreeNodeRenderer


1 /*
2  * Copyright 2004 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 package org.apache.myfaces.custom.tree.renderkit.html;
17
18 import org.apache.myfaces.custom.tree.HtmlTreeNode;
19 import org.apache.myfaces.renderkit.html.HtmlLinkRendererBase;
20 import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
21
22 import javax.faces.component.UIComponent;
23 import javax.faces.context.FacesContext;
24
25 /**
26  * @author <a HREF="mailto:oliver@rossmueller.com">Oliver Rossmueller</a>
27  * @version $Revision: 1.8 $ $Date: 2004/11/26 12:14:09 $
28  *
29  *
30  * $Log: HtmlTreeNodeRenderer.java,v $
31  * Revision 1.8 2004/11/26 12:14:09 oros
32  * MYFACES-8: applied tree table patch by David Le Strat
33  *
34  * Revision 1.7 2004/10/13 11:50:58 matze
35  * renamed packages to org.apache
36  *
37  * Revision 1.6 2004/07/01 21:53:10 mwessendorf
38  * ASF switch
39  *
40  * Revision 1.5 2004/06/09 20:32:16 o_rossmueller
41  * fix: removed duplicate output of value
42  *
43  * Revision 1.4 2004/06/03 12:57:03 o_rossmueller
44  * modified link renderer to use one hidden field for all links according to 1.1 renderkit docs
45  * added onclick=clear_XXX to button
46  *
47  * Revision 1.3 2004/05/27 15:06:39 manolito
48  * bugfix: node labels not rendered any more
49  *
50  * Revision 1.2 2004/04/29 18:48:07 o_rossmueller
51  * node selection handling
52  *
53  * Revision 1.1 2004/04/22 10:20:24 manolito
54  * tree component
55  *
56  */

57 public class HtmlTreeNodeRenderer
58         extends HtmlLinkRendererBase
59 {
60
61
62     public void decode(FacesContext facesContext, UIComponent component)
63     {
64         super.decode(facesContext, component);
65         String JavaDoc clientId = component.getClientId(facesContext);
66         String JavaDoc reqValue = (String JavaDoc)facesContext.getExternalContext().getRequestParameterMap().get(HtmlRendererUtils.getHiddenCommandLinkFieldName(HtmlRendererUtils.getFormName(component, facesContext)));
67         if (reqValue != null && reqValue.equals(clientId))
68         {
69             HtmlTreeNode node = (HtmlTreeNode)component;
70
71             node.setSelected(true);
72         }
73     }
74 }
75
Popular Tags