use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
the class SharedPagesController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
SharedPageRow row = model.getObject(se.getIndex());
if ("select".equals(cmd)) {
Activateable2 activeateable = doSelectedPage(ureq, row);
if (activeateable != null) {
activeateable.activate(ureq, null, null);
}
}
} else if (event instanceof FlexiTableSearchEvent) {
FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
if (FlexiTableSearchEvent.QUICK_SEARCH.equals(se.getCommand()) || FormEvent.RESET.getCommand().equals(se.getCommand())) {
loadModel(true, true);
}
}
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
if ("mark".equals(link.getCmd())) {
SharedPageRow row = (SharedPageRow) link.getUserObject();
toggleBookmark(row);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
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 klemens.
the class MediaCenterController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == tableEl) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
MediaRow row = model.getObject(se.getIndex());
if ("select".equals(cmd)) {
if (select) {
doSelect(ureq, row.getKey());
} else {
Activateable2 activateable = doOpenMedia(ureq, row.getKey());
if (activateable != null) {
activateable.activate(ureq, null, null);
}
}
}
} else if (event instanceof FlexiTableSearchEvent) {
loadModel();
}
} else if (newMediaCallout == source) {
doOpenNewMediaCallout(ureq, newMediaCallout);
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if ("select".equals(cmd)) {
MediaRow row = (MediaRow) link.getUserObject();
if (select) {
doSelect(ureq, row.getKey());
} else {
Activateable2 activateable = doOpenMedia(ureq, row.getKey());
if (activateable != null) {
activateable.activate(ureq, null, null);
}
}
} else if ("tag".equals(cmd)) {
doToggleCategory(link);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project openolat by klemens.
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 klemens.
the class BaseFullWebappController method back.
protected void back(UserRequest ureq, HistoryPoint cstate) {
List<ContextEntry> entries = cstate.getEntries();
if (entries.isEmpty())
return;
entries = new ArrayList<ContextEntry>(entries);
ContextEntry state = entries.remove(0);
// no red screen for this
if (state == null)
return;
OLATResourceable ores = state.getOLATResourceable();
if (ores != null && "HomeSite".equals(ores.getResourceableTypeName())) {
activateSite(userTools, ureq, entries, false);
} else {
DTab dt = getDTab(ores);
if (dt != null) {
doActivateDTab(dt);
if (dt.getController() instanceof Activateable2) {
((Activateable2) dt.getController()).activate(ureq, entries, null);
}
updateBusinessPath(ureq, dt);
} else {
StateEntry s = state.getTransientState();
if (s instanceof StateSite && ((StateSite) s).getSite() != null && sites != null) {
SiteInstance site = ((StateSite) s).getSite();
for (SiteInstance savedSite : sites) {
if (savedSite != null && site.getClass().equals(savedSite.getClass())) {
activateSite(savedSite, ureq, entries, false);
}
}
}
}
}
}
Aggregations