});
type.setDefaultToFirstOption(true);
type.selectItem(1);
final ListItem fieldNames = new ListItem("fieldNames", "FieldNames")
{
@Override
public boolean isRequired() {
return false;
}
};
form.setFields(name, address, type, fieldNames);
layout.add(form.asWidget());
DialogueOptions options = new DialogueOptions(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final FormValidation validation = form.validate();
ModelNode addressNode = new ModelNode();
try {
List<String[]> tuple = AddressBinding.parseAddressString(address.getValue());
addressNode = new AddressBinding(tuple).asResource().get("address");
} catch (Throwable e) {
validation.addError("Invalid address value");
address.setErroneous(true);
}
if(!validation.hasErrors())
{
FXTemplate template = new FXTemplate(
name.getValue(),
UUID.uuid()
);
FXModel model = new FXModel(
FXModel.ExecutionType.valueOf(type.getValue()),
addressNode
);
model.getFieldNames().addAll(fieldNames.getValue());
template.getModels().add(model);
presenter.onCreateTemplate(template);
}