Example usage for java.util Calendar MAY

List of usage examples for java.util Calendar MAY

Introduction

In this page you can find the example usage for java.util Calendar MAY.

Prototype

int MAY

To view the source code for java.util Calendar MAY.

Click Source Link

Document

Value of the #MONTH field indicating the fifth month of the year in the Gregorian and Julian calendars.

Usage

From source file:com.frey.repo.DateUtil.java

/**
 * ?//from w  w w .  j a va 2s.c o  m
 */
public static Date[] getSeasonDate(Date date) {
    Date[] season = new Date[3];

    Calendar c = Calendar.getInstance();
    c.setTime(date);

    int nSeason = getSeason(date);
    if (nSeason == 1) {//
        c.set(Calendar.MONTH, Calendar.JANUARY);
        season[0] = c.getTime();
        c.set(Calendar.MONTH, Calendar.FEBRUARY);
        season[1] = c.getTime();
        c.set(Calendar.MONTH, Calendar.MARCH);
        season[2] = c.getTime();
    } else if (nSeason == 2) {//
        c.set(Calendar.MONTH, Calendar.APRIL);
        season[0] = c.getTime();
        c.set(Calendar.MONTH, Calendar.MAY);
        season[1] = c.getTime();
        c.set(Calendar.MONTH, Calendar.JUNE);
        season[2] = c.getTime();
    } else if (nSeason == 3) {//
        c.set(Calendar.MONTH, Calendar.JULY);
        season[0] = c.getTime();
        c.set(Calendar.MONTH, Calendar.AUGUST);
        season[1] = c.getTime();
        c.set(Calendar.MONTH, Calendar.SEPTEMBER);
        season[2] = c.getTime();
    } else if (nSeason == 4) {//
        c.set(Calendar.MONTH, Calendar.OCTOBER);
        season[0] = c.getTime();
        c.set(Calendar.MONTH, Calendar.NOVEMBER);
        season[1] = c.getTime();
        c.set(Calendar.MONTH, Calendar.DECEMBER);
        season[2] = c.getTime();
    }
    return season;
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testApplyPeriodicFeeWithHoliday() throws Exception {
    Date startDate = DateUtils.getDate(2008, Calendar.MAY, 23);
    new DateTimeService().setCurrentDateTime(new DateTime(startDate));

    accountBO = getLoanAccount(startDate, AccountState.LOAN_APPROVED);

    Money intialTotalFeeAmount = ((LoanBO) accountBO).getLoanSummary().getOriginalFees();
    TestObjectFactory.flushandCloseSession();
    accountBO = TestObjectFactory.getObject(AccountBO.class, accountBO.getAccountId());

    // create holiday on first installment date
    HolidayBO holiday = createHoliday(DateUtils.getDate(2008, Calendar.MAY, 30));

    try {/*  ww  w.j  a  va2 s .  c  o  m*/
        LoanBO loanBO = (LoanBO) accountBO;
        loanBO.updateLoan(loanBO.isInterestDeductedAtDisbursement(), loanBO.getLoanAmount(),
                loanBO.getInterestRate(), loanBO.getNoOfInstallments(), loanBO.getDisbursementDate(),
                loanBO.getGracePeriodDuration(), loanBO.getBusinessActivityId(), "Loan account updated", null,
                null, false, null, null);

        FeeBO periodicFee = TestObjectFactory.createPeriodicAmountFee("Periodic Fee", FeeCategory.LOAN, "25",
                RecurrenceType.WEEKLY, EVERY_WEEK);

        UserContext uc = TestUtils.makeUser();
        loanBO.setUserContext(uc);
        loanBO.applyCharge(periodicFee.getFeeId(),
                ((AmountFeeBO) periodicFee).getFeeAmount().getAmountDoubleValue());
        StaticHibernateUtil.commitTransaction();
        StaticHibernateUtil.closeSession();

        Map<String, String> fees1 = new HashMap<String, String>();
        fees1.put("Mainatnence Fee", "100.0");

        Map<String, String> fees2 = new HashMap<String, String>();
        fees2.put("Mainatnence Fee", "100.0");
        fees2.put("Periodic Fee", "25.0");

        LoanScheduleEntity[] paymentsArray = LoanBOTestUtils
                .getSortedAccountActionDateEntity(loanBO.getAccountActionDates());

        List<Date> installmentDates = new ArrayList<Date>();
        List<Date> feeDates = new ArrayList<Date>();
        for (LoanScheduleEntity loanScheduleEntity : paymentsArray) {
            installmentDates.add(loanScheduleEntity.getActionDate());
            for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : loanScheduleEntity
                    .getAccountFeesActionDetails()) {
                Date feeDate = accountFeesActionDetailEntity.getAccountActionDate().getActionDate();
                feeDates.add(feeDate);
            }
        }

        Assert.assertEquals(6, paymentsArray.length);

        checkFees(fees2, paymentsArray[0], false);
        checkFees(fees2, paymentsArray[1], false);
        checkFees(fees2, paymentsArray[2], false);
        checkFees(fees2, paymentsArray[3], false);
        checkFees(fees2, paymentsArray[4], false);
        checkFees(fees2, paymentsArray[5], false);

        List<Date> expectedDates = new ArrayList<Date>();
        expectedDates.add(DateUtils.getDate(2008, Calendar.MAY, 31));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 06));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 13));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 20));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 27));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JULY, 04));

        int i = 0;
        for (AccountActionDateEntity accountActionDateEntity : accountBO.getAccountActionDates()) {
            LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
            Assert.assertEquals(expectedDates.get(i++), loanScheduleEntity.getActionDate());
            Assert.assertEquals(new Money(getCurrency(), "125"), loanScheduleEntity.getTotalFees());
        }

        Assert.assertEquals(intialTotalFeeAmount.add(new Money(getCurrency(), "750.0")),
                loanBO.getLoanSummary().getOriginalFees());
    } finally {
        // make sure that we don't leave any persistent changes that could
        // affect subsequent tests
        new DateTimeService().resetToCurrentSystemDateTime();
        deleteHoliday(holiday);
    }
}

