panel.setButtonAlign(HorizontalAlignment.CENTER);
panel.setLayout(new FitLayout());
final TabPanel tabs = new TabPanel();
TabItem personal = new TabItem();
personal.setStyleAttribute("padding", "10px");
personal.setText("Personal Details");
personal.setLayout(new FormLayout());
TextField<String> name = new TextField<String>();
name.setFieldLabel("First Name");
name.setValue("Darrell");
personal.add(name, formData);
TextField<String> last = new TextField<String>();
last.setFieldLabel("Last Name");
last.setValue("Meyer");
personal.add(last, formData);
TextField<String> company = new TextField<String>();
company.setFieldLabel("Company");
personal.add(company, formData);
TextField<String> email = new TextField<String>();
email.setFieldLabel("Email");
personal.add(email, formData);
tabs.add(personal);
TabItem numbers = new TabItem();
numbers.setStyleAttribute("padding", "10px");
numbers.setText("Phone Numbers");
numbers.setLayout(new FormLayout());
TextField<String> home = new TextField<String>();
home.setFieldLabel("Home");
home.setValue("800-555-1212");
numbers.add(home, formData);
TextField<String> business = new TextField<String>();
business.setFieldLabel("Business");
numbers.add(business, formData);
TextField<String> mobile = new TextField<String>();
mobile.setFieldLabel("Mobile");
numbers.add(mobile, formData);
TextField<String> fax = new TextField<String>();
fax.setFieldLabel("Fax");
numbers.add(fax, formData);
tabs.add(numbers);
panel.add(tabs);
panel.addButton(new Button("Cancel"));
panel.addButton(new Button("Submit"));
panel.setSize(340, 200);
if (GXT.isFocusManagerEnabled()) {
name.getFocusSupport().setPreviousId(panel.getButtonBar().getId());
home.getFocusSupport().setPreviousId(panel.getButtonBar().getId());
panel.getButtonBar().getFocusSupport().addListener(FocusManager.TabNext, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
tabs.getItem(tabs.getSelectedItem() == tabs.getItem(0) ? 0 : 1).getItem(0).focus();
be.setCancelled(true);
}
});
panel.getButtonBar().getFocusSupport().addListener(FocusManager.TabPrevious, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
TabItem item = tabs.getItem(tabs.getSelectedItem() == tabs.getItem(0) ? 0 : 1);
item.getItem(item.getItemCount() - 1).focus();
be.setCancelled(true);
}
});
}