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();
String pass = passBox.getText();
String domain = domainBox.getText();
String host = domainBox.getText();
boolean sasl = authCheck.isChecked();
if(serverConfig.isChecked())
{
int port = Integer.parseInt(portBox.getText());
//JabberApp.instance().onLogin(host, port, domain, sasl, user, pass);
}
else