Search in sources :

Example 1 with QItemMarkedEvent

use of org.olat.modules.qpool.ui.events.QItemMarkedEvent in project OpenOLAT by OpenOLAT.

the class AbstractItemListController method event.

@Override
public void event(Event event) {
    if (event instanceof QItemMarkedEvent) {
        QItemMarkedEvent qime = (QItemMarkedEvent) event;
        ItemRow row = getRowByItemKey(qime.getKey());
        if (row != null) {
            row.setMark(qime.isMark());
        }
    }
}
Also used : QItemMarkedEvent(org.olat.modules.qpool.ui.events.QItemMarkedEvent)

Example 2 with QItemMarkedEvent

use of org.olat.modules.qpool.ui.events.QItemMarkedEvent in project openolat by klemens.

the class QuestionPoolMainEditorController method doDrop.

private void doDrop(UserRequest ureq, String targetId, String dropId) {
    try {
        int lastIndex = dropId.lastIndexOf('-');
        String rowStr = dropId.substring(lastIndex + 1, dropId.length());
        int row = Integer.parseInt(rowStr);
        QuestionItemShort item = ((QuestionsController) currentCtrl).getQuestionAt(row);
        TreeNode node = menuTree.getTreeModel().getNodeById(targetId);
        if (node != null) {
            Object userObj = node.getUserObject();
            if (userObj instanceof BusinessGroup) {
                doShareItemsOptions(ureq, singletonList(item), singletonList((BusinessGroup) userObj), null);
            } else if (userObj instanceof Pool) {
                doShareItemsOptions(ureq, singletonList(item), null, singletonList((Pool) userObj));
            } else if (userObj instanceof QuestionItemCollection) {
                qpoolService.addItemToCollection(singletonList(item), singletonList((QuestionItemCollection) userObj));
                showInfo("item.collectioned", item.getTitle());
            } else if (node instanceof MyQuestionsTreeNode) {
                doCopyToMyConfirmation(ureq, item);
            } else if (node instanceof MarkedQuestionsTreeNode) {
                String businessPath = "[QuestionItem:" + item.getKey() + "]";
                markManager.setMark(item, getIdentity(), null, businessPath);
                QItemMarkedEvent event = new QItemMarkedEvent("marked", item.getKey(), true);
                ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(event, QITEM_MARKED);
            }
        }
    } catch (Exception e) {
        logError("Cannot drop with id: " + dropId, e);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) QuestionItemCollection(org.olat.modules.qpool.QuestionItemCollection) MarkedQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MarkedQuestionsTreeNode) QItemMarkedEvent(org.olat.modules.qpool.ui.events.QItemMarkedEvent) MyQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MyQuestionsTreeNode) ControllerTreeNode(org.olat.modules.qpool.ui.tree.ControllerTreeNode) CollectionTreeNode(org.olat.modules.qpool.ui.tree.CollectionTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) MarkedQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MarkedQuestionsTreeNode) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) MyQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MyQuestionsTreeNode) QuestionItem2Pool(org.olat.modules.qpool.QuestionItem2Pool) Pool(org.olat.modules.qpool.Pool)

Example 3 with QItemMarkedEvent

use of org.olat.modules.qpool.ui.events.QItemMarkedEvent in project OpenOLAT by OpenOLAT.

the class QuestionPoolMainEditorController method doDrop.

private void doDrop(UserRequest ureq, String targetId, String dropId) {
    try {
        int lastIndex = dropId.lastIndexOf('-');
        String rowStr = dropId.substring(lastIndex + 1, dropId.length());
        int row = Integer.parseInt(rowStr);
        QuestionItemShort item = ((QuestionsController) currentCtrl).getQuestionAt(row);
        TreeNode node = menuTree.getTreeModel().getNodeById(targetId);
        if (node != null) {
            Object userObj = node.getUserObject();
            if (userObj instanceof BusinessGroup) {
                doShareItemsOptions(ureq, singletonList(item), singletonList((BusinessGroup) userObj), null);
            } else if (userObj instanceof Pool) {
                doShareItemsOptions(ureq, singletonList(item), null, singletonList((Pool) userObj));
            } else if (userObj instanceof QuestionItemCollection) {
                qpoolService.addItemToCollection(singletonList(item), singletonList((QuestionItemCollection) userObj));
                showInfo("item.collectioned", item.getTitle());
            } else if (node instanceof MyQuestionsTreeNode) {
                doCopyToMyConfirmation(ureq, item);
            } else if (node instanceof MarkedQuestionsTreeNode) {
                String businessPath = "[QuestionItem:" + item.getKey() + "]";
                markManager.setMark(item, getIdentity(), null, businessPath);
                QItemMarkedEvent event = new QItemMarkedEvent("marked", item.getKey(), true);
                ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(event, QITEM_MARKED);
            }
        }
    } catch (Exception e) {
        logError("Cannot drop with id: " + dropId, e);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) QuestionItemCollection(org.olat.modules.qpool.QuestionItemCollection) MarkedQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MarkedQuestionsTreeNode) QItemMarkedEvent(org.olat.modules.qpool.ui.events.QItemMarkedEvent) MyQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MyQuestionsTreeNode) ControllerTreeNode(org.olat.modules.qpool.ui.tree.ControllerTreeNode) CollectionTreeNode(org.olat.modules.qpool.ui.tree.CollectionTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) MarkedQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MarkedQuestionsTreeNode) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) MyQuestionsTreeNode(org.olat.modules.qpool.ui.tree.MyQuestionsTreeNode) QuestionItem2Pool(org.olat.modules.qpool.QuestionItem2Pool) Pool(org.olat.modules.qpool.Pool)

Example 4 with QItemMarkedEvent

use of org.olat.modules.qpool.ui.events.QItemMarkedEvent in project openolat by klemens.

the class AbstractItemListController method event.

@Override
public void event(Event event) {
    if (event instanceof QItemMarkedEvent) {
        QItemMarkedEvent qime = (QItemMarkedEvent) event;
        ItemRow row = getRowByItemKey(qime.getKey());
        if (row != null) {
            row.setMark(qime.isMark());
        }
    }
}
Also used : QItemMarkedEvent(org.olat.modules.qpool.ui.events.QItemMarkedEvent)

Aggregations

QItemMarkedEvent (org.olat.modules.qpool.ui.events.QItemMarkedEvent)4 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 BusinessGroup (org.olat.group.BusinessGroup)2 Pool (org.olat.modules.qpool.Pool)2 QuestionItem2Pool (org.olat.modules.qpool.QuestionItem2Pool)2 QuestionItemCollection (org.olat.modules.qpool.QuestionItemCollection)2 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)2 CollectionTreeNode (org.olat.modules.qpool.ui.tree.CollectionTreeNode)2 ControllerTreeNode (org.olat.modules.qpool.ui.tree.ControllerTreeNode)2 MarkedQuestionsTreeNode (org.olat.modules.qpool.ui.tree.MarkedQuestionsTreeNode)2 MyQuestionsTreeNode (org.olat.modules.qpool.ui.tree.MyQuestionsTreeNode)2