Fmt.setTemplate(new TextData("mmmm - yyyy")); //$NON-NLS-1$
this.getqq_MonthYear().setText(Fmt.formatDate(DateInput).toString());
// Change the color of the label to BLUE if it is the
// current month. All other months stays BLACK
DateTimeData CurrentMonthYear = new DateTimeData();
CurrentMonthYear.setCurrent();
if (this.getqq_MonthYear().getText().equals(Fmt.formatDate(CurrentMonthYear))) {
UIutils.setForeground(this.getqq_MonthYear(), Color.blue);
}
else {
UIutils.setForeground(this.getqq_MonthYear(), Color.black);
}
// Get the current day of the month
// so that it can be highlighted
Fmt.setTemplate(new TextData("d"));
this.setCurrentDay(Fmt.formatDate(DateInput).getValue());
// Find out what day of the week does the 1st of the month fall on
Fmt.setTemplate(new TextData("m/yyyy")); //$NON-NLS-1$
TextData FirstOfMonthText = new TextData("1/"); //$NON-NLS-1$
FirstOfMonthText.concat( Fmt.formatDate(DateInput) );
Fmt.setTemplate(new TextData("d/m/yyyy"));
DateTimeData FirstOfMonth = Fmt.decodeDate(FirstOfMonthText);
int DateStart = FirstOfMonth.dayOfWeek();
// Find out how many days are there in this month
// Note that we need to deal with leap year
int DateEnd = 0;
if (Month.toString().equals("4") || Month.toString().equals("6") || Month.toString().equals("9") || Month.toString().equals("11")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
DateEnd = DateStart+29;
}
else if (Month.toString().equals("2")) { //$NON-NLS-1$
IntervalData Days28 = new IntervalData();
Days28.addUnit(0, 0, 28, 0, 0, 0, 0);
FirstOfMonth.add(Days28);
Fmt.setTemplate(new TextData("m"));
TextData FebOrMarch = Fmt.formatDate(FirstOfMonth);
if (FebOrMarch.toString().equals("2")) { //$NON-NLS-1$
// Leap year