Package net.sourceforge.ganttproject

Examples of net.sourceforge.ganttproject.GanttCalendar


    }

    public boolean isPublicHoliDay(Date curDayStart) {
        boolean result = publicHolidaysArray.contains(curDayStart);
        if (!result) {
            result = myStableHolidays.contains(new GanttCalendar(1, curDayStart.getMonth(), curDayStart.getDate()).getTime());
        }
        return result;
    }
View Full Code Here


            return myStart;
        }
    }

    public GanttCalendar getEnd() {
        GanttCalendar result = null;
        if (myMutator != null
                && myMutator.myIsolationLevel == TaskMutator.READ_UNCOMMITED) {
            result = myMutator.getEnd();
        }
        if (result==null) {
View Full Code Here

        }
        return result;
    }

    GanttCalendar calculateEnd() {
        GanttCalendar result = getStart().Clone();
        Date newEnd = shiftDate(result.getTime(), getDuration());
        result.setTime(newEnd);
        return result;
    }
View Full Code Here

    public void setStart(GanttCalendar start) {
        Date closestWorkingStart = myManager.findClosestWorkingTime(start
                .getTime());
        start.setTime(closestWorkingStart);
        GanttCalendar oldStart = myStart == null ? null : myStart.Clone();
        myStart = start;
        GanttCalendar oldEnd = getEnd();

        //if (myID>=0) {
            recalculateActivities();
        //}
    }
View Full Code Here

    public boolean isSupertask() {
        return myManager.getTaskHierarchy().hasNestedTasks(this);
    }

    public void setEnd(GanttCalendar end) {
        GanttCalendar oldFinish = myEnd == null ? null : myEnd.Clone();
        myEnd = end;
        recalculateActivities();
        // System.err.println("we have "+myActivities.size()+" activities");
//        if (areEventsEnabled()) {
//            myManager.fireTaskScheduleChanged(this, myStart.Clone(), oldFinish);
View Full Code Here

            //
            for (int i = 0; i < depsAsDependant.length; i++) {
                TaskDependency next = depsAsDependant[i];
                TaskDependencyConstraint.Collision nextCollision = next
                        .getConstraint().getCollision();
                GanttCalendar acceptableStart = nextCollision
                        .getAcceptableStart();
                switch (nextCollision.getVariation()) {
                case TaskDependencyConstraint.Collision.START_EARLIER_VARIATION: {
                    startEarlierVariations.add(acceptableStart);
                    break;
                }
                case TaskDependencyConstraint.Collision.START_LATER_VARIATION: {
                    startLaterVariations.add(acceptableStart);
                    break;
                }
                case TaskDependencyConstraint.Collision.NO_VARIATION: {
                    noVariations.add(acceptableStart);
                    break;
                }
                }
            }
            if (noVariations.size() > 1) {
                throw new TaskDependencyException(
                        "Failed to fulfill constraints of task="
                                + dependant
                                + ". There are "
                                + noVariations.size()
                                + " constraints which don't allow for task start variation");
            }
            //
            Collections.sort(startEarlierVariations);
            Collections.sort(startLaterVariations);
            //
            GanttCalendar solution;
            GanttCalendar earliestStart = (GanttCalendar) (startEarlierVariations
                    .size() == 0 ? null : startEarlierVariations.get(0));
            GanttCalendar latestStart = (GanttCalendar) (startLaterVariations
                    .size() >= 0 ? startLaterVariations
                    .get(startLaterVariations.size() - 1) : null);
            if (earliestStart == null && latestStart == null) {
                solution = dependant.getStart();
            } else {
                if (earliestStart == null && latestStart != null) {
                    earliestStart = latestStart;
                } else if (earliestStart != null && latestStart == null) {
                    latestStart = earliestStart;
                }
                if (earliestStart.compareTo(latestStart) < 0) {
                    throw new TaskDependencyException(
                            "Failed to fulfill constraints of task="
                                    + dependant);
                }
            }
            if (noVariations.size() > 0) {
                GanttCalendar notVariableStart = (GanttCalendar) noVariations
                        .get(0);
                if (notVariableStart.compareTo(earliestStart) < 0
                        || notVariableStart.compareTo(latestStart) > 0) {
                    throw new TaskDependencyException(
                            "Failed to fulfill constraints of task="
                                    + dependant);
                }
                solution = notVariableStart;
View Full Code Here

//            myManager.fireTaskScheduleChanged(this, myStart.Clone(), oldFinish);
//        }
    }

    public void setThirdDate(GanttCalendar third) {
        GanttCalendar oldThird = myThird == null ? null : myThird.Clone();
        myThird = third;
        // recalculateActivities();
        // if (areEventsEnabled()) {
        // myManager.fireTaskScheduleChanged(this, myThird.Clone(), oldThird);
        // }
View Full Code Here

    public void shift(TaskLength shift) {
        float unitCount = shift.getLength(myLength.getTimeUnit());
        if (unitCount != 0f) {
            Task resultTask = shift(unitCount);
            GanttCalendar oldStart = myStart;
            GanttCalendar oldEnd = myEnd;
            myStart = resultTask.getStart();
            myLength = resultTask.getDuration();
            myEnd = resultTask.getEnd();
            if (areEventsEnabled()) {
                myManager.fireTaskScheduleChanged(this, oldStart, oldEnd);
View Full Code Here

        if (unitCount > 0) {
            TaskLength length = myManager.createLength(myLength.getTimeUnit(),
                    unitCount);
            // clone.setDuration(length);
            Date shiftedDate = RESTLESS_CALENDAR.shiftDate(myStart.getTime(), length);
            clone.setStart(new GanttCalendar(shiftedDate));
            clone.setDuration(myLength);
        } else {
            Date newStart = shiftDate(clone.getStart().getTime(),
                                  getManager().createLength(clone.getDuration().getTimeUnit(), (long) unitCount));
            clone.setStart(new GanttCalendar(newStart));
            clone.setDuration(myLength);
        }
        return clone;
    }
View Full Code Here

            switch (getThirdDateConstraint()) {
            case EARLIESTBEGIN:
                // TODO: TIME UNIT (assumption about days)
                if (getThird().after(getStart())) {
                    int difference = getThird().diff(getStart());
                    GanttCalendar _start = getStart().newAdd(difference);
                    GanttCalendar _end = getEnd().newAdd(difference);
                    setEnd(_end);
                    setStart(_start);
                    setDuration(length);
                }
                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.