Package net.sourceforge.ganttproject.time

Examples of net.sourceforge.ganttproject.time.TimeUnitText


        int curX = 0;
        Date curDate = getChartModel().getStartDate();
        final int topUnitHeight = getChartModel().getChartUIConfiguration().getSpanningHeaderHeight();
        for (int i=0; i<getChartModel().getTopUnitOffsets().size(); i++) {
          Offset nextOffset = (Offset) getChartModel().getTopUnitOffsets().get(i);
            TimeUnitText timeUnitText = nextOffset.getOffsetUnit().format(curDate);
            String unitText = timeUnitText.getText(-1);
            int posY = topUnitHeight - 5;
            GraphicPrimitiveContainer.Text text = myPrimitiveContainer.createText(curX + 2, posY, unitText);
            myPrimitiveContainer.bind(text, timeUnitText);
            text.setMaxLength(nextOffset.getOffsetPixels() - curX);
            text.setFont(getChartModel().getChartUIConfiguration().getSpanningHeaderFont());
View Full Code Here


        Date curDate = getChartModel().getStartDate();
        final int topUnitHeight = getChartModel().getChartUIConfiguration().getSpanningHeaderHeight();
        boolean firstWeekendDay = true;
        for (int i=0; i<getChartModel().getBottomUnitOffsets().size(); i++) {
          Offset nextOffset = (Offset) getChartModel().getBottomUnitOffsets().get(i);
            TimeUnitText timeUnitText = nextOffset.getOffsetUnit().format(curDate);
            String unitText = timeUnitText.getText(-1);
            int posY = 2*topUnitHeight - 5;
            GraphicPrimitiveContainer.Text text = myPrimitiveContainer.createText(curX + 2, posY, unitText);
            myPrimitiveContainer.bind(text, timeUnitText);
            text.setMaxLength(nextOffset.getOffsetPixels() - curX);
            text.setFont(getChartModel().getChartUIConfiguration().getSpanningHeaderFont());
View Full Code Here

//            myGraphics.setFont(myConfig.getChartFont().deriveFont(10f));
            myGraphics.setFont(myConfig.getChartFont());
        int actualLength;
        String nextTextString = next.getText();
        if (next.getModelObject() != null) {
            TimeUnitText nextText = (TimeUnitText) next.getModelObject();
            nextTextString = nextText.getText(requestedMaxLength,
                    myTextLengthCalculator);
            actualLength = requestedMaxLength;
        } else {
            actualLength = TextLengthCalculatorImpl.getTextLength(myGraphics,
                    next.getText());
View Full Code Here

    public MonthTextFormatter() {
        initFormats();
    }

    protected TimeUnitText createTimeUnitText(Date adjustedLeft) {
        TimeUnitText result;
        String longText = MessageFormat.format("{0}",
                new Object[] { myLongFormat.format(adjustedLeft) });
        String mediumText = MessageFormat.format("{0}",
                new Object[] { myMediumFormat.format(adjustedLeft) });
        String shortText = MessageFormat.format("{0}",
                new Object[] { myShortFormat.format(adjustedLeft) });
        result = new TimeUnitText(longText, mediumText, shortText);
        return result;
    }
View Full Code Here

    public TimeUnitText getUnitText(TimeUnit unitLine, int position) {
        LineHeader lineHeader = getLineHeader(unitLine);
        LineItem lineItem = lineHeader == null ? null : lineHeader
                .getLineItem(position);
        Date startDate = lineItem == null ? null : lineItem.myStartDate;
        TimeUnitText result = startDate == null ? null : getUnitText(unitLine,
                startDate);
        // if ("31".equals(result)) {
        // System.err.println("unit line="+unitLine+" position="+position);
        // }
        return result;
View Full Code Here

    protected CachingTextFormatter() {
        GanttLanguage.getInstance().addListener(this);
    }

    public TimeUnitText format(TimeUnit timeUnit, Date baseDate) {
        TimeUnitText result = null;
        Date adjustedLeft = ((DateFrameable) timeUnit).adjustLeft(baseDate);
        result = getCachedText(adjustedLeft);
        if (result == null) {
            result = createTimeUnitText(adjustedLeft);
            myTextCache.put(adjustedLeft, result);
View Full Code Here

        Integer weekNo = new Integer(myCalendar.get(Calendar.WEEK_OF_YEAR));
        String shortText = MessageFormat.format("{0}", new Object[] { weekNo });
        String middleText = MessageFormat.format(GanttLanguage.getInstance()
                .getText("week")
                + " {0}", new Object[] { weekNo });
        return new TimeUnitText(middleText, middleText, shortText);
    }
View Full Code Here

        // Integer yearNo = new Integer(myCalendar.get(Calendar.YEAR));
        // String shortText = MessageFormat.format("{0}", new Object[]
        // {yearNo});
        String shortText = MessageFormat.format("{0,date,yyyy}",
                new Object[] { myCalendar.getTime() });
        return new TimeUnitText(shortText);
    }
View Full Code Here

public class DayTextFormatter extends CachingTextFormatter implements TextFormatter {
    /** cache for holding formatted day names * */
    private final HashMap textCache = new HashMap();

    protected TimeUnitText createTimeUnitText(Date adjustedLeft) {
        return new TimeUnitText(MessageFormat.format("{0}", new Object[] { ""
              + adjustedLeft.getDate() }));
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.time.TimeUnitText

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.