private List<Long> getCheckedParticipantKeys() { List<Long> selected = new ArrayList<Long>(); for (GroupWrapper wrapper : tableDataModel.getObjects()) { if (wrapper.getParticipant().isSelected(0)) { selected.add(wrapper.getGroupKey()); } } return selected; }
/** * Perform a search for the given search value in the search result providers and clear any GUI * errors that might be on the page * * @param searchValue * @param ureq */ private void doSearchGroups(String searchValue, UserRequest ureq) { if (StringHelper.containsNonWhitespace(searchValue)) { SearchBusinessGroupParams param1s = new SearchBusinessGroupParams(); param1s.setNameOrDesc(searchValue); List<BusinessGroup> group1s = businessGroupService.findBusinessGroups(param1s, null, 0, -1); filterGroups(group1s); SearchBusinessGroupParams param2s = new SearchBusinessGroupParams(); param2s.setCourseTitle(searchValue); List<BusinessGroup> group2s = businessGroupService.findBusinessGroups(param2s, null, 0, -1); filterGroups(group2s); List<BusinessGroup> groups = new ArrayList<BusinessGroup>(group1s.size() + group2s.size()); groups.addAll(group1s); groups.addAll(group2s); List<Long> groupKeysWithRelations = PersistenceHelper.toKeys(groups); List<BGRepositoryEntryRelation> resources = businessGroupService.findRelationToRepositoryEntries(groupKeysWithRelations, 0, -1); List<GroupWrapper> groupWrappers = new ArrayList<GroupWrapper>(); for (BusinessGroup group : groups) { StringBuilder sb = new StringBuilder(); for (BGRepositoryEntryRelation resource : resources) { if (resource.getGroupKey().equals(group.getKey())) { if (sb.length() > 0) sb.append(", "); sb.append(resource.getRepositoryEntryDisplayName()); } } GroupWrapper wrapper = new GroupWrapper(group, sb.toString()); wrapper.setTutor(createSelection("tutor_" + group.getKey())); wrapper.setParticipant(createSelection("participant_" + group.getKey())); groupWrappers.add(wrapper); } table.reset(); tableDataModel.setObjects(groupWrappers); errorComp.clearError(); } }
@Override public Object getValueAt(int row, int col) { GroupWrapper option = getObject(row); switch (Cols.values()[col]) { case groupName: return option.getGroupName(); case description: return option.getDescription(); case courses: return option.getCourses(); case tutor: return option.getTutor(); case participant: return option.getParticipant(); default: return option; } }