BaseServiceCache.getService().getUsers(getUsersCallback);
}
public boolean apply() {
if (nameTextBox.getText() == null || "".equals(nameTextBox.getText())) {
MessageDialogBox dialog = new MessageDialogBox("Error", "Enter a group name.", true, true, true);
dialog.center();
return false;
}
group.setName(nameTextBox.getText());
group.setDescription(descriptionTextBox.getText());
if (showUsers) {
for (User user : users) {
if (user.getUsername().equals(ownerListBox.getItemText(ownerListBox.getSelectedIndex()))) {
group.setOwner(user);
}
}
}
group.setAutoJoin(autoJoinCheckBox.getValue());
group.setLocked(lockGroupCheckBox.getValue());
group.setVisible(visibleCheckBox.getValue());
final AsyncCallback<UserGroup> updateGroupCallback = new AsyncCallback<UserGroup>() {
public void onFailure(Throwable caught) {
MessageDialogBox dialog = new MessageDialogBox("Error", "Could not save group: " + caught.getMessage(), true, true, true);
dialog.center();
}
public void onSuccess(UserGroup group) {
if (group == null) {
MessageDialogBox dialog = new MessageDialogBox("Error", "Could not save group.", true, true, true);
dialog.center();
} else if (callback != null) {
callback.invoke(group);
}
};
};