private void showPrevMonth() {
update(activeDate.addMonths(-1));
}
private void update(DateWrapper date) {
DateWrapper vd = activeDate;
activeDate = date;
if (vd != null && el() != null) {
int days = date.getDaysInMonth();
DateWrapper firstOfMonth = date.getFirstDayOfMonth();
int startingPos = firstOfMonth.getDayInWeek() - firstDOW;
if (startingPos <= firstDOW) {
startingPos += 7;
}
// go to previous month.
DateWrapper pm = activeDate.addMonths(-1);
int prevStart = pm.getDaysInMonth() - startingPos;
days += startingPos;
DateWrapper d = new DateWrapper(pm.getFullYear(), pm.getMonth(), prevStart).resetTime();
today = new DateWrapper().resetTime().getTime();
long sel = value != null ? value.resetTime().getTime() : Long.MIN_VALUE;
long min = minDate != null ? new DateWrapper(minDate).getTime() : Long.MIN_VALUE;
long max = maxDate != null ? new DateWrapper(maxDate).getTime() : Long.MAX_VALUE;
int i = 0;
for (; i < startingPos; i++) {
fly(textNodes[i]).update("" + ++prevStart);
d = d.addDays(1);
cells[i].setClassName("x-date-prevday");
if (GXT.isAriaEnabled()) {
cells[i].setAttribute("aria-disabled", "true");
}
setCellStyle(cells[i], d.asDate(), sel, min, max);
}
for (; i < days; i++) {
int intDay = i - startingPos + 1;
fly(textNodes[i]).update("" + intDay);
d = d.addDays(1);
cells[i].setClassName("x-date-active");
setCellStyle(cells[i], d.asDate(), sel, min, max);
}
int extraDays = 0;
for (; i < 42; i++) {
fly(textNodes[i]).update("" + ++extraDays);
d = d.addDays(1);
cells[i].setClassName("x-date-nextday");
if (GXT.isAriaEnabled()) {
cells[i].setAttribute("aria-disabled", "true");
}
setCellStyle(cells[i], d.asDate(), sel, min, max);
}
int month = activeDate.getMonth();
String t = constants.standaloneMonths()[month] + " " + activeDate.getFullYear();