/** * Finds the first component by the given id expression or client id. * * @param id The id. * @param base The base component to start the traversal. * @param separatorChar The separatorChar (e.g. :). * @param context The FacesContext. * @param callback the callback for the found component */ public static void firstById(String id, UIComponent base, char separatorChar, FacesContext context, ContextCallback callback) { // try #findComponent first UIComponent component = base.findComponent(id); // try #invokeOnComponent // it's required to support e.g. a full client id for a component which is placed inside UIData components if (component == null) { // #invokeOnComponent doesn't support the leading seperator char String tempExpression = id; if (tempExpression.charAt(0) == separatorChar) { tempExpression = tempExpression.substring(1); } context.getViewRoot().invokeOnComponent(context, tempExpression, callback); } else { callback.invokeContextCallback(context, component); } }
context.getViewRoot().invokeOnComponent(context, renderId, contextCallback);
context.getViewRoot().invokeOnComponent(context, uiDataId, contextCallback); data = contextCallback.getData();
/** * @param context * @param clientId * @param callback * @throws FacesException * @see javax.faces.component.UIComponentBase#invokeOnComponent(javax.faces.context.FacesContext, java.lang.String, * javax.faces.component.ContextCallback) */ public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException { return original.invokeOnComponent(context, clientId, callback); }
private List<UIComponent> getComponentSubtrees(List<String> subtrees) { FacesContext context = FacesContext.getCurrentInstance(); Map<String,Object> requestMap = context.getExternalContext().getRequestMap(); List<UIComponent> zoneList = (List<UIComponent>) requestMap.get(RENDERED_ZONE_LIST); if (null == zoneList) { zoneList = new ArrayList<UIComponent>(); requestMap.put(RENDERED_ZONE_LIST, zoneList); final UIComponent curZone[] = new UIComponent[1]; UIViewRoot viewRoot = context.getViewRoot(); for (String cur : subtrees) { // If the current view has a component with a clientId of cur... if (viewRoot.invokeOnComponent(context, cur, new ContextCallback() { public void invokeContextCallback(FacesContext facesContext, UIComponent uIComponent) { curZone[0] = uIComponent; } })) { // add it to the zone list. zoneList.add(curZone[0]); } } } return zoneList; }
/** * Finds the first component by the given id expression or client id. * * @param id The id. * @param base The base component to start the traversal. * @param separatorString The seperatorString (e.g. :). * @param context The FacesContext. * @param callback the callback for the found component */ public static void firstById(String id, UIComponent base, String separatorString, FacesContext context, ContextCallback callback) { // try #findComponent first UIComponent component = base.findComponent(id); // try #invokeOnComponent // it's required to support e.g. a full client id for a component which is placed inside UIData components if (component == null) { // #invokeOnComponent doesn't support the leading seperator char String tempExpression = id; if (tempExpression.startsWith(separatorString)) { tempExpression = tempExpression.substring(1); } context.getViewRoot().invokeOnComponent(context, tempExpression, callback); } else { callback.invokeContextCallback(context, component); } }
context.getViewRoot().invokeOnComponent(context, renderId, contextCallback);
@Override protected void doDecode(FacesContext facesContext, UIComponent component) { Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap(); if (requestParamMap.get(component.getClientId(facesContext)) == null) { return; } String dragSourceId = (String) requestParamMap.get("dragSource"); if (Strings.isNullOrEmpty(dragSourceId)) { return; } DragSourceContextCallBack dragSourceContextCallBack = new DragSourceContextCallBack(); boolean invocationResult = facesContext.getViewRoot().invokeOnComponent(facesContext, dragSourceId, dragSourceContextCallBack); if (!invocationResult) { // TODO - log return; } AbstractDropTarget dropTarget = (AbstractDropTarget) component; new DropEvent(dropTarget, dropTarget.getDropValue(), dragSourceContextCallBack.getDragSource(), dragSourceContextCallBack.getDragValue()).queue(); }
@Override protected void doDecode(FacesContext facesContext, UIComponent component) { Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap(); if (requestParamMap.get(component.getClientId(facesContext)) == null) { return; } String dragSourceId = (String) requestParamMap.get("dragSource"); if (Strings.isNullOrEmpty(dragSourceId)) { return; } DragSourceContextCallBack dragSourceContextCallBack = new DragSourceContextCallBack(); boolean invocationResult = facesContext.getViewRoot().invokeOnComponent(facesContext, dragSourceId, dragSourceContextCallBack); if (!invocationResult) { // TODO - log return; } AbstractDropTarget dropTarget = (AbstractDropTarget) component; new DropEvent(dropTarget, dropTarget.getDropValue(), dragSourceContextCallBack.getDragSource(), dragSourceContextCallBack.getDragValue()).queue(); }
@Override protected void doDecode(FacesContext facesContext, UIComponent component) { Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap(); if (requestParamMap.get(component.getClientId(facesContext)) == null) { return; } String dragSourceId = (String) requestParamMap.get("dragSource"); if (Strings.isNullOrEmpty(dragSourceId)) { return; } DragSourceContextCallBack dragSourceContextCallBack = new DragSourceContextCallBack(); boolean invocationResult = facesContext.getViewRoot().invokeOnComponent(facesContext, dragSourceId, dragSourceContextCallBack); if (!invocationResult) { // TODO - log return; } AbstractDropTarget dropTarget = (AbstractDropTarget) component; new DropEvent(dropTarget, dropTarget.getDropValue(), dragSourceContextCallBack.getDragSource(), dragSourceContextCallBack.getDragValue()).queue(); }
view.invokeOnComponent(context, clientId, callback); if (callback.isComponentFound()) view.invokeOnComponent(context, parentClientId, new AddComponentCallback(addedState));
facesContext.getViewRoot().invokeOnComponent(facesContext, expression, callback);
facesContext.getViewRoot().invokeOnComponent(facesContext, expression, callback);
facesContext.getViewRoot().invokeOnComponent(facesContext, expression, callback);
uiViewRoot.invokeOnComponent(facesContext, clientId, new RemoveComponentCallback());
view.invokeOnComponent(context, clientId, new ContextCallback() view.invokeOnComponent(context, parentClientId, new ContextCallback()
view.invokeOnComponent(context, clientId, new ContextCallback() view.invokeOnComponent(context, parentClientId, new ContextCallback()
context.getViewRoot().invokeOnComponent(context, uiDataId, contextCallback); data = contextCallback.getData();