Package com.projity.grouping.core

Examples of com.projity.grouping.core.Node



  public void nodesChanged(HierarchyEvent e) {
//      System.out.println("Node changed ...");
//      if ("NO_PROJECT_UPDATE".equals(e.getFlag())) return;
    Node node, previousParentNode, newParentNode;
    Task task, previousParentTask, newParentTask;
    int count=e.getNodes().length;
    if (count==0) return;
    for (int i=0;i<count;i++){
      node=(Node)e.getNodes()[i];
      if (!(node.getImpl() instanceof Task)) continue;
      task=(Task) node.getImpl();

      //TODO verify that this is ok when pasting for bug 426
//      task.setProject((Project) getSchedulingAlgorithm().getMasterDocument());
//      task.setOwningProject(this);
      //moved to validateObject

      previousParentTask=task.getWbsParentTask();
      previousParentNode=taskOutlines.getDefaultOutline().search(previousParentTask);

      // refresh the previous parent's children
      if (previousParentTask!=null) {
        previousParentTask.markAllDependentTasksAsNeedingRecalculation(true); // flag this and dependent tasks as dirty
        previousParentTask.setWbsChildrenNodes(taskOutlines.getDefaultOutline().getHierarchy().getChildren(previousParentNode));
      }

      // refresh the new parent's children
      NodeHierarchy hierarchy=taskOutlines.getDefaultOutline().getHierarchy();
      newParentNode = hierarchy.getParent(node);
      newParentTask = null;
      if (newParentNode!=hierarchy.getRoot()) {
        newParentTask=(Task)newParentNode.getImpl();
        newParentTask.setWbsChildrenNodes(taskOutlines.getDefaultOutline().getHierarchy().getChildren(newParentNode));
        newParentTask.restrictToValidConstraintType();
    //    newParentTask.setParentDuration(); //hk
        newParentTask.markAllDependentTasksAsNeedingRecalculation(true); // flag this and dependent tasks as dirty
      }

      //refresh this node to point to new parent
      task.setWbsParent(newParentTask);

      final Task _newParentTask = newParentTask;
      final Object eventSource = e.getSource();

      // recursively remove all dependencies between new parent and any children, grandchildren, etc.
      taskOutlines.getDefaultOutline().getHierarchy().visitAll(newParentNode, new Closure() {
        public void execute(Object arg) {
          Node node=(Node)arg;
          if (!(node.getImpl() instanceof Task)) return;
          Task task = (Task) node.getImpl();
          DependencyService.getInstance().removeAnyDependencies(task, _newParentTask,eventSource);
        }
      });
    }
    if (!e.isVoid()) { // if the event was not the promotion of a void node
View Full Code Here


      return ((double) calcSummedActualWork()) / work;
  }

  private long calcSummedWork() {
    NodeModel nodeModel = getProject().getTaskOutline();
    Node node = nodeModel.search(this);
    if (node == null)
      return 0;
    Number value = (Number) Configuration.getFieldFromId("Field.work")
        .getValue(node, nodeModel, null);
    return value.longValue();
View Full Code Here

    return value.longValue();
  }

  private long calcSummedActualWork() {
    NodeModel nodeModel = getProject().getTaskOutline();
    Node node = nodeModel.search(this);
    Number value = (Number) Configuration
        .getFieldFromId("Field.actualWork").getValue(node, nodeModel,
            null);
    return value.longValue();
  }
View Full Code Here

    return newOne;
  }


  public void setLocalParent(Task child, Task parent) {
    Node childNode = getTaskModel().search(child);
    Node parentNode = parent == null ? null : getTaskModel().search(parent);
    setLocalParent(childNode,parentNode);
  }
View Full Code Here

  public void setLocalParent(Node childNode, Node parentNode) {
    Task child = (Task) childNode.getImpl();
    Task parent = (Task) (parentNode == null ? null : parentNode.getImpl());
    if (child.getWbsParentTask() == parent)
      return;
    Node oldParentNode = getTaskModel().search(child.getWbsParentTask());
    if (oldParentNode != null)
      oldParentNode.getChildren().remove(childNode);
    ArrayList temp = new ArrayList();
    temp.add(childNode);
    getTaskModel().move(parentNode, temp, -1,NodeModel.NORMAL);
    setDefaultRelationship(parentNode,childNode);
  }
View Full Code Here

    setDefaultRelationship(parentNode,childNode);
  }

  public Node createLocalTaskNode(Node parentNode) {
    NormalTask task=new NormalTask(this);
    Node childNode = NodeFactory.getInstance().createNode(task); // get a node for this task
    connectTask(task);
    addToDefaultOutline(parentNode,childNode);
    getSchedulingAlgorithm().addObject(task);
    return childNode;
  }
View Full Code Here


    connectTask(newTask); // put task in project list
    taskOutlines.addToAll(newlyCreated,nodeModel); // update all node models except the one passed in
    Task parentTask = newTask.getWbsParentTask();
    Node parentNode = (parentTask == null) ? null : nodeModel.search(newTask.getWbsParentTask());
    Node childNode =  nodeModel.search(newTask);
    setDefaultRelationship(parentNode,childNode);
    newTask.markTaskAsNeedingRecalculation();
    updateScheduling(this,newlyCreated,ObjectEvent.CREATE);
    //objectEventManager.fireCreateEvent(eventSource,newlyCreated,hierarchyInfo);
View Full Code Here


  public void nodesChanged(HierarchyEvent e) {
//      System.out.println("Node changed ...");
//      if ("NO_PROJECT_UPDATE".equals(e.getFlag())) return;
    Node node, previousParentNode, newParentNode;
    Task task, previousParentTask, newParentTask;
    int count=e.getNodes().length;
    if (count==0) return;
    for (int i=0;i<count;i++){
      node=(Node)e.getNodes()[i];
      if (!(node.getImpl() instanceof Task)) continue;
      task=(Task) node.getImpl();

      //TODO verify that this is ok when pasting for bug 426
//      task.setProject((Project) getSchedulingAlgorithm().getMasterDocument());
//      task.setOwningProject(this);
      //moved to validateObject

      previousParentTask=task.getWbsParentTask();
      previousParentNode=taskOutlines.getDefaultOutline().search(previousParentTask);

      // refresh the previous parent's children
      if (previousParentTask!=null) {
        previousParentTask.markAllDependentTasksAsNeedingRecalculation(true); // flag this and dependent tasks as dirty
        previousParentTask.setWbsChildrenNodes(taskOutlines.getDefaultOutline().getHierarchy().getChildren(previousParentNode));
      }

      // refresh the new parent's children
      NodeHierarchy hierarchy=taskOutlines.getDefaultOutline().getHierarchy();
      newParentNode = hierarchy.getParent(node);
      newParentTask = null;
      if (newParentNode!=hierarchy.getRoot()) {
        newParentTask=(Task)newParentNode.getImpl();
        newParentTask.setWbsChildrenNodes(taskOutlines.getDefaultOutline().getHierarchy().getChildren(newParentNode));
        newParentTask.restrictToValidConstraintType();
    //    newParentTask.setParentDuration(); //hk
        newParentTask.markAllDependentTasksAsNeedingRecalculation(true); // flag this and dependent tasks as dirty
      }

      //refresh this node to point to new parent
      task.setWbsParent(newParentTask);

      final Task _newParentTask = newParentTask;
      final Object eventSource = e.getSource();

      // recursively remove all dependencies between new parent and any children, grandchildren, etc.
      taskOutlines.getDefaultOutline().getHierarchy().visitAll(newParentNode, new Closure() {
        public void execute(Object arg) {
          Node node=(Node)arg;
          if (!(node.getImpl() instanceof Task)) return;
          Task task = (Task) node.getImpl();
          DependencyService.getInstance().removeAnyDependencies(task, _newParentTask,eventSource);
        }
      });
    }
    if (!e.isVoid()) { // if the event was not the promotion of a void node
View Full Code Here

    }

    public void dump(Collection tasks,String indent){
        if (tasks!=null)
        for (Iterator i=tasks.iterator();i.hasNext();){
            Node node=(Node)i.next();
            Task task=(Task)node.getImpl();
            System.out.println(indent+task.getWbsParentTask()+"->"+task);
            dump(task.getWbsChildrenNodes(),indent+"-");
        }
    }
View Full Code Here

*/
  public void setAllTasksAsUnchangedFromPersisted(boolean justSaved) {
    getTaskOutline().getHierarchy().visitAll(new Closure(){
      int id=1;
      public void execute(Object o) {
        Node node=(Node)o;
        if (node.getImpl() instanceof NormalTask){
          NormalTask task=(NormalTask)node.getImpl();
          task.setDirty(false);
          task.setLastSavedStart(task.getStart()); //
          task.setLastSavedFinish(task.getEnd());
          Iterator j = task.getAssignments().iterator();
          while (j.hasNext())
            ((Assignment)j.next()).setDirty(false);


          j=task.getDependencyList(true).iterator();
          while (j.hasNext())
            ((Dependency)j.next()).setDirty(false);

          Node parent=(Node)node.getParent();
          if (parent==null||parent.isRoot()) task.setLastSavedParentId(-1L);
          else task.setLastSavedParentId(((Task)parent.getImpl()).getUniqueId());
          task.setLastSavedPosistion(parent.getIndex(node));



        }
      }
View Full Code Here

TOP

Related Classes of com.projity.grouping.core.Node

Copyright © 2018 www.massapicom. 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.