001: /*
002: * GWT-Ext Widget Library
003: * Copyright(c) 2007-2008, GWT-Ext.
004: * licensing@gwt-ext.com
005: *
006: * http://www.gwt-ext.com/license
007: */
008: package com.gwtext.sample.showcase2.client.form;
009:
010: import com.gwtext.client.core.Position;
011: import com.gwtext.client.widgets.Button;
012: import com.gwtext.client.widgets.Panel;
013: import com.gwtext.client.widgets.TabPanel;
014: import com.gwtext.client.widgets.form.FormPanel;
015: import com.gwtext.client.widgets.form.HtmlEditor;
016: import com.gwtext.client.widgets.form.TextField;
017: import com.gwtext.client.widgets.layout.*;
018: import com.gwtext.sample.showcase2.client.ShowcasePanel;
019:
020: public class FormWithTabSample extends ShowcasePanel {
021:
022: public String getSourceUrl() {
023: return "source/form/FormWithTabSample.java.html";
024: }
025:
026: public Panel getViewPanel() {
027: if (panel == null) {
028: panel = new Panel();
029:
030: FormPanel formPanel = new FormPanel();
031: formPanel.setLabelAlign(Position.TOP);
032: formPanel.setTitle("Inner Tabs");
033: formPanel.setPaddings(5);
034: formPanel.setWidth(600);
035:
036: Panel topPanel = new Panel();
037: topPanel.setLayout(new ColumnLayout());
038: topPanel.setBorder(false);
039:
040: Panel firstColumn = new Panel();
041: firstColumn.setLayout(new FormLayout());
042: firstColumn.setBorder(false);
043:
044: firstColumn.add(new TextField("First Name", "first"),
045: new AnchorLayoutData("95%"));
046: firstColumn.add(new TextField("Company", "company"),
047: new AnchorLayoutData("95%"));
048: topPanel.add(firstColumn, new ColumnLayoutData(0.5));
049:
050: Panel secondColumn = new Panel();
051: secondColumn.setLayout(new FormLayout());
052: secondColumn.setBorder(false);
053:
054: secondColumn.add(new TextField("Last Name", "last"),
055: new AnchorLayoutData("95%"));
056: secondColumn.add(new TextField("Email", "email"),
057: new AnchorLayoutData("95%"));
058: topPanel.add(secondColumn, new ColumnLayoutData(0.5));
059:
060: formPanel.add(topPanel);
061:
062: TabPanel tabPanel = new TabPanel();
063: tabPanel.setPlain(true);
064: tabPanel.setActiveTab(0);
065: tabPanel.setHeight(235);
066:
067: Panel firstTab = new Panel();
068: firstTab.setTitle("Personal Details");
069: firstTab.setLayout(new FormLayout());
070: firstTab.setPaddings(10);
071:
072: firstTab.add(new TextField("First Name", "first", 230,
073: "James"));
074: firstTab.add(new TextField("Last Name", "last", 230));
075: firstTab.add(new TextField("Company", "company", 230));
076: firstTab.add(new TextField("Email", "email", 230));
077: tabPanel.add(firstTab);
078:
079: Panel secondTab = new Panel();
080: secondTab.setTitle("Phone Numbers");
081: secondTab.setLayout(new FormLayout());
082: secondTab.setPaddings(10);
083:
084: secondTab.add(new TextField("Home", "home", 230,
085: "(888) 555-2222"));
086: secondTab.add(new TextField("Business", "business", 230));
087: secondTab.add(new TextField("Mobile", "mobile", 230));
088: secondTab.add(new TextField("Fax", "fax", 230));
089: tabPanel.add(secondTab);
090:
091: Panel thirdPanel = new Panel();
092: thirdPanel.setTitle("Biography");
093: thirdPanel.setLayout(new FitLayout());
094: thirdPanel.add(new HtmlEditor("Biography"));
095: tabPanel.add(thirdPanel);
096:
097: formPanel.add(tabPanel);
098: formPanel.addButton(new Button("Save"));
099: formPanel.addButton(new Button("Cancel"));
100:
101: panel.add(formPanel);
102: }
103:
104: return panel;
105: }
106:
107: public String getIntro() {
108: return "This is an example of a Form that containts a TabPanel and each tab can have Form fields.";
109: }
110: }
|