Package net.sourceforge.ganttproject.task

Examples of net.sourceforge.ganttproject.task.TaskLength


    private void drawPreviousStateTask(GanttPreviousStateTask task, int row) {
        int topy = (row * getRowHeight()) + getRowHeight() - 8;
        int posX = myPosX;
        if (task.getStart().getTime().compareTo(myUnitStart) >= 0) {
            TaskLength deltaLength = myModel.getTaskManager().createLength(
                    getChartModel().getTimeUnitStack().getDefaultTimeUnit(),
                    myUnitStart, task.getStart().getTime());

            int deltaX = (int) (deltaLength.getLength(myCurrentUnit) * getChartModel()
                    .getBottomUnitWidth());
            posX += deltaX;
        }
        int duration = task.getEnd(myModel.getTaskManager().getCalendar())
                .diff(task.getStart());

        TaskLength tl = myModel.getTaskManager().createLength(duration);
        int length = (int) (tl.getLength(myCurrentUnit) * getChartModel()
                .getBottomUnitWidth());

        Integer nextOrdNumber = (Integer) myActivity2ordinalNumber.get(task);
        GraphicPrimitiveContainer container = getPrimitiveContainer();

View Full Code Here


        return result.toString();
    }

    private long getNegativeOffset(Date offsetDate, Date anchorDate) {
      if (getChartModel().getTimeUnitStack().getDefaultTimeUnit().equals(myCurrentUnit)) {
        TaskLength length = getChartModel().getTaskManager().createLength(myCurrentUnit, offsetDate, anchorDate);
        return -length.getLength()*getChartModel().getBottomUnitWidth();
      }
      int length = 0;
      while(true) {
        ChartModelBase.Offset[] offsets = getChartModel().calculateOffsets(myCurrentTimeFrame, myCurrentUnit, offsetDate, getChartModel().getTimeUnitStack().getDefaultTimeUnit(), getChartModel().getBottomUnitWidth());
        assert offsets.length>0;
View Full Code Here

      }
      return -length;
    }
    private long getPositiveOffset(Date offsetDate, Date anchorDate) {
        if (getChartModel().getTimeUnitStack().getDefaultTimeUnit().equals(myCurrentUnit)) {
            TaskLength length = getChartModel().getTaskManager().createLength(myCurrentUnit, anchorDate, offsetDate);
            return length.getLength()*getChartModel().getBottomUnitWidth();
        }
        int length = 0;
        while(true) {
            ChartModelBase.Offset[] offsets = getChartModel().calculateOffsets(
                    myCurrentTimeFrame,
View Full Code Here

        GanttCalendar st = pstart.Clone();
        return st.getTime();
    }

    public Date getEndDate() {
        TaskLength projectLength = getTaskManager().getProjectLength();
        GanttCalendar pstart = new GanttCalendar(getTaskManager()
                .getProjectStart());
        pstart.add((int) projectLength.getLength());
        GanttCalendar end = pstart.Clone();
        return end.getTime();
    }
View Full Code Here

        }

        // System.out.println("GanttGraphicArea dateStart=" + dateStart);
        // System.out.println("GanttGraphicArea dateEnd=" + dateEnd);

        TaskLength printedLength = getTaskManager().createLength(unit,
                dateStart, dateEnd);
        BufferedImage taskImage = (BufferedImage) myTaskImageGenerator.createImage(myItemsToConsider);
        int chartWidth = (int) ((printedLength.getLength(getViewState()
                .getBottomTimeUnit()) + 1) * getViewState()
                .getBottomUnitWidth());
        if (chartWidth<getWidth()) {
            chartWidth = getWidth();
        }
View Full Code Here

            myMutator = getTask().createMutator();
            myInitialEnd = getTask().getEnd();
        }

        protected void apply(float diff) {
            TaskLength newLength = getTaskManager().createLength(
                    getViewState().getBottomTimeUnit(),
                    getInitialDuration() + diff);
            TaskLength translated = getTask().translateDuration(newLength);
            if (translated.getLength() != 0) {
                myMutator.setDuration(translated);
            }
        }
View Full Code Here

            myMutator = getTask().createMutator();
            myInitialStart = getTask().getStart();
        }

        protected void apply(float diff) {
            TaskLength newLength = getTaskManager().createLength(
                    getViewState().getBottomTimeUnit(),
                    getInitialDuration() + diff);
            TaskLength translated = getTask().translateDuration(newLength);
            int dayDiff = (int) (translated.getValue() - myInitialLength
                    .getValue());
            // System.err.println("[ChangeTaskStart] dayDiff="+dayDiff+"
            // newLength="+newLength+" translated="+translated);
            if (dayDiff != 0) {
                // System.err.println("[ChangeTaskStartInteraction] apply():
View Full Code Here

        }

        public void apply(MouseEvent event) {
            float diff = getChartModel().calculateLengthNoWeekends(getStartX(),
                    event.getX());
            TaskLength bottomUnitLength = getTaskManager().createLength(
                    getViewState().getBottomTimeUnit(), diff);
            TaskLength taskLength = myTask.translateDuration(bottomUnitLength);
            int dayDiff = (int) (taskLength.getValue());
            // System.err.println("[MoveTaskInteraction] apply():
            // dayDiff="+dayDiff+" bottomUnitLength="+bottomUnitLength+"
            // translated="+taskLength);
            if (dayDiff != 0) {
                myMutator.shift(dayDiff);
View Full Code Here

            }
        }

        public void apply(MouseEvent event) {
            float diff = getLengthDiff(event);
            TaskLength bottomUnitLength = getTaskManager().createLength(
                    getViewState().getBottomTimeUnit(), diff);

            for (int i = 0; i < myTasks.size(); i++) {
                Task task = (Task) myTasks.get(i);
                TaskLength taskLength = task
                        .translateDuration(bottomUnitLength);
                int dayDiff = (int) (taskLength.getValue());
                if (dayDiff != 0) {
                    ((TaskMutator) myMutators.get(i)).shift(dayDiff);
                }
            }
        }
View Full Code Here

            //no tasks defined, nothing to do
            if(min == null || max == null)
              return;

            TimeUnit defaultUnit = getTimeUnitStack().getDefaultTimeUnit();
            final TaskLength selectionLength = getTaskManager().createLength(
                    defaultUnit, min.getTime(), max.getTime());
            final TaskLength viewLength = getChartModel().getVisibleLength();
            float viewLengthInDefaultUnits = viewLength.getLength(defaultUnit);
            // if selection is shorter than view we'll scroll right,
            // otherwise we'll scroll left
            // delta is measured in the bottom line time units
            final float delta = (selectionLength.getValue() - viewLengthInDefaultUnits) / 2;
            scrollDate = GPCalendar.PLAIN.shiftDate(min.getTime(),
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.task.TaskLength

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.