Package org.apache.click.control

Examples of org.apache.click.control.TextField


        form.add(fieldSet1);

        fileField1 = new FileField("selectFile1", "Select File 1", 40);
        fieldSet1.add(fileField1);

        descField1 = new TextField("description1", "File Description 1", 30);
        fieldSet1.add(descField1);

        FieldSet fieldSet2 = new FieldSet("upload2", "<b>Upload File 2</b>");
        form.add(fieldSet2);

        fileField2 = new FileField("selectFile2", "Select File 2", 40);
        fieldSet2.add(fileField2);

        descField2 = new TextField("description2", "File Description 2", 30);
        fieldSet2.add(descField2);

        form.add(new Submit("ok", "  OK  ", this, "onOkClick"));
        form.add(new PageSubmit("cancel", HomePage.class));
    }
View Full Code Here


    public AdvancedForm() {
        FieldSet fieldSet = new FieldSet("Customer");
        form.add(fieldSet);

        TextField nameField = new TextField("name", true);
        nameField.setMinLength(5);
        nameField.setFocus(true);
        fieldSet.add(nameField);

        fieldSet.add(new EmailField("email", true));

        fieldSet.add(investmentSelect);
View Full Code Here

        radioGroup.add(new Radio("B"));
        radioGroup.add(new Radio("C"));
        fieldSet.add(radioGroup);
        fieldSet.add(select);
        fieldSet.add(new TextArea("textArea"));
        fieldSet.add(new TextField("textField"));

        Button button = new Button("button");
        button.setAttribute("onclick", "alert('Button clicked');");
        form.add(button);
        ImageSubmit imageSubmit = new ImageSubmit("image", "/assets/images/edit-button.gif");
View Full Code Here

        addControl(editLink);
        addControl(deleteLink);

        // Setup customers form
        FieldSet fieldSet = new FieldSet("customer");
        fieldSet.add(new TextField("name"));
        fieldSet.add(new EmailField("email"));
        fieldSet.add(new DoubleField("holdings"));
        fieldSet.add(new DateField("dateJoined"));
        form.add(fieldSet);
        form.add(new Submit("save", this, "onSaveClick"));
View Full Code Here

        Panel panel2 = new Panel("panel2", "panel/tabbed/form-panel2.htm");
        Form form = new Form("form");
        panel2.add(form);

        final TextField field = new TextField("name", "Enter your name");
        form.add(field);
        Submit submit = new Submit("go");
        submit.setActionListener(new ActionListener() {

            public boolean onAction(Control source) {
                addModel("msg", "Hi " + field.getValue() + ". Your form has been saved!");
                return true;
            }
        });

        form.add(submit);
View Full Code Here

        Select titleSelect = new Select("title", true);
        setupTitleSelect(titleSelect);
        getForm().add(titleSelect);

        getForm().add(new TextField("firstName", true));
        getForm().add(new TextField("lastName", true));
        getForm().add(new DateField("dateJoined", true));
        getForm().add(new EmailField("email"));

        client = WizardUils.getClientFromSession();
        if (client != null) {
View Full Code Here

        postCodeLookupWrapper.add(postCodeLookup);
        postCodeLookupWrapper.setStyle("text-align", "right");

        getForm().add(postCodeLookupWrapper);

        getForm().add(new TextField("address.line1", "Line One", true));
        getForm().add(new TextField("address.line2", "Line Two"));
        getForm().add(new TextField("address.suburb", "Suburb", true));

        stateSelect = new Select("address.state", "State", true);
        setupStateSelect(stateSelect);

        getForm().add(stateSelect);
View Full Code Here

        // ------
        // Form 1
        form1.setColumns(3);

        // Row 1
        Field titleField = new TextField("title");
        titleField.setStyle("width", "100%");
        form1.add(titleField, 2);
        form1.add(new Label("blank", ""));

        // Row 2
        form1.add(new TextArea("description", 70, 3), 3);

        // Row 3
        form1.add(new TextField("name"));
        form1.add(new TextField("type"));
        form1.add(new TelephoneField("telephone"));

        form1.add(new Submit("ok", " OK "));
        form1.add(new PageSubmit("cancel", HomePage.class));

        //-------
        // Form 2
        form2.setColumns(2);

        FieldSet fieldSet = new FieldSet("fieldSet", "FieldSet");
        form2.add(fieldSet);

        // Row 1
        fieldSet.add(new TextField("name"));
        fieldSet.add(new TextField("type"));

        // Row 2
        fieldSet.add(new TextArea("description", 39, 3), 2);

        // Row 3
View Full Code Here

                return true;
            }
        });

        // Add textfield after the button.
        form.add(new TextField("field"));
    }
View Full Code Here

    public void testCopyFormToObject() {

      // set up the form
        Form form = new Form("sample");
       
        TextField idField = new TextField("id");
        form.add(idField);

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

        TextField nameField = new TextField("name");
        fieldset.add(nameField);

        TextField dateField = new TextField("dateOfBirth");
        fieldset.add(dateField);
       
        TextField intField = new TextField("int");
        form.add(intField);

        TextField doubleField = new TextField("double");
        form.add(doubleField);
              
        Checkbox checkBox = new Checkbox("boolean");
        form.add(checkBox)
       
        TextField telephoneField = new TextField("telephone");
        form.add(telephoneField);
       
        HiddenField hidden = new HiddenField("hidden", String.class);
        form.add(hidden);
       
        // Populate fields
        idField.setValueObject(ID);
        nameField.setValue(NAME);
        dateField.setValueObject(DATE_OF_BIRTH);
        intField.setValue(String.valueOf(INT));
        doubleField.setValue(String.valueOf(DOUBLE));
        checkBox.setChecked(BOOLEAN);
        telephoneField.setValue(TELEPHONE);

        // copy form to object
        SampleObject sampleObject = new SampleObject();
        ClickUtils.copyFormToObject(form, sampleObject, true);

        // has the object been configured correctly?
        assertEquals(new Integer(idField.getValue()), sampleObject.getId());
        assertEquals(nameField.getValue(), sampleObject.getName());
       
        //NOTE the dateField was NOT copied to the sampleObject's Date property.
        //Use org.apache.click.extras.control.DateField in the extras project, to
        //copy a Date property.
        assertEquals(null, sampleObject.getDateOfBirth());
        assertEquals(telephoneField.getValueObject().toString(), sampleObject.getTelephone());
        assertTrue(sampleObject.getInt() == new Integer(intField.getValue()).intValue());
        assertTrue(sampleObject.getDouble() == new Double(doubleField.getValue()).doubleValue());
        assertTrue(sampleObject.isBoolean() == checkBox.isChecked());
       
        // Test object path copying
       
        User user = new User();
        user.setAddress(new Address());
        user.getAddress().setState(new State());
       
        form = new Form();
        TextField codeField = new TextField("address.state.code");
        codeField.setValue("NSW");
        form.add(codeField);
        form.copyTo(user, true);
        assertEquals("NSW", user.getAddress().getState().getCode());
    }
View Full Code Here

TOP

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

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.