From source file:freemarker.ext.dump.DumpDirectiveTest.java

private Employee getEmployee() {

    Calendar c = Calendar.getInstance();
    c.set(1982, Calendar.MAY, 5);
    c = DateUtils.truncate(c, Calendar.DATE);
    Employee jdoe = new Employee("John", "Doe", 34523, c.getTime());
    jdoe.setFavoriteColors("blue", "green");
    jdoe.setSalary(65000);//from www . jav  a  2s .  c  o m

    //        Map<String, String> degrees = new HashMap<String, String>();
    //        degrees.put("BA", "Mathematics");
    //        degrees.put("MS", "Computer Science");
    //        jdoe.setDegrees(degrees);

    c.clear();
    c.set(1975, Calendar.OCTOBER, 25);
    c = DateUtils.truncate(c, Calendar.DATE);
    Employee jsmith = new Employee("Jane", "Smith", 78234, c.getTime());
    jsmith.setFavoriteColors("red", "orange");

    jdoe.setSupervisor(jsmith);

    return jdoe;
}

From source file:freemarker.ext.dump.DumpDirectiveTest.java

private Map<String, Object> getJohnDoeExpectedDump(int exposureLevel) {

    Map<String, Object> expectedDump = new HashMap<String, Object>();

    Map<String, Object> supervisorExpectedDump = new HashMap<String, Object>();
    supervisorExpectedDump.put(Key.TYPE.toString(), "freemarker.ext.dump.DumpDirectiveTest$Employee");
    supervisorExpectedDump.put(Key.VALUE.toString(), getJaneSmithExpectedDump(exposureLevel));

    // Properties
    SortedMap<String, Object> propertiesExpectedDump = new TreeMap<String, Object>();

    if (exposureLevel < BeansWrapper.EXPOSE_NOTHING) {

        Map<String, Object> birthdateExpectedDump = new HashMap<String, Object>();
        birthdateExpectedDump.put(Key.TYPE.toString(), Type.DATE);
        birthdateExpectedDump.put(Key.DATE_TYPE.toString(), DateType.UNKNOWN);
        Calendar c = Calendar.getInstance();
        c.set(1982, Calendar.MAY, 5);
        c = DateUtils.truncate(c, Calendar.DATE);
        birthdateExpectedDump.put(Key.VALUE.toString(), c.getTime());
        propertiesExpectedDump.put("birthdate", birthdateExpectedDump);

        Map<String, Object> fullNameExpectedDump = new HashMap<String, Object>();
        fullNameExpectedDump.put(Key.TYPE.toString(), Type.STRING);
        fullNameExpectedDump.put(Key.VALUE.toString(), "John Doe");
        propertiesExpectedDump.put("fullName", fullNameExpectedDump);

        Map<String, Object> idExpectedDump = new HashMap<String, Object>();
        idExpectedDump.put(Key.TYPE.toString(), Type.NUMBER);
        idExpectedDump.put(Key.VALUE.toString(), 34523);
        propertiesExpectedDump.put("id", idExpectedDump);

        Map<String, Object> nicknameExpectedDump = new HashMap<String, Object>();
        nicknameExpectedDump.put(Key.TYPE.toString(), Type.STRING);
        nicknameExpectedDump.put(Key.VALUE.toString(), "");
        propertiesExpectedDump.put("nickname", nicknameExpectedDump);

        Map<String, Object> middleNameExpectedDump = new HashMap<String, Object>();
        middleNameExpectedDump.put(Key.VALUE.toString(), Value.NULL.toString());
        propertiesExpectedDump.put("middleName", middleNameExpectedDump);

        Map<String, Object> marriedExpectedDump = new HashMap<String, Object>();
        marriedExpectedDump.put(Key.TYPE.toString(), Type.BOOLEAN);
        marriedExpectedDump.put(Key.VALUE.toString(), true);
        propertiesExpectedDump.put("married", marriedExpectedDump);

        propertiesExpectedDump.put("supervisor", supervisorExpectedDump);

        Map<String, Object> favoriteColorsExpectedDump = new HashMap<String, Object>();
        favoriteColorsExpectedDump.put(Key.TYPE.toString(), Type.SEQUENCE);
        List<Map<String, Object>> favoriteColorListExpectedDump = new ArrayList<Map<String, Object>>();
        Map<String, Object> color1ExpectedDump = new HashMap<String, Object>();
        color1ExpectedDump.put(Key.TYPE.toString(), Type.STRING);
        color1ExpectedDump.put(Key.VALUE.toString(), "blue");
        favoriteColorListExpectedDump.add(color1ExpectedDump);
        Map<String, Object> color2ExpectedDump = new HashMap<String, Object>();
        color2ExpectedDump.put(Key.TYPE.toString(), Type.STRING);
        color2ExpectedDump.put(Key.VALUE.toString(), "green");
        favoriteColorListExpectedDump.add(color2ExpectedDump);
        favoriteColorsExpectedDump.put(Key.VALUE.toString(), favoriteColorListExpectedDump);
        propertiesExpectedDump.put("favoriteColors", favoriteColorsExpectedDump);

        // This test fails, don't know why
        //            Map<String, Object> degreesExpectedDump = new HashMap<String, Object>();
        //            degreesExpectedDump.put(Key.TYPE.toString(), Type.HASH);
        //            Map<String, Map<String, Object>> degreeMapExpectedDump = new HashMap<String, Map<String, Object>>();
        //            Map<String, Object> degree1ExpectedDump = new HashMap<String, Object>();
        //            degree1ExpectedDump.put(Key.TYPE.toString(), Type.STRING);
        //            degree1ExpectedDump.put(Key.VALUE.toString(), "Mathematics");
        //            degreeMapExpectedDump.put("BA", degree1ExpectedDump);
        //            Map<String, Object> degree2ExpectedDump = new HashMap<String, Object>();
        //            degree2ExpectedDump.put(Key.TYPE.toString(), Type.STRING);
        //            degree2ExpectedDump.put(Key.VALUE.toString(), "Computer Science");
        //            degreeMapExpectedDump.put("MS", degree2ExpectedDump);
        //            degreesExpectedDump.put(Key.VALUE.toString(), degreeMapExpectedDump);
        //            propertiesExpectedDump.put("degrees", degreesExpectedDump);

    }/*from  w  w w . j  a  va  2  s.  c om*/

    expectedDump.put(Key.PROPERTIES.toString(), propertiesExpectedDump);

    // Methods       
    SortedMap<String, Object> methodDump = getEmployeeMethodsExpectedDump(exposureLevel, "Doe");
    if (!methodDump.isEmpty()) {
        methodDump.put("boss()", supervisorExpectedDump);
    }
    expectedDump.put(Key.METHODS.toString(), methodDump);

    return expectedDump;
}

