public void onSuccess(Void result) {
titleBar.displayGroupName(newName);
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_group_summary_nameUpdateSuccessful(
String.valueOf(group.getId()), oldName, newName), Message.Severity.Info));
}
});
}
});
nameItem = togglableNameItem;
} else {
StaticTextItem staticNameItem = new StaticTextItem();
staticNameItem.setEscapeHTML(true);
nameItem = staticNameItem;
}
nameItem.setName("name");
nameItem.setTitle(MSG.common_title_name());
nameItem.setValue(group.getName());
formItems.add(nameItem);
StaticTextItem typeItem = new StaticTextItem("memberType", MSG.view_group_summary_memberType());
ResourceType type = group.getResourceType();
if (type != null) {
// compatible group
typeItem.setTooltip(MSG.common_title_plugin() + ": " + type.getPlugin() + "\n<br>"
+ MSG.common_title_type() + ": " + type.getName());
typeItem.setValue(type.getName() + " (" + type.getPlugin() + ")");
} else {
// mixed group
typeItem.setValue("<i>" + MSG.view_group_summary_mixed() + "</i>");
}
formItems.add(typeItem);
StaticTextItem countItem = new StaticTextItem("memberCount", MSG.view_group_summary_memberCount());
long memberCount = this.groupComposite.getImplicitCount();
countItem.setValue(memberCount);
formItems.add(countItem);
final FormItem descriptionItem;
String value;
if (canEdit) {
final EditableFormItem togglableDescriptionItem = new EditableFormItem();
togglableDescriptionItem.setValidators(notNullValidator);
togglableDescriptionItem.setValueEditedHandler(new ValueEditedHandler() {
public void editedValue(Object newValue) {
final String newDescription = newValue.toString();
final String oldDescription = group.getDescription();
if (newDescription.equals(oldDescription)) {
return;
}
group.setDescription(newDescription);
GeneralProperties.this.resourceGroupService.updateResourceGroup(group, false,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
MSG.view_group_summary_descUpdateFailure(String.valueOf(group.getId())), caught);
// We failed to update it on the Server, so change back the ResourceGroup and the form item
// to the original value.
group.setDescription(oldDescription);
togglableDescriptionItem.setValue(oldDescription);
}
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_group_summary_descUpdateSuccessful(), Message.Severity.Info));
}
});
}
});
descriptionItem = togglableDescriptionItem;
value = group.getDescription();
} else {
descriptionItem = new StaticTextItem();
value = StringUtility.escapeHtml(group.getDescription());
}
descriptionItem.setName("description");
descriptionItem.setTitle(MSG.common_title_description());
descriptionItem.setValue(value);
formItems.add(descriptionItem);
StaticTextItem dynamicItem = new StaticTextItem("dynamic", MSG.view_group_summary_dynamic());
dynamicItem.setValue(isDynaGroup ? MSG.common_val_yes() : MSG.common_val_no());
formItems.add(dynamicItem);
FormItem recursiveItem;
if (canEdit) {
CheckboxEditableFormItem editableRecursiveItem = new CheckboxEditableFormItem("recursive",
MSG.view_group_summary_recursive());
editableRecursiveItem.setValueEditedHandler(new ValueEditedHandler() {
public void editedValue(Object newValue) {
boolean isRecursive = ((newValue != null) && (Boolean) newValue);
resourceGroupService.setRecursive(group.getId(), isRecursive, new AsyncCallback<Void>() {
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_group_detail_recursiveChange(group.getName())));
}
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
MSG.view_group_detail_failRecursiveChange(String.valueOf(group.getName())));