Package javax.faces.component.html

Examples of javax.faces.component.html.HtmlForm


        resetCallbacks(childCallback, facetCallback, immediateFacetCallback);
    }

    public void testSaveRestoreChildrenState() throws Exception {
        HtmlForm form = new HtmlForm();
        HtmlInputText input = new HtmlInputText();
        IterationStateHolderComponent stateHolder = new IterationStateHolderComponent();

        List<UIComponent> children = mockDataAdaptor.getChildren();
        children.add(form);
        form.getChildren().add(input);
        form.getFacets().put("facet", stateHolder);

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));

        assertFalse(form.isSubmitted());
        assertNull(input.getSubmittedValue());
        assertNull(input.getLocalValue());
        assertTrue(input.isValid());
        assertFalse(input.isLocalValueSet());
        assertNull(stateHolder.getIterationState());

        form.setSubmitted(true);
        input.setSubmittedValue("user input");
        input.setValue("component value");
        input.setValid(false);
        input.setLocalValueSet(true);
        stateHolder.setIterationState("state");

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));

        assertFalse(form.isSubmitted());
        assertNull(input.getSubmittedValue());
        assertNull(input.getLocalValue());
        assertTrue(input.isValid());
        assertFalse(input.isLocalValueSet());
        assertNull(stateHolder.getIterationState());

        input.setSubmittedValue("another input from user");
        input.setValue("123");
        assertTrue(input.isLocalValueSet());
        stateHolder.setIterationState("456");

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));
        assertTrue(form.isSubmitted());
        assertEquals("user input", input.getSubmittedValue());
        assertEquals("component value", input.getLocalValue());
        assertFalse(input.isValid());
        assertTrue(input.isLocalValueSet());
        assertEquals("state", stateHolder.getIterationState());

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
        assertFalse(form.isSubmitted());
        assertEquals("another input from user", input.getSubmittedValue());
        assertEquals("123", input.getLocalValue());
        assertTrue(input.isValid());
        assertTrue(input.isLocalValueSet());
        assertEquals("456", stateHolder.getIterationState());

        mockDataAdaptor.setRowKey(facesContext, null);
        assertFalse(form.isSubmitted());
        assertNull(input.getSubmittedValue());
        assertNull(input.getLocalValue());
        assertTrue(input.isValid());
        assertFalse(input.isLocalValueSet());
        assertNull(stateHolder.getIterationState());
View Full Code Here


        super.setUp();
        writer = new MockResponseWriter(new StringWriter(), null, null);
        facesContext.setResponseWriter(writer);
        facesContext.getApplication().setNavigationHandler(new NavigationHandlerImpl());
        outcomeTargetButton = new HtmlOutcomeTargetButton();
        form = new HtmlForm();
        outcomeTargetButton.setParent(form);
       
        facesContext.getViewRoot().setRenderKitId(MockRenderKitFactory.HTML_BASIC_RENDER_KIT);
        facesContext.getRenderKit().addRenderer(
                outcomeTargetButton.getFamily(),
View Full Code Here


    @Override
    protected UIComponent createComponentToTest()
    {
        return new HtmlForm();
    }
View Full Code Here

    @Override
    protected UIComponent createComponentToTest()
    {
        UIComponent component = new HtmlCommandLink();
        UIComponent form = new HtmlForm();
        form.getChildren().add(component);
        facesContext.getViewRoot().getChildren().add(form);
        return component;
    }
View Full Code Here

    }

    @NotNull
    public static HtmlForm addForm(@NotNull
    UIComponent parent, FacesComponentIdFactory idFactory) {
        HtmlForm form = createComponent(HtmlForm.class, idFactory);
        form.setPrependId(false);
        parent.getChildren().add(form);
        return form;
    }
View Full Code Here

        // Insert the modal panel as a sibling of the configSet form, just after the form in the component tree.
        int index = getComponentIndex(configSetForm);
        configSetForm.getParent().getChildren().add(index + 1, modalPanel);

        // Add the propSet form as a child of the modal panel.
        HtmlForm propSetForm = new HtmlForm();
        modalPanel.getChildren().add(propSetForm);
        String propSetFormId = ConfigurationSetComponent.getPropSetFormId(configurationSetComponent);
        propSetForm.setId(propSetFormId);
        propSetForm.setOnsubmit("prepareInputsForSubmission(this)");

        // Add inputs for the request params that need to be forwarded when the propSet form is submitted.
        forwardParameter(propSetForm, "id");
        forwardParameter(propSetForm, "groupId");
        forwardParameter(propSetForm, "arcuId");
        forwardParameter(propSetForm, "apcuId");
        forwardParameter(propSetForm, "mode");

        addPropSetButtons(configurationSetComponent, propSetForm);

        // Add an AJAX region+panel as a child of this second form.
        HtmlAjaxRegion ajaxRegion = FacesComponentUtility.createComponent(HtmlAjaxRegion.class);
        propSetForm.getChildren().add(ajaxRegion);
        HtmlAjaxOutputPanel ajaxOutputPanel = FacesComponentUtility.createComponent(HtmlAjaxOutputPanel.class);
        ajaxRegion.getChildren().add(ajaxOutputPanel);
        ajaxOutputPanel.setLayout("block");
        ajaxOutputPanel.setAjaxRendered(true);
        ajaxOutputPanel.setKeepTransient(true);
View Full Code Here

        renderKit.addRenderer(
                new HtmlCommandButton().getFamily(),
                new HtmlCommandButton().getRendererType(),
                new HtmlButtonRenderer());
        renderKit.addRenderer(
                new HtmlForm().getFamily(),
                new HtmlForm().getRendererType(),
                new HtmlFormRenderer());
        renderKit.addRenderer(
                new HtmlOutputText().getFamily(),
                new HtmlOutputText().getRendererType(),
                new HtmlTextRenderer());
View Full Code Here

            input.setId("var1");
           
            HtmlCommandButton button = new HtmlCommandButton();
            button.setId("button1");
           
            UIForm form = new HtmlForm();
            form.setId("form1");
           
            form.getChildren().add(output);
            form.getChildren().add(input);
            form.getChildren().add(button);
            viewRoot.getChildren().add(form);
           
            markInitialState(viewRoot);
        }
View Full Code Here

    @Override
    protected UIComponent createComponentToTest()
    {
        UIComponent component = new HtmlCommandLink();
        UIComponent form = new HtmlForm();
        form.getChildren().add(component);
        facesContext.getViewRoot().getChildren().add(form);
        return component;
    }
View Full Code Here

    public void setUp() throws Exception {
        super.setUp();
        writer = new MockResponseWriter(new StringWriter(), null, null);
        facesContext.setResponseWriter(writer);
        commandButton = new HtmlCommandButton();
        form = new HtmlForm();
        commandButton.setParent(form);
       
        facesContext.getViewRoot().setRenderKitId(MockRenderKitFactory.HTML_BASIC_RENDER_KIT);
        facesContext.getRenderKit().addRenderer(
                commandButton.getFamily(),
View Full Code Here

TOP

Related Classes of javax.faces.component.html.HtmlForm

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.