writer.startElement(HtmlElements.DIV, null);
writer.writeClassAttribute(Classes.create(output, "row"));
dateFormat = new SimpleDateFormat("E", locale);
for (int dayIt = 0; dayIt < 7; ++dayIt) {
DateModel date = model.getDate(0, dayIt);
String dayName = dateFormat.format(date.getCalendar().getTime());
dayName = StringUtils.substring(dayName, 0, 2);
writer.startElement(HtmlElements.SPAN, null);
writer.writeClassAttribute(Classes.create(output, "dayOfWeek"));
writer.writeText(dayName);
writer.endElement(HtmlElements.SPAN);
}
writer.endElement(HtmlElements.DIV);
// end weeks
// int weekCount = model.getWeekCount();
for (int week = 0; week < 6; ++week) {
// String style = (week < weekCount) ? "" : "style=\"display: none\"";
writer.startElement(HtmlElements.DIV, null);
writer.writeIdAttribute(id + ":" + week);
writer.writeClassAttribute(Classes.create(output, "row"));
// writer.writeAttribute(HtmlAttributes.STYLE, style, null);
for (int dayIt = 0; dayIt < 7; ++dayIt) {
// if (week < weekCount) {
DateModel date = model.getDate(week, dayIt);
String dayDescription = String.valueOf(date.getDay());
String onclick = "selectDay('" + id + "', " + week + " , " + dayIt + ");";
writer.startElement(HtmlElements.SPAN, null);
writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, true);
writer.writeIdAttribute(id + ":" + week + ":" + dayIt);
writer.writeClassAttribute(
Classes.create(output, "day", date.getMonth() == model.getMonth() ? null : Markup.DISABLED));
writer.writeText(dayDescription);
writer.endElement(HtmlElements.SPAN);