Search in sources :

Example 1 with CollectionTreeNode

use of org.olat.modules.qpool.ui.tree.CollectionTreeNode in project openolat by klemens.

the class QuestionPoolMainEditorController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (shareItemsCtrl == source) {
        if (QPoolEvent.ITEM_SHARED.equals(event.getCommand())) {
            List<QuestionItemShort> items = shareItemsCtrl.getItems();
            if (items.size() > 0) {
                // can only drop one item
                QuestionItemShort item = items.get(0);
                if (shareItemsCtrl.getGroups() != null) {
                    showInfo("item.shared", item.getTitle());
                } else if (shareItemsCtrl.getPools() != null) {
                    showInfo("item.pooled", item.getTitle());
                }
            }
            treeModel.buildShareSubTreeModel();
            menuTree.setDirty(true);
        }
        cmc.deactivate();
        cleanUp();
    } else if (event instanceof QPoolEvent) {
        if (QPoolEvent.ITEM_SHARED.equals(event.getCommand())) {
            treeModel.buildShareSubTreeModel();
            menuTree.setDirty(true);
        } else if (QPoolEvent.COLL_CREATED.equals(event.getCommand()) || QPoolEvent.COLL_CHANGED.equals(event.getCommand())) {
            treeModel.buildMySubTreeModel();
            Long collKey = ((QPoolEvent) event).getObjectKey();
            CollectionTreeNode qNode = (CollectionTreeNode) findNodeByPersistableUserObject(treeModel.getMyNode(), collKey);
            if (qNode != null) {
                menuTree.setSelectedNode(qNode);
                doSelectQuestionsNode(ureq, qNode, null, null);
            }
            menuTree.setDirty(true);
        } else if (QPoolEvent.COLL_DELETED.equals(event.getCommand())) {
            treeModel.buildMySubTreeModel();
            menuTree.setSelectedNode(treeModel.getMyNode());
            doSelectControllerTreeNode(ureq, treeModel.getMyNode(), null, null);
        } else if (QPoolEvent.POOL_CREATED.equals(event.getCommand()) || QPoolEvent.POOL_DELETED.equals(event.getCommand())) {
            treeModel.buildShareSubTreeModel();
            menuTree.setDirty(true);
        } else if (QPoolEvent.ITEMS_RELOADED.equals(event.getCommand())) {
            treeModel.reloadReviewCounts();
        }
    } else if (copyToMyCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            QuestionItemShort item = (QuestionItemShort) copyToMyCtrl.getUserObject();
            doCopyToMy(item);
        }
    } else if (cmc == source) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : CollectionTreeNode(org.olat.modules.qpool.ui.tree.CollectionTreeNode) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) QPoolEvent(org.olat.modules.qpool.ui.events.QPoolEvent)

Example 2 with CollectionTreeNode

use of org.olat.modules.qpool.ui.tree.CollectionTreeNode in project OpenOLAT by OpenOLAT.

the class QuestionPoolMainEditorController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (shareItemsCtrl == source) {
        if (QPoolEvent.ITEM_SHARED.equals(event.getCommand())) {
            List<QuestionItemShort> items = shareItemsCtrl.getItems();
            if (items.size() > 0) {
                // can only drop one item
                QuestionItemShort item = items.get(0);
                if (shareItemsCtrl.getGroups() != null) {
                    showInfo("item.shared", item.getTitle());
                } else if (shareItemsCtrl.getPools() != null) {
                    showInfo("item.pooled", item.getTitle());
                }
            }
            treeModel.buildShareSubTreeModel();
            menuTree.setDirty(true);
        }
        cmc.deactivate();
        cleanUp();
    } else if (event instanceof QPoolEvent) {
        if (QPoolEvent.ITEM_SHARED.equals(event.getCommand())) {
            treeModel.buildShareSubTreeModel();
            menuTree.setDirty(true);
        } else if (QPoolEvent.COLL_CREATED.equals(event.getCommand()) || QPoolEvent.COLL_CHANGED.equals(event.getCommand())) {
            treeModel.buildMySubTreeModel();
            Long collKey = ((QPoolEvent) event).getObjectKey();
            CollectionTreeNode qNode = (CollectionTreeNode) findNodeByPersistableUserObject(treeModel.getMyNode(), collKey);
            if (qNode != null) {
                menuTree.setSelectedNode(qNode);
                doSelectQuestionsNode(ureq, qNode, null, null);
            }
            menuTree.setDirty(true);
        } else if (QPoolEvent.COLL_DELETED.equals(event.getCommand())) {
            treeModel.buildMySubTreeModel();
            menuTree.setSelectedNode(treeModel.getMyNode());
            doSelectControllerTreeNode(ureq, treeModel.getMyNode(), null, null);
        } else if (QPoolEvent.POOL_CREATED.equals(event.getCommand()) || QPoolEvent.POOL_DELETED.equals(event.getCommand())) {
            treeModel.buildShareSubTreeModel();
            menuTree.setDirty(true);
        } else if (QPoolEvent.ITEMS_RELOADED.equals(event.getCommand())) {
            treeModel.reloadReviewCounts();
        }
    } else if (copyToMyCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            QuestionItemShort item = (QuestionItemShort) copyToMyCtrl.getUserObject();
            doCopyToMy(item);
        }
    } else if (cmc == source) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : CollectionTreeNode(org.olat.modules.qpool.ui.tree.CollectionTreeNode) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) QPoolEvent(org.olat.modules.qpool.ui.events.QPoolEvent)

Aggregations

QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)2 QPoolEvent (org.olat.modules.qpool.ui.events.QPoolEvent)2 CollectionTreeNode (org.olat.modules.qpool.ui.tree.CollectionTreeNode)2