use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class BinderListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (newBinderDropdown == source) {
doNewBinderCallout(ureq);
} else if (newBinderFromCourseButton == source) {
doNewBinderFromCourse(ureq);
} else if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("select".equals(cmd)) {
BinderRow row = model.getObject(se.getIndex());
Activateable2 activateable = doOpenBinder(ureq, row);
if (activateable != null) {
activateable.activate(ureq, null, null);
}
}
}
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if ("open".equals(cmd)) {
BinderRow row = (BinderRow) link.getUserObject();
Activateable2 activateable = doOpenBinder(ureq, row);
if (activateable != null) {
activateable.activate(ureq, null, null);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class BinderListController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
if ("Binder".equalsIgnoreCase(resName)) {
Long portfolioKey = entries.get(0).getOLATResourceable().getResourceableId();
Activateable2 activateable = doOpenBinder(ureq, new BinderRefImpl(portfolioKey));
if (activateable != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
}
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class TableOfContentController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty()) {
return;
}
String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
if ("Page".equalsIgnoreCase(resName) || "Entry".equalsIgnoreCase(resName)) {
Long pageKey = entries.get(0).getOLATResourceable().getResourceableId();
Page page = portfolioService.getPageByKey(pageKey);
if (page != null && page.getSection() != null && binder.equals(page.getSection().getBinder())) {
Activateable2 activateable = doOpenPage(ureq, page);
if (activateable != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
}
}
} else if ("Section".equalsIgnoreCase(resName)) {
Long sectionKey = entries.get(0).getOLATResourceable().getResourceableId();
Section section = portfolioService.getSection(new SectionRefImpl(sectionKey));
if (section != null && binder.equals(section.getBinder())) {
doOpenSection(ureq, section);
}
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method activate.
/**
* Activating a tab is like focusing a new window - we need to adjust the
* guipath since e.g. the button triggering the activation is not
* part of the guipath, but rather the new tab in its initial state.
* in all other cases the "focus of interest" (where the calculation of the
* guipath is started) matches the controller which listens to the
* event caused by a user interaction.
* this is the starting point.
*/
@Override
public void activate(UserRequest ureq, DTab dTab, List<ContextEntry> entries) {
UserSession usess = ureq.getUserSession();
if ((lockStatus != null || usess.isInAssessmentModeProcess()) && !usess.matchLockResource(dTab.getOLATResourceable())) {
return;
}
// update window settings if needed
setWindowSettings(getWindowControl().getWindowBackOffice().getWindowSettings());
// jump here via external link or just open a new tab from e.g. repository
if (dTab == null && contentCtrl instanceof Activateable2) {
((Activateable2) contentCtrl).activate(ureq, entries, null);
} else {
DTabImpl dtabi = (DTabImpl) dTab;
Controller c = dtabi.getController();
if (c == null) {
throw new AssertException("no controller set yet! " + dTab);
}
doActivateDTab(dtabi);
if (c instanceof Activateable2) {
final Activateable2 activateable = ((Activateable2) c);
activateable.activate(ureq, entries, null);
}
updateBusinessPath(ureq, dtabi);
// update the panels after activation
setGuiStack(dtabi.getGuiStackHandle());
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source instanceof Link) {
Link link = (Link) source;
String mC = link.getCommand().substring(0, 1);
if (mC.equals("t")) {
// activate normal tab
SiteInstance s = (SiteInstance) link.getUserObject();
// fix the state of the last tab/site
updateBusinessPath(ureq);
HistoryPoint point = null;
if (siteToBusinessPath.containsKey(s)) {
point = siteToBusinessPath.get(s);
}
activateSite(s, ureq, null, true);
if (point != null) {
BusinessControlFactory.getInstance().addToHistory(ureq, point);
}
updateBusinessPath(ureq, s);
} else if (mC.equals("a")) {
// activate dyntab
DTab dt = (DTab) link.getUserObject();
// fix the state of the last tab/site
updateBusinessPath(ureq);
HistoryPoint point = null;
if (dtabToBusinessPath.containsKey(dt)) {
point = dtabToBusinessPath.get(dt);
}
doActivateDTab(dt);
if (dt.getController() instanceof Activateable2) {
((Activateable2) dt.getController()).activate(ureq, null, new ReloadEvent());
}
if (point != null) {
BusinessControlFactory.getInstance().addToHistory(ureq, point);
}
} else if (mC.equals("c")) {
// close dyntab
DTab dt = (DTab) link.getUserObject();
requestCloseTab(ureq, dt);
}
} else if (source == getWindowControl().getWindowBackOffice().getWindow()) {
if (event == Window.OLDTIMESTAMPCALL) {
getLogger().info("RELOAD");
HistoryPoint point = ureq.getUserSession().popLastHistoryEntry();
if (point != null) {
back(ureq, point);
}
}
}
}
Aggregations