use of org.olat.core.gui.components.link.Link in project OpenOLAT by OpenOLAT.
the class CalendarColorChooserController method event.
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source instanceof Link) {
Link colorLink = (Link) source;
choosenColor = (String) colorLink.getUserObject();
fireEvent(ureq, Event.DONE_EVENT);
}
}
use of org.olat.core.gui.components.link.Link in project OpenOLAT by OpenOLAT.
the class LinksPortletRunController method event.
/**
* @see org.olat.gui.control.DefaultController#event(org.olat.gui.UserRequest, org.olat.gui.components.Component, org.olat.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == editButton) {
buildEditorPanel();
} else if (source == backLink) {
LinksPortlet.reInit(ureq);
initOrUpdatePortletView(ureq);
viewPanel.setContent(portletVC);
} else if (source instanceof Link) {
// clicked on a link in editor-mode -> open editor in callout
Link link = (Link) source;
String linkName = link.getComponentName();
if (linkName.contains(LINKID)) {
String identifier = linkName.substring(LINKID.length());
PortletLink portLink = LinksPortlet.getLinkByIdentifier(identifier);
if (portLink != null) {
popupLinkEditor(ureq, portLink);
} else {
showError("error.link.not.found");
}
} else if (linkName.contains(LINKADD)) {
// add a link to institution:
PortletLink newLink = new PortletLink("", "", "", i18nModule.getLocaleKey(ureq.getLocale()), "", null);
// find institution and port in link!
String institution = link.getCommand().substring(LINKADD.length());
PortletInstitution inst = LinksPortlet.getContent().get(institution);
newLink.setInstitution(inst);
popupLinkEditor(ureq, newLink);
} else if (linkName.contains(LINKDEL)) {
String identifier = linkName.substring(LINKDEL.length());
PortletLink portLink = LinksPortlet.getLinkByIdentifier(identifier);
delLinkCtrl = activateYesNoDialog(ureq, translate("del.link.title"), translate("del.link.text", portLink.getTitle()), delLinkCtrl);
delLinkCtrl.setUserObject(portLink);
}
}
}
use of org.olat.core.gui.components.link.Link in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method addDTab.
@Override
public boolean addDTab(UserRequest ureq, DTab dt) {
if (isDisposed()) {
return false;
}
DTab old = getDTab(dt.getOLATResourceable());
if (old != null) {
return true;
}
// add to tabs list
synchronized (dtabs) {
// make dtabs and dtabsControllers access synchronized
dtabs.add(dt);
dtabsLinkNames.add(dtabCreateCounter);
Link link = LinkFactory.createCustomLink("a" + dtabCreateCounter, "a" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
link.setCustomDisplayText(StringHelper.escapeHtml(dt.getNavElement().getTitle()));
link.setIconLeftCSS("o_icon o_icon-fw " + dt.getNavElement().getIconCSSClass());
link.setTitle(dt.getTitle());
link.setUserObject(dt);
// Set accessibility access key using the 's' key. You can loop through all opened tabs by
// pressing s repetitively (works only in IE/FF which is normally used by blind people)
link.setAccessKey("s");
// add close links
Link calink = LinkFactory.createCustomLink("c" + dtabCreateCounter, "c" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
calink.setCustomEnabledLinkCSS("o_navbar_tab_close");
calink.setIconLeftCSS("o_icon o_icon_close_tab");
calink.setTitle(translate("close"));
calink.setUserObject(dt);
Controller dtabCtr = dt.getController();
dtabCtr.addControllerListener(this);
updateBusinessPath(ureq, dt);
// add to tabs controller lookup table for later event dispatching
dtabsControllers.add(dtabCtr);
// increase DTab added counter.
dtabCreateCounter++;
}
return true;
}
use of org.olat.core.gui.components.link.Link in project OpenOLAT by OpenOLAT.
the class ImpressumUserTool method getMenuComponent.
@Override
public Component getMenuComponent(UserRequest ureq, VelocityContainer container) {
Link impressumLink = LinkFactory.createLink("topnav.impressum", container, this);
impressumLink.setTooltip("topnav.impressum.alt");
impressumLink.setIconLeftCSS("o_icon o_icon_impress o_icon-lg");
impressumLink.setAjaxEnabled(false);
impressumLink.setTarget("_blank");
return impressumLink;
}
use of org.olat.core.gui.components.link.Link in project OpenOLAT by OpenOLAT.
the class YearNavigationController method event.
/**
* @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) {
if (source == next) {
model.next();
createLinks();
Year year = (Year) yearLink.getUserObject();
Event navEvent = new NavigationEvent(year.getItems());
fireEvent(ureq, navEvent);
yearLink.setCustomEnabledLinkCSS("o_year o_selected");
} else if (source == previous) {
model.previous();
createLinks();
Year year = (Year) yearLink.getUserObject();
Event navEvent = new NavigationEvent(year.getItems());
fireEvent(ureq, navEvent);
yearLink.setCustomEnabledLinkCSS("o_year o_selected");
} else if (source == yearLink) {
// Click on year toggles between year filter and show all filter
if (showAll) {
Year year = (Year) yearLink.getUserObject();
Event navEvent = new NavigationEvent(year.getItems());
fireEvent(ureq, navEvent);
// update GUI
yearLink.setCustomEnabledLinkCSS("o_year o_selected");
for (Link monthLink : monthLinks) {
monthLink.setCustomEnabledLinkCSS("o_month");
}
showAll = false;
} else {
Event navEvent = new NavigationEvent(allObjects);
fireEvent(ureq, navEvent);
// update GUI
yearLink.setCustomEnabledLinkCSS("o_year");
showAll = true;
}
} else if (monthLinks.contains(source)) {
Link monthLink = (Link) source;
Month month = (Month) monthLink.getUserObject();
Event navEvent = new NavigationEvent(month.getItems());
fireEvent(ureq, navEvent);
// update GUI
yearLink.setCustomEnabledLinkCSS("o_year");
for (Link link : monthLinks) {
link.setCustomEnabledLinkCSS("o_month");
}
monthLink.setCustomEnabledLinkCSS("o_month o_selected");
}
}
Aggregations