basedOnSelection.setDefaultToFirstOption(true);
basedOnSelection.setValueMap(exists);
form.setFields(nameField, basedOnSelection);
Button submit = new DefaultButton("Save");
submit.getElement().setAttribute("style", "width:50px;height:18px");
submit.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// merge base
ServerGroupRecord newGroup = form.getUpdatedEntity();
FormValidation validation = form.validate();
if(validation.hasErrors())
return;
ServerGroupRecord base = null;
for(ServerGroupRecord rec : existing)
{
if(rec.getGroupName().equals(basedOnSelection.getValue()))
{
base = rec;
break;
}
}
newGroup.setJvm(base.getJvm());
newGroup.setSocketBinding(base.getSocketBinding());
newGroup.setProfileName(base.getProfileName());
newGroup.setProperties(base.getProperties());
presenter.createNewGroup(newGroup);
}
});
Label cancel = new Label("Cancel");
cancel.setStyleName("html-link");
cancel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.closeDialoge();
}
});
HorizontalPanel options = new HorizontalPanel();
options.getElement().setAttribute("style", "width:100%");
HTML spacer = new HTML(" ");
options.add(spacer);
//spacer.getElement().getParentElement().setAttribute("width", "100%");
options.add(submit);
options.add(spacer);
options.add(cancel);
cancel.getElement().getParentElement().setAttribute("style","vertical-align:middle");
submit.getElement().getParentElement().setAttribute("align", "right");
submit.getElement().getParentElement().setAttribute("width", "100%");
// ----------------------------------------
Widget formWidget = form.asWidget();