ResourceGroupGWTServiceAsync groupManager = GWTServiceLookup.getResourceGroupService(60000);
groupManager.deleteGroupDefinitions(groupDefinitionIds, new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_dynagroup_deleteSuccessfulSelection(String
.valueOf(groupDefinitionIds.length)), Severity.Info));
GroupDefinitionListView.this.refresh();
}
@Override
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_deleteFailureSelection(), caught);
}
});
}
});
addTableAction(MSG.common_button_new(), null, ButtonColor.BLUE, new AbstractTableAction() {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
newDetails();
}
});
addTableAction(MSG.view_dynagroup_recalculate(), null, ButtonColor.GRAY, new AbstractTableAction(TableActionEnablement.ANY) {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
final int[] groupDefinitionIds = TableUtility.getIds(selection);
ResourceGroupGWTServiceAsync resourceGroupManager = GWTServiceLookup.getResourceGroupService();
resourceGroupManager.recalculateGroupDefinitions(groupDefinitionIds, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
if (caught instanceof DuplicateExpressionTypeException) {
CoreGUI.getMessageCenter().notify(
new Message(caught.getMessage(), Message.Severity.Warning));
} else {
CoreGUI.getErrorHandler().handleError(MSG.view_dynagroup_recalcFailureSelection(), caught);
}
}
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_dynagroup_recalcSuccessfulSelection(String
.valueOf(groupDefinitionIds.length)), Severity.Info));
GroupDefinitionListView.this.refresh();
}
});
}