1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.compat;
21
22 import javax.faces.component.ContextCallback;
23 import javax.faces.component.NamingContainer;
24 import javax.faces.component.UIComponent;
25 import javax.faces.context.FacesContext;
26
27
28
29
30 @Deprecated
31 public class FacesInvokeOnComponent12 {
32
33
34
35
36 @Deprecated
37 public static boolean invokeOnComponent(
38 FacesContext context, UIComponent component, String clientId, ContextCallback callback) {
39 String thisClientId = component.getClientId(context);
40
41 if (clientId.equals(thisClientId)) {
42 callback.invokeContextCallback(context, component);
43 return true;
44 } else if (component instanceof NamingContainer) {
45
46
47
48
49 if (clientId.startsWith(thisClientId)
50 && (clientId.charAt(thisClientId.length()) == NamingContainer.SEPARATOR_CHAR)) {
51 if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
52 return true;
53 }
54 }
55 } else {
56 if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
57 return true;
58 }
59 }
60
61 return false;
62 }
63
64
65
66
67 @Deprecated
68 private static boolean invokeOnComponentFacetsAndChildren(
69 FacesContext context, UIComponent component, String clientId, ContextCallback callback) {
70 for (java.util.Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();) {
71 UIComponent child = it.next();
72 if (child.invokeOnComponent(context, clientId, callback)) {
73 return true;
74 }
75 }
76 return false;
77 }
78 }