use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.
the class GroupInfoMainController method buildTreeModel.
private TreeModel buildTreeModel() {
// Builds the model for the navigation tree
GenericTreeModel treeModel = new GenericTreeModel();
GenericTreeNode rootNode = new GenericTreeNode();
rootNode.setTitle(translate("main.menu.title"));
treeModel.setRootNode(rootNode);
GenericTreeNode childNode = new GenericTreeNode();
childNode.setTitle(translate("main.menu.title"));
childNode.setUserObject(COMMAND_MENU_GROUPINFO);
childNode.setCssClass("o_sel_groupcard_infos");
childNode.setSelected(true);
rootNode.addChild(childNode);
rootNode.setDelegate(childNode);
if (calendarModule.isEnableGroupCalendar() && isCalendarEnabled()) {
childNode = new GenericTreeNode();
childNode.setTitle(translate("main.menu.calendar"));
childNode.setUserObject(COMMAND_MENU_GROUPCALENDAR);
childNode.setCssClass("o_sel_groupcard_calendar");
rootNode.addChild(childNode);
}
if (businessGroup.isOwnersVisiblePublic() || businessGroup.isParticipantsVisiblePublic() || businessGroup.isWaitingListVisiblePublic()) {
childNode = new GenericTreeNode();
childNode.setTitle(translate("main.menu.members"));
childNode.setUserObject(COMMAND_MENU_GROUPMEMBERS);
childNode.setCssClass("o_sel_groupcard_members");
rootNode.addChild(childNode);
}
if (isContactEnabled()) {
childNode = new GenericTreeNode();
childNode.setTitle(translate("main.menu.contact"));
childNode.setUserObject(COMMAND_MENU_GROUPCONTACT);
childNode.setCssClass("o_sel_groupcard_contact");
rootNode.addChild(childNode);
}
return treeModel;
}
use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.
the class QTI21StatisticResourceResult method getSubTreeModel.
/**
* Return the tree model for a course and a specific test.
*/
@Override
public TreeModel getSubTreeModel() {
GenericTreeModel subTreeModel = new GenericTreeModel();
StatisticResourceNode rootTreeNode = new StatisticResourceNode(courseNode, this);
subTreeModel.setRootNode(rootTreeNode);
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest test = resolvedAssessmentTest.getTestLookup().getRootNodeHolder().getRootNode();
buildRecursively(test, rootTreeNode);
return subTreeModel;
}
use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.
the class QTI21StatisticResourceResult method getTreeModel.
/**
* Return the tree model for a test learn resource.
*
* @return
*/
public TreeModel getTreeModel() {
GenericTreeModel treeModel = new GenericTreeModel();
GenericTreeNode rootTreeNode = new GenericTreeNode();
treeModel.setRootNode(rootTreeNode);
FileResourceManager frm = FileResourceManager.getInstance();
File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
AssessmentTest test = resolvedAssessmentTest.getTestLookup().getRootNodeHolder().getRootNode();
rootTreeNode.setTitle(test.getTitle());
rootTreeNode.setUserObject(test);
rootTreeNode.setIconCssClass("o_icon o_icon-lg o_qtiassessment_icon");
buildRecursively(test, rootTreeNode);
return treeModel;
}
use of org.olat.core.gui.components.tree.GenericTreeModel in project OpenOLAT by OpenOLAT.
the class AssessmentHelper method assessmentTreeModel.
/**
* @param course
* @return
*/
public static TreeModel assessmentTreeModel(ICourse course) {
CourseNode rootNode = course.getRunStructure().getRootNode();
GenericTreeModel gtm = new GenericTreeModel();
GenericTreeNode node = new GenericTreeNode();
node.setTitle(rootNode.getShortTitle());
node.setUserObject(rootNode);
node.setIconCssClass(CourseNodeFactory.getInstance().getCourseNodeConfiguration(rootNode.getType()).getIconCSSClass());
gtm.setRootNode(node);
List<GenericTreeNode> children = addAssessableNodesToList(rootNode);
children.forEach((child) -> node.addChild(child));
return gtm;
}
use of org.olat.core.gui.components.tree.GenericTreeModel in project openolat by klemens.
the class UserInfoMainController method buildTreeModel.
/**
* Generates the archiver menu
*
* @return The generated menu tree model
* @param firstLastName
*/
private GenericTreeModel buildTreeModel(String name) {
GenericTreeNode root, gtn;
GenericTreeModel gtm = new GenericTreeModel();
root = new GenericTreeNode();
root.setTitle(name);
root.setAltText(name);
root.setAccessible(false);
gtm.setRootNode(root);
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.homepage"));
gtn.setUserObject(CMD_HOMEPAGE);
gtn.setAltText(translate("menu.homepage.alt"));
root.addChild(gtn);
// following user info elements are only shown for undeleted and real
// users (not invited
// eportfolio users)
boolean isInvitee = invitationDao.isInvitee(chosenIdentity);
boolean isDeleted = chosenIdentity.getStatus().equals(Identity.STATUS_DELETED);
if (!isDeleted && !isInvitee) {
if (calendarModule.isEnablePersonalCalendar()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.calendar"));
gtn.setUserObject(CMD_CALENDAR);
gtn.setAltText(translate("menu.calendar.alt"));
gtn.setCssClass("o_visiting_card_calendar");
root.addChild(gtn);
}
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.folder"));
gtn.setUserObject(CMD_FOLDER);
gtn.setAltText(translate("menu.folder.alt"));
gtn.setCssClass("o_visiting_card_folder");
root.addChild(gtn);
}
if (!isDeleted) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.contact"));
gtn.setUserObject(CMD_CONTACT);
gtn.setAltText(translate("menu.contact.alt"));
gtn.setCssClass("o_visiting_card_contact");
root.addChild(gtn);
}
if (!isDeleted && !isInvitee) {
PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean("portfolioModule");
if (portfolioModule.isEnabled()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.portfolio"));
gtn.setUserObject(CMD_PORTFOLIO);
gtn.setAltText(translate("menu.portfolio.alt"));
gtn.setCssClass("o_visiting_card_portfolio");
root.addChild(gtn);
}
}
return gtm;
}
Aggregations