From source file:org.exist.xquery.modules.mail.SendEmailFunction.java

/**
 * Returns the current date and time in an RFC822 format, suitable for an email Date Header
 *
 * @return      RFC822 formated date and time as a String
 *//*from   ww  w .j av  a 2 s  .c  o m*/
private String getDateRFC822() {

    String dateString = new String();
    final Calendar rightNow = Calendar.getInstance();

    //Day of the week
    switch (rightNow.get(Calendar.DAY_OF_WEEK)) {
    case Calendar.MONDAY:
        dateString = "Mon";
        break;

    case Calendar.TUESDAY:
        dateString = "Tue";
        break;

    case Calendar.WEDNESDAY:
        dateString = "Wed";
        break;

    case Calendar.THURSDAY:
        dateString = "Thu";
        break;

    case Calendar.FRIDAY:
        dateString = "Fri";
        break;

    case Calendar.SATURDAY:
        dateString = "Sat";
        break;

    case Calendar.SUNDAY:
        dateString = "Sun";
        break;
    }

    dateString += ", ";

    //Date
    dateString += rightNow.get(Calendar.DAY_OF_MONTH);
    dateString += " ";

    //Month
    switch (rightNow.get(Calendar.MONTH)) {
    case Calendar.JANUARY:
        dateString += "Jan";
        break;

    case Calendar.FEBRUARY:
        dateString += "Feb";
        break;

    case Calendar.MARCH:
        dateString += "Mar";
        break;

    case Calendar.APRIL:
        dateString += "Apr";
        break;

    case Calendar.MAY:
        dateString += "May";
        break;

    case Calendar.JUNE:
        dateString += "Jun";
        break;

    case Calendar.JULY:
        dateString += "Jul";
        break;

    case Calendar.AUGUST:
        dateString += "Aug";
        break;

    case Calendar.SEPTEMBER:
        dateString += "Sep";
        break;

    case Calendar.OCTOBER:
        dateString += "Oct";
        break;

    case Calendar.NOVEMBER:
        dateString += "Nov";
        break;

    case Calendar.DECEMBER:
        dateString += "Dec";
        break;
    }
    dateString += " ";

    //Year
    dateString += rightNow.get(Calendar.YEAR);
    dateString += " ";

    //Time
    String tHour = Integer.toString(rightNow.get(Calendar.HOUR_OF_DAY));
    if (tHour.length() == 1) {
        tHour = "0" + tHour;
    }

    String tMinute = Integer.toString(rightNow.get(Calendar.MINUTE));
    if (tMinute.length() == 1) {
        tMinute = "0" + tMinute;
    }

    String tSecond = Integer.toString(rightNow.get(Calendar.SECOND));
    if (tSecond.length() == 1) {
        tSecond = "0" + tSecond;
    }

    dateString += tHour + ":" + tMinute + ":" + tSecond + " ";

    //TimeZone Correction
    String tzSign = new String();
    String tzHours = new String();
    String tzMinutes = new String();

    final TimeZone thisTZ = rightNow.getTimeZone();
    int tzOffset = thisTZ.getOffset(rightNow.getTime().getTime()); //get timezone offset in milliseconds
    tzOffset = (tzOffset / 1000); //convert to seconds
    tzOffset = (tzOffset / 60); //convert to minutes

    //Sign
    if (tzOffset > 1) {
        tzSign = "+";
    } else {
        tzSign = "-";
        tzOffset *= -1;
    }

    //Calc Hours and Minutes?
    if (tzOffset >= 60) {
        //Minutes and Hours
        tzHours += (tzOffset / 60); //hours

        // do we need to prepend a 0
        if (tzHours.length() == 1) {
            tzHours = "0" + tzHours;
        }

        tzMinutes += (tzOffset % 60); //minutes

        // do we need to prepend a 0
        if (tzMinutes.length() == 1) {
            tzMinutes = "0" + tzMinutes;
        }
    } else {
        //Just Minutes
        tzHours = "00";
        tzMinutes += tzOffset;
        // do we need to prepend a 0
        if (tzMinutes.length() == 1) {
            tzMinutes = "0" + tzMinutes;
        }
    }

    dateString += tzSign + tzHours + tzMinutes;

    return dateString;
}

From source file:org.mifos.accounts.loan.business.LoanBOIntegrationTest.java

public void testPeriodicFeeWithHoliday() throws Exception {
    Date startDate = DateUtils.getDate(2008, Calendar.MAY, 23);
    new DateTimeService().setCurrentDateTime(new DateTime(startDate));

    accountBO = getLoanAccount(startDate, AccountState.LOAN_APPROVED);

    Money intialTotalFeeAmount = ((LoanBO) accountBO).getLoanSummary().getOriginalFees();
    TestObjectFactory.flushandCloseSession();
    accountBO = TestObjectFactory.getObject(AccountBO.class, accountBO.getAccountId());

    // create holiday on first installment date
    HolidayBO holiday = createHoliday(DateUtils.getDate(2008, Calendar.MAY, 30));

    try {/*from  w w  w  .  ja v a  2s  . co  m*/
        LoanBO loanBO = (LoanBO) accountBO;
        loanBO.updateLoan(loanBO.isInterestDeductedAtDisbursement(), loanBO.getLoanAmount(),
                loanBO.getInterestRate(), loanBO.getNoOfInstallments(), loanBO.getDisbursementDate(),
                loanBO.getGracePeriodDuration(), loanBO.getBusinessActivityId(), "Loan account updated", null,
                null, false, null, null);

        Map<String, String> fees1 = new HashMap<String, String>();
        fees1.put("Mainatnence Fee", "100.0");

        LoanScheduleEntity[] paymentsArray = LoanBOTestUtils
                .getSortedAccountActionDateEntity(loanBO.getAccountActionDates());

        List<Date> installmentDates = new ArrayList<Date>();
        List<Date> feeDates = new ArrayList<Date>();
        for (LoanScheduleEntity loanScheduleEntity : paymentsArray) {
            installmentDates.add(loanScheduleEntity.getActionDate());
            for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : loanScheduleEntity
                    .getAccountFeesActionDetails()) {
                Date feeDate = accountFeesActionDetailEntity.getAccountActionDate().getActionDate();
                feeDates.add(feeDate);
            }
        }
        System.out.println(installmentDates);
        System.out.println(feeDates);

        Assert.assertEquals(6, paymentsArray.length);

        checkFees(fees1, paymentsArray[0], false);
        checkFees(fees1, paymentsArray[1], false);
        checkFees(fees1, paymentsArray[2], false);
        checkFees(fees1, paymentsArray[3], false);
        checkFees(fees1, paymentsArray[4], false);
        checkFees(fees1, paymentsArray[5], false);

        List<Date> expectedDates = new ArrayList<Date>();
        expectedDates.add(DateUtils.getDate(2008, Calendar.MAY, 31));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 06));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 13));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 20));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JUNE, 27));
        expectedDates.add(DateUtils.getDate(2008, Calendar.JULY, 04));

        int i = 0;
        for (AccountActionDateEntity accountActionDateEntity : accountBO.getAccountActionDates()) {
            LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
            Assert.assertEquals(expectedDates.get(i++), loanScheduleEntity.getActionDate());
            Assert.assertEquals(new Money(getCurrency(), "100"), loanScheduleEntity.getTotalFees());
        }

        Assert.assertEquals(intialTotalFeeAmount.add(new Money(getCurrency(), "600.0")),
                loanBO.getLoanSummary().getOriginalFees());
    } finally {
        // make sure that we don't leave any persistent changes that could
        // affect subsequent tests
        new DateTimeService().resetToCurrentSystemDateTime();
        deleteHoliday(holiday);
    }
}

From source file:org.sakaiproject.sitestats.impl.chart.ChartServiceImpl.java

private Map<Integer, String> getMonthNamesMap() {
    monthNamesMap = new HashMap<Integer, String>();
    monthNamesMap.put(Calendar.JANUARY, msgs.getString("mo_jan"));
    monthNamesMap.put(Calendar.FEBRUARY, msgs.getString("mo_feb"));
    monthNamesMap.put(Calendar.MARCH, msgs.getString("mo_mar"));
    monthNamesMap.put(Calendar.APRIL, msgs.getString("mo_apr"));
    monthNamesMap.put(Calendar.MAY, msgs.getString("mo_may"));
    monthNamesMap.put(Calendar.JUNE, msgs.getString("mo_jun"));
    monthNamesMap.put(Calendar.JULY, msgs.getString("mo_jul"));
    monthNamesMap.put(Calendar.AUGUST, msgs.getString("mo_ago"));
    monthNamesMap.put(Calendar.SEPTEMBER, msgs.getString("mo_sep"));
    monthNamesMap.put(Calendar.OCTOBER, msgs.getString("mo_oct"));
    monthNamesMap.put(Calendar.NOVEMBER, msgs.getString("mo_nov"));
    monthNamesMap.put(Calendar.DECEMBER, msgs.getString("mo_dec"));
    return monthNamesMap;
}

From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java

public static String[] mapMonths(DateFormatSymbols symbols) {
    String[] months = new String[12];

    String[] localeMonths = symbols.getMonths();

    months[0] = localeMonths[Calendar.JANUARY];
    months[1] = localeMonths[Calendar.FEBRUARY];
    months[2] = localeMonths[Calendar.MARCH];
    months[3] = localeMonths[Calendar.APRIL];
    months[4] = localeMonths[Calendar.MAY];
    months[5] = localeMonths[Calendar.JUNE];
    months[6] = localeMonths[Calendar.JULY];
    months[7] = localeMonths[Calendar.AUGUST];
    months[8] = localeMonths[Calendar.SEPTEMBER];
    months[9] = localeMonths[Calendar.OCTOBER];
    months[10] = localeMonths[Calendar.NOVEMBER];
    months[11] = localeMonths[Calendar.DECEMBER];

    return months;
}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset./*ww w.  j a va  2  s . c  o m*/
 *
 * @deprecated Moved to the demo applications that require it.
 */
private static IntervalCategoryDataset createGanttDataset1() {

    final TaskSeries s1 = new TaskSeries("Scheduled");
    s1.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s1.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s1.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(5, Calendar.MAY, 2001))));
    s1.add(new Task("Design Phase",
            new SimpleTimePeriod(date(6, Calendar.MAY, 2001), date(30, Calendar.MAY, 2001))));
    s1.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(2, Calendar.JUNE, 2001), date(2, Calendar.JUNE, 2001))));
    s1.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(3, Calendar.JUNE, 2001), date(31, Calendar.JULY, 2001))));
    s1.add(new Task("Design Review",
            new SimpleTimePeriod(date(1, Calendar.AUGUST, 2001), date(8, Calendar.AUGUST, 2001))));
    s1.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(10, Calendar.AUGUST, 2001), date(10, Calendar.AUGUST, 2001))));
    s1.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(12, Calendar.AUGUST, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s1.add(new Task("Testing",
            new SimpleTimePeriod(date(13, Calendar.SEPTEMBER, 2001), date(31, Calendar.OCTOBER, 2001))));
    s1.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(1, Calendar.NOVEMBER, 2001), date(15, Calendar.NOVEMBER, 2001))));
    s1.add(new Task("Signoff",
            new SimpleTimePeriod(date(28, Calendar.NOVEMBER, 2001), date(30, Calendar.NOVEMBER, 2001))));

    final TaskSeries s2 = new TaskSeries("Actual");
    s2.add(new Task("Write Proposal",
            new SimpleTimePeriod(date(1, Calendar.APRIL, 2001), date(5, Calendar.APRIL, 2001))));
    s2.add(new Task("Obtain Approval",
            new SimpleTimePeriod(date(9, Calendar.APRIL, 2001), date(9, Calendar.APRIL, 2001))));
    s2.add(new Task("Requirements Analysis",
            new SimpleTimePeriod(date(10, Calendar.APRIL, 2001), date(15, Calendar.MAY, 2001))));
    s2.add(new Task("Design Phase",
            new SimpleTimePeriod(date(15, Calendar.MAY, 2001), date(17, Calendar.JUNE, 2001))));
    s2.add(new Task("Design Signoff",
            new SimpleTimePeriod(date(30, Calendar.JUNE, 2001), date(30, Calendar.JUNE, 2001))));
    s2.add(new Task("Alpha Implementation",
            new SimpleTimePeriod(date(1, Calendar.JULY, 2001), date(12, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Design Review",
            new SimpleTimePeriod(date(12, Calendar.SEPTEMBER, 2001), date(22, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Revised Design Signoff",
            new SimpleTimePeriod(date(25, Calendar.SEPTEMBER, 2001), date(27, Calendar.SEPTEMBER, 2001))));
    s2.add(new Task("Beta Implementation",
            new SimpleTimePeriod(date(27, Calendar.SEPTEMBER, 2001), date(30, Calendar.OCTOBER, 2001))));
    s2.add(new Task("Testing",
            new SimpleTimePeriod(date(31, Calendar.OCTOBER, 2001), date(17, Calendar.NOVEMBER, 2001))));
    s2.add(new Task("Final Implementation",
            new SimpleTimePeriod(date(18, Calendar.NOVEMBER, 2001), date(5, Calendar.DECEMBER, 2001))));
    s2.add(new Task("Signoff",
            new SimpleTimePeriod(date(10, Calendar.DECEMBER, 2001), date(11, Calendar.DECEMBER, 2001))));

    final TaskSeriesCollection collection = new TaskSeriesCollection();
    collection.add(s1);
    collection.add(s2);

    return collection;
}

From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java

public static String[] mapShortMonths(DateFormatSymbols symbols) {
    String[] months = new String[12];

    String[] localeMonths = symbols.getShortMonths();

    months[0] = localeMonths[Calendar.JANUARY];
    months[1] = localeMonths[Calendar.FEBRUARY];
    months[2] = localeMonths[Calendar.MARCH];
    months[3] = localeMonths[Calendar.APRIL];
    months[4] = localeMonths[Calendar.MAY];
    months[5] = localeMonths[Calendar.JUNE];
    months[6] = localeMonths[Calendar.JULY];
    months[7] = localeMonths[Calendar.AUGUST];
    months[8] = localeMonths[Calendar.SEPTEMBER];
    months[9] = localeMonths[Calendar.OCTOBER];
    months[10] = localeMonths[Calendar.NOVEMBER];
    months[11] = localeMonths[Calendar.DECEMBER];

    return months;
}