Examples of TimeUnit


Examples of net.sourceforge.ganttproject.time.TimeUnit

//    protected TimeUnit getTopUnit() {
//        return myTopUnit;
//    }

    protected TimeUnit getTopUnit(Date startDate) {
        TimeUnit result = myTopUnit;
        if (myTopUnit instanceof TimeUnitFunctionOfDate) {
            if (startDate == null) {
                throw new RuntimeException("No date is set");
            } else {
                result = ((TimeUnitFunctionOfDate) myTopUnit).createTimeUnit(startDate);
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

    void constructOffsets(List topUnitOffsets, List bottomUnitOffsets) {
        {
            int offsetEnd = 0;
            Date currentDate = myStartDate;
            do {
                final TimeUnit bottomUnit = getBottomUnit();
                final TimeUnit defaultUnit = myTimeUnitStack.getDefaultTimeUnit();
                TimeFrame currentFrame = myTimeUnitStack.createTimeFrame(
                        currentDate, bottomUnit, defaultUnit);
                Date endDate = currentFrame.getFinishDate();
                offsetEnd += getBottomUnitWidth();
                bottomUnitOffsets.add(
                        new Offset(
                                bottomUnit,
                                myStartDate,
                                endDate,
                                offsetEnd,
                                null));
                currentDate = endDate;
            } while (offsetEnd <= getChartWidth());
        }
        {
            int offsetEnd = 0;
            Date currentDate = myStartDate;
            SkewedFramesWidthFunction widthFunction = new SkewedFramesWidthFunction();
            widthFunction.initialize();
            do {
                final TimeUnit topUnit = getTopUnit(currentDate);
                final TimeUnit defaultUnit = myTimeUnitStack.getDefaultTimeUnit();
                final TimeFrame currentFrame = myTimeUnitStack.createTimeFrame(
                        currentDate, topUnit, defaultUnit);

                Date endDate = currentFrame.getFinishDate();
                offsetEnd += widthFunction.getTimeFrameWidth(currentFrame);
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

    protected TimeUnit getTopUnit() {
        return myTopUnit;
    }

    protected TimeUnit getTopUnit(Date startDate) {
        TimeUnit result = myTopUnit;
        if (myTopUnit instanceof TimeUnitFunctionOfDate) {
            if (startDate == null) {
                throw new RuntimeException("No date is set");
            } else {
                result = ((TimeUnitFunctionOfDate) myTopUnit).createTimeUnit(startDate);
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

    public void testMonthAndDayFrameEvenBounds() throws Exception {
        Calendar c = (Calendar) GregorianCalendar.getInstance().clone();
        c.set(2000, Calendar.JANUARY, 1, 0, 0);
        GregorianTimeUnitStack stack = new GregorianTimeUnitStack();
        TimeUnit monthUnit = ((TimeUnitFunctionOfDate) GregorianTimeUnitStack.MONTH)
                .createTimeUnit(c.getTime());
        TimeUnit dayUnit = GregorianTimeUnitStack.DAY;
        TimeFrame timeFrame = stack.createTimeFrame(c.getTime(), monthUnit,
                dayUnit);
        assertEquals("Unexpected number of monthes in the time frame="
                + timeFrame, 1, timeFrame.getUnitCount(monthUnit));
        assertEquals(
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

    public void testMonthAndDayFrameUnevenBounds() throws Exception {
        Calendar c = (Calendar) GregorianCalendar.getInstance().clone();
        c.set(2000, Calendar.JANUARY, 16, 0, 0);
        GregorianTimeUnitStack stack = new GregorianTimeUnitStack();
        TimeUnit monthUnit = ((TimeUnitFunctionOfDate) GregorianTimeUnitStack.MONTH)
                .createTimeUnit(c.getTime());
        TimeUnit dayUnit = GregorianTimeUnitStack.DAY;
        TimeFrame timeFrame = stack.createTimeFrame(c.getTime(), monthUnit,
                dayUnit);
        assertEquals("Unexpected number of monthes in the time frame="
                + timeFrame, 1, timeFrame.getUnitCount(monthUnit));
        assertEquals(
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

    public RenderedImage getRenderedImage(GanttExportSettings settings) {
        Date dateStart = null;
        Date dateEnd = null;

        List myItemsToConsider = myTaskImageGenerator.getPrintableNodes(settings);
        TimeUnit unit = getViewState().getBottomTimeUnit();

        dateStart = settings.getStartDate() == null ? getStartDate() : settings
                .getStartDate();
        dateEnd = settings.getEndDate() == null ? getEndDate() : settings
                .getEndDate();
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

            //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,
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

        //myBottomUnitLineRenderer.setEnabled(false);
        myChartGrid.setEnabled(false);
    }

    protected void paintSkewedTimeFrames(Graphics g) {
        TimeUnit savedBottomUnit = myBottomUnit;
        TimeUnit topUnit = getTopUnit();
        setTopUnit(myBottomUnit);
        myTimeFrames = null;
        enableRenderers1();
        TimeFrame[] timeFrames = getTimeFrames(null);
        paintRegularTimeFrames(g, timeFrames);
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

    protected void paintRegularTimeFrames(Graphics g, TimeFrame[] timeFrames) {
        fireBeforeProcessingTimeFrames();
        for (int i = 0; i < timeFrames.length; i++) {
            TimeFrame next = timeFrames[i];
            fireFrameStarted(next);
            TimeUnit topUnit = next.getTopUnit();
            fireUnitLineStarted(topUnit);
            fireUnitLineFinished(topUnit);
            //
            TimeUnit bottomUnit = myBottomUnit;// next.getBottomUnit();
            fireUnitLineStarted(bottomUnit);
            visitTimeUnits(next, bottomUnit);
            fireUnitLineFinished(bottomUnit);
            fireFrameFinished(next);
        }
View Full Code Here

Examples of net.sourceforge.ganttproject.time.TimeUnit

            result = new DayTypeAlternance[] { f.createAlternance(timeUnit,
                    startDate, endDate) };
        } else if (timeUnit.isConstructedFrom(myTimeUnitStack
                .getDefaultTimeUnit())) {
            java.util.List buf = new ArrayList();
            TimeUnit defaultUnit = myTimeUnitStack.getDefaultTimeUnit();
            TimeFrame innerFrame = myTimeUnitStack.createTimeFrame(startDate,
                    timeUnit, defaultUnit);
            // System.err.println("[ChartModelImpl] topUnit="+timeUnit+"
            // bottom="+defaultUnit+"
            // count="+innerFrame.getUnitCount(defaultUnit));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.