final String formId = parentFormInfo == null ? null : parentFormInfo.getFormName();
final TreeSet entrySet = new TreeSet(comparator);
for (Iterator entryIterator = day.iterator(); entryIterator.hasNext();)
{
ScheduleEntry entry = (ScheduleEntry) entryIterator.next();
entrySet.add(entry);
}
if (entrySet.size() > 0)
{
writer.startElement(HTML.TABLE_ELEM, schedule);
writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTR, "0", null);
writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%;", null);
for (Iterator entryIterator = entrySet.iterator(); entryIterator
.hasNext();)
{
ScheduleEntry entry = (ScheduleEntry) entryIterator.next();
writer.startElement(HTML.TR_ELEM, schedule);
writer.startElement(HTML.TD_ELEM, schedule);
if (isSelected(schedule, entry))
{
writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
"selected"), null);
}
//compose the CSS style for the entry box
StringBuffer entryStyle = new StringBuffer();
entryStyle.append("width: 100%;");
String entryColor = getEntryRenderer(schedule).getColor(context, schedule, entry, isSelected(schedule, entry));
if (isSelected(schedule, entry) && entryColor != null) {
entryStyle.append(" background-color: ");
entryStyle.append(entryColor);
entryStyle.append(";");
entryStyle.append(" border-color: ");
entryStyle.append(entryColor);
entryStyle.append(";");
}
writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null);
// draw the tooltip
if (schedule.isTooltip())
{
getEntryRenderer(schedule).renderToolTip(context, writer,
schedule, entry, isSelected(schedule, entry));
}
if (!isSelected(schedule, entry) && !schedule.isReadonly())
{
writer.startElement(HTML.ANCHOR_ELEM, schedule);
writer.writeAttribute(HTML.HREF_ATTR, "#", null);
writer.writeAttribute(
HTML.ONCLICK_ATTR,
"fireEntrySelected('"
+ formId + "', '"
+ clientId + "', '"
+ entry.getId()
+ "');",
null);
}
// draw the content