javax.faces.component.UINamingContainer Java Examples

The following examples show how to use javax.faces.component.UINamingContainer. 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: TagCloud.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public String resolveWidgetVar() {
	FacesContext context = FacesContext.getCurrentInstance();
	String userWidgetVar = (String) getAttributes().get("widgetVar");
	if (userWidgetVar != null)
		return userWidgetVar;
	else
		return "widget_" + getClientId(context).replaceAll("-|" + UINamingContainer.getSeparatorChar(context), "_");
}
 
Example #2
Source File: Chart.java    From ChartistJSF with Apache License 2.0 5 votes vote down vote up
public String resolveWidgetVar() {
	FacesContext context = getFacesContext();
	String userWidgetVar = (String) getAttributes().get("widgetVar");

	if (userWidgetVar != null)
		return userWidgetVar;
	else
		return "widget_" + getClientId(context).replaceAll("-|" + UINamingContainer.getSeparatorChar(context), "_");
}
 
Example #3
Source File: ExpressionResolver.java    From BootsFaces-OSP with Apache License 2.0 4 votes vote down vote up
private static String getComponentId(FacesContext context, UIComponent component, String originalExpression) {
	char separatorChar = UINamingContainer.getSeparatorChar(context);
	String separator = "" + separatorChar;
	UIComponent root;
	if (originalExpression.startsWith(":")) {
		originalExpression = originalExpression.substring(1);
		root = context.getViewRoot();
	} else {
		root = component;
	}
	List<UIComponent> roots = new ArrayList<UIComponent>();
	roots.add(root);
	String result = "";
	String[] subexpressions = originalExpression.split(separator);
	for (int i = 0; i < subexpressions.length; i++) {
		String currentId = subexpressions[i];
		if (currentId != null && currentId.length() > 0) {
			if (currentId.startsWith("@(") && currentId.endsWith(")")) {
				// the jQuery expression is evaluated on the client side
				result += currentId + " ";
				roots.clear();
			} else {
				if (currentId.equals("**")) {
					i++;
					if (subexpressions[i].contains("*"))
						currentId = "@findPartialIdRecursively(" + subexpressions[i] + ")";
					else
						currentId = "@findIdRecursively(" + subexpressions[i] + ")";
				} else if (currentId.equals("*")) {
					i++;
					currentId = "@findId(" + subexpressions[i] + ")";
				} else if (currentId.contains("*")) {
					currentId = "@findPartialId(" + currentId + ")";
				}
				roots = translateSearchExpressionToId(component, roots, currentId, originalExpression);
			}
		} else
			throw new FacesException("Invalid search expression: " + originalExpression);
	}


	for (UIComponent c : roots) {
		result += c.getClientId() + " ";
	}
	return result.trim();
}