this.permissibleObject = permissibleObject;
final User user = AuthenticationHandler.getInstance().getUser();
setText("E-mail to Friends");
Button ok = new Button("OK");
ok.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// build a map of addresses/names from table
String toAddresses = "";
for (int i = 0; i < NUM_ADDRESSES; i++) {
String address = ((TextBox) emailAddressTable.getWidget(i, 0)).getText();
if (!StringUtils.isEmpty(address)) {
String name = ((TextBox) emailAddressTable.getWidget(i, 1)).getText();
if (StringUtils.isEmpty(name)) {
name = address;
}
toAddresses += address + ";" + name + ";";
}
}
String fromAddress = null;
String fromName = null;
if (user == null) {
fromAddress = userEmailTextBox.getText();
fromName = userTextBox.getText();
} else {
fromAddress = user.getEmail();
fromName = user.getFirstname();
}
if (StringUtils.isEmpty(fromName)) {
fromName = fromAddress;
}
if (StringUtils.isEmpty(fromAddress)) {
MessageDialogBox messageDialog = new MessageDialogBox("Error", "You must enter your email address.", false, false, true);
messageDialog.center();
return;
}
sendEmail(permissibleObject, subject, message, fromAddress, fromName, toAddresses);
hide();
}
});
Button cancel = new Button("Cancel");
cancel.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
hide();
}
});
final HorizontalPanel dialogButtonPanel = new HorizontalPanel();