Package org.apache.click.control

Examples of org.apache.click.control.Form


     * Check that FileField value is escaped.
     */
    public void testEscapeValue() {
        MockContext.initContext();

        Form form = new Form("form");
        Menu menu = new Menu("menu");
        form.add(menu);

        String value = "<script>";
        String expected = "title=\"&lt;script&gt;\"";

        menu.setTitle(value);
View Full Code Here


    /**
     * Builds the user interface for users to change the tree options interactively.
     */
    public void buildOptionsUI() {
        //Form to handle user selected options
        optionsForm = new Form("optionForm");
        FieldSet fieldSet = new FieldSet("options", "Form Options");
        fieldSet.add(jsEnabled);
        fieldSet.add(rootNodeDisplayed);
        fieldSet.add(selectChildNodes);
        optionsForm.add(fieldSet);
View Full Code Here

    public FormProperties() {

        // Setup demonstration form

        form = new Form("form");

        FieldSet fieldSet = new FieldSet("demo", "<b>Demonstration Form</b>");
        form.add(fieldSet);

        nameField = new TextField("name");
        nameField.setRequired(true);
        nameField.setFocus(true);
        fieldSet.add(nameField);

        emailField = new EmailField("email");
        emailField.setRequired(true);
        fieldSet.add(emailField);

        investmentsField = new InvestmentSelect("investments");
        fieldSet.add(investmentsField);

        dateJoinedField = new DateField("dateJoined");
        fieldSet.add(dateJoinedField);

        form.add(new Submit("ok", "  OK  ", this, "onOkClick"));

        Submit cancel = new PageSubmit("cancel", HomePage.class);
        cancel.setCancelJavaScriptValidation(true);
        form.add(cancel);

        addControl(form);

        // Setup control form

        optionsForm = new Form("optionsForm");
        optionsForm.setColumns(3);
        optionsForm.setLabelAlign("right");
        optionsForm.setListener(this, "onApplyChanges");
        optionsForm.setLabelStyle("padding-left:2em;");
View Full Code Here

        if (!ArrayUtils.isEmpty(expandOrCollapseNodeIds)) {
            expandOrCollapse(expandOrCollapseNodeIds);
        }

        // Try and locate a parent form
        Form form = ContainerUtils.findForm(this);
        if (form != null) {
            // If the form was submitted, invoke bindSelectOrDeselectValues()
            if (form.isFormSubmission()) {
                onFormSubmission();
            }
        }
        return true;
    }
View Full Code Here

    /**
     * Builds the user interface for users to change the tree options interactively.
     */
    public void buildOptionsUI() {
        //Form to handle user selected options
        optionsForm = new Form("optionForm");
        FieldSet fieldSet = new FieldSet("options", "Form Options");
        fieldSet.add(jsEnabled);
        fieldSet.add(rootNodeDisplayed);
        optionsForm.add(fieldSet);

View Full Code Here

     * Check that all input fields are retrieved from container.
     */
    public void testGetInputFields() {
        MockContext.initContext();
        // set up the form
        Form form = new Form("sample");

        // HiddenField should be included
        HiddenField hiddenField = new HiddenField("hidden", boolean.class);
        form.add(hiddenField);

        // TextField should be included
        TextField idField = new TextField("id");
        form.add(idField);

        // FieldSet should NOT be included
        FieldSet fieldset = new FieldSet("fieldset");
        form.add(fieldset);

        // Label should NOT be included
        Label label = new Label("name");
        form.add(label);

        // Button should NOT be included
        Button button = new Button("button");
        form.add(button);
       
        List fields = ContainerUtils.getInputFields(form);
       
        // Total should be 4 consisting of the fields "hidden", "id" and the
        // Forms internal HiddenFields "form_name" and "bypass_validation".
View Full Code Here

        String price = "10.99";
        context.getMockRequest().setParameter("part.price", price);
        context.getMockRequest().setParameter("form_name", "form");

        // Setup form
        Form form = new Form("form");

        // Setup price field
        TextField priceField = new TextField("part.price");
        form.add(priceField);

        // Process form to bind request parameter to field
        form.onProcess();

        // Assert that the bound priceField value is equal to price
        assertEquals(price, priceField.getValue());

        Car car = new Car();
        form.copyTo(car);

        // Assert that the copied part price value is equal to the price
        assertEquals(price, Double.toString(car.getPart().getPrice()));
    }
View Full Code Here

        if (!ArrayUtils.isEmpty(expandOrCollapseNodeIds)) {
            expandOrCollapse(expandOrCollapseNodeIds);
        }

        // Try and locate a parent form
        Form form = ContainerUtils.findForm(this);
        if (form != null) {
            // If the form was submitted, invoke bindSelectOrDeselectValues()
            if (form.isFormSubmission()) {
                onFormSubmission();
            }
        }
        return true;
    }
View Full Code Here

        // This can cause issue with two fields inside a form with the same name.
        if (context.isAjaxRequest()) {
            return true;
        }

        Form form = ContainerUtils.findForm(control);
        if (form != null) {
            return form.isFormSubmission();
        }
        return true;
    }
View Full Code Here

    public void demo1() {
        // Create a submit link.
        final SubmitLink submitLink = new SubmitLink("submit");

        Form form = new Form("demo1");
        addControl(form);

        FieldSet fieldSet = new FieldSet("fieldSet");
        form.add(fieldSet);

        fieldSet.add(new TextField("name"));

        // Add the submit link to the fieldSet
        fieldSet.add(submitLink);
View Full Code Here

TOP

Related Classes of org.apache.click.control.Form

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.