use of org.olat.group.ui.wizard.BGMergeStep in project OpenOLAT by OpenOLAT.
the class AbstractBusinessGroupListController method doMerge.
/**
* @param ureq
* @param items
*/
private void doMerge(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
removeAsListenerAndDispose(businessGroupWizard);
if (selectedItems == null || selectedItems.size() < 2) {
showWarning("error.select.one");
return;
}
final List<BusinessGroup> groups = toBusinessGroups(ureq, selectedItems, true);
if (groups.size() < 2) {
showWarning("msg.alleasttwo.editable.group");
return;
}
if (selectedItems.size() != groups.size()) {
showWarning("msg.only.editable.group");
return;
}
StringBuilder managedNames = new StringBuilder();
for (BusinessGroup group : groups) {
String gname = group.getName() == null ? "???" : StringHelper.escapeHtml(group.getName());
if (StringHelper.containsNonWhitespace(group.getManagedFlagsString())) {
if (managedNames.length() > 0)
managedNames.append(", ");
managedNames.append(gname);
}
}
if (managedNames.length() > 0) {
showWarning("error.managed.group", managedNames.toString());
return;
}
Step start = new BGMergeStep(ureq, groups);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
BusinessGroup targetGroup = (BusinessGroup) runContext.get("targetGroup");
groups.remove(targetGroup);
businessGroupService.mergeBusinessGroups(getIdentity(), targetGroup, groups, null);
return StepsMainRunController.DONE_MODIFIED;
}
};
businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("merge.group"), "o_sel_groups_merge_wizard");
listenTo(businessGroupWizard);
getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
use of org.olat.group.ui.wizard.BGMergeStep in project openolat by klemens.
the class AbstractBusinessGroupListController method doMerge.
/**
* @param ureq
* @param items
*/
private void doMerge(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
removeAsListenerAndDispose(businessGroupWizard);
if (selectedItems == null || selectedItems.size() < 2) {
showWarning("error.select.one");
return;
}
final List<BusinessGroup> groups = toBusinessGroups(ureq, selectedItems, true);
if (groups.size() < 2) {
showWarning("msg.alleasttwo.editable.group");
return;
}
if (selectedItems.size() != groups.size()) {
showWarning("msg.only.editable.group");
return;
}
StringBuilder managedNames = new StringBuilder();
for (BusinessGroup group : groups) {
String gname = group.getName() == null ? "???" : StringHelper.escapeHtml(group.getName());
if (StringHelper.containsNonWhitespace(group.getManagedFlagsString())) {
if (managedNames.length() > 0)
managedNames.append(", ");
managedNames.append(gname);
}
}
if (managedNames.length() > 0) {
showWarning("error.managed.group", managedNames.toString());
return;
}
Step start = new BGMergeStep(ureq, groups);
StepRunnerCallback finish = new StepRunnerCallback() {
@Override
public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
BusinessGroup targetGroup = (BusinessGroup) runContext.get("targetGroup");
groups.remove(targetGroup);
businessGroupService.mergeBusinessGroups(getIdentity(), targetGroup, groups, null);
return StepsMainRunController.DONE_MODIFIED;
}
};
businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("merge.group"), "o_sel_groups_merge_wizard");
listenTo(businessGroupWizard);
getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
Aggregations