01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08: package com.gwtext.sample.showcase2.client.form;
09:
10: import com.gwtext.client.widgets.Button;
11: import com.gwtext.client.widgets.Panel;
12: import com.gwtext.client.widgets.form.FormPanel;
13: import com.gwtext.client.widgets.form.TextField;
14: import com.gwtext.client.widgets.form.TimeField;
15: import com.gwtext.client.widgets.form.VType;
16: import com.gwtext.sample.showcase2.client.ShowcasePanel;
17:
18: public class SimpleFormSample extends ShowcasePanel {
19:
20: public String getSourceUrl() {
21: return "source/form/SimpleFormSample.java.html";
22: }
23:
24: public Panel getViewPanel() {
25: if (panel == null) {
26: panel = new Panel();
27:
28: final FormPanel formPanel = new FormPanel();
29: formPanel.setFrame(true);
30: formPanel.setTitle("Simple Form");
31:
32: formPanel.setWidth(350);
33: formPanel.setLabelWidth(75);
34: formPanel.setUrl("save-form.php");
35:
36: TextField firstName = new TextField("First Name", "first",
37: 230);
38: firstName.setAllowBlank(false);
39: formPanel.add(firstName);
40:
41: TextField lastName = new TextField("Last Name", "last", 230);
42: formPanel.add(lastName);
43:
44: TextField company = new TextField("Company", "company", 230);
45: formPanel.add(company);
46:
47: TextField email = new TextField("Email", "email", 230);
48: email.setVtype(VType.EMAIL);
49: formPanel.add(email);
50:
51: TimeField time = new TimeField("Time", "time", 230);
52: time.setMinValue("8:00am");
53: time.setMaxValue("6:00pm");
54: formPanel.add(time);
55:
56: Button save = new Button("Save");
57: formPanel.addButton(save);
58:
59: Button cancel = new Button("Cancel");
60: formPanel.addButton(cancel);
61:
62: panel.add(formPanel);
63: }
64:
65: return panel;
66: }
67:
68: public String getIntro() {
69: return "<p>This example demonstates a very basic form with minimal validation. 'First Name' field is required in"
70: + " this example and the Buttons do not do anything but you can assocate actions with them.</p>";
71: }
72: }
|