public String getErrMessage() {
return "Not empty, no whitespace";
}
};
final ComboBoxItem basedOnSelection = new ComboBoxItem("based-on", "Based On");
String[] exists = new String[existing.size()];
int i=0;
for(ServerGroupRecord rec : existing)
{
exists[i] = rec.getGroupName();
i++;
}
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;
}
}