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

The following examples show how to use javax.faces.component.UIComponent#findComponent() . 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: InternalIDExpressionResolver.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
private UIComponent findIdInNamingcontainer(UIComponent component, String currentId, List<UIComponent> result,
		UIComponent parent) {
	while ((!(parent instanceof UIViewRoot)) && (!(parent instanceof NamingContainer))) {
		parent = parent.getParent();
	}
	
	String parentId = ExpressionResolverUtilities.determineQualifiedId(parent);
	String childId;
	if (parentId.length()==0)
		childId=currentId;
	else if (parentId.endsWith(":"))
		childId = parentId + currentId;
	else
		childId = parentId + ":" + currentId;
	
	UIComponent c = component.findComponent(childId);
	if (null == c) {
		c = parent.findComponent(childId);
	}
	if (null == c) {
		c = component.findComponent(":"+childId);
	}
	
	return c;
}