Date curDate = getChartModel().getStartDate();
final int topUnitHeight = getLineTopPosition();
boolean firstWeekendDay = true;
List offsets = getOffsets();
for (int i=0; i<offsets.size(); i++) {
Offset nextOffset = (Offset) offsets.get(i);
if (nextOffset.getDayType() == GPCalendar.DayType.WEEKEND ||
nextOffset.getDayType() == GPCalendar.DayType.HOLIDAY) {
GraphicPrimitiveContainer.Rectangle r =
getPrimitiveContainer().createRectangle(
curX,
getLineBottomPosition()+1,
nextOffset.getOffsetPixels() - curX,
getHeight());
Color background = nextOffset.getDayType()==GPCalendar.DayType.WEEKEND ?
getConfig().getHolidayTimeBackgroundColor() :
getConfig().getPublicHolidayTimeBackgroundColor();
r.setBackgroundColor(background);
r.setStyle("calendar.holiday");
getPrimitiveContainer().bind(r, nextOffset.getDayType());
// if (firstWeekendDay) {
// getPrimitiveContainer().createLine(
// curX, getLineTopPosition(), curX, getLineTopPosition()+10);
// firstWeekendDay = false;
// }
}
// else {
// TimeUnitText timeUnitText = nextOffset.getOffsetUnit().format(curDate);
// String unitText = timeUnitText.getText(-1);
// int posY = getTextBaselinePosition();
// GraphicPrimitiveContainer.Text text = getPrimitiveContainer().createText(
// curX + 2, posY, unitText);
// getPrimitiveContainer().bind(text, timeUnitText);
// text.setMaxLength(nextOffset.getOffsetPixels() - curX);
// text.setFont(getChartModel().getChartUIConfiguration().getSpanningHeaderFont());
// getPrimitiveContainer().createLine(
// curX, getLineTopPosition(), curX, getLineTopPosition()+10);
// firstWeekendDay = true;
// }
if (curDate.equals(myToday) && myRedlineOption.isChecked()) {
Line redLine = getPrimitiveContainer().createLine(
curX+2, getLineBottomPosition()+1, curX+2, getHeight());
redLine.setForegroundColor(Color.RED);
}
if ((curDate.equals(getChartModel().getTaskManager().getProjectStart()) ||
curDate.equals(getChartModel().getTaskManager().getProjectEnd())) &&
isProjectBoundariesOptionOn()) {
Line blueLine = getPrimitiveContainer().createLine(
curX, getLineBottomPosition()+1, curX, getHeight());
blueLine.setForegroundColor(Color.BLUE);
}
curX = nextOffset.getOffsetPixels();
curDate = nextOffset.getOffsetEnd();
//System.err.println("curDate="+curDate+" curX="+curX);
}
}