TextBoxItem socket = new TextBoxItem("socketBinding", "Socket Binding");
TextBoxItem user = new TextBoxItem("username", "Username");
PasswordBoxItem pass = new PasswordBoxItem("password", "Password");
CheckBoxItem ssl = new CheckBoxItem("ssl", "Use SSL?");
final ComboBoxItem type = new ComboBoxItem("type", "Type");
type.setValueMap(new String[]{
ServerType.smtp.name(),
ServerType.imap.name(),
ServerType.pop3.name()
});
type.setDefaultToFirstOption(true);
form.setFields(socket, type, user, pass, ssl);
DialogueOptions options = new DialogueOptions(
// save
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// merge base
FormValidation validation = form.validate();
if(validation.hasErrors())
return;
MailServerDefinition entity = form.getUpdatedEntity();
entity.setType(ServerType.valueOf(type.getValue()));
presenter.onCreateServer(entity);
}
},