1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.custom.focus;
20
21 import javax.faces.component.UIComponent;
22 import javax.faces.component.UIInput;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27
28
29
30
31
32
33
34
35
36 public abstract class AbstractHtmlFocus extends UIInput
37 {
38 public static final String COMPONENT_TYPE = "org.apache.myfaces.Focus";
39 public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Focus";
40 public static final String COMPONENT_FAMILY = "javax.faces.Output";
41
42 private static final boolean DEFAULT_REMEMBER_CLIENT_FOCUS = false;
43
44 private static Log log = LogFactory.getLog(AbstractHtmlFocus.class);
45
46
47
48
49
50
51 public abstract String getFor();
52
53
54
55
56
57 public abstract boolean isRememberClientFocus();
58
59
60 protected UIComponent findUIComponent()
61 {
62 String forStr = getFor();
63
64 if (forStr == null)
65 {
66 throw new IllegalArgumentException("focus@for must be specified");
67 }
68
69 UIComponent forComp = findComponent(forStr);
70 if (forComp == null)
71 {
72 log.warn("could not find UIComponent referenced by attribute focus@for = '"
73 + forStr + "'");
74 }
75 return forComp;
76 }
77
78 }