Example usage for java.util Calendar DECEMBER

List of usage examples for java.util Calendar DECEMBER

Introduction

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

Prototype

int DECEMBER

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

Click Source Link

Document

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

Usage

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;
}

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

/**
 * Creates a sample dataset for a Gantt chart.
 *
 * @return The dataset.//  w w w  .  j a v a  2  s .  co  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:com.icesoft.faces.component.selectinputdate.SelectInputDateRenderer.java

/**
 * @param symbols//ww w  .j  a va2 s  .c  o  m
 * @return months - String[] containing localized month names
 */
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.celllife.idart.gui.patient.AddPatient.java

/**
 * checks if the given date is valid/*from   w ww.j a  v a  2s  .c o m*/
 * 
 * @param strDay
 *            String
 * @param strMonth
 *            String
 * @param strYear
 *            String
 * @return true if the date is valid else false
 */
public boolean dateOkay(String strDay, String strMonth, String strYear) {

    boolean result = false;

    try {

        int day = Integer.parseInt(strDay);

        // check the year
        if (strYear.length() != 4)
            return result;
        int year = Integer.parseInt(strYear);

        // get the int value for the string month (e.g. January)
        // int month = Integer.parseInt(strMonth);
        int month = -1;
        for (int i = 0; i < cmbDOBMonth.getItemCount(); i++) {
            if (strMonth.equals(cmbDOBMonth.getItem(i))) {
                month = i;
            }
        }

        switch (month) {
        case -1:
            result = false;
            break;
        case Calendar.FEBRUARY:
            if (day <= 29) {
                GregorianCalendar greg = new GregorianCalendar();
                if (day == 29 & greg.isLeapYear(year)) {
                    result = true;
                } else {
                    if (day == 29) {
                        result = false;
                    } else {
                        result = true;
                    }
                }
            } else {
                result = false;
            }
            break;
        case Calendar.JANUARY | Calendar.MARCH | Calendar.MAY | Calendar.JULY | Calendar.AUGUST
                | Calendar.OCTOBER | Calendar.DECEMBER:
            if (day <= 31) {
                result = true;
            } else {
                result = false;
            }
            break;
        default:
            result = true;
            break;
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
    }

    return result;

}

From source file:org.motechproject.server.ws.RegistrarServiceTest.java

@Test
public void queryUpcomingCare() throws ValidationException {
    Integer staffId = 1, facilityId = 2, motechId = 3;

    List<ExpectedEncounter> expectedEncounters = new ArrayList<ExpectedEncounter>();
    List<ExpectedObs> expectedObs = new ArrayList<ExpectedObs>();

    Calendar calendar = Calendar.getInstance();

    Care encounterCare1 = new Care();
    encounterCare1.setName("EncounterCare1");
    calendar.set(2010, Calendar.APRIL, 4);
    encounterCare1.setDate(calendar.getTime());
    Care encounterCare2 = new Care();
    encounterCare2.setName("EncounterCare2");
    calendar.set(2010, Calendar.DECEMBER, 12);
    encounterCare2.setDate(calendar.getTime());
    Care obsCare1 = new Care();
    obsCare1.setName("ObsCare1");
    calendar.set(2010, Calendar.OCTOBER, 10);
    obsCare1.setDate(calendar.getTime());
    Care obsCare2 = new Care();
    obsCare2.setName("ObsCare2");
    calendar.set(2010, Calendar.JANUARY, 1);
    obsCare2.setDate(calendar.getTime());
    Care[] upcomingCares = { obsCare2, encounterCare1, obsCare1, encounterCare2 };

    org.openmrs.Patient patient = new org.openmrs.Patient(1);

    expect(registrarBean.isValidIdCheckDigit(staffId)).andReturn(true);
    expect(openmrsBean.getStaffBySystemId(staffId.toString())).andReturn(new User(1));
    expect(registrarBean.isValidIdCheckDigit(facilityId)).andReturn(true);
    expect(registrarBean.getFacilityById(facilityId)).andReturn(new Facility());
    expect(registrarBean.isValidMotechIdCheckDigit(motechId)).andReturn(true);
    expect(openmrsBean.getPatientByMotechId(motechId.toString())).andReturn(patient);
    expect(patientModelConverter.patientToWebService(eq(patient), eq(true))).andReturn(new Patient());

    expect(registrarBean.getUpcomingExpectedEncounters(patient)).andReturn(expectedEncounters);
    expect(registrarBean.getUpcomingExpectedObs(patient)).andReturn(expectedObs);
    expect(careModelConverter.upcomingToWebServiceCares(expectedEncounters, expectedObs, false))
            .andReturn(upcomingCares);/*from  w  w w  . j  a v  a2 s  .  c o m*/

    replay(registrarBean, patientModelConverter, openmrsBean, careModelConverter);

    Patient wsPatient = regWs.queryUpcomingCare(staffId, facilityId, motechId);

    verify(registrarBean, patientModelConverter, openmrsBean, careModelConverter);
    verify(registrarBean, patientModelConverter, openmrsBean, careModelConverter);

    assertNotNull("Patient result is null", wsPatient);
    Care[] cares = wsPatient.getCares();
    assertNotNull("Patient cares is null", cares);
    assertEquals(4, cares.length);
    assertEquals(obsCare2.getName(), cares[0].getName());
    assertEquals(obsCare2.getDate(), cares[0].getDate());
    assertEquals(encounterCare1.getName(), cares[1].getName());
    assertEquals(encounterCare1.getDate(), cares[1].getDate());
    assertEquals(obsCare1.getName(), cares[2].getName());
    assertEquals(obsCare1.getDate(), cares[2].getDate());
    assertEquals(encounterCare2.getName(), cares[3].getName());
    assertEquals(encounterCare2.getDate(), cares[3].getDate());
}