Package org.zkoss.ganttz.data

Examples of org.zkoss.ganttz.data.GanttDate


            LocalDate start, int durationDays, LocalDate date) {
        ITaskFundamentalProperties result = createNiceMock(ITaskFundamentalProperties.class);
        expect(result.getBeginDate()).andReturn(toDate(start)).anyTimes();
        expect(result.getEndDate()).andReturn(
                toDate(start.plusDays(durationDays))).anyTimes();
        GanttDate ganttDate = GanttDate.createFrom(date);
        Constraint<GanttDate> constraint = biggerOrEqualThan(ganttDate);
        expect(result.getStartConstraints()).andReturn(
                Arrays.asList(constraint)).anyTimes();

        replay(result);
View Full Code Here


        ITaskFundamentalProperties result = createNiceMock(ITaskFundamentalProperties.class);
        expect(result.getBeginDate()).andReturn(toDate(start)).anyTimes();
        expect(result.getEndDate()).andReturn(
                toDate(start.plusDays(durationDays))).anyTimes();

        GanttDate ganttDate = GanttDate.createFrom(date);
        Constraint<GanttDate> constraint = ConstraintOnComparableValues
                .equalTo(ganttDate);
        expect(result.getStartConstraints()).andReturn(
                Arrays.asList(constraint)).anyTimes();
View Full Code Here

                && task.canBeExplicitlyMoved();
    }


    void doUpdatePosition(int leftX, int topY) {
        GanttDate startBeforeMoving = this.task.getBeginDate();
        final LocalDate newPosition = getMapper().toDate(leftX);
        this.task.doPositionModifications(new IModifications() {

            @Override
            public void doIt(IUpdatablePosition position) {
View Full Code Here

    public String getType() {
        return this.type;
    }

    public static Interval getIntervalFrom(List<LoadTimeLine> timeLines) {
        GanttDate start = null;
        GanttDate end = null;
        for (LoadTimeLine loadTimeLine : timeLines) {
            if(!loadTimeLine.isEmpty()) {
                Validate.notNull(loadTimeLine.getStart());
                start = min(start, loadTimeLine.getStart());
                Validate.notNull(loadTimeLine.getEnd());
                end = max(end, loadTimeLine.getEnd());
            }
        }
        if (timeLines.isEmpty() || start == null || end == null) {
            LocalDate localDateNow = new LocalDate();
            return new Interval(localDateNow, localDateNow.plusYears(5));
        }
        return new Interval(start.toLocalDate(), end.asExclusiveEnd());
    }
View Full Code Here

        }
        return result;
    }

    public GanttDate getStart() {
        GanttDate result = getStartPeriod();
        for (LoadTimeLine loadTimeLine : getChildren()) {
            GanttDate start = loadTimeLine.getStart();
            if (start != null) {
                result = result == null || result.compareTo(start) > 0 ? start
                        : result;
            }
        }
View Full Code Here

        }
        return result;
    }

    public GanttDate getEnd() {
        GanttDate result = getEndPeriod();
        for (LoadTimeLine loadTimeLine : getChildren()) {
            GanttDate end = loadTimeLine.getEnd();
            if (end != null) {
                result = result == null || result.compareTo(end) < 0 ? end
                        : result;
            }
        }
View Full Code Here

    private LocalDate calculateInitDate() {
        if (graph.getTasks().isEmpty()) {
            return null;
        }
        GanttDate ganttDate = Collections.min(getStartDates());
        return LocalDate.fromDateFields(ganttDate.toDayRoundedDate());
    }
View Full Code Here

    }

    private void setEarliestStart(Node<T, D> node, int earliestStart,
            Constraint<GanttDate> constraint) {
        if (constraint != null) {
            GanttDate date = GanttDate.createFrom(initDate
                    .plusDays(earliestStart));
            date = constraint.applyTo(date);
            earliestStart = Days.daysBetween(initDate,
                    LocalDate.fromDateFields(date.toDayRoundedDate()))
                    .getDays();
        }
        node.setEarliestStart(earliestStart);
    }
View Full Code Here

    private void setLatestFinish(Node<T, D> node, int latestFinish,
            Constraint<GanttDate> constraint) {
        if (constraint != null) {
            int duration = node.getDuration();
            GanttDate date = GanttDate.createFrom(initDate.plusDays(latestFinish - duration));
            date = constraint.applyTo(date);
            int daysBetween = Days.daysBetween(initDate,
                    LocalDate.fromDateFields(date.toDayRoundedDate()))
                    .getDays();
            latestFinish = daysBetween + duration;
        }
        node.setLatestFinish(latestFinish);
    }
View Full Code Here

            Date startDateFilter, Date endDateFilter) {
        List<LoadPeriod> list = new PeriodsBuilder(factory, sortedByStartDate).buildPeriods();
        List<LoadPeriod> toReturn = new ArrayList<LoadPeriod>();
        for (LoadPeriod loadPeriod : list) {

            final GanttDate finalStartDate;
            if (startDateFilter != null) {
                finalStartDate = GanttDate.max(GanttDate
                        .createFrom(new LocalDate(startDateFilter.getTime())),
                        loadPeriod.getStart());
            } else {
                finalStartDate = loadPeriod.getStart();
            }

            final GanttDate finalEndDate;
            if (endDateFilter != null) {
                finalEndDate = GanttDate.min(loadPeriod.getEnd(), GanttDate
                        .createFrom(new LocalDate(endDateFilter.getTime())));
            } else {
                finalEndDate = loadPeriod.getEnd();
View Full Code Here

TOP

Related Classes of org.zkoss.ganttz.data.GanttDate

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.