Package javax.faces.component

Examples of javax.faces.component.UIForm


       
        // Add a component in order to trigger a dynamic update
        UIOutput testComponent = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
        testComponent.setId("testId");
        testComponent.setValue("Some Text");
        UIForm form = (UIForm) facesContext.getViewRoot().findComponent("mainForm");
        form.getChildren().add(testComponent);
       
        FaceletState faceletState = (FaceletState) facesContext.getViewRoot().getAttributes().get(
            ComponentSupport.FACELET_STATE_INSTANCE);
       
        executeViewHandlerRender(facesContext);
        executeAfterRender(facesContext);
       
        UIViewRoot root = new UIViewRoot();
        root.setLocale(locale);
        root.setRenderKitId("HTML_BASIC");
        root.setViewId("/dynPage1.xhtml");
       
        ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
        ViewPool viewPool = processor.getViewPool(facesContext, root);
        ViewEntry entry = viewPool.popDynamicStructureView(facesContext, root, faceletState);
        Assert.assertNotNull(entry);
        Assert.assertEquals(RestoreViewFromPoolResult.COMPLETE, entry.getResult());
       
        //Check the component was removed
        UIForm form2 = (UIForm) entry.getViewRoot().findComponent("mainForm");
        Assert.assertNotNull(form2);
        UIOutput testComponent2 = (UIOutput) form2.findComponent("testId");
        Assert.assertNull(testComponent2);
       
        tearDownRequest();
    }
View Full Code Here


    public void encodeBegin(FacesContext facesContext, UIComponent component)
            throws IOException
    {
        org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext, component, UIForm.class);

        UIForm htmlForm = (UIForm)component;

        ResponseWriter writer = facesContext.getResponseWriter();
        String clientId = htmlForm.getClientId(facesContext);
        String acceptCharset = getAcceptCharset(facesContext, htmlForm);
        String actionURL = getActionUrl(facesContext, htmlForm);
        String method = getMethod(facesContext, htmlForm);

        Map<String, List<ClientBehavior>> behaviors = null;
View Full Code Here

        {
            return;
        }
        */

        UIForm htmlForm = (UIForm)component;

        Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
        String submittedValue = (String)paramMap.get(component.getClientId(facesContext) +
                                                     HIDDEN_SUBMIT_INPUT_SUFFIX);
        if (submittedValue != null && submittedValue.equals(HIDDEN_SUBMIT_INPUT_VALUE))
        {
            htmlForm.setSubmitted(true);
        }
        else
        {
            htmlForm.setSubmitted(false);
        }
       
        HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
    }
View Full Code Here

    public void setUp() throws Exception
    {
        super.setUp();

        UIForm form = new UIForm();

        commandLink = new HtmlCommandLink();
        outputLink = new HtmlOutputLink();
        outputLink.setValue("http://someurl");
        outcomeTargetLink = new HtmlOutcomeTargetLink();

        form.getChildren().add(commandLink);

        writer = new MockResponseWriter(new StringWriter(), null, "UTF-8");
        facesContext.setResponseWriter(writer);
        facesContext.getApplication().setNavigationHandler(new NavigationHandlerImpl());
      


        facesContext.getViewRoot().setRenderKitId(MockRenderKitFactory.HTML_BASIC_RENDER_KIT);
        facesContext.getRenderKit().addRenderer(
                commandLink.getFamily(),
                commandLink.getRendererType(),
                new HtmlLinkRenderer());
        facesContext.getRenderKit().addRenderer(
                form.getFamily(),
                form.getRendererType(),
                new HtmlFormRenderer());
        facesContext.getRenderKit().addRenderer(
                outputLink.getFamily(),
                outputLink.getRendererType(),
                new HtmlLinkRenderer());
View Full Code Here

    assertEquals("#form\\\\:test", ComponentUtils.escapeJQueryId(id));
  }

  @Test
  public void shouldFindParentForm() {
    UIForm outerForm = new UIForm();
    UIForm innerForm = new UIForm();
    UINamingContainer container = new UINamingContainer();
    UIComponent cmp = new UIOutput();

    innerForm.getChildren().add(cmp);
    container.getChildren().add(innerForm);
    outerForm.getChildren().add(container);

    UIComponent result = ComponentUtils.findParentForm(null, cmp);
    assertSame("Expected closest surrounding UIForm", innerForm, result);
View Full Code Here

  @Test
  public void shouldFindParentContainer() {
    UINamingContainer outerContainer = new UINamingContainer();
    UINamingContainer innerContainer = new UINamingContainer();
    UIForm form = new UIForm();
    UIComponent cmp = new UIOutput();

    innerContainer.getChildren().add(cmp);
    form.getChildren().add(innerContainer);
    outerContainer.getChildren().add(form);

    UIComponent result = ComponentUtils.findParentNamingContainer(cmp);
    assertSame("Expected closest surrounding UIForm", innerContainer, result);
  }
View Full Code Here

  @Test
  public void resolveComponent_Parent() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
    outerContainer.getChildren().add(innerContainer);

    UIComponent component = new UIOutput();
View Full Code Here

  @Test
  public void resolveComponent_ParentParent() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
    outerContainer.getChildren().add(innerContainer);

    UIComponent component = new UIOutput();
View Full Code Here

  @Test
  public void resolveComponent_Form() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
    outerContainer.getChildren().add(innerContainer);

    UIComponent component = new UIOutput();
View Full Code Here

  @Test
  public void resolveComponent_FormParent() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
    outerContainer.getChildren().add(innerContainer);

    UIComponent component = new UIOutput();
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.