use of org.santfeliu.faces.dynamicform.render.FormRenderer in project gdmatrix by gdmatrix.
the class DynamicForm method chooseBestRendererType.
// internal methods
protected String chooseBestRendererType(String rendererTypes) {
Form form = getForm();
String[] array = rendererTypes.split(",");
FacesContext facesContext = getFacesContext();
RenderKit renderKit = facesContext.getRenderKit();
String bestRendererType = null;
int bestSuitability = 0;
for (String rendererType : array) {
rendererType = rendererType.trim();
Renderer renderer = renderKit.getRenderer(FAMILY, rendererType);
int suitability;
if (renderer instanceof FormRenderer) {
FormRenderer formRenderer = (FormRenderer) renderer;
suitability = formRenderer.getSuitability(form, facesContext);
} else {
// default suitability
suitability = 1;
}
if (suitability > bestSuitability) {
bestSuitability = suitability;
bestRendererType = rendererType;
}
}
return bestRendererType;
}
Aggregations