boolean renderGutter = true;
while (intervalIt.hasNext())
{
Interval interval = (Interval) intervalIt.next();
int intervalHeight = calcRowHeight(rowHeight, interval.getDuration()) - 1;
// Don't render rows where the timespan is too small
if (intervalHeight <= 0)
{
continue;
}
if (!renderGutter)
{
renderGutter = true;
continue;
}
writer.startElement(HTML.TR_ELEM, schedule);
int gutterHeight = intervalHeight;
if (day.getIntervals() == null && interval.getStartMinutes(getTimeZone(schedule)) == 0)
{
gutterHeight = (gutterHeight * 2) + 1;
renderGutter = false;
}
//write the hours of the day on the left
//this only happens on even rows, or every hour
writer.startElement(HTML.TD_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "gutter"), null);
writer.writeAttribute(
HTML.STYLE_ATTR,
"height: " + gutterHeight
+ "px; border-style: none; border-width: 0px; overflow: hidden; padding: 0px",
null);
if (interval.getDuration() >= HalfHourInterval.HALF_HOUR)
{
if (!useIntervalLabels || interval.getLabel() == null)
{
writer.startElement(HTML.SPAN_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
renderGutter ? "minutes" : "hours"), null);
writer.writeAttribute(HTML.STYLE_ATTR,
"vertical-align: top; height: 100%; padding: 0px;",
null);
writer.writeText(hourFormater.format(interval.getStartTime()), null);
writer.endElement(HTML.SPAN_ELEM);
}
writer.startElement(HTML.SPAN_ELEM, schedule);
writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
"minutes"), null);
writer.writeAttribute(HTML.STYLE_ATTR,
"vertical-align: top; height: 100%; padding: 0px;",
null);
if (useIntervalLabels && interval.getLabel() != null)
{
writer.writeText(interval.getLabel(), null);
}
else
{
writer.writeText((renderGutter ? minuteFormater : shortMinuteFormater).format(interval.getStartTime()), null);
}
writer.endElement(HTML.SPAN_ELEM);
}
writer.endElement(HTML.TD_ELEM);
writer.endElement(HTML.TR_ELEM);