Package com.projity.grouping.core

Examples of com.projity.grouping.core.Node


  private class TaskIterator implements Iterator<Task>{
    private Iterator iterator;
    private Task next=null;
    private Task nextElement(){
          Node node=null;
          while(iterator.hasNext() && !((node=(Node)iterator.next()).getImpl() instanceof Task));
          if (node!=null && node.getImpl() instanceof Task) next=(Task)node.getImpl();
          else next=null;
          return next;
    }
View Full Code Here


        Frame parent=JOptionPane.getFrameForComponent(getGraph());
        dependencyPropertiesDialog = new XbsDependencyDialog(parent,dependency);
      }
      boolean didAction = XbsDependencyDialog.doDialog(dependencyPropertiesDialog,dependency,new Closure(){
        public void execute(Object arg0) {
          Node child=dependency.getSuccessor().getNode();
          int position=0;
          TreeNode[] path=((NodeBridge)child).getPath();
          if (path.length>1){
            NodeBridge previous=(NodeBridge)path[1];
            position=previous.getRoot().getIndex(previous)+1;
View Full Code Here

  }
 
 
 
  public GraphicNode getParent(GraphicNode node){
    Node parent=getModel().getHierarchy().getParent(node.getNode()); //can be null
    return (GraphicNode)nodeCache.getElement(parent);
  }
View Full Code Here

   
    GraphicNode current;
    Collection children=model.getHierarchy().getChildren((node==null)?null:node.getNode());
    boolean summary=false;
    if (children!=null){
      Node child;
      for (Iterator i=children.iterator();i.hasNext();){
        child=(Node)i.next();
        Object impl=child.getImpl();
        if (!(impl instanceof Assignment)) summary=true;
        current=(GraphicNode) nodeCache.getElement(child);
        if (current==null){
          current=createNode(child);
          if (collapseLevel!=-1&&level>=collapseLevel-1) current.setCollapsed(true);
View Full Code Here

    Object object=objectEvent.getObject();
    if (object instanceof Dependency) {
      Dependency dependency = ((Dependency)object);
      if (dependency.getDocument() == document || dependency.getMasterDocument() == document) { // links can come from other projects too, but successor should be in this project
        if (objectEvent.isCreate()) {
          Node preNode=(Node)model.search(dependency.getPredecessor());
          Node sucNode=(Node)model.search(dependency.getSuccessor());
          GraphicNode preGNode=(GraphicNode)nodeCache.getElement(preNode);
          GraphicNode sucGNode=(GraphicNode)nodeCache.getElement(sucNode);
          if (preGNode!=null&&sucGNode!=null){
            GraphicDependency edge=(GraphicDependency)edgeCache.getElement(dependency);
            if (edge == null) { // for external tasks in subprojects, it's possible they already were created
              edge=newGraphicDependency(preGNode,sucGNode,dependency);
              update();
            }
          }
        } else if (objectEvent.isDelete()) {
          GraphicDependency edge=(GraphicDependency)edgeCache.getElement(dependency);
          if (edge!=null){
            removeEdge(edge);
            update();
          }
          //edgeCache.fireEdgesRemoved(this,new Object[]{edge});
        } else { //update
          GraphicDependency edge=(GraphicDependency)edgeCache.getElement(dependency);
          if (edge!=null){
            modifyEdge(edge,dependency.getDependencyType());
            update();
          }
          //edgeCache.fireEdgesUpdated(this,new Object[]{edge});
        }
      }
    }else{
      if (object!=null&&((object instanceof Task && (type&NodeModelCache.TASK_TYPE)==NodeModelCache.TASK_TYPE)||
        (object instanceof Resource && (type&NodeModelCache.RESOURCE_TYPE)==NodeModelCache.RESOURCE_TYPE)||
        (object instanceof Assignment && (type&NodeModelCache.ASSIGNMENT_TYPE)==NodeModelCache.ASSIGNMENT_TYPE)||
        (object instanceof Project && (type&NodeModelCache.PROJECT_TYPE)==NodeModelCache.PROJECT_TYPE))){
        if (object!=null&&!objectEvent.isDelete()){ //because node is already deleted
          //TODO cannot update parents in case of deletion
          Node node=model.search(object);
          if (node !=null) {
            for(;!node.isRoot();node=model.getParent(node)){
//            System.out.println("objectChanged "+objectEvent.getType()+": "+node);
            GraphicNode gnode=getGraphicNode(node);
            if (gnode != null) // on project list it is null
              gnode.setDirty(true);
            //nodeCache.fireObjectEvent(objectEvent.getSource(),objectEvent);
View Full Code Here

      }
      return true;
    }

  public void newNode(GraphicNode gnode){
    Node node=gnode.getNode();
    if (!isAllowedAction(node,false)) return;
    if (node!=null && (node.getImpl() instanceof Task) && ((Task)node.getImpl()).isReadOnly()) return; //read only subprojects
    Node parent=getModel().getParent(node);
    int index=parent.getIndex(node);
    getModel().newNode(parent,index,NodeModel.NORMAL);
  }
View Full Code Here

    private void replicate(NodeModel source, Node sourceParentNode, Node newParentNode, NodeModel newModel, Transformer transformer) {
      Collection children = source.getHierarchy().getChildren(sourceParentNode);         
      if (children != null) {
          Iterator i = children.iterator();
          while (i.hasNext()) {
            Node sourceNode = (Node)i.next();
            Object newImpl = transformer.transform(sourceNode.getImpl()); // make a new object from source
            if (newImpl==null) continue;
            Node newNode = NodeFactory.getInstance().createNode(newImpl); // make a new node
            newModel.add(newParentNode,newNode,NodeModel.SILENT);
            replicate(source,sourceNode,newNode,newModel,transformer);
          }
      }
     
View Full Code Here

      System.out.println(indent + ">" + parent.toString());
    Collection children = nodeModel.getChildren(parent);
    if (children != null) {
      Iterator i = children.iterator();
      while (i.hasNext()) {
        Node n = (Node) i.next();
        Object impl = n.getImpl();
        if (impl instanceof Task) {
          if (((Task) impl).getWbsParentTask() != (parent == null ? null : parent.getImpl()))
            System.out.println("cached hierarchy error - child " + impl + " cached parent" + ((Task) impl).getWbsParentTask()
                + " parent " + parent.getImpl());
        }
View Full Code Here

      result.add(parent);
    Collection children = nodeModel.getChildren(parent);
    if (children != null) {
      Iterator i = children.iterator();
      while (i.hasNext()) {
        Node n = (Node) i.next();
        extractNodeList(nodeModel, n, result);
      }
    }
  }
View Full Code Here

    Object parentImpl = parentNode.getImpl();
    List children = nodeModel.getChildren(parentNode);
    if (parentImpl instanceof Task && children != null && children.size() > 0) {
      Task parent = (Task) parentImpl;
      parent.setWbsChildrenNodes(children); // cached values
      Node child;
      for (Iterator i = children.iterator(); i.hasNext();) {
        child = (Node) i.next();
        Object impl = child.getImpl();
        if (impl instanceof Task) {
          ((Task) impl).setWbsParent(parent); // set cached wbs parent
                            // too
          cacheWbs(nodeModel, child);
        }
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.