Java Code Examples for javax.faces.component.UIComponent#getFamily()

The following examples show how to use javax.faces.component.UIComponent#getFamily() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BsfUtils.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
public static Locale selectLocale(Locale vrloc, Object loc, UIComponent comp) {
	java.util.Locale selLocale = vrloc;

	if (loc != null) {
		if (loc instanceof String) {
			selLocale = BsfUtils.toLocale((String) loc);
		} else if (loc instanceof java.util.Locale) {
			selLocale = (java.util.Locale) loc;
		} else {
			throw new IllegalArgumentException(
					"Type:" + loc.getClass() + " is not a valid locale type for " + comp.getFamily() + ":" + comp.getClientId());
		}
	}

	return selLocale;
}
 
Example 2
Source File: InputDateDetectRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
private Renderer findDelegate(FacesContext context, UIComponent component, String newRendererType) {
    String componentFamily = component.getFamily();
    Renderer delegate = FacesUtil.getRenderer(context, componentFamily, newRendererType);
    if( null == delegate ){
        // won't happen, the 2 renderer-types in the detect method both have registered renderers.
        throw new NullPointerException("Renderer is null for componentFamily="+componentFamily+" rendererType="+newRendererType); //$NON-NLS-1$ //$NON-NLS-2$
    }
    return delegate;
}
 
Example 3
Source File: ComponentRendererTest.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
private void addFailComponentFamilyWrong(StringBuffer fails, UIComponent component, FacesComponentDefinition compDef) {
    String message = compDef.getFile().getFilePath()+" "+ getCompId(compDef)
    		+ " Mismatch <component-family> != getFamily() for "
    		+ XspTestUtil.getShortClass(component) + ". Expected "
    		+ component.getFamily() + ", was >"
    		+  compDef.getComponentFamily() + "</component-family>\n";
    System.err.print(ComponentRendererTest.class.getName()
    		+ ".testComponentRenderers() : " + message);
    fails.append( message);
}