📄 helponfocuscomponent.java
字号:
package jsfcssjs;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.util.Map;
public class HelpOnFocusComponent extends SetupComponent {
protected void setup(FacesContext ctx, UIComponent comp) {
Map attrMap = comp.getAttributes();
String helpOnFocus = getAttribute(attrMap, "helpOnFocus");
if (helpOnFocus != null) {
String helpParam[] = new String[] {
EncodeUtils.encodeString(helpOnFocus).toString() };
insertCall(attrMap, "onfocus", "showHelpOnFocus", helpParam);
insertCall(attrMap, "onblur", "clearHelpOnBlur", null);
}
}
protected String getAttribute(Map attrMap, String attrName) {
Object attrValue = attrMap.get(attrName);
if (attrValue != null)
return attrValue.toString();
else
return null;
}
protected void insertCall(Map attrMap, String attrName,
String functionName, String functionParams[]) {
String attrValue = getAttribute(attrMap, attrName);
if (attrValue != null && attrValue.indexOf(functionName) != -1)
return;
StringBuilder buf = EncodeUtils.encodeCall(
functionName, functionParams);
if (attrValue != null && attrValue.length() > 0) {
buf.append(';');
buf.append(attrValue);
}
attrMap.put(attrName, buf.toString());
}
public String getFamily() {
return "HelpOnFocus";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -