Search in sources :

Example 51 with Activateable2

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());
            }
        }
    }
}
Also used : MySharedItemRow(org.olat.modules.portfolio.model.MySharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 52 with Activateable2

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);
    }
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) ArrayList(java.util.ArrayList) AssessedBinderSection(org.olat.modules.portfolio.model.AssessedBinderSection) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 53 with Activateable2

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);
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)

Example 54 with Activateable2

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);
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 55 with Activateable2

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());
            }
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) GenericActionExtension(org.olat.core.extensions.action.GenericActionExtension) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)78 ContextEntry (org.olat.core.id.context.ContextEntry)44 Controller (org.olat.core.gui.control.Controller)28 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)22 TreeNode (org.olat.core.gui.components.tree.TreeNode)16 WindowControl (org.olat.core.gui.control.WindowControl)16 BasicController (org.olat.core.gui.control.controller.BasicController)14 CourseNode (org.olat.course.nodes.CourseNode)12 CollaborationTools (org.olat.collaboration.CollaborationTools)10 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)10 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)10 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)10 GTACourseNode (org.olat.course.nodes.GTACourseNode)10 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)8 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)8 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)6 ChiefController (org.olat.core.gui.control.ChiefController)6 VetoableCloseController (org.olat.core.gui.control.VetoableCloseController)6 BornSiteInstance (org.olat.core.gui.control.navigation.BornSiteInstance)6 OLATResourceable (org.olat.core.id.OLATResourceable)5