1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| /**
* <b> return HTML code for 1 line of planning </b>
* @return String : html code
*/
public String lineHTML() {
StringBuffer result = new StringBuffer();
//Name
result.append("<tr onmouseover=\"this.className='grey'\"; onmouseout=\"this.className='white'\"; ><td class=\"title\" width=\"3\"></td><td width=\"200\">");
result.append(this.name);
result.append("</td>");
//Week end Verification, leave verification
// Else : white line
GregorianCalendar gc = new GregorianCalendar();
try {
//For every days :
for (int i = 1; i <= getNbDaysOfMonth(); i++) {
// Calendar initialization
gc.set(getYear(), getMonth(), i);
// Holidays :
ArrayList holidays = new ArrayList();
holidays = getHoliday();
Integer dInteger = new Integer(i);
if (holidays.contains(dInteger)) {
result.append(insertHoliday());
} else {
// If week end :
if (gc.get(Calendar.DAY_OF_WEEK) == 1 || gc.get(Calendar.DAY_OF_WEEK) == 7){
//if(gc.get(Calendar.DAY_OF_WEEK) == 7) {
result.append(insertWeekEnd());
//}
} else {
// Current day recovery
String d = new String(String.valueOf(i));
// If current day in list of leaves days :
if (days.contains(d)) {
// index recovery
int index = days.indexOf(d);
// type recovery
String type = new String((String) types.get(index));
String docId = new String((String) docIds.get(index));
// type CSS recovery according to the type
String css = CSS_LEAVE;
if(TYPE_LEAVE_UNPAID.equalsIgnoreCase(type)) {
css = CSS_UNPAID_LEAVE;
}
if (TYPE_LEAVE_RECUPERATION.equalsIgnoreCase(type)) {
css = CSS_RECUPERATION;
}
if (TYPE_LEAVE_REQUEST.equalsIgnoreCase(type)) {
css = CSS_REQUEST;
}
if (TYPE_LEAVE_SPECIAL.equalsIgnoreCase(type)) {
css = CSS_SPECIAL;
}
if (TYPE_LEAVE_OTHER.equalsIgnoreCase(type)) {
css = CSS_OTHER;
}
// duration recovery
// if half day : 1 cell else 2 cells in table
String duration = new String((String) durations.get(index));
result.append(insertLeave(css, duration, docId, type));
} else {
// write line
result.append("<td colspan=\"2\"></td>");
}
}
}
}
}finally {
gc = null;
}
result.append(emptyCol());
result.append("</tr>");
return result.toString();
} |