private Widget createAdvancedForm()
{
iJabConstants constants = (iJabConstants) GWT.create(iJabConstants.class);
// Create a table to layout the form options
FlexTable layout = new FlexTable();
layout.setCellSpacing(6);
layout.setWidth("300px");
FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
// Add a title to the form
/*
layout.setHTML(0, 0,constants.iJabLogin());
cellFormatter.setColSpan(0, 0, 2);
cellFormatter.setHorizontalAlignment(0, 0,
HasHorizontalAlignment.ALIGN_CENTER);
*/
// Add some standard form options
final TextBox userBox = new TextBox();
userBox.setText("imdev");
layout.setHTML(0, 0, constants.user());
layout.setWidget(0, 1, userBox);
final PasswordTextBox passBox = new PasswordTextBox ();
passBox.setText("imdev631");
layout.setHTML(1, 0, constants.password());
layout.setWidget(1, 1, passBox);
// Create some advanced options
Grid advancedOptions = new Grid(5, 2);
advancedOptions.setCellSpacing(6);
final TextBox hostBox = new TextBox();
final TextBox portBox = new TextBox();
final TextBox domainBox = new TextBox();
final CheckBox authCheck = new CheckBox("SASL");
authCheck.setChecked(false);
hostBox.setEnabled(false);
portBox.setEnabled(false);
domainBox.setEnabled(false);
authCheck.setEnabled(false);
final CheckBox serverConfig = new CheckBox(constants.defineServerConfig());
advancedOptions.setWidget(0, 0, serverConfig);
serverConfig.addClickListener(new ClickListener()
{
public void onClick(Widget sender) {
if(serverConfig.isChecked())
{
hostBox.setEnabled(true);
portBox.setEnabled(true);
domainBox.setEnabled(true);
authCheck.setEnabled(true);
}
else
{
hostBox.setEnabled(false);
portBox.setEnabled(false);
domainBox.setEnabled(false);
authCheck.setEnabled(false);
}
}
});
serverConfig.setChecked(false);
advancedOptions.setHTML(1, 0, constants.domain());
advancedOptions.setWidget(1, 1, hostBox);
advancedOptions.setHTML(2, 0, constants.host());
advancedOptions.setWidget(2, 1, portBox);
advancedOptions.setHTML(3, 0, constants.port());
advancedOptions.setWidget(3, 1, domainBox);
advancedOptions.setWidget(4, 0, authCheck);
// Add advanced options to form in a disclosure panel
DisclosurePanel advancedDisclosure = new DisclosurePanel(
constants.moreOptions());
advancedDisclosure.setAnimationEnabled(true);
advancedDisclosure.ensureDebugId("cwDisclosurePanel");
advancedDisclosure.setContent(advancedOptions);
layout.setWidget(2, 0, advancedDisclosure);
Button loginButton = new Button(constants.login());
layout.setWidget(3, 0,loginButton);
loginButton.addSelectionListener(new SelectionListener<ButtonEvent>()
{
public void componentSelected(ButtonEvent ce)
{
String user = userBox.getText();