Package org.gwtoolbox.sample.widget.client.form

Source Code of org.gwtoolbox.sample.widget.client.form.MultiColumnForm

package org.gwtoolbox.sample.widget.client.form;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import org.gwtoolbox.ioc.core.client.annotation.Order;
import org.gwtoolbox.sample.widget.client.SamplePanel;
//import org.gwtoolbox.widget.client.form.field.FieldColumns;

/**
* @author Uri Boness
*/
//@Component
@Order(4)
@FormSample
public class MultiColumnForm extends Composite implements SamplePanel {

    public MultiColumnForm() {
//
//        final FormPanel form = new FormPanel();
//        form.setWidth("300px");
//        form.setVerticalGap("10px");
//        form.setHorizontalGap("10px");
//        form.setLabelPosition(FormPanel.LabelPosition.TOP);
//        form.setLabelWidth("50px");
//
//        FieldColumns columns = new FieldColumns();
//
//        ShortTextField fromField = new ShortTextField("from", "From");
//        fromField.setValidators(notNull(), notEmpty());
//        fromField.setEditorWidth("100%");
//        columns.addField(fromField);
//
//        ShortTextField toField = new ShortTextField("to", "To:");
//        toField.setValidators(notNull(), notEmpty());
//        toField.setEditorWidth("100%");
//        columns.addField(toField);
//
//        form.addFieldContainer(columns);
//
//        columns = new FieldColumns();
//
//        ShortTextField firstNameField = new ShortTextField("firstName", "First Name");
//        firstNameField.setValidators(notNull(), notEmpty());
//        firstNameField.setEditorWidth("100%");
//        columns.addField(firstNameField);
//
//        ShortTextField lastNameField = new ShortTextField("lastName", "Last Name");
//        lastNameField.setValidators(notNull(), notEmpty());
//        lastNameField.setEditorWidth("100%");
//        columns.addField(lastNameField);
//
//        form.addFieldContainer(columns);
//
//        ShortTextField subjectField = new ShortTextField("subject", "Subject");
//        subjectField.setValidators(notNull(), notEmpty());
//        subjectField.setEditorWidth("100%");
//        form.addField(subjectField);
//
//        LongTextField descriptionField = new LongTextField("body", "Body");
//        descriptionField.setValidators(notNull(), notEmpty());
//        descriptionField.setEditorWidth("100%");
//        descriptionField.setEditorHeight("200px");
//        form.addField(descriptionField);
//
//        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);
//        addGap(buttons, "10px");
//        buttons.add(sendButton);
//        addGap(buttons, "10px");
//        buttons.add(clearButton);
//
//        VerticalPanel vp = new VerticalPanel();
//        vp.add(form);
//        LayoutUtils.addGap(vp, "10px");
//        vp.add(buttons);
//        vp.setCellHorizontalAlignment(buttons, VerticalPanel.ALIGN_CENTER);
//
//        SimplePanel sp = new SimplePanel();
//        sp.setWidth("320px");
//        sp.setWidget(vp);
//        DOM.setStyleAttribute(sp.getElement(), "padding", "10px");
//        DOM.setStyleAttribute(sp.getElement(), "backgroundColor", "#cfe4fb");
//

        SimplePanel main = new SimplePanel();
//        main.setWidget(sp);

        initWidget(main);
    }

    public String getName() {
        return "Multi Column Form";
    }

    public Widget getContentWidget() {
        return this;
    }

    public void reset() {
    }
}
TOP

Related Classes of org.gwtoolbox.sample.widget.client.form.MultiColumnForm

TOP
Copyright © 2018 www.massapi.com. 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.