Component Authoring
Component Authoring
101
•Extend the appropriate UIComponent class
• Define the following properties
public static final String COMPONENT_TYPE = "your component";
public static final String RENDERER_TYPE = "your renderer";
1.
•Define public String getFamily () { return COMPONENT_TYPE; }
•Define default constructor which calls setRendererType(RENDERER_TYPE);
•Define your properties and their getters and setters.
IphoneHelper.java
public class IphoneHelper extends UIInput {
public static final String COMPONENET_TYPE = "com.icesoft.faces.IphoneHelper";
public static final String DEFAULT_RENDERER_TYPE =
"com.icesoft.faces.IphoneHelper";
public static final String COMPONENT_FAMILY =
"javax.faces.IphoneHelper";
public IphoneHelper() {
super();
McvJavascriptContext.includeLib(McvJavascriptContext.MCV_EXTRAS,
FacesContext.getCurrentInstance());
System.out.println("mcv context loaded");
}
public String getFamily() {
return COMPONENT_FAMILY;
}
public String getRendererType() {
return DEFAULT_RENDERER_TYPE;
}
Add any State saving and restoring code
IphoneHelper , creates the background javascript for a basic iui it does not have any saved state .ListviewData will however and will need something similar to the following.
Write the UIComponent Class
6/3/08
Hint:
Why write custom components
Icefaces doesn’t always play nice with other component libraries. ie. ajax4jf, it does work with the apache tomahawk but some components have limited functionality. The icefaces developers quide has a chart of compatibility. The icefaces developers guide has a wealth of information and should be one of the first places to look for info.