Use {@link ComponentTraversalUtils#closestForm(javax.faces.context.FacesContext, javax.faces.component.UIComponent)} instead.

@param context
@param component
@return
@deprecated
325323
@Deprecated
    public static UIComponent findParentForm(FacesContext context, UIComponent component) {
        return ComponentTraversalUtils.closestForm(context, component);
    }
352206
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}

		Message message = (Message) component;
		String forValue = message.getFor();
		if (null == forValue || forValue.length() == 0)
			forValue = "@previous";
		try {
		forValue = ExpressionResolver.getComponentIDs(context, message, forValue);
		} catch (FacesException ex) {
			if (null == message.getFor() || message.getFor().length() == 0) {
				throw new FacesException("<b:message> couldn't find its predecessor automatically. Please add the 'for' attribute to indicate which JSF element the message belongs to. id of the <b:message>: " + message.getClientId());
			}
		}

		List<FacesMessage> messageList = context.getMessageList(forValue);

		ResponseWriter rw = context.getResponseWriter();
		int numberOfDivs = 0;
		boolean idHasBeenRendered = false;

		String responsiveStyleClass = Responsive.getResponsiveStyleClass(message, false).trim();
		String clientId = message.getClientId(context);
		numberOfDivs++;
		rw.startElement("div", component);
		if (!responsiveStyleClass.isEmpty()) {
			writeAttribute(rw, "class", responsiveStyleClass);
		}
		writeAttribute(rw, "id", clientId);
		idHasBeenRendered = true;

		if (!messageList.isEmpty()) {
			numberOfDivs++;
			rw.startElement("div", message);
			if (!idHasBeenRendered) {
				writeAttribute(rw, "id", clientId);
			}
			if (null != message.getDir()) {
				rw.writeAttribute("dir", message.getDir(), "dir");
			}

			String styleClass = message.getStyleClass();
			if (null != styleClass && styleClass.length() > 0)
				styleClass = styleClass + " ";
			else
				styleClass = "";

			String severityClass = findHighestSeverityClass(messageList, message);
			// alert-danger
			styleClass += "alert " + severityClass + " bf-message";

			writeAttribute(rw, "class", styleClass.trim());
			String style = message.getStyle();
			if (null == style)
				style = "";
			else if (!style.endsWith(";"))
				style += ";";
			String severityStyle = findHighestSeverityStyle(messageList, message);
			if (null == severityStyle)
				severityStyle = "";
			else if (!severityStyle.endsWith(";"))
				severityStyle += ";";

			writeAttribute(rw, "style", style + severityStyle);
			writeAttribute(rw, "role", "alert");

			boolean onlyMostSevere = message.isOnlyMostSevere();
			FacesMessage mostSevere = null;
			if (onlyMostSevere) {
				for (FacesMessage msg : messageList) {
					if (null == mostSevere || msg.getSeverity().getOrdinal() > mostSevere.getSeverity().getOrdinal()) {
						mostSevere = msg;
					}
				}
			}

			boolean firstMessage = true;

			for (FacesMessage msg : messageList) {
				if (onlyMostSevere && msg != mostSevere) {
					continue;
				}
				if (!firstMessage) {
					if (message.isLineBreak()) {
						rw.append(message.getLineBreakTag());
					}
				}
				firstMessage = false;

				if (message.isShowIcon()) {
					rw.startElement("span", component);
					writeAttribute(rw, "class", findHighestSeverityIcon(messageList, message) + " bf-message-icon");
					writeAttribute(rw, "aria-hidden", "true");
					rw.endElement("span");
				}

				if (message.isShowSummary() && msg.getSummary() != null && !msg.getSummary().equals(msg.getDetail())) {
					rw.startElement("span", component);
					writeAttribute(rw, "class", "bf-message-summary");
					if (message.isEscape()) {
						rw.writeText(msg.getSummary(), null);
					} else {
						warnOnFirstUse();
						rw.write(msg.getSummary());
					}
					rw.endElement("span");
				}

				if (message.isShowDetail() && msg.getDetail() != null) {
					rw.startElement("span", component);
					writeAttribute(rw, "class", "bf-message-detail");
					if (message.isEscape()) {
						rw.writeText(msg.getDetail(), null);
					} else {
						warnOnFirstUse();
						rw.write(msg.getDetail());
					}

					rw.endElement("span");
				}
				msg.rendered();
			}
		}
		for (int i = numberOfDivs; i > 0; i--) {
			rw.endElement("div");
		}
	}
77255
static Object getLabel(FacesContext context, 
                                        UIComponent component) {
                                        
        Object o = component.getAttributes().get("label");
        if (o == null || (o instanceof String && ((String) o).length() == 0)) {
            o = component.getValueExpression("label");
        }
        // Use the "clientId" if there was no label specified.
        if (o == null) {
            o = component.getClientId(context);
        }
        return o;
    }
1238316
protected UIComponent createComponent(FacesContext context, String newId) {
        UIComponent component;
        Application application = context.getApplication();
        if (binding != null) {
            ValueBinding vb = application.createValueBinding(binding);
            component = application.createComponent(vb, context,
                                                    getComponentType());
	    component.setValueBinding("binding", vb);
        } else {
            component = application.createComponent(getComponentType());
        }

        component.setId(newId);
        setProperties(component);

        return component;
    }
1359773
public static void associateCSH(BaseUIComponent component, HelpContext context) {
        HelpUtil.associateCSH(component, context, getShell());
    }
78903
public static ComponentWithContext getComponentById(final String id, final boolean visibleOnly) {
		UIContext uic = UIContextHolder.getCurrent();
		WComponent root = uic.getUI();
		ComponentWithContext comp = TreeUtil.getComponentWithContextForId(root, id, visibleOnly);
		return comp;
	}
937556
private UIForm getForm(UIComponent component) {
		while (component != null) {
			if (component instanceof UIForm) {
				break;
			}
			component = component.getParent();
		}
		return (UIForm) component;
	}
272711
protected Set<String> countComponentContainPaxWicketBeanAnnotatedFieldsHierachical(Class<?> component) {
        Set<String> foundAnnotation = new HashSet<String>();
        Class<?> clazz = component;
        while (clazz != null && !isBoundaryClass(clazz)) {
            for (Field field : clazz.getDeclaredFields()) {
                if (field.isAnnotationPresent(Inject.class)) {
                    foundAnnotation.add(field.toGenericString());
                }
            }
            clazz = clazz.getSuperclass();
        }
        return foundAnnotation;
    }
1306192
private final UIComponent createComponent(FacesContext facesContext, 
            final String componentType) throws FacesException
    {
        checkNull(componentType, "componentType");
        checkEmpty(componentType, "componentType");

        final Class<? extends UIComponent> componentClass =
                getObjectFromClassMap(componentType, _componentClassMap);
        if (componentClass == null)
        {
            log.log(Level.SEVERE, "Undefined component type " + componentType);
            throw new FacesException("Undefined component type " + componentType);
        }

        try
        {
            UIComponent component = componentClass.newInstance();
            _handleAnnotations(facesContext, component, component);
            return component;
        }
        catch (Exception e)
        {
            log.log(Level.SEVERE, "Could not instantiate component componentType = " + componentType, e);
            throw new FacesException("Could not instantiate component componentType = " + componentType, e);
        }
    }
798395
public static void decodeUISelectBoolean(FacesContext facesContext, UIComponent component)
    {
        if (!(component instanceof EditableValueHolder))
        {
            throw new IllegalArgumentException("Component "
                    + component.getClientId(facesContext)
                    + " is not an EditableValueHolder");
        }
        if (isDisabledOrReadOnly(component))
        {
            return;
        }
        Map paramMap = facesContext.getExternalContext()
                .getRequestParameterMap();
        String clientId = component.getClientId(facesContext);
        if (paramMap.containsKey(clientId))
        {
            String reqValue = (String) paramMap.get(clientId);
            if ((reqValue.equalsIgnoreCase("on")
                    || reqValue.equalsIgnoreCase("yes") || reqValue
                    .equalsIgnoreCase("true")))
            {
                ((EditableValueHolder) component).setSubmittedValue(Boolean.TRUE);
            }
            else
            {
                ((EditableValueHolder) component).setSubmittedValue(Boolean.FALSE);
            }
        }
        else
        {
            ((EditableValueHolder) component).setSubmittedValue(Boolean.FALSE);
        }
    }
439355
public static UIComponentTag getParentUIComponentTag(PageContext context) {

        UIComponentClassicTagBase result =
             getParentUIComponentClassicTagBase(context);
        if (!(result instanceof UIComponentTag)) {
            return new UIComponentTagAdapter(result);
        }
        return ((UIComponentTag) result);

    }
956212
public void setComponentConstraints(JComponent component)
    {
        GridBagConstraints c = this.getGBConstraints();
        GridBagLayout gridbag = (GridBagLayout)this.getScreenLayout();
        gridbag.setConstraints(component, c);
        
        Application application = BaseApplet.getSharedInstance().getApplication();
        MuffinManager muffinManager = application.getMuffinManager();
        if (component instanceof JTextComponent)
            if (muffinManager != null)
        {
            muffinManager.replaceClipboardAction(component, "cut");
            muffinManager.replaceClipboardAction(component, "copy");
            muffinManager.replaceClipboardAction(component, "paste");
        }        
    }
1151318
public static String resolveWidgetVar(String expression, UIComponent component) {
        UIComponent resolvedComponent = SearchExpressionFacade.resolveComponent(
                FacesContext.getCurrentInstance(),
                component,
                expression);

        if (resolvedComponent instanceof Widget) {
            return "PF('" + ((Widget) resolvedComponent).resolveWidgetVar() + "')";
        }
        else {
            throw new FacesException("Component with clientId " + resolvedComponent.getClientId() + " is not a Widget");
        }
    }
971568
public boolean invokeOnComponent(FacesContext context, String clientId,
                                     ContextCallback callback)
            throws FacesException {
        return super.invokeOnComponent(context, clientId, callback);
    }
1193884
@Deprecated
    public void close(ComponentDescriptor<?> descriptor, Object component) {
        close(descriptor, component, true);
    }
1310837
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPanel panel = (WPanel) component;
		XmlStringBuilder xml = renderContext.getWriter();
		FlowLayout layout = (FlowLayout) panel.getLayout();
		Size gap = layout.getSpace();
		String gapString = gap != null ? gap.toString() : null;
		FlowLayout.Alignment align = layout.getAlignment();

		xml.appendTagOpen("ui:flowlayout");

		switch (align) {
			case RIGHT: {
				xml.appendAttribute("align", "right");
				break;
			}
			case CENTER: {
				xml.appendAttribute("align", "center");
				break;
			}
			case LEFT: {
				xml.appendAttribute("align", "left");
				break;
			}

			case VERTICAL:
				xml.appendAttribute("align", "vertical");
				break;

			default:
				throw new IllegalStateException("Unknown layout type: " + layout.getAlignment());
		}

		if (layout.getContentAlignment() != null) {
			switch (layout.getContentAlignment()) {
				case TOP: {
					xml.appendAttribute("valign", "top");
					break;
				}
				case MIDDLE: {
					xml.appendAttribute("valign", "middle");
					break;
				}
				case BASELINE: {
					xml.appendAttribute("valign", "baseline");
					break;
				}

				case BOTTOM:
					xml.appendAttribute("valign", "bottom");
					break;

				default:
					throw new IllegalStateException("Unknown content alignment type: " + layout.
							getContentAlignment());
			}
		}
		xml.appendOptionalAttribute("gap", gapString);

		xml.appendClose();

		int size = panel.getChildCount();

		for (int i = 0; i < size; i++) {
			xml.appendTag("ui:cell");
			WComponent child = panel.getChildAt(i);
			child.paint(renderContext);
			xml.appendEndTag("ui:cell");
		}

		xml.appendEndTag("ui:flowlayout");
	}
346252
protected InputContainerElements scan(final UIComponent component, InputContainerElements elements,
            final FacesContext context) {
        if (elements == null) {
            elements = new InputContainerElements();
        }

        // NOTE we need to walk the tree ignoring rendered attribute because it's condition
        // could be based on what we discover
        if ((elements.getLabel() == null) && (component instanceof HtmlOutputLabel)) {
            elements.setLabel((HtmlOutputLabel) component);
        } else if (component instanceof EditableValueHolder) {
            elements.registerInput((EditableValueHolder) component, getDefaultValidator(context), context);
        } else if (component instanceof UIMessage) {
            elements.registerMessage((UIMessage) component);
        }
        // may need to walk smarter to ensure "element of least suprise"
        for (UIComponent child : component.getChildren()) {
            scan(child, elements, context);
        }

        return elements;
    }