Widget asWidget() {
VerticalPanel layout = new VerticalPanel();
layout.setStyleName("window-content");
final Form<MailSession> form = new Form(MailSession.class);
TextBoxItem jndi = new JndiNameItem("jndiName", "JNDI Name");
TextBoxItem pop = new TextBoxItem("popServer", "Pop3 Server") {
{
setRequired(false);
}
};
TextBoxItem imap = new TextBoxItem("imapServer", "IMAP Server") {{
setRequired(false);
}};
TextBoxItem smtp = new TextBoxItem("smtpServer", "SMTP Server");
form.setFields(jndi, smtp, imap, pop);
DialogueOptions options = new DialogueOptions(
// save
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// merge base
FormValidation validation = form.validate();
if(validation.hasErrors())
return;
presenter.onCreateSession(form.getUpdatedEntity());
}
},
// cancel
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.closeDialoge();
}
}
);
// ----------------------------------------
Widget formWidget = form.asWidget();
final FormHelpPanel helpPanel = new FormHelpPanel(
new FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {