1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.custom.tree.renderkit.html;
20
21 import javax.faces.component.UIComponent;
22 import javax.faces.context.FacesContext;
23
24 import org.apache.myfaces.custom.tree.HtmlTreeNode;
25 import org.apache.myfaces.renderkit.html.jsf.ExtendedHtmlLinkRenderer;
26 import org.apache.myfaces.renderkit.html.util.DummyFormUtils;
27 import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
28
29
30
31
32
33
34
35
36
37
38 public class HtmlTreeNodeRenderer
39 extends ExtendedHtmlLinkRenderer {
40
41 public void decode(FacesContext facesContext, UIComponent component) {
42 super.decode(facesContext, component);
43 String clientId = component.getClientId(facesContext);
44 String reqValue = (String) facesContext
45 .getExternalContext()
46 .getRequestParameterMap()
47 .get(HtmlRendererUtils
48 .getHiddenCommandLinkFieldName(DummyFormUtils
49 .findNestingForm(component, facesContext)));
50 if (reqValue != null && reqValue.equals(clientId)) {
51 HtmlTreeNode node = (HtmlTreeNode) component;
52
53 node.setSelected(true);
54 }
55 }
56 }