Package javax.faces.component

Examples of javax.faces.component.UIForm


        initializeRequestParameterMap(new HashMap<String, String>() {
            {
                put("component", "component");
            }
        });
        UIForm form = mock(UIForm.class);
        UIComponent component = mock(UIComponent.class);
        UIViewRoot viewRoot = mock(UIViewRoot.class);

        when(facesContext.getViewRoot()).thenReturn(viewRoot);
        when(facesContext.getViewRoot().findComponent("component")).thenReturn(component);
View Full Code Here


        initializeRequestParameterMap(new HashMap<String, String>() {
            {
                put("form", "form");
            }
        });
        UIForm form = mock(UIForm.class);

        when(form.getClientId(facesContext)).thenReturn("form");

        // when
        boolean result = utils.isFormSubmitted(facesContext, form);

        // then
View Full Code Here

        initializeRequestParameterMap(new HashMap<String, String>() {
            {
                put("form", "");
            }
        });
        UIForm form = mock(UIForm.class);

        when(form.getClientId(facesContext)).thenReturn("form");

        // when
        boolean result = utils.isFormSubmitted(facesContext, form);

        // then
View Full Code Here

    @Test
    public void when_isFormSubbmited_is_called_with_form_which_does_not_have_corresponding_request_parameter_then_false_is_returned() {
        // given
        initializeRequestParameterMap(new HashMap<String, String>() {
        });
        UIForm form = mock(UIForm.class);

        when(form.getClientId(facesContext)).thenReturn("form");

        // when
        boolean result = utils.isFormSubmitted(facesContext, form);

        // then
View Full Code Here

   
    private void renderAction(FacesContext context, CommandButton comp) throws java.io.IOException {
        ResponseWriter writer = context.getResponseWriter();
       
        // post form data
        UIForm parentForm = getParentForm(context, comp);
        String href = RendererUtils.getCurrentUrl(context);
       
        // <go href='"+ href  +"' method='post' >
        writer.startElement(Attributes.GO, comp);
        writer.writeAttribute(Attributes.HREF, href, null);
        writer.writeAttribute(Attributes.METHOD, Attributes.POST, null);
       
        Set inputTags = RendererUtils.getInputTags(parentForm.getChildren());
        Iterator iter = inputTags.iterator();
       
        log.debug("Form has " + inputTags.size() + " input tags.");
       
        while(iter.hasNext()){
            UIComponent component = (UIComponent)iter.next();           
            String name = RendererUtils.getAttribute(component, Attributes.NAME);
           
            // <postfield name='" + name + "' value='$(" + name + ")' />
            writer.startElement(Attributes.POSTFIELD, component);
            writer.writeAttribute(Attributes.NAME, name, null);
            writer.writeAttribute(Attributes.VALUE, "$(" + name + ")", null);
            writer.endElement(Attributes.POSTFIELD);
        }
       
        // write hidden input to determine "submited" value on decode parent UIForm component
        writer.startElement(Attributes.POSTFIELD, comp);
        writer.writeAttribute(Attributes.NAME, parentForm.getClientId(context) + Attributes.POSTFIX_SUBMITED, null);
        writer.writeAttribute(Attributes.VALUE, "true", null);
        writer.endElement(Attributes.POSTFIELD);
       
        // write hidden input to determine "activated" value on decode commandLink
        writer.startElement(Attributes.POSTFIELD, comp);
View Full Code Here

    private void renderReset(FacesContext context, CommandButton comp) throws java.io.IOException {       
        ResponseWriter writer = context.getResponseWriter();
   
        writer.startElement(Attributes.REFRESH, comp);
       
        UIForm parentForm = getParentForm(context, comp);
        Set inputTags = RendererUtils.getInputTags(parentForm.getChildren());
        Iterator iter = inputTags.iterator();
       
        while(iter.hasNext()){
            UIComponent component = (UIComponent)iter.next();           
           
View Full Code Here

            throw new NullPointerException();
        }
        if (!component.isRendered()) return;

        CommandLink comp = (CommandLink)component;
        UIForm parentForm = getParentForm(context, component);
       
        ResponseWriter writer = context.getResponseWriter();
       
        String href = RendererUtils.getCurrentUrl(context);       
       
        // <go href='"+ href  +"' method='post' >
        writer.startElement(Attributes.GO, component);
        writer.writeAttribute(Attributes.HREF, href, null);
        writer.writeAttribute(Attributes.METHOD, Attributes.POST, null);
                       
        Set inputTags = RendererUtils.getInputTags(parentForm.getChildren());       
        Iterator iter = inputTags.iterator();
       
        log.debug("Form has " + inputTags.size() + " input tags.");                    
       
        while(iter.hasNext()){
            UIComponent inputComp = (UIComponent)iter.next();           
            String name = RendererUtils.getAttribute(inputComp, Attributes.NAME);

            // <postfield name='" + name + "' value='$(" + name + ")' />
            writer.startElement(Attributes.POSTFIELD, component);
            writer.writeAttribute(Attributes.NAME, name, null);
            writer.writeAttribute(Attributes.VALUE, "$(" + name + ")", null);
            writer.endElement(Attributes.POSTFIELD);
        }
               
        // write hidden input to determine "submited" value on decode parent UIForm component
        writer.startElement(Attributes.POSTFIELD, component);       
        writer.writeAttribute(Attributes.NAME, parentForm.getClientId(context) + Attributes.POSTFIX_SUBMITED, null);
        writer.writeAttribute(Attributes.VALUE, "true", null);
        writer.endElement(Attributes.POSTFIELD);
               
        // write hidden input to determine "activated" value on decode commandLink
        writer.startElement(Attributes.POSTFIELD, component);
View Full Code Here

        if (tabbedPane.getBgcolor() == null)
        {
            tabbedPane.setBgcolor(DEFAULT_BG_COLOR);
        }

        UIForm parentForm = RendererUtils.findParentForm(tabbedPane);
        if (parentForm == null)
        {
            writeFormStart(writer, facesContext, tabbedPane);
        }
View Full Code Here

        while (parent != null && !(parent instanceof UIForm))
        {
            parent = parent.getParent();
        }

        UIForm nestingForm = null;
        String formName;
        DummyFormResponseWriter dummyFormResponseWriter;
        if (parent != null)
        {
            //link is nested inside a form
            nestingForm = (UIForm)parent;
            formName = nestingForm.getClientId(facesContext);
            dummyFormResponseWriter = null;
        }
        else
        {
            //not nested in form, we must add a dummy form at the end of the document
View Full Code Here

    public void encodeBegin(FacesContext facesContext, UIComponent component)
            throws IOException
    {
        RendererUtils.checkParamValidity(facesContext, component, UIForm.class);

        UIForm htmlForm = (HtmlForm)component;

        ResponseWriter writer = facesContext.getResponseWriter();
        ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
        String viewId = facesContext.getViewRoot().getViewId();
        String clientId = htmlForm.getClientId(facesContext);
        String actionURL = viewHandler.getActionURL(facesContext, viewId);

        writer.startElement(HTML.FORM_ELEM, htmlForm);
        writer.writeAttribute(HTML.ID_ATTR, clientId, null);
        writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
View Full Code Here

TOP

Related Classes of javax.faces.component.UIForm

Copyright © 2018 www.massapicom. 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.