use of org.olat.core.gui.components.tabbedpane.TabCreator in project openolat by klemens.
the class BusinessGroupEditController method setAllTabs.
/**
* Learning areas and and course rights should only appear when at least one course is associated.</br>
* <ul><li>
* a) No courses associated and user is not author</br>
* Description, Tools, Members, Publishing and booking
* </li><li>
* b) No course associated and user is author:</br>
* Description, Tools, Members, Courses, Publishing and booking
* </li><li>
* c) With courses associated:</br>
* Description, Tools, Members, Courses, Learning areas, Course rights, Publishing and booking
*
* @param ureq
*/
private void setAllTabs(UserRequest ureq) {
hasResources = businessGroupService.hasResources(currBusinessGroup);
tabAccessCtrl = getAccessController(ureq);
int currentSelectedPane = tabbedPane.getSelectedPane();
tabbedPane.removeAll();
editDetailsController.setAllowWaitingList(tabAccessCtrl == null || !tabAccessCtrl.isPaymentMethodInUse());
tabbedPane.addTab(translate("group.edit.tab.details"), editDetailsController.getInitialComponent());
tabbedPane.addTab(translate("group.edit.tab.collabtools"), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
collaborationToolsController = new BusinessGroupToolsController(uureq, getWindowControl(), currBusinessGroup);
listenTo(collaborationToolsController);
return collaborationToolsController.getInitialComponent();
}
});
membersTab = tabbedPane.addTab(translate("group.edit.tab.members"), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
if (membersController == null) {
membersController = new BusinessGroupMembersController(uureq, getWindowControl(), toolbarPanel, currBusinessGroup);
listenTo(membersController);
} else {
membersController.updateBusinessGroup(currBusinessGroup);
}
return membersController.getInitialComponent();
}
});
// resources (optional)
Roles roles = ureq.getUserSession().getRoles();
boolean resourceEnabled = roles.isOLATAdmin() || roles.isGroupManager() || roles.isAuthor() || hasResources;
if (resourceEnabled) {
tabbedPane.addTab(translate("group.edit.tab.resources"), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
if (resourceController == null) {
resourceController = new BusinessGroupEditResourceController(uureq, getWindowControl(), currBusinessGroup);
listenTo(resourceController);
}
return resourceController.getInitialComponent();
}
});
} else {
removeAsListenerAndDispose(resourceController);
resourceController = null;
}
if (tabAccessCtrl != null) {
tabbedPane.addTab(translate("group.edit.tab.accesscontrol"), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
return tabAccessCtrl.getInitialComponent();
}
});
}
if (currentSelectedPane > 0) {
tabbedPane.setSelectedPane(ureq, currentSelectedPane);
}
}
Aggregations