Package net.sourceforge.ganttproject

Examples of net.sourceforge.ganttproject.GanttCalendar


        Task task2 = taskManager.createTask();
        //
        task1.move(supertask);
        task2.move(supertask);
        //
        task1.setStart(new GanttCalendar(2000, 01, 01));
        task1.setEnd(new GanttCalendar(2000, 01, 03));
        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
                .getAlgorithmCollection().getRecalculateTaskScheduleAlgorithm();
        alg.run(task1);
        //
        assertEquals("Unexpected start of supertask=" + supertask,
                new GanttCalendar(2000, 01, 01), supertask.getStart());
        assertEquals("Unexpected end of supertask=" + supertask,
                new GanttCalendar(2000, 01, 05), supertask.getEnd());
    }
View Full Code Here


        Task task2 = taskManager.createTask();
        //
        task1.move(supertask);
        task2.move(supertask);
        //
        task1.setStart(new GanttCalendar(2000, 01, 01));
        task1.setEnd(new GanttCalendar(2000, 01, 03));
        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));
        //
        task1.setStart(new GanttCalendar(2000, 01, 02));
        task2.setStart(new GanttCalendar(2000, 01, 02));
        task2.setEnd(new GanttCalendar(2000, 01, 03));
        //
        AdjustTaskBoundsAlgorithm alg = taskManager.getAlgorithmCollection()
                .getAdjustTaskBoundsAlgorithm();
        alg.run(new Task[] { task1, task2 });
        //
        assertEquals("Unexpected start of supertask=" + supertask,
                new GanttCalendar(2000, 01, 02), supertask.getStart());
        assertEquals("Unexpected end of supertask=" + supertask,
                new GanttCalendar(2000, 01, 03), supertask.getEnd());
    }
View Full Code Here

    }

    public void testFinishStartBindings() throws Exception {
        Task dependant = getTaskManager().createTask();
        Task dependee = getTaskManager().createTask();
        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 TaskDependencyConstraint.Collision getCollision() {
        TaskDependencyConstraint.Collision result = null;
        Task dependee = getDependency().getDependee();
        Task dependant = getDependency().getDependant();
        GanttCalendar dependeeEnd = dependee.getEnd().Clone();
        // GanttCalendar dependeeEnd = dependee.getEnd();
        GanttCalendar dependantStart = dependant.getStart();

        int difference = getDependency().getDifference();
        GanttCalendar comparisonDate = dependantStart.Clone();
        comparisonDate.add(difference);

        boolean isActive = getDependency().getHardness()==TaskDependency.Hardness.RUBBER ? dependeeEnd
                .compareTo(comparisonDate) > 0 : dependeeEnd
                .compareTo(comparisonDate) != 0;
        // new Exception("[FinishStartConstraint] isActive="+isActive+"
View Full Code Here

    public TaskDependencyConstraint.Collision getCollision() {
        TaskDependencyConstraint.Collision result = null;
        Task dependee = getDependency().getDependee();
        Task dependant = getDependency().getDependant();
        GanttCalendar dependeeEnd = dependee.getEnd();
        GanttCalendar dependantEnd = dependant.getEnd();
        //
       
        int difference = getDependency().getDifference();
       
        GanttCalendar comparisonDate = dependeeEnd.Clone();
        comparisonDate.add(difference);
       
        boolean isActive = getDependency().getHardness()==TaskDependency.Hardness.RUBBER ? dependantEnd
                .compareTo(comparisonDate) < 0 : dependantEnd
                .compareTo(comparisonDate) != 0;

        GanttCalendar acceptableStart = dependant.getStart().Clone();

        // GanttCalendar acceptableStart = dependant.getStart();
        if (isActive) {
            Task clone = dependee.unpluggedClone();
            TaskMutator mutator = clone.createMutator();
View Full Code Here

    public TaskDependencyConstraint.Collision getCollision() {
        TaskDependencyConstraint.Collision result = null;
        Task dependee = getDependency().getDependee();
        Task dependant = getDependency().getDependant();
        GanttCalendar dependeeStart = dependee.getStart();
        GanttCalendar dependantEnd = dependant.getEnd();
        //
        int difference = getDependency().getDifference();
        GanttCalendar comparisonDate = dependeeStart.Clone();
        comparisonDate.add(difference);

        boolean isActive = getDependency().getHardness()==TaskDependency.Hardness.RUBBER ? dependantEnd
                .compareTo(comparisonDate) < 0 : dependantEnd
                .compareTo(comparisonDate) != 0;

        // GanttCalendar acceptableStart = dependant.getStart();
        GanttCalendar acceptableStart = dependee.getStart().Clone();
        if (isActive) {
            Task clone = dependee.unpluggedClone();
            TaskMutator mutator = clone.createMutator();
            mutator.shift(-dependant.getDuration().getLength());
            acceptableStart = clone.getStart();
View Full Code Here

    public TaskDependencyConstraint.Collision getCollision() {
        TaskDependencyConstraint.Collision result = null;
        Task dependee = getDependency().getDependee();
        Task dependant = getDependency().getDependant();
        GanttCalendar dependeeStart = dependee.getStart();
        GanttCalendar dependantStart = dependant.getStart();
        //
        int difference = getDependency().getDifference();
       GanttCalendar comparisonDate = dependeeStart.Clone();
       comparisonDate.add(difference);

        boolean isActive = getDependency().getHardness()==TaskDependency.Hardness.RUBBER ? dependantStart
                .compareTo(comparisonDate) < 0 : dependantStart
                .compareTo(comparisonDate) != 0;
        // GanttCalendar acceptableStart = dependee.getStart();
        GanttCalendar acceptableStart = dependee.getStart().Clone();
        addDelay(acceptableStart);
        result = new TaskDependencyConstraint.DefaultCollision(acceptableStart,
                TaskDependencyConstraint.Collision.START_LATER_VARIATION,
                isActive);
        return result;
View Full Code Here

    }

    public void addDelay(GanttCalendar calendar) {
        int difference = myDependency.getDifference();
        calendar.add(difference);
        GanttCalendar solutionStart = calendar.Clone();
        solutionStart.add(-1 * myDependency.getDifference());
        for (int i = 0; i <= difference; i++) {
            if ((myDependency.getDependant()
                    .getManager().getCalendar()).isNonWorkingDay(solutionStart
                    .getTime())) {
                calendar.add(1);
                difference++;
            }
            solutionStart.add(1);
        }
    }
View Full Code Here

        addAttribute("currentDateTimeValue", df.format(new java.util.Date()),
                attrs);
        addAttribute("description", i18n("shortDescription"), attrs);

        addAttribute("begin", i18n("start"), attrs);
        addAttribute("beginValue", new GanttCalendar(getProject().getTaskManager().getProjectStart()).toString(), attrs);

        addAttribute("end", i18n("end"), attrs);
        addAttribute("endValue", new GanttCalendar(getProject().getTaskManager().getProjectEnd()).toString(), attrs);

        startPrefixedElement("project", attrs, handler);
        textElement("descriptionValue", attrs, getProject().getDescription(),
                handler);
        endPrefixedElement("project", handler);
View Full Code Here

                defValue = new Double(Double.parseDouble(td));
                break;
            case 3:
                colClass = GregorianCalendar.class;
                if (myDate.getValue() == null)
                  defValue = new  GanttCalendar();
                else
                  defValue = new GanttCalendar(myDate.getValue());
                break;
            case 4:
                colClass = Boolean.class;
                defValue = new Boolean(radioTrue.isSelected());
                break;
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.GanttCalendar

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.