bernard
authored
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?xml version="1.0" encoding="UTF-8"?>
<f:root
xmlns:f="http://jsf.exadel.com/template"
xmlns:vcp=" http://jsf.exadel.com/vcp"
xmlns:ui=" http://jsf.exadel.com/ui"
xmlns:x=" http://jsf.exadel.com/vcp"
xmlns:u="http://jsf.exadel.com/util"
xmlns:h="http://jsf.exadel.com/header"
component="org.richfaces.component.UIFocus"
baseclass="org.ajax4jsf.renderkit.HeaderResourcesRendererBase"
class="org.richfaces.renderkit.html.FocusRenderer">
<f:clientid var="clientId"/>
<c:set var="for" value="#{component.forComponentId}"/>
<c:set var="priority" value="#{component.attributes['priority']}"/>
<h:scripts>new org.ajax4jsf.javascript.PrototypeScript(),/org/richfaces/renderkit/html/scripts/focus.js</h:scripts>
<jsp:scriptlet>
<![CDATA[
Integer priority = (Integer)variables.getVariable("priority");
if(priority == null) {
priority = component.getDefaultPriority();
}
variables.setVariable("priority",priority);
String sid = (String) variables.getVariable("for");
String target;
if (sid != null && ! "".equals(sid)) {
try {
UIComponent forcomp = getUtils().findComponentFor((UIComponent)component,sid);
if (forcomp != null) {
target = forcomp.getClientId(context);
} else {
target = sid;
}
}catch(IllegalArgumentException e) {
target = sid;
}
String suffix = component.getSuffix();
if(suffix != null && !"".equals(suffix)) {
target += suffix;
}
} else {
target = component.getParent().getClientId(context);
}
variables.setVariable("for",target);
]]>
</jsp:scriptlet>
<script type="text/javascript">
Richfaces.FocusManager.setFocus("#{for}",#{priority});
</script>
</f:root>
|