//生成甘特图
private function renderGanttChart():void
{
this.clearGanttChart(); //清除甘特图
var startDate:Date = this.taskList.getItemAt(0).plannedStartDate;
var endDate:Date = this.taskList.getItemAt(0).plannedEndDate;
var leaf:String = this.taskList.getItemAt(0).leaf;
var duration:Number = this.taskList.getItemAt(0).duration;
//甘特图开始日期(周日)
var beginSunday:Date = this.getStartDate4GanttChart(startDate);
//甘特图结束日期(周六)
var endSaturday:Date = this.getEndDate4GanttChart(endDate);
//计算起止两个周日的间隔天数(一定为7的倍数)
var intervalBetweenSundays:Number = this.getDateInterval(beginSunday, new Date(endSaturday.getFullYear(), endSaturday.getMonth(), endSaturday.getDate() + 1));
//计算起止两个周日间隔的周数
var numberOfWeeks:Number = intervalBetweenSundays / 7;
//绘制甘特图标题栏的上部区域
//注意:前面多显示一周,后面多显示一周
for(var i:Number = -1; i <= numberOfWeeks; ++i)
{
var hbox:HBox = new HBox();
hbox.height = 20;
hbox.width = 140;
hbox.setStyle("borderStyle", "solid");
hbox.setStyle("borderThickness", "1");
hbox.setStyle("borderColor","black");
hbox.setStyle("horizontalAlign","center");
hbox.setStyle("backgroundColor", "0XD7D7D7");
if(-1 != i)
{
hbox.setStyle("borderSides", "top right bottom"); //从第二个开始不显示左边框
}
var label:Label = new Label();
label.text = this.getDateByIndexOfWeek(i, beginSunday);
hbox.addChild(label);
this.upper.addChild(hbox);
}
//绘制甘特图下部区域
for(var i:Number = 0; i < intervalBetweenSundays + 14; ++i)
{
var hbox:HBox = new HBox();
hbox.height = 20;
hbox.width = 20;
hbox.setStyle("borderStyle", "solid");
hbox.setStyle("borderThickness", "1");
hbox.setStyle("borderColor","black");
hbox.setStyle("horizontalAlign","center");
hbox.setStyle("backgroundColor", "0XD7D7D7");
hbox.setStyle("borderSides", "left right bottom");
if(0 != i)
{
hbox.setStyle("borderSides", "right bottom");
}
var label:Label = new Label();
label.text = this.getDayByIndex(i);
hbox.addChild(label);
this.lower.addChild(hbox);
}
//绘制星期分割线
this.canvas.graphics.lineS