g.setColor(Color.black);
g.drawString(String.valueOf(i)+":00",2,i*hourH+12);
}
// fill in all appointments that are absences...
EmployeeActivityVO vo = null;
int startW = 0;
Calendar day = Calendar.getInstance();
day.setTime(currentDay);
appointments.clear();
for(int i=0;i<rows.size();i++) {
vo = (EmployeeActivityVO)rows.get(i);
if (!vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE) &&
!vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY) &&
!vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
continue;
if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_CALL_OUT))
g.setColor(new Color(240,200,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_APPOINTMENT))
g.setColor(new Color(250,210,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_PHONE_CALL))
g.setColor(new Color(240,210,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_MEETING))
g.setColor(new Color(250,220,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_EMAIL))
g.setColor(new Color(240,220,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_FAX))
g.setColor(new Color(250,230,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE))
g.setColor(new Color(230,230,230));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY))
g.setColor(new Color(220,220,220));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
g.setColor(new Color(225,225,225));
else
g.setColor(new Color(240,230,200));
cal.setTime(vo.getStartDateSCH07());
startH = 0;
startM = 0;
if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
startH = cal.get(cal.HOUR_OF_DAY);
startM = cal.get(cal.MINUTE);
}
cal.setTime(vo.getEndDateSCH07());
endH = 24;
endM = 60;
if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
endH = cal.get(cal.HOUR_OF_DAY);
endM = cal.get(cal.MINUTE);
}
g.fillRect(
hourW,
startH*hourH+startM*hourH/60,
getWidth()-hourW,
(endH-startH)*hourH-startM*hourH/60+endM*hourH/60
);
g.setColor(Color.gray);
g.drawRect(
hourW,
startH*hourH+startM*hourH/60,
getWidth()-hourW,
(endH-startH)*hourH-startM*hourH/60+endM*hourH/60
);
g.setColor(Color.black);
g.drawString(
sdf.format(vo.getStartDateSCH07())+" - "+vo.getDescriptionSCH06(),
hourW+3,
startH*hourH+startM*hourH/60+14
);
appointments.put(new int[]{
hourW,
startH*hourH+startM*hourH/60,
getWidth()-hourW,
endH*hourH+endM*hourH/60
},vo);
}
// fill in all appointments that are not absences...
for(int i=0;i<rows.size();i++) {
vo = (EmployeeActivityVO)rows.get(i);
if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE) ||
vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY) ||
vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
continue;
if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_CALL_OUT))
g.setColor(new Color(240,200,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_APPOINTMENT))
g.setColor(new Color(250,210,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_PHONE_CALL))
g.setColor(new Color(240,210,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_MEETING))
g.setColor(new Color(250,220,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_EMAIL))
g.setColor(new Color(240,220,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_SEND_FAX))
g.setColor(new Color(250,230,200));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ABSENCE))
g.setColor(new Color(230,230,230));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_HOLIDAY))
g.setColor(new Color(220,220,220));
else if (vo.getActivityTypeSCH06().equals(ApplicationConsts.ACT_ILLNESS))
g.setColor(new Color(225,225,225));
else
g.setColor(new Color(240,230,200));
cal.setTime(vo.getStartDateSCH07());
startH = 0;
startM = 0;
if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
startH = cal.get(cal.HOUR_OF_DAY);
startM = cal.get(cal.MINUTE);
}
cal.setTime(vo.getEndDateSCH07());
endH = 24;
endM = 60;
if (cal.get(cal.DAY_OF_MONTH)==day.get(day.DAY_OF_MONTH)) {
endH = cal.get(cal.HOUR_OF_DAY);
endM = cal.get(cal.MINUTE);
}
startW = getNextW(startW,startH*hourH+startM*hourH/60,endH*hourH+endM*hourH/60);
g.fillRect(
hourW+startW,
startH*hourH+startM*hourH/60,
appW,
(endH-startH)*hourH-startM*hourH/60+endM*hourH/60
);
g.setColor(Color.gray);
g.drawRect(
hourW+startW,
startH*hourH+startM*hourH/60,
appW,
(endH-startH)*hourH-startM*hourH/60+endM*hourH/60
);
g.setColor(Color.black);
g.drawString(
sdf.format(vo.getStartDateSCH07())+" - "+vo.getDescriptionSCH06(),
hourW+startW+3,
startH*hourH+startM*hourH/60+14
);
appointments.put(new int[]{
hourW+startW,