this.setModal(true);
this.templateListener = templateListener;
this.templates = templates;
this.setResizable(false);
FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setFrame(true);
form.setLabelAlign(LabelAlign.TOP);
form.setButtonAlign(HorizontalAlignment.CENTER);
String selectLabelText = allowMultiple ? textMessages.pleaseSelectTemplates() : textMessages.pleaseSelectTemplate();
store = new ListStore<TemplateData>();
templateListBox = new ListField<TemplateData>();
templateListBox.setSize(300, 150);
templateListBox.setDisplayField(Constants.NAME);
templateListBox.setFieldLabel(selectLabelText);
templateListBox.getListView().getSelectionModel().setSelectionMode(allowMultiple ? SelectionMode.MULTI : SelectionMode.SINGLE);
templateListBox.getListView().addListener(Events.OnDoubleClick, new Listener<BaseEvent>()
{
@Override
public void handleEvent(BaseEvent be)
{
if (templateListBox.getSelection().size() > 0)
{
doOkay();
}
}
});
form.add(templateListBox);
Button okayButton = new Button(textMessages.okay(), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
doOkay();
}
});
Button cancelButton = new Button(textMessages.cancel(), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
doCancel();
}
});
form.setButtonAlign(HorizontalAlignment.CENTER);
form.addButton(okayButton);
form.addButton(cancelButton);
setFields();
this.add(form);
}