Package net.sourceforge.ganttproject.task.dependency

Examples of net.sourceforge.ganttproject.task.dependency.TaskDependency


        task2.setStart(new GanttCalendar(2000, 01, 03));
        task2.setEnd(new GanttCalendar(2000, 01, 04));
        supertask.setStart(new GanttCalendar(2000, 01, 01));
        supertask.setEnd(new GanttCalendar(2000, 01, 04));
        //
        TaskDependency dep = taskManager
                .getDependencyCollection()
                .createDependency(task2, task1, new FinishStartConstraintImpl());
        //
        task1.setEnd(new GanttCalendar(2000, 01, 04));
        RecalculateTaskScheduleAlgorithm alg = taskManager
View Full Code Here


        dependant.setStart(new GanttCalendar(1999, Calendar.DECEMBER, 30));
        dependant.setEnd(new GanttCalendar(2000, Calendar.JANUARY, 3));
        dependee.setStart(new GanttCalendar(1999, Calendar.NOVEMBER, 15));
        dependee.setEnd(new GanttCalendar(1999, Calendar.NOVEMBER, 16));
        //
        TaskDependency dep = getTaskManager().getDependencyCollection()
                .createDependency(dependant, dependee,
                        new FinishStartConstraintImpl());
        TaskDependency.ActivityBinding binding = dep.getActivityBinding();
        assertEquals(binding.getDependantActivity(),
                dependant.getActivities()[0]);
        assertEquals(binding.getDependeeActivity(), dependee.getActivities()[0]);
        //
        dependant.setStart(new GanttCalendar(2000, Calendar.JANUARY, 4));
        dependant.setEnd(new GanttCalendar(2000, Calendar.JANUARY, 5));
        dependee.setStart(new GanttCalendar(1999, Calendar.DECEMBER, 30));
        dependee.setEnd(new GanttCalendar(2000, Calendar.JANUARY, 3));
        binding = dep.getActivityBinding();
        assertEquals(binding.getDependantActivity(),
                dependant.getActivities()[0]);
        assertEquals(binding.getDependeeActivity(), dependee.getActivities()[1]);
    }
View Full Code Here

    public void testNewDependencyAppearsInCollections()
            throws TaskDependencyException {
        TaskManager taskMgr = getTaskManager();
        Task task1 = taskMgr.createTask(1);
        Task task2 = taskMgr.createTask(2);
        TaskDependency dep = taskMgr
                .getDependencyCollection()
                .createDependency(task1, task2, new FinishStartConstraintImpl());
        //
        assertDependenciesCollectionContainsDependency(task1, dep);
        assertDependenciesCollectionContainsDependency(task2, dep);
View Full Code Here

    public void testDeletedDependencyDisappearsFromCollections()
            throws TaskDependencyException {
        TaskManager taskMgr = getTaskManager();
        Task task1 = taskMgr.createTask(1);
        Task task2 = taskMgr.createTask(2);
        TaskDependency dep = taskMgr
                .getDependencyCollection()
                .createDependency(task1, task2, new FinishStartConstraintImpl());
        //
        dep.delete();
        assertDependenciesCollectionDoesntContainDependency(task1, dep);
        assertDependenciesCollectionDoesntContainDependency(task2, dep);
    }
View Full Code Here

        TaskManager taskMgr = getTaskManager();
        Task task1 = taskMgr.createTask(1);
        Task task2 = taskMgr.createTask(2);
        Task task3 = taskMgr.createTask(3);
        //
        TaskDependency dep1 = taskMgr
                .getDependencyCollection()
                .createDependency(task1, task2, new FinishStartConstraintImpl());
        TaskDependency dep2 = taskMgr
                .getDependencyCollection()
                .createDependency(task1, task3, new FinishStartConstraintImpl());
        //
        dep1.delete();
        assertDependenciesCollectionContainsDependency(task1, dep2);
View Full Code Here

        TaskManager taskMgr = getTaskManager();
        Task task1 = taskMgr.createTask(1);
        Task task2 = taskMgr.createTask(2);
        Task task3 = taskMgr.createTask(3);
        //
        TaskDependency dep1 = taskMgr
                .getDependencyCollection()
                .createDependency(task1, task2, new FinishStartConstraintImpl());
        TaskDependency dep2 = taskMgr
                .getDependencyCollection()
                .createDependency(task2, task3, new FinishStartConstraintImpl());
        //
        assertDependencySliceContainsDependency(task2
                .getDependenciesAsDependant(), dep2);
View Full Code Here

    public void testImpossibleToAddDependencyTwice()
            throws TaskDependencyException {
        TaskManager taskMgr = getTaskManager();
        Task task1 = taskMgr.createTask(1);
        Task task2 = taskMgr.createTask(2);
        TaskDependency dep1 = taskMgr
                .getDependencyCollection()
                .createDependency(task1, task2, new FinishStartConstraintImpl());
        TaskDependency dep2 = null;
        try {
            dep2 = taskMgr.getDependencyCollection().createDependency(task1,
                    task2, new FinishStartConstraintImpl());
        } catch (TaskDependencyException e) {
        }
View Full Code Here

        GanttTask gTask1;
        int gTaskNumber1;
        GanttTask gTask2;
        int gTaskNumber2;
        TaskDependency gTaskDependency;
        int gConstraintType;
        while (taskIter.hasNext() == true) {
            task = (Task) taskIter.next();
            gTaskNumber1 = mapTaskNumber(task.getID());

            if (gTaskNumber1 == -1) {
                continue;
            }

            rels = (RelationList)task.getPredecessors();

            if (rels != null) {
                relIter = rels.iterator();

                while (relIter.hasNext() == true) {
                    rel = (Relation) relIter.next();

                    gTaskNumber2 = mapTaskNumber(new Integer(rel
                            .getTaskIDValue()));

                    if (gTaskNumber2 != -1) {
                        gTask1 = tm.getTask(gTaskNumber1);
                        gTask2 = tm.getTask(gTaskNumber2);

                        switch (rel.getType().getType()) {
                        case RelationType.FINISH_FINISH_VALUE: {
                            gConstraintType = GanttTaskRelationship.FF;
                            break;
                        }

                        case RelationType.START_FINISH_VALUE: {
                            gConstraintType = GanttTaskRelationship.SF;
                            break;
                        }

                        case RelationType.START_START_VALUE: {
                            gConstraintType = GanttTaskRelationship.SS;
                            break;
                        }

                        default:
                        case RelationType.FINISH_START_VALUE: {
                            gConstraintType = GanttTaskRelationship.FS;
                            break;
                        }
                        }

                        try {
                            gTaskDependency = tm
                                    .getDependencyCollection()
                                    .createDependency(
                                            gTask1,
                                            gTask2,
                                            tm
                                                    .createConstraint(gConstraintType));
                            gTaskDependency.setConstraint(tm
                                    .createConstraint(gConstraintType));
                        }

                        catch (TaskDependencyException e) {
                          if (!GPLogger.log(e)) {
View Full Code Here

                    }
                    if(cpDependencies!=null)
                    {
                      for (int i = 0; i < cpDependencies.size(); i++) {
                        // for(int i=cpDependencies.size()-1; i >= 0; i--) {
                        TaskDependency td = ((TaskDependency) cpDependencies
                            .get(i));
                        Task dependee = td.getDependee();
                        Task dependant = td.getDependant();
                        TaskDependencyConstraint constraint = td
                                  .getConstraint();
                        for (int j = 0; j < allNodes.size(); j++) {
                          for (int k = 0; k < allNodes.size(); k++) {
                            if ((dependant
                                .equals((Task) (((DefaultMutableTreeNode) allNodes
                                    .get(j)).getUserObject())))
                                    && (dependee
                                        .equals((Task) (((DefaultMutableTreeNode) allNodes
                                            .get(k))
                                            .getUserObject())))) {
                              try {
                                TaskDependency newDependency = getTaskManager()
                                                  .getDependencyCollection()
                                                  .createDependency(
                                                      getTaskManager()
                                                                  .getTask(
                                                                        ((Integer) mapOriginalIDCopyID
                                                                                .get(new Integer(
                                                                                        dependant
                                                                                                .getTaskID())))
                                                                                .intValue()),
                                                        getTaskManager()
                                                                .getTask(
                                                                        ((Integer) mapOriginalIDCopyID
                                                                                .get(new Integer(
                                                                                        dependee
                                                                                                .getTaskID())))
                                                                                .intValue()),
                                                        getTaskManager()
                                                                .createConstraint(
                                                                        constraint
                                                                                .getID()));
                                          newDependency.setDifference(td
                                                  .getDifference());
                                          newDependency.setHardness(td.getHardness());
                                      } catch (TaskDependencyException e) {
                                          myUIFacade.showErrorDialog(e);
                                      }
                                  }
                              }
View Full Code Here

     *            current task
     */
    private void processRelationships(Task ganttTask) {
        // Vector relationships = ganttTask.getPredecessorsOld();
        TaskDependency[] dependencies = ganttTask.getDependencies().toArray();
        TaskDependency relationship;
        com.tapsterrock.mpx.Task mpxSuccessorTask;
        com.tapsterrock.mpx.Task mpxPredecessorTask;
        Integer mpxSuccessorTaskID;
        Integer mpxPredecessorTaskID;
        Relation mpxRelation;

        for (int loop = 0; loop < dependencies.length; loop++) {
            relationship = dependencies[loop];
            mpxSuccessorTaskID = (Integer) m_ganttMpxTaskMap.get(new Integer(
                    relationship.getDependant().getTaskID()));
            mpxPredecessorTaskID = (Integer) m_ganttMpxTaskMap.get(new Integer(
                    relationship.getDependee().getTaskID()));

            if (mpxSuccessorTaskID != null && mpxPredecessorTaskID != null) {
                mpxSuccessorTask = m_mpx.getTaskByUniqueID(mpxSuccessorTaskID
                        .intValue());
                mpxPredecessorTask = m_mpx
                        .getTaskByUniqueID(mpxPredecessorTaskID.intValue());

                mpxRelation = mpxSuccessorTask
                        .addPredecessor(mpxPredecessorTask);

                TaskDependencyConstraint constraint = relationship
                        .getConstraint();
                switch (constraint.getID()) {
                case GanttTaskRelationship.SS: {
                    mpxRelation.setType(RelationType.START_START);
                    break;
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.task.dependency.TaskDependency

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.