Examples of FormInfo


Examples of org.apache.myfaces.shared_impl.renderkit.html.util.FormInfo

        //todo: move out for 1.2!
        facesContext.getExternalContext().getRequestMap().put(FORM_CLIENT_ID_ATTR,
                                                              component.getClientId(facesContext));

        if ("true".equals(facesContext.getExternalContext().getInitParameter(VALIDATE_CONTEXT_PARAM))) {
            FormInfo info = RendererUtils.findNestingForm(component, facesContext);

            if (info != null && info.getForm() != null) {
                throw new FacesException("You should never nest HTML-forms. " +
                    "This leads to unpredictable behaviour in all major browsers. " +
                    "You can use multiple forms on a page, but they may not be nested!" +
                    "If you need to disable this check (on your own risk!) set the param " +
                    "org.apache.myfaces.VALIDATE in your web.xml context parameters to false");
View Full Code Here

Examples of org.apache.myfaces.shared_impl.renderkit.html.util.FormInfo

    }


    protected StringBuffer buildOnClick(UIComponent uiComponent, FacesContext facesContext, ResponseWriter writer)
        throws IOException {
        FormInfo formInfo = findNestingForm(uiComponent, facesContext);
        if (formInfo == null) {
            throw new IllegalArgumentException("Component " + uiComponent.getClientId(facesContext) + " must be embedded in an form");
        }
        String formName = formInfo.getFormName();
        UIComponent nestingForm = formInfo.getForm();

        StringBuffer onClick = new StringBuffer();
        String commandOnClick = (String) uiComponent.getAttributes().get(HTML.ONCLICK_ATTR);

        if (commandOnClick != null) {
View Full Code Here

Examples of org.apache.myfaces.shared_impl.renderkit.html.util.FormInfo

    public void decode(FacesContext facesContext, UIComponent component) {
        super.decode(facesContext, component)//check for NP

        if (component instanceof UICommand) {
            String clientId = component.getClientId(facesContext);
            FormInfo formInfo = findNestingForm(component, facesContext);
            String reqValue = (String) facesContext.getExternalContext().getRequestParameterMap().get(
                HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo));
            if (reqValue != null && reqValue.equals(clientId)) {
                component.queueEvent(new ActionEvent(component));
View Full Code Here

Examples of org.apache.myfaces.shared_impl.renderkit.html.util.FormInfo

                                               ResponseWriter writer,
                                               UIComponent component,
                                               String clientId)
        throws IOException {
        //Find form
        FormInfo formInfo = findNestingForm(component, facesContext);
        if (formInfo == null) {
            String path = RendererUtils.getPathToComponent(component);
            String msg = "Link is not embedded in a form. Change component/tag '" + clientId + "' from javax.faces.*/<h:tagName /> " +
                "to org.apache.myfaces.*/<t:tagName />, or embed it in a form.  This is not a bug. " +
                "Please see: http://wiki.apache.org/myfaces/Upgrading_to_Tomahawk_1.1.3 " +
                "The path to this component is " + path + ". If you need to render a special form and a JSF-form's attributes are not enough," +
                "consider using the s:form tag of the MyFaces sandbox.";
            throw new IllegalArgumentException(msg);
        }
        UIComponent nestingForm = formInfo.getForm();
        String formName = formInfo.getFormName();

        StringBuffer onClick = new StringBuffer();

        String commandOnclick;
        if (component instanceof HtmlCommandLink) {
            commandOnclick = ((HtmlCommandLink) component).getOnclick();
        }
        else {
            commandOnclick = (String) component.getAttributes().get(HTML.ONCLICK_ATTR);
        }
        if (commandOnclick != null) {
            onClick.append(commandOnclick);
            onClick.append(';');
        }

        if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm())) {
            onClick.append("submitForm('");
            onClick.append(formInfo.getForm().getClientId(facesContext));
            onClick.append("',1,{source:'");
            onClick.append(component.getClientId(facesContext));
            onClick.append("'});return false;");
        }
        else {
View Full Code Here

Examples of org.apache.myfaces.shared_impl.renderkit.html.util.FormInfo

        if (parent != null)
        {
            //link is nested inside a form
            String formName = parent.getClientId(facesContext);
            return new FormInfo(parent, formName);
        }

        return null;
    }
View Full Code Here

Examples of org.apache.myfaces.shared_orchestra.renderkit.html.util.FormInfo

        //todo: move out for 1.2!
        facesContext.getExternalContext().getRequestMap().put(FORM_CLIENT_ID_ATTR,
                                                              component.getClientId(facesContext));

        if ("true".equals(facesContext.getExternalContext().getInitParameter(VALIDATE_CONTEXT_PARAM))) { //todo: should go to MyfacesConfig class!
            FormInfo info = RendererUtils.findNestingForm(component, facesContext);

            if (info != null && info.getForm() != null) {
                throw new FacesException("You should never nest HTML-forms. " +
                    "This leads to unpredictable behaviour in all major browsers. " +
                    "You can use multiple forms on a page, but they may not be nested!" +
                    "If you need to disable this check (on your own risk!) set the param " +
                    "org.apache.myfaces.VALIDATE in your web.xml context parameters to false");
View Full Code Here

Examples of org.apache.myfaces.shared_tomahawk.renderkit.html.util.FormInfo

        if (parent != null)
        {
            //link is nested inside a form
            String formName = parent.getClientId(facesContext);
            return new FormInfo(parent, formName);
        }

        return null;
    }
View Full Code Here

Examples of org.apache.myfaces.shared_tomahawk.renderkit.html.util.FormInfo

    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
        RendererUtils.checkParamValidity(context, component, HtmlCommandJSCookMenu.class);

        List list = NavigationMenuUtils.getNavigationMenuItemList(component);
        if (list.size() > 0) {
            FormInfo parentFormInfo = RendererUtils.findNestingForm(component, context);
            ResponseWriter writer = context.getResponseWriter();

            if (parentFormInfo == null)
                throw new FacesException("jscook menu is not embedded in a form.");
            String formName = parentFormInfo.getFormName();
            List uiNavMenuItemList = component.getChildren();
            /* todo: disabled for now. Check if dummy form stuff is still needed/desired
                if( formName == null ) {
                DummyFormUtils.setWriteDummyForm(context,true);
                DummyFormUtils.addDummyFormParameter(context,JSCOOK_ACTION_PARAM);

                formName = DummyFormUtils.getDummyFormName();
            }
            else {*/
            if (RendererUtils.isAdfOrTrinidadForm(parentFormInfo.getForm())) {
                // need to add hidden input, cause MyFaces form is missing hence will not render hidden inputs
                writer.write("<input type=\"hidden\" name=\"");
                writer.write(JSCOOK_ACTION_PARAM);
                writer.write("\" />");
            }
            else {
                HtmlFormRendererBase.addHiddenCommandParameter(context, parentFormInfo.getForm(), JSCOOK_ACTION_PARAM);
            }

            //}

            String myId = getMenuId(context, component);
View Full Code Here

Examples of org.apache.myfaces.shared_tomahawk.renderkit.html.util.FormInfo

    public void decode(FacesContext facesContext, UIComponent component) {
        super.decode(facesContext, component)//check for NP

        if (component instanceof UICommand) {
            String clientId = component.getClientId(facesContext);
            FormInfo formInfo = findNestingForm(component, facesContext);
            String reqValue = (String) facesContext.getExternalContext().getRequestParameterMap().get(
                HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo));
            if (reqValue != null && reqValue.equals(clientId)) {
                component.queueEvent(new ActionEvent(component));
View Full Code Here

Examples of org.apache.myfaces.shared_tomahawk.renderkit.html.util.FormInfo

                                               ResponseWriter writer,
                                               UIComponent component,
                                               String clientId)
        throws IOException {
        //Find form
        FormInfo formInfo = findNestingForm(component, facesContext);
        if (formInfo == null) {
            String path = RendererUtils.getPathToComponent(component);
            String msg = "Link is not embedded in a form. Change component/tag '" + clientId + "' from javax.faces.*/<h:tagName /> " +
                "to org.apache.myfaces.*/<t:tagName />, or embed it in a form.  This is not a bug. " +
                "Please see: http://wiki.apache.org/myfaces/Upgrading_to_Tomahawk_1.1.3 " +
                "The path to this component is " + path + ". If you need to render a special form and a JSF-form's attributes are not enough," +
                "consider using the s:form tag of the MyFaces sandbox.";
            throw new IllegalArgumentException(msg);
        }
        UIComponent nestingForm = formInfo.getForm();
        String formName = formInfo.getFormName();

        StringBuffer onClick = new StringBuffer();

        String commandOnclick;
        if (component instanceof HtmlCommandLink) {
            commandOnclick = ((HtmlCommandLink) component).getOnclick();
        }
        else {
            commandOnclick = (String) component.getAttributes().get(HTML.ONCLICK_ATTR);
        }
        if (commandOnclick != null) {
            onClick.append(commandOnclick);
            onClick.append(';');
        }

        if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm())) {
            onClick.append("submitForm('");
            onClick.append(formInfo.getForm().getClientId(facesContext));
            onClick.append("',1,{source:'");
            onClick.append(component.getClientId(facesContext));
            onClick.append("'");
            // See Jira Issue 1809 https://issues.apache.org/jira/browse/MYFACES-1809
            onClick.append(getChildParametersTrinidad(component));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.