maximizeEntries(entries, numberOfColumns);
//now determine the width in percent of 1 column
float columnWidth = 100 / numberOfColumns;
UIForm parentForm = getParentForm(schedule);
//and now draw the entries in the columns
for (Iterator entryIterator = entrySet.iterator(); entryIterator
.hasNext();)
{
EntryWrapper wrapper = (EntryWrapper) entryIterator.next();
if (isSelected(schedule, wrapper))
{
writer.startElement(HTML.DIV_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, "entry-selected", null);
writer.writeAttribute(HTML.STYLE_ATTR, wrapper.getBounds(
schedule, columnWidth), null);
//draw the tooltip
if (showTooltip(schedule))
{
writer.writeAttribute("onmouseover", getTooltipText(
wrapper.entry, schedule), null);
}
//draw the contents of the selected entry
writer.startElement(HTML.DIV_ELEM, null);
writer.writeAttribute(HTML.CLASS_ATTR, "text", null);
writer.writeAttribute(HTML.STYLE_ATTR,
"height: 100%; width: 100%;", null);
writer.startElement(HTML.SPAN_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, "title", null);
writer.writeText(wrapper.entry.getTitle(), null);
writer.endElement(HTML.SPAN_ELEM);
writer.startElement("br", schedule);
writer.endElement("br");
writer.startElement(HTML.SPAN_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, "subtitle", null);
writer.writeText(wrapper.entry.getSubtitle(), null);
writer.endElement(HTML.SPAN_ELEM);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.DIV_ELEM);
}
else
{
//if the schedule is read-only, the entries should not be
//hyperlinks
writer.startElement(
schedule.isReadonly() ? HTML.DIV_ELEM : "a", schedule);
//draw the tooltip
if (showTooltip(schedule))
{
writer.writeAttribute("onmouseover", getTooltipText(
wrapper.entry, schedule), null);
}
if (!schedule.isReadonly())
{
writer.writeAttribute("href", "#", null);
String clientId = schedule.getClientId(context);
StringBuffer mousedown = new StringBuffer();
mousedown.append("document.forms['");
mousedown.append(parentForm.getClientId(context));
mousedown.append("']['");
mousedown.append(clientId);
mousedown.append("'].value='");
mousedown.append(wrapper.entry.getId());
mousedown.append("'; document.forms['");
mousedown.append(parentForm.getClientId(context));
mousedown.append("'].submit()");
writer.writeAttribute("onmousedown", mousedown.toString(),
null);
}