Package com.projity.pm.task

Examples of com.projity.pm.task.Project$Workspace


   */
  public void setDocumentFrame(DocumentFrame documentFrame) {
    if (documentFrame != null && documentFrame.getProject() != null)
        documentFrame.getProject().removeObjectListener(this);
    this.documentFrame = documentFrame;
    Project project=documentFrame.getProject();
    project.getResourcePool().addObjectListener(this);
//    if (projectName != null)
//      projectName.setText(project == null ? "" : "Resources from: " + project.getName());
  }
View Full Code Here


    }

    public void paste(Node parent,List children,int position,NodeModel model,int actionType){
      Node p=(parent==null)?root:parent;

      Project project=null;
      ResourcePool resourcePool=null;
      if (model.getDataFactory() instanceof Project)
          project=(Project)model.getDataFactory();
      else if(model.getDataFactory() instanceof ResourcePool)
          resourcePool=(ResourcePool)model.getDataFactory();

      int subprojectLevel=getChildrenSubprojectLevel(parent);


//      ArrayList trees=new ArrayList();
//      HierarchyUtils.extractParents(children,trees);

      int childCount=p.getChildCount();
      if (position>childCount){
        NodeFactory nodeFactory=NodeFactory.getInstance();
        Node node=nodeFactory.createVoidNode();
        for (int i=childCount;i<position;i++){
          setSubprojectLevel(node,subprojectLevel);
          p.add(node);
        }
      }



      int j=position;
         for (Iterator i=/*trees*/children.iterator();i.hasNext();){
           Node node=(Node)i.next();
           if ((project!=null && node.getImpl() instanceof Task)||
               (resourcePool!=null && node.getImpl() instanceof Resource)||
               node.isVoid()){
            //if (node.getImpl() instanceof Task) System.out.println("PASTE parent="+parent+":"+(parent==null?"X":parent.isInSubproject())+", node="+node+":"+node.isInSubproject());
          setSubprojectLevel(node,subprojectLevel);
        //if (node.getImpl() instanceof Task) System.out.println("PASTE node in sub="+node.isInSubproject());
          if (position==-1) p.add(node);
      else p.insert(node,j++);
           }
         }
         Node[] descendants=addDescendants(/*trees*/children);


         ArrayList<Dependency> dependencies=new ArrayList<Dependency>();

      boolean doTransaction = model.getDocument() != null && descendants.length > 0;
      int transactionId = 0;
      if (doTransaction)
        transactionId = model.getDocument().fireMultipleTransaction(0,true);


      ArrayList<Node> insertedNodes=new ArrayList<Node>(descendants.length);

      if (project!=null){
        HashMap<Long,Resource> resourceMap=new HashMap<Long,Resource>();
        for (Resource r: (Collection<Resource>)project.getResourcePool().getResourceList())
          resourceMap.put(r.getUniqueId(),r);

        HashMap<Long,Task> taskMap=null;
        if (Environment.isKeepExternalLinks()){
          taskMap=new HashMap<Long,Task>();
          for (Task t: (Collection<Task>)project.getTasks()) //use model instead?
            taskMap.put(t.getUniqueId(),t);
        }

        Project owningProject;
        if (parent!=null && parent.getImpl() instanceof Task){
          Task task=(Task)parent.getImpl();
          if (task.isSubproject()) owningProject=((SubProj)task).getSubproject();
          else owningProject=task.getOwningProject();
        }else owningProject=(Project)model.getDataFactory();

          for (int i=0;i<descendants.length;i++){
            if (descendants[i].getImpl() instanceof Task){
              Task task=(Task)descendants[i].getImpl();

              Node parentSubproject=getParentSubproject((Node)descendants[i].getParent());
              if (parentSubproject!=null) owningProject=((SubProj)parentSubproject.getImpl()).getSubproject();
              if (!task.isExternal()) // fixes  subproject bug with external links
                task.setProjectId(owningProject.getUniqueId()); //useful?
              owningProject.validateObject(task,model,this,null,false);

              Set<Dependency> depsSet=new HashSet<Dependency>();
            List pdeps=task.getDependencyList(true);
            if (pdeps!=null&&pdeps.size()>0){
              if (Environment.isKeepExternalLinks()){
View Full Code Here

      }
    }
    if (NodeModelUtil.nodeIsSubproject(parent)){
      int nbEndVoids=nbMultiprojectEndVoidNodes;
      if (parent.getImpl() instanceof SubProj){
        Project s=((SubProj)parent.getImpl()).getSubproject();
        if (s!=null&&s.isReadOnly()) nbEndVoids=0; //don't add end void nodes for read-only subprojects
      }
      if ( count<nbEndVoids){
        LazyParent sub=(LazyParent)parent.getImpl();
        if (sub.isDataFetched()){
          int subprojectLevel=getChildrenSubprojectLevel(parent);
View Full Code Here

      if (anyProjectButThisOne != null) {
        currentProjectIds.add(new Long(anyProjectButThisOne.getUniqueId()));
      } else {
        ProjectFactory.getInstance().getPortfolio().forProjects(new Closure(){
          public void execute(Object impl) {
            Project project=(Project)impl;
            currentProjectIds.add(new Long(project.getUniqueId()));
          }
        });
      }
  }
View Full Code Here

      frame.setTabNameAndTitle(project);
    }


    public void switchToProject(long projectId) {
      Project project = ProjectFactory.getInstance().findFromId(projectId);
      if (project == null)
        return;
      DocumentFrame f = (DocumentFrame) frameMap.get(project);
      if (f == null)
        return;
View Full Code Here

    CreateOptions opt=new CreateOptions();
    opt.setResourcePool(form.getResourcePool());
    opt.setLocal(local);
    opt.setName(form.getName());
    opt.setAddResources(!local);
    Project project = projectFactory.createProject(opt);
    try {
      //createProject above might make a new resource pool, so make sur it is used when copying properties
      //projectDialog.getForm().setResourcePool(project.getResourcePool());

      project.setManager(form.getManager());
      project.setName(form.getName());
      project.setNotes(form.getNotes());
      project.setForward(form.isForward());
      project.setGroup(form.getGroup());
      project.setDivision(form.getDivision());
      project.setProjectType(form.getProjectType());
      project.setProjectStatus(form.getProjectStatus());
      project.setExpenseType(form.getExpenseType());

      if (!form.isLocal()){
        project.setAccessControlPolicy(form.getAccessControlType());
        project.resetRoles(form.getAccessControlType()==0);
      }


      if (form.isLocal())
        project.setLocal(true);
      else project.setTemporaryLocal(true);
      if (form.isForward())
        project.setStartDate(form.getStartDate());
      else
        project.setFinishDate(form.getStartDate());
      // copy any extra fields to the project
      project.getExtraFields().putAll(form.getExtra().getExtraFields());

//      PropertyUtils.copyProperties(project, projectDialog.getForm());
    } catch (Exception propertyException) {
      propertyException.printStackTrace();
    }
View Full Code Here

      return;
    doingOpenDialog = true;

    finishAnyOperations();

    final Project project;
    project= getCurrentFrame().getProject();

//    List nodes=getCurrentFrame().getSelectedNodes();
//    if (nodes==null||nodes.size()==0) return;
//    Node node=(Node)nodes.get(0);
View Full Code Here



  public void insertSubproject(final Project project, final long subprojectUniqueId,final boolean undo) {
    addHistory("insertSubproject", new Object[]{project.getName(),project.getUniqueId(),subprojectUniqueId});
    Project openedAlready = ProjectFactory.getInstance().findFromId(subprojectUniqueId);

    if (!project.getSubprojectHandler().canInsertProject(subprojectUniqueId)) {
      Alert.error(Messages.getString("GraphicManager.SelectedProjectAlreadySubproject")); //$NON-NLS-1$
      return;
    }
    if (openedAlready != null && openedAlready.isOpenedAsSubproject()) {
      Alert.error(Messages.getString("GraphicManager.SelectedProjectAlreadyOpenedAsSubproject")); //$NON-NLS-1$
      return;
    }
    SubProj subprojectTask = project.getSubprojectHandler().createSubProj(subprojectUniqueId);
    Node subprojectNode = getCurrentFrame().addNodeForImpl(subprojectTask,NodeModel.EVENT);
View Full Code Here

    return result;
  }
protected boolean loadLocalDocument(String fileName,boolean merge){ //uses server to merge
  addHistory("loadLocalDocument",new Object[]{fileName,merge});
    //showWaitCursor(true);
    Project project;
    if (fileName==null) {
      //System.out.println("creating empty project");
      project = projectFactory.createProject();

    } else {
View Full Code Here

  protected void saveLocalDocument(String fileName,final boolean saveAs){
    addHistory("saveLocalDocument",new Object[]{fileName,saveAs});
    //showWaitCursor(true);
    SaveOptions opt=new SaveOptions();
    opt.setLocal(true);
    final Project project=getCurrentFrame().getProject();
    if (project.getFileName()!=fileName){
      final DocumentFrame frame=getCurrentFrame();
      if (saveAs) opt.setSaveAs(true);
      opt.setPostSaving(new Closure(){
        public void execute(Object arg0) {
          if (saveAs) frame.setId(project.getUniqueId()+""); //$NON-NLS-1$
          refreshSaveStatus(true);
        }
      });
    }
    if (fileName.endsWith(".pod")){ //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of com.projity.pm.task.Project$Workspace

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.