Examples of CourseEditorTreeNode


Examples of org.olat.course.tree.CourseEditorTreeNode

      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {
        // user chose a position to insert a new node
        String nodeId = te.getNodeId();
        TreePosition tp = insertModel.getTreePosition(nodeId);
        CourseNode selectedNode = insertModel.getCourseNode(tp.getParentTreeNode());
        CourseEditorTreeNode insertParent = course.getEditorTreeModel().getCourseEditorNodeById(selectedNode.getIdent());

        // check if insert position is within the to-be-copied tree
        if (checkIfIsChild(insertParent, moveCopyFrom)) {         
          this.showError("movecopynode.error.overlap");
          fireEvent(ureq, Event.CANCELLED_EVENT);
          return;
        }

        int insertPos = tp.getChildpos();
        if (copy) { // do a copy
          // copy subtree and save model
          recursiveCopy(moveCopyFrom, insertParent, insertPos, true, CourseFactory.getCourseEditSession(ores.getResourceableId()));         
          CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());

          ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_NODE_COPIED, getClass());
          fireEvent(ureq, Event.DONE_EVENT);
        } else { // move only
          if (insertParent.getIdent().equals(moveCopyFrom.getParent().getIdent())) {
            // same parent, adjust insertPos
            if (insertPos > moveCopyFrom.getPosition()) insertPos--;
          }
          insertParent.insert(moveCopyFrom, insertPos);

          moveCopyFrom.setDirty(true);
          //mark subtree as dirty
          TreeVisitor tv = new TreeVisitor( new Visitor() {
            public void visit(INode node) {
              CourseEditorTreeNode cetn = (CourseEditorTreeNode)node;
              cetn.setDirty(true);
            }
          },moveCopyFrom,true);
          tv.visitAll();         
          CourseFactory.saveCourseEditorTreeModel(course.getResourceableId()); // TODO: pb: Review : Add by chg to FIX OLAT-1662
          this.showInfo("movecopynode.info.condmoved");
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

    // create copy of course node
    CourseNode copyOfNode = copyFrom2.getCourseNode().createInstanceForCopy(firstIteration);
    copyNodeId = copyOfNode.getIdent();
    // Insert at desired position   
    course.getEditorTreeModel().insertCourseNodeAt(copyOfNode, insertParent.getCourseNode(), pos);
    CourseEditorTreeNode insertedEditorTreeNode = course.getEditorTreeModel().getCourseEditorNodeById(copyOfNode.getIdent());
    for (int i = 0; i < copyFrom2.getChildCount(); i++) {
      recursiveCopy(course.getEditorTreeModel().getCourseEditorNodeById(copyFrom2.getChildAt(i).getIdent()), insertedEditorTreeNode, i, false, course);
    }
  }
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

   * @param excludeNode Node that should be excluded in the list, e.g. the
   *          current node or null if all assessable nodes should be used
   * @return List of assessable course nodes
   */
  public static List<CourseNode> getAssessableNodes(final CourseEditorTreeModel editorModel, final CourseNode excludeNode) {
    CourseEditorTreeNode rootNode = (CourseEditorTreeNode) editorModel.getRootNode();
    final List<CourseNode> nodes = new ArrayList<CourseNode>();
    // visitor class: takes all assessable nodes if not the exclude node and
    // puts
    // them into the nodes list
    Visitor visitor = new Visitor() {
      public void visit(INode node) {
        CourseEditorTreeNode editorNode = (CourseEditorTreeNode) node;
        CourseNode courseNode = editorModel.getCourseNode(node.getIdent());
        if (!editorNode.isDeleted() && (courseNode != excludeNode)) {
          if(checkIfNodeIsAssessable(courseNode)) {
            nodes.add(courseNode);
          }
        }
      }
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

   * Visitor pattern to delete the course nodes
   *
   * @see org.olat.core.util.tree.Visitor#visit(org.olat.core.util.nodes.INode)
   */
  public void visit(INode node) {
    CourseEditorTreeNode cNode = (CourseEditorTreeNode) node;
    cNode.getCourseNode().exportNode(exportDirectory, course);
    //OLAT-5368: do frequent intermediate commits to avoid transaction timeout
    // discussion intermediatecommit vs increased transaction timeout:
    //  pro intermediatecommit: not much
    //  pro increased transaction timeout: would fix OLAT-5368 but only move the problem
    //@TODO OLAT-2597: real solution is a long-running background-task concept...
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

    initialStructure.setRootNode(runRootNode);
    newCourse.setRunStructure(initialStructure);
    newCourse.saveRunStructure();

    CourseEditorTreeModel editorTreeModel = new CourseEditorTreeModel();
    CourseEditorTreeNode editorRootNode = new CourseEditorTreeNode((CourseNode) ObjectCloner.deepCopy(runRootNode));
    editorTreeModel.setRootNode(editorRootNode);
    newCourse.setEditorTreeModel(editorTreeModel);
    newCourse.saveEditorTreeModel();

    return newCourse;
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

   * @param course
   * @param currentNode
   */
  private static void deployReferencedRepositoryEntries(File importDirectory, ICourse course, CourseEditorTreeNode currentNode) {
    for (int i = 0; i < currentNode.getChildCount(); i++) {
      CourseEditorTreeNode childNode = (CourseEditorTreeNode)currentNode.getChildAt(i);
      childNode.getCourseNode().importNode(importDirectory, course, true, null, null);
      deployReferencedRepositoryEntries(importDirectory, course, childNode);
    }
  }
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

    // append new nodes' subnodes
    int selectCount = nodeIdsToPublish.size();
    for (int i = 0; i < selectCount; i++) {
      // avoid using iterator here so we can modify the Collection
      String nodeId = nodeIdsToPublish.get(i);
      CourseEditorTreeNode cetn = editorTreeModel.getCourseEditorNodeById(nodeId);
      if (cetn.isNewnode() || cetn.isDeleted() || publishTreeModel.isMoved(cetn)) appendPublishableSubnodeIds(cetn, nodeIdsToPublish);
    }

    /*
     * generatePublishSet, testPublishSet, applyPublishSet
     */
 
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

     * be published, but exists already in the runstructure it must be added to
     * the tmp-runstructure as it is in the existing runstructure.
     * ..................................................
     */
    // start point for node publish visitor
    CourseEditorTreeNode editorRoot = (CourseEditorTreeNode) editorTreeModel.getRootNode();

    // the active runstructure and the new created runstructure
    Structure existingCourseRun = course.getRunStructure();
    // breadth first!
    boolean visitChildrenFirst = false;
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

   * @param cetn
   * @param nodesToPublish
   */
  private void appendPublishableSubnodeIds(CourseEditorTreeNode cetn, List<String> nodesToPublish) {
    for (int i = 0; i < cetn.getChildCount(); i++) {
      CourseEditorTreeNode child = (CourseEditorTreeNode) cetn.getChildAt(i);
      if (child.hasPublishableChanges()) nodesToPublish.add(child.getIdent());
      appendPublishableSubnodeIds(child, nodesToPublish);
    }
  }
View Full Code Here

Examples of org.olat.course.tree.CourseEditorTreeNode

      status = damagedRefsModifiedNodes.toArray(status);
      return status;
    }

    CourseNode clonedCourseNode = (CourseNode) ObjectCloner.deepCopy(resultingCourseRun.getRootNode());
    CourseEditorTreeNode clonedRoot = new CourseEditorTreeNode(clonedCourseNode);
    convertInCourseEditorTreeNode(clonedRoot, clonedCourseNode);
    clonedCourseNode.removeAllChildren(); // Do remove all children after convertInCourseEditorTreeNode
    CourseEditorTreeModel cloneCETM = new CourseEditorTreeModel();
    cloneCETM.setRootNode(clonedRoot);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.