use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class MySharedItemsController 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 resId = entries.get(0).getOLATResourceable().getResourceableId();
MySharedItemRow activatedRow = null;
for (MySharedItemRow row : model.getObjects()) {
if (row.getBinderKey().equals(resId)) {
activatedRow = row;
break;
}
}
if (activatedRow != null) {
Activateable2 activeateable = doSelectBinder(ureq, activatedRow);
if (activeateable != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
activeateable.activate(ureq, subEntries, entries.get(0).getTransientState());
}
}
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class SharedBindersController method doSelectSection.
private void doSelectSection(UserRequest ureq) {
try {
String row = ureq.getParameter("select-section");
int index = Integer.parseInt(row);
SharedItemRow itemRow = model.getObject(index);
if (itemRow != null) {
String sectionParam = ureq.getParameter("section");
int sectionIndex = Integer.parseInt(sectionParam);
AssessedBinderSection section = itemRow.getSections().get(sectionIndex);
Activateable2 activeateable = doSelectBinder(ureq, itemRow);
if (activeateable != null) {
List<ContextEntry> entries = new ArrayList<>(2);
entries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("Entries", 0l)));
entries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("Section", section.getSectionKey())));
activeateable.activate(ureq, entries, null);
}
}
} catch (Exception e) {
logError("", e);
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class SharedBindersController 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();
SharedItemRow row = model.getObject(se.getIndex());
if ("select".equals(cmd)) {
Activateable2 activeateable = doSelectBinder(ureq, row);
if (activeateable != null) {
activeateable.activate(ureq, null, null);
}
} else if ("leave".equals(cmd)) {
doConfirmLeaveBinder(ureq, row);
}
} else if (event instanceof FlexiTableSearchEvent) {
FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
loadModel(se.getSearch());
} else if ("ONCLICK".equals(event.getCommand())) {
String row = ureq.getParameter("select-section");
String expand = ureq.getParameter("expand-section");
if (StringHelper.isLong(row)) {
doSelectSection(ureq);
} else if (StringHelper.containsNonWhitespace(expand)) {
doExpandSections(ureq);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class HomeMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
ContextEntry entry = entries.get(0);
String navKey = entry.getOLATResourceable().getResourceableTypeName();
if ("HomeSite".equals(navKey)) {
entries = entries.subList(1, entries.size());
if (entries.size() > 0) {
entry = entries.get(0);
navKey = entry.getOLATResourceable().getResourceableTypeName();
}
}
if (navKey.equals(currentNavKey) && currentCtr instanceof ReusableHomeController) {
if (currentCtr instanceof Activateable2) {
((Activateable2) currentCtr).activate(ureq, entries, entry.getTransientState());
}
} else {
GenericActionExtension gAE = ExtManager.getInstance().getActionExtensioByNavigationKey(HomeMainController.class.getName(), navKey);
if (gAE != null) {
currentNavKey = navKey;
stackPanel.popUpToRootController(ureq);
currentCtr = createController(gAE, ureq);
contentCtr = new LayoutMain3ColsController(ureq, getWindowControl(), currentCtr);
listenTo(contentCtr);
if (entries.size() >= 1) {
entries = entries.subList(1, entries.size());
}
String actionText = gAE.getActionText(getLocale());
stackPanel.rootController(actionText, contentCtr);
if (currentCtr instanceof Activateable2) {
((Activateable2) currentCtr).activate(ureq, entries, entry.getTransientState());
}
}
}
}
Aggregations