use of org.olat.core.gui.components.link.Link in project openolat by klemens.
the class BreadCrumbController method event.
/*
* (non-Javadoc)
*
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
for (Link link : breadCrumbLinks) {
if (source == link) {
// set content to new controller view and disable the corresponding link
link.setEnabled(false);
CrumbController crumbController = (CrumbController) link.getUserObject();
breadCrumbVC.put("content", crumbController.getInitialComponent());
// remove all children from this new controller
CrumbController childCrumb = crumbController.getChildCrumbController();
if (childCrumb != null) {
removeFromBreadCrumb(childCrumb);
}
// manually fire an event to the crumb controller
crumbController.dispatchEvent(ureq, this, CRUMB_VIEW_ACTIVATED);
break;
} else {
link.setEnabled(true);
}
}
}
use of org.olat.core.gui.components.link.Link in project openolat by klemens.
the class BreadCrumbController method putToBreadCrumbStack.
/**
* Put a crumb controller with it's view to the bread crumb stack. Use the
* crumbController.activateAndListenToChildCrumbController() to put new crumbs
* to the stack in your code
*
* @param crumbController
*/
void putToBreadCrumbStack(CrumbController crumbController) {
// re-enable last link
if (breadCrumbLinks.size() > 0)
breadCrumbLinks.get(breadCrumbLinks.size() - 1).setEnabled(true);
// create new link for this crumb and add it to data model
String cmd = "crumb-" + breadCrumbLinks.size();
Link link = LinkFactory.createCustomLink(cmd, cmd, cmd, Link.NONTRANSLATED, breadCrumbVC, this);
link.setCustomDisplayText(crumbController.getCrumbLinkText());
link.setTitle(crumbController.getCrumbLinkHooverText());
link.setUserObject(crumbController);
link.setEnabled(false);
breadCrumbLinks.add(link);
breadCrumbVC.put("content", crumbController.getInitialComponent());
// set bread crumb navigation controller
crumbController.setBreadCrumbController(this);
}
use of org.olat.core.gui.components.link.Link in project openolat by klemens.
the class BreadCrumbController method resetCrumbTexts.
/**
* Reset all texts on the crumb path
*/
public void resetCrumbTexts() {
for (Link link : breadCrumbLinks) {
CrumbController crumbController = (CrumbController) link.getUserObject();
link.setCustomDisplayText(crumbController.getCrumbLinkText());
link.setTitle(crumbController.getCrumbLinkHooverText());
}
}
use of org.olat.core.gui.components.link.Link in project openolat by klemens.
the class BreadCrumbController method removeFromBreadCrumb.
/**
* Remove a crumb controller and all it's child controllers that are created
* by this controller or it's children from the bread crumb stack and calls
* dispose on the crumb controller. Use
* crumbController.removeFromBreadCrumbPathAndDispose() if you manually want
* to remove a crumb controller from the bread crumb
*
* @param crumbController
*/
void removeFromBreadCrumb(CrumbController crumbController) {
int activateLinkPos = 0;
for (Link link : breadCrumbLinks) {
CrumbController linkController = (CrumbController) link.getUserObject();
if (linkController.equals(crumbController)) {
linkController.deactivateAndDisposeChildCrumbController();
linkController.dispose();
break;
}
activateLinkPos++;
}
if (activateLinkPos > 0) {
// remove children elements from list and reput to hibernate
breadCrumbLinks = breadCrumbLinks.subList(0, activateLinkPos);
breadCrumbVC.contextPut("breadCrumbs", breadCrumbLinks);
// disable current link and update content view from current controller
Link parentLink = breadCrumbLinks.get(activateLinkPos - 1);
parentLink.setEnabled(false);
CrumbController parentController = (CrumbController) parentLink.getUserObject();
breadCrumbVC.put("content", parentController.getInitialComponent());
}
}
use of org.olat.core.gui.components.link.Link in project openolat by klemens.
the class EdubasePeekViewController method createPeekviewComponent.
private Component createPeekviewComponent(ModuleConfiguration modulConfiguration) {
VelocityContainer container = createVelocityContainer(PEEKVIEW_CONTAINER);
;
// BookSections
List<BookSection> bookSections = modulConfiguration.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSection.class).stream().sorted(new PositionComparator()).limit(NUMBER_BOOK_SECTION_DESC_DISABLED).collect(Collectors.toList());
container.contextPut("bookSections", bookSections);
// Add a link to show all BookSections (go to node)
Link allItemsLink = LinkFactory.createLink("peekview.allItemsLink", container, this);
allItemsLink.setIconRightCSS("o_icon o_icon_start");
allItemsLink.setCustomEnabledLinkCSS("pull-right");
return container;
}
Aggregations