Package org.gwtoolbox.widget.client.form

Examples of org.gwtoolbox.widget.client.form.Form


        subjectField.setValidators(notNull(), notEmpty());

        LongTextField bodyField = new LongTextField("body", "Body:");
        bodyField.setValidators(notNull(), notEmpty());

        final Form form = new Form();
        form.addFields(toField, subjectField, bodyField);


        EmailFormRenderer renderer = GWT.create(EmailFormRenderer.class);
        Widget formPanel = renderer.render(form);
        formPanel.setWidth("300px");

        SimpleButton validateButton = new SimpleButton("Validate", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton sendButton = new SimpleButton("Send", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton clearButton = new SimpleButton("Clear", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.reset();
            }
        });

        HorizontalPanel buttons = new HorizontalPanel();
        buttons.add(validateButton);
View Full Code Here


        subjectField.setValidators(notNull(), notEmpty());

        LongTextField bodyField = new LongTextField("body", "Body:");
        bodyField.setValidators(notNull(), notEmpty());
       
        final Form form = new Form();
        form.addFields(toField, subjectField, bodyField);

        FieldGroup group = new FieldGroup("to", "subject", "body");
        group.setHints(editorWidth("100%"));
        group.setHints("body", editorHeight("200px"));

        SimpleFieldsRenderer render = new SimpleFieldsRenderer();
        render.addFieldGroup(group);
        render.setLineGap(10);
        render.setHints(labelWidth("50px"));
        Widget formPanel = render.render(form);
        formPanel.setWidth("300px");

        SimpleButton validateButton = new SimpleButton("Validate", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton sendButton = new SimpleButton("Send", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton clearButton = new SimpleButton("Clear", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.reset();
            }
        });

        HorizontalPanel buttons = new HorizontalPanel();
        buttons.add(validateButton);
View Full Code Here

            put(3, "Tel-Aviv");
        }};
        SelectField<Integer> cityField = new SelectField<Integer>("city", Integer.class, cities, "City");
        cityField.setValidators(notNull());

        final Form form = new Form();
        form.addFields(firstNameField, lastNameField, emailField, street1Field, street2Field, cityField);

        FieldGroup generalGroup = new FieldGroup("firstName", "lastName", "email");
//        generalGroup.setLayoutHints(new LayoutHints().setEditorWidth("100%"));

        FieldGroup addressGroup = new FieldGroup("Address", new String[]{"street1", "street2", "city"});
        addressGroup.setHints(editorWidth("100%"));
        addressGroup.setHints("street2", labelVisible(false));

        SimpleFieldsRenderer renderer = new SimpleFieldsRenderer();
        renderer.setHints(labelWidth("65px"));
        renderer.addFieldGroup(generalGroup);
        renderer.addFieldGroup(addressGroup);
        Widget formPanel = renderer.render(form);
        formPanel.setWidth("300px");

        SimpleButton validateButton = new SimpleButton("Validate", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.validate();
            }
        });

        SimpleButton sendButton = new SimpleButton("Send", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton clearButton = new SimpleButton("Clear", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.reset();
            }
        });

        SimpleButton toggleMutableButton = new SimpleButton("Toggle Mutable", new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (form.isMutable()) {
                    form.markUnMutable();
                } else {
                    form.markMutable();
                }
            }
        });

        HorizontalPanel buttons = new HorizontalPanel();
View Full Code Here

@FormSample
public class FormPanelSample extends Composite implements SamplePanel {

    public FormPanelSample() {

        Form form = new Form();
        form.addFields(
                new ShortTextField("firstName", "First Name"),
                new ShortTextField("lastName", "Last Name"),
                new IntegerField("age", "Age"),
                new ShortTextField("email", "Email").setValidators(Validators.email()),
                new ShortTextField("address.street", "Street"),
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.form.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.