Search in sources :

Example 1 with EPArtefactClicked

use of org.olat.portfolio.ui.structel.EPArtefactClicked in project openolat by klemens.

the class EPTOCController method doSelectTreeElement.

private void doSelectTreeElement(UserRequest ureq, TreeEvent te) {
    TreeNode selectedNode = treeCtr.getTreeModel().getNodeById(te.getNodeId());
    Object userObj = selectedNode.getUserObject();
    if (userObj instanceof PortfolioStructure) {
        // structure clicked
        structureClicked = (PortfolioStructure) userObj;
        refreshAddElements(ureq, structureClicked);
        delButton.setVisible(true);
        // send event to load this page
        fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.SELECTED, structureClicked));
    } else if (userObj instanceof AbstractArtefact) {
        // artefact clicked
        Object parentObj = ((TreeNode) selectedNode.getParent()).getUserObject();
        if (parentObj instanceof PortfolioStructure) {
            artefactClicked = (AbstractArtefact) userObj;
            PortfolioStructure structure = (PortfolioStructure) parentObj;
            refreshAddElements(ureq, null);
            delButton.setVisible(true);
            fireEvent(ureq, new EPArtefactClicked(ARTEFACT_NODE_CLICKED, structure));
        }
    } else {
        // root tree node clicked, no add/delete link
        delButton.setVisible(false);
        refreshAddElements(ureq, null);
        fireEvent(ureq, new Event(ARTEFACT_NODE_CLICKED));
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) Event(org.olat.core.gui.control.Event) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPArtefactClicked(org.olat.portfolio.ui.structel.EPArtefactClicked)

Example 2 with EPArtefactClicked

use of org.olat.portfolio.ui.structel.EPArtefactClicked in project OpenOLAT by OpenOLAT.

the class EPTOCController method doSelectTreeElement.

private void doSelectTreeElement(UserRequest ureq, TreeEvent te) {
    TreeNode selectedNode = treeCtr.getTreeModel().getNodeById(te.getNodeId());
    Object userObj = selectedNode.getUserObject();
    if (userObj instanceof PortfolioStructure) {
        // structure clicked
        structureClicked = (PortfolioStructure) userObj;
        refreshAddElements(ureq, structureClicked);
        delButton.setVisible(true);
        // send event to load this page
        fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.SELECTED, structureClicked));
    } else if (userObj instanceof AbstractArtefact) {
        // artefact clicked
        Object parentObj = ((TreeNode) selectedNode.getParent()).getUserObject();
        if (parentObj instanceof PortfolioStructure) {
            artefactClicked = (AbstractArtefact) userObj;
            PortfolioStructure structure = (PortfolioStructure) parentObj;
            refreshAddElements(ureq, null);
            delButton.setVisible(true);
            fireEvent(ureq, new EPArtefactClicked(ARTEFACT_NODE_CLICKED, structure));
        }
    } else {
        // root tree node clicked, no add/delete link
        delButton.setVisible(false);
        refreshAddElements(ureq, null);
        fireEvent(ureq, new Event(ARTEFACT_NODE_CLICKED));
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) Event(org.olat.core.gui.control.Event) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent) EPArtefactClicked(org.olat.portfolio.ui.structel.EPArtefactClicked)

Aggregations

GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeDropEvent (org.olat.core.gui.components.tree.TreeDropEvent)2 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)2 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 Event (org.olat.core.gui.control.Event)2 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2 EPArtefactClicked (org.olat.portfolio.ui.structel.EPArtefactClicked)2 EPStructureChangeEvent (org.olat.portfolio.ui.structel.EPStructureChangeEvent